9 #include "Teuchos_UnitTestHarness.hpp" 13 #include "../TestModels/SinCosModel.hpp" 14 #include "../TestModels/DahlquistTestModel.hpp" 21 using Teuchos::rcp_const_cast;
22 using Teuchos::rcp_dynamic_cast;
33 TEUCHOS_ASSERT(stepper->getOrder() == 1);
34 const auto rk_fe = stepper->getTableau();
36 TEUCHOS_ASSERT( rk_fe->isTVD() );
37 TEUCHOS_ASSERT( rk_fe->getTVDCoeff() == 1 );
65 Teuchos::RCP<const Thyra::ModelEvaluator<double> >
68 stepper->setModel(model);
69 stepper->setICConsistency(
"Consistent");
70 stepper->setUseFSAL(
true);
71 stepper->initialize();
77 stepper->setInitialConditions(solutionHistory);
78 solutionHistory->initWorkingState();
80 solutionHistory->getWorkingState()->setTimeStep(dt);
81 solutionHistory->getWorkingState()->setTime(dt);
82 stepper->takeStep(solutionHistory);
85 const double relTol = 1.0e-14;
88 auto currentState = solutionHistory->getCurrentState();
89 const double x_0 = get_ele(*(currentState->getX()), 0);
90 const double xDot_0 = get_ele(*(currentState->getXDot()), 0);
91 TEST_FLOATING_EQUALITY(x_0, 1.0, relTol);
92 TEST_FLOATING_EQUALITY(xDot_0, -1.0, relTol);
93 TEST_ASSERT(std::abs(currentState->getTime()) < relTol);
96 auto workingState = solutionHistory->getWorkingState();
97 const double x_1 = get_ele(*(workingState->getX()), 0);
98 const double xDot_1 = get_ele(*(workingState->getXDot()), 0);
100 TEST_ASSERT(std::abs(x_1 ) < relTol);
101 TEST_ASSERT(std::abs(xDot_1) < relTol);
102 TEST_FLOATING_EQUALITY(workingState->getTime(), 1.0, relTol);
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 testExplicitRKAccessorsFullConstruction(const RCP< Tempus::StepperExplicitRK< 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.
The classic Dahlquist Test Problem.
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.
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
Forward Euler Runge-Kutta Butcher Tableau.