9 #include "Teuchos_UnitTestHarness.hpp"
10 #include "Teuchos_XMLParameterListHelpers.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
12 #include "Teuchos_DefaultComm.hpp"
14 #include "Thyra_VectorStdOps.hpp"
20 #include "../TestModels/VanDerPol_IMEX_ExplicitModel.hpp"
21 #include "../TestModels/VanDerPol_IMEXPart_ImplicitModel.hpp"
22 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
27 namespace Tempus_Unit_Test {
31 using Teuchos::rcp_const_cast;
32 using Teuchos::rcp_dynamic_cast;
33 using Teuchos::ParameterList;
34 using Teuchos::sublist;
35 using Teuchos::getParametersFromXmlFile;
46 const bool useProductVector =
true;
51 const int numExplicitBlocks = 1;
52 const int parameterIndex = 4;
54 explicitModel, implicitModel,
55 numExplicitBlocks, parameterIndex));
60 stepper->setModel(model);
61 stepper->initialize();
62 TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
68 auto solver = rcp(
new Thyra::NOXNonlinearSolver());
71 bool useFSAL = stepper->getUseFSALDefault();
72 std::string ICConsistency = stepper->getICConsistencyDefault();
73 bool ICConsistencyCheck = stepper->getICConsistencyCheckDefault();
74 bool zeroInitialGuess = stepper->getZeroInitialGuess();
75 std::string stepperType =
"IMEX RK SSP2";
77 auto explicitTableau = stepperERK->getTableau();
79 auto implicitTableau = stepperSDIRK->getTableau();
84 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
86 stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
88 stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
89 stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
90 stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
91 stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
92 stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
93 stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
94 stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
95 stepper->setZeroInitialGuess(zeroInitialGuess); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
97 stepper->setStepperType(stepperType); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
98 stepper->setExplicitTableau(explicitTableau); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
99 stepper->setImplicitTableau(implicitTableau); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
100 stepper->setOrder(order); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
102 TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getTableau());
103 TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getExplicitTableau());
104 TEUCHOS_TEST_FOR_EXCEPT(implicitTableau != stepper->getImplicitTableau());
107 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
109 model, obs, solver, useFSAL,
110 ICConsistency, ICConsistencyCheck, zeroInitialGuess,
111 stepperType, explicitTableau, implicitTableau, order));
112 TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
115 model, solver, useFSAL, ICConsistency, ICConsistencyCheck,
116 zeroInitialGuess, modifier, stepperType, explicitTableau,
117 implicitTableau, order));
118 TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
121 std::cout <<
"ordero = " << stepper->getOrder() << std::endl;
122 TEUCHOS_ASSERT(stepper->getOrder() == 2);
131 const bool useProductVector =
true;
136 const int numExplicitBlocks = 1;
137 const int parameterIndex = 4;
139 explicitModel, implicitModel,
140 numExplicitBlocks, parameterIndex));
151 const bool useProductVector =
true;
156 const int numExplicitBlocks = 1;
157 const int parameterIndex = 4;
159 explicitModel, implicitModel,
160 numExplicitBlocks, parameterIndex));
164 auto stepper = sf->createStepper(
"General Partitioned IMEX RK", model);
165 TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
171 TEUCHOS_UNIT_TEST(IMEX_RK_Partition, StepperFactory_Construction_General_wo_Parameterlist_Model)
174 const bool useProductVector =
true;
179 const int numExplicitBlocks = 1;
180 const int parameterIndex = 4;
182 explicitModel, implicitModel,
183 numExplicitBlocks, parameterIndex));
187 auto stepper = sf->createStepper(
"General Partitioned IMEX RK");
188 stepper->setModel(model);
189 stepper->initialize();
190 TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
201 const bool useProductVector =
true;
206 const int numExplicitBlocks = 1;
207 const int parameterIndex = 4;
209 explicitModel, implicitModel,
210 numExplicitBlocks, parameterIndex));
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.
Default observer for StepperRK.
Explicit Runge-Kutta time stepper.
void testFactoryConstruction(std::string stepperType, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model)
Unit test utility for Stepper construction through StepperFactory.
van der Pol model formulated for the partitioned IMEX-RK.
Partitioned Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
Teuchos::RCP< Teuchos::ParameterList > defaultSolverParameters()
Returns the default solver ParameterList for implicit Steppers.
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
Default ModifierX for StepperRK.
Default modifier for StepperRK.
This observer is a composite observer,.
van der Pol model formulated for IMEX.