Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
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
11#include "Teuchos_XMLParameterListHelpers.hpp"
12
13
14namespace Tempus_Unit_Test {
15
16using Teuchos::RCP;
17using Teuchos::rcp;
18using Teuchos::rcp_const_cast;
19using Teuchos::rcp_dynamic_cast;
20using Teuchos::ParameterList;
21using Teuchos::sublist;
22
23
24// ************************************************************
25// ************************************************************
26TEUCHOS_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// ************************************************************
38TEUCHOS_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
51TEUCHOS_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// ************************************************************
75TEUCHOS_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_Test
Backward Euler Runge-Kutta Butcher Tableau.
void testDIRKAccessorsFullConstruction(const RCP< Tempus::StepperDIRK< double > > &stepper)
Unit test utility for ExplicitRK Stepper construction and accessors.
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_UNIT_TEST(BackwardEuler, Default_Construction)
void testFactoryConstruction(std::string stepperType, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model)
Unit test utility for Stepper construction through StepperFactory.