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: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
10 
12 
13 namespace Tempus_Unit_Test {
14 
16 using Teuchos::RCP;
17 using Teuchos::rcp;
18 using Teuchos::rcp_const_cast;
19 using Teuchos::rcp_dynamic_cast;
20 using Teuchos::sublist;
21 
22 // ************************************************************
23 // ************************************************************
24 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, Default_Construction)
25 {
26  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
28 
29  // Test stepper properties.
30  TEUCHOS_ASSERT(stepper->getOrder() == 1);
31 }
32 
33 // ************************************************************
34 // ************************************************************
35 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, StepperFactory_Construction)
36 {
37  auto model = rcp(new Tempus_Test::SinCosModel<double>());
38  testFactoryConstruction("RK Backward Euler", model);
39 }
40 
41 // ************************************************************
42 //* Test: construct the integrator from PL and make sure that
43 //* the solver PL is the same as the provided solver PL
44 //* and not the default solver PL
45 // ************************************************************
46 
47 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, App_PL)
48 {
49  auto model = rcp(new Tempus_Test::SinCosModel<double>());
50 
51  // read the params from xml file
52  auto pList = Teuchos::getParametersFromXmlFile("Tempus_DIRK_VanDerPol.xml");
53  auto pl = sublist(pList, "Tempus", true);
54  auto appSolverPL = pl->sublist("App Stepper").sublist("App Solver");
55 
56  // setup the Integrator
57  auto integrator = Tempus::createIntegratorBasic<double>(pl, model);
58  auto stepperSolverPL = Teuchos::ParameterList();
59  stepperSolverPL.set(
60  "NOX", *(integrator->getStepper()->getSolver()->getParameterList()));
61 
62  // make sure the app Solver PL is being used
63  TEUCHOS_ASSERT(Teuchos::haveSameValues(appSolverPL, stepperSolverPL));
64 }
65 
66 // ************************************************************
67 // ************************************************************
68 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, AppAction)
69 {
70  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
71  auto model = rcp(new Tempus_Test::SinCosModel<double>());
72  testRKAppAction(stepper, model, out, success);
73 }
74 
75 } // 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)