13 #include "../TestModels/DahlquistTestModel.hpp"
16 namespace Tempus_Unit_Test {
20 using Teuchos::rcp_const_cast;
21 using Teuchos::rcp_dynamic_cast;
23 using Teuchos::sublist;
59 class StepperRKModifierSDIRK21Test
66 : out(Out), success(Success)
70 virtual ~StepperRKModifierSDIRK21Test(){}
78 const double relTol = 1.0e-14;
79 auto stageNumber = stepper->getStageNumber();
82 auto currentState = sh->getCurrentState();
83 auto workingState = sh->getWorkingState();
84 const double dt = workingState->getTimeStep();
85 double time = currentState->getTime();
86 if (stageNumber >= 0) time += c(stageNumber)*dt;
88 auto x = workingState->getX();
89 auto xDot = workingState->getXDot();
90 if (xDot == Teuchos::null) xDot = stepper->getStepperXDot();
96 auto DME = Teuchos::rcp_dynamic_cast<
102 const double x_0 = get_ele(*(x), 0);
103 const double xDot_0 = get_ele(*(xDot), 0);
114 const double X_i = get_ele(*(x), 0);
115 const double f_i = get_ele(*(xDot), 0);
117 if (stageNumber == 0) {
121 }
else if (stageNumber == 1) {
135 const double X_i = get_ele(*(x), 0);
136 const double f_i = get_ele(*(xDot), 0);
138 if (stageNumber == 0) {
143 }
else if (stageNumber == 1) {
156 const double x_1 = get_ele(*(x), 0);
157 time = workingState->getTime();
163 if (stepper->getUseEmbedded() ==
true) {
165 TEST_ASSERT(std::abs(workingState->getTolAbs()) < relTol);
167 TEST_ASSERT(std::abs(workingState->getErrorRel()) < relTol);
192 auto modifier =
rcp(
new StepperRKModifierSDIRK21Test(out, success));
194 stepper->setModel(model);
195 stepper->setAppAction(modifier);
196 stepper->setICConsistency(
"Consistent");
197 stepper->setUseFSAL(
false);
198 stepper->initialize();
204 stepper->setInitialConditions(solutionHistory);
205 solutionHistory->initWorkingState();
207 solutionHistory->getWorkingState()->setTimeStep(dt);
208 solutionHistory->getWorkingState()->setTime(dt);
209 stepper->takeStep(solutionHistory);
At the beginning of the stage.
At the beginning of the step.
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.
The classic Dahlquist Test Problem.
#define TEST_COMPARE(v1, comp, v2)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
Before the implicit solve.
Sine-Cosine model problem from Rythmos. This is a canonical Sine-Cosine differential equation with a...
Teuchos::RCP< SolutionHistory< Scalar > > createSolutionHistoryME(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Nonmember contructor from a Thyra ModelEvaluator.
Base class for Runge-Kutta methods, ExplicitRK, DIRK and IMEX.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
ACTION_LOCATION
Indicates the location of application action (see algorithm).
void testDIRKAccessorsFullConstruction(const RCP< Tempus::StepperDIRK< double > > &stepper)
Unit test utility for ExplicitRK Stepper construction and accessors.
After the implicit solve.
Before the explicit evaluation.
#define TEUCHOS_ASSERT(assertion_test)
Base modifier for StepperRK.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)