Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_UnitTest_DIRK_BackwardEuler.cpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
11 
13 
14 namespace Tempus_Unit_Test {
15 
17 using Teuchos::RCP;
18 using Teuchos::rcp;
19 using Teuchos::rcp_const_cast;
20 using Teuchos::rcp_dynamic_cast;
21 using Teuchos::sublist;
22 
23 // ************************************************************
24 // ************************************************************
25 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, Default_Construction)
26 {
27  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
29 
30  // Test stepper properties.
31  TEUCHOS_ASSERT(stepper->getOrder() == 1);
32 }
33 
34 // ************************************************************
35 // ************************************************************
36 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, StepperFactory_Construction)
37 {
38  auto model = rcp(new Tempus_Test::SinCosModel<double>());
39  testFactoryConstruction("RK Backward Euler", model);
40 }
41 
42 // ************************************************************
43 //* Test: construct the integrator from PL and make sure that
44 //* the solver PL is the same as the provided solver PL
45 //* and not the default solver PL
46 // ************************************************************
47 
48 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, App_PL)
49 {
50  auto model = rcp(new Tempus_Test::SinCosModel<double>());
51 
52  // read the params from xml file
53  auto pList = Teuchos::getParametersFromXmlFile("Tempus_DIRK_VanDerPol.xml");
54  auto pl = sublist(pList, "Tempus", true);
55  auto appSolverPL = pl->sublist("App Stepper").sublist("App Solver");
56 
57  // setup the Integrator
58  auto integrator = Tempus::createIntegratorBasic<double>(pl, model);
59  auto stepperSolverPL = Teuchos::ParameterList();
60  stepperSolverPL.set(
61  "NOX", *(integrator->getStepper()->getSolver()->getParameterList()));
62 
63  // make sure the app Solver PL is being used
64  TEUCHOS_ASSERT(Teuchos::haveSameValues(appSolverPL, stepperSolverPL));
65 }
66 
67 // ************************************************************
68 // ************************************************************
69 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, AppAction)
70 {
71  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
72  auto model = rcp(new Tempus_Test::SinCosModel<double>());
73  testRKAppAction(stepper, model, out, success);
74 }
75 
76 } // namespace Tempus_Unit_Test
void testDIRKAccessorsFullConstruction(const RCP< Tempus::StepperDIRK< double >> &stepper)
Unit test utility for ExplicitRK Stepper construction and accessors.
void testFactoryConstruction(std::string stepperType, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model)
Unit test utility for Stepper construction through StepperFactory.
Backward Euler Runge-Kutta Butcher Tableau.
Sine-Cosine model problem from Rythmos. This is a canonical Sine-Cosine differential equation with a...
void testRKAppAction(const Teuchos::RCP< Tempus::StepperRKBase< double >> &stepper, const Teuchos::RCP< const Thyra::ModelEvaluator< double >> &model, Teuchos::FancyOStream &out, bool &success)
Unit test utility for Stepper RK AppAction.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
#define TEUCHOS_ASSERT(assertion_test)