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 
14 namespace Tempus_Unit_Test {
15 
16 using Teuchos::RCP;
17 using Teuchos::rcp;
18 using Teuchos::rcp_const_cast;
19 using Teuchos::rcp_dynamic_cast;
21 using Teuchos::sublist;
22 
23 
24 // ************************************************************
25 // ************************************************************
26 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, Default_Construction)
27 {
28  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
30 
31  // Test stepper properties.
32  TEUCHOS_ASSERT(stepper->getOrder() == 1);
33 }
34 
35 
36 // ************************************************************
37 // ************************************************************
38 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, StepperFactory_Construction)
39 {
40  auto model = rcp(new Tempus_Test::SinCosModel<double>());
41  testFactoryConstruction("RK Backward Euler", model);
42 }
43 
44 
45 // ************************************************************
46 //* Test: construct the integrator from PL and make sure that
47 //* the solver PL is the same as the provided solver PL
48 //* and not the default solver PL
49 // ************************************************************
50 
51 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, App_PL)
52 {
53  auto model = rcp(new Tempus_Test::SinCosModel<double>());
54 
55  // read the params from xml file
56  auto pList = Teuchos::getParametersFromXmlFile("Tempus_DIRK_VanDerPol.xml");
57  auto pl = sublist(pList, "Tempus", true);
58  auto appSolverPL = pl->sublist("App Stepper").sublist("App Solver");
59 
60 
61  // setup the Integrator
62  auto integrator = Tempus::createIntegratorBasic<double>(pl, model);
63  auto stepperSolverPL = Teuchos::ParameterList();
64  stepperSolverPL.set("NOX", *(integrator->getStepper()->getSolver()->getParameterList()));
65 
66  // make sure the app Solver PL is being used
67  TEUCHOS_ASSERT( Teuchos::haveSameValues(appSolverPL, stepperSolverPL) );
68 
69 }
70 
71 
72 
73 // ************************************************************
74 // ************************************************************
75 TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, AppAction)
76 {
77  auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler<double>());
78  auto model = rcp(new Tempus_Test::SinCosModel<double>());
79  testRKAppAction(stepper, model, out, success);
80 }
81 
82 
83 } // namespace Tempus_Unit_Test
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.
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...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
void testDIRKAccessorsFullConstruction(const RCP< Tempus::StepperDIRK< double > > &stepper)
Unit test utility for ExplicitRK Stepper construction and accessors.
#define TEUCHOS_ASSERT(assertion_test)