30 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
33 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStrategyType() !=
"Constant");
34 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStepType() !=
"Constant");
35 TEUCHOS_TEST_FOR_EXCEPT(tscs->getName() !=
"Constant");
36 TEST_FLOATING_EQUALITY(tscs->getConstantTimeStep(), 0.0, 1.0e-14);
39 tscs->setConstantTimeStep(0.989);
41 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
43 TEST_FLOATING_EQUALITY(tscs->getConstantTimeStep(), 0.989, 1.0e-14);
51 0.123,
"Full_Construction_Test"));
52 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
54 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStrategyType() !=
"Constant");
55 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStepType() !=
"Constant");
56 TEUCHOS_TEST_FOR_EXCEPT(tscs->getName() !=
"Full_Construction_Test");
57 TEST_FLOATING_EQUALITY(tscs->getConstantTimeStep(), 0.123, 1.0e-14);
64 auto pl = Tempus::getTimeStepControlStrategyConstantPL<double>();
67 pl->set<
double>(
"Time Step", 0.02);
69 auto tscsc = Tempus::createTimeStepControlStrategyConstant<double>(pl);
70 TEUCHOS_TEST_FOR_EXCEPT(!tscsc->isInitialized());
72 TEST_FLOATING_EQUALITY(tscsc->getConstantTimeStep(), 0.02, 1.0e-14);
80 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
82 double initTime = 1.0;
87 auto inArgsIC = model->getNominalValues();
89 rcp_const_cast<Thyra::VectorBase<double> >(inArgsIC.get_x());
90 auto icState = Tempus::createSolutionStateX<double>(icSolution);
92 solutionHistory->addState(icState);
93 solutionHistory->getCurrentState()->setTimeStep(0.9);
94 solutionHistory->getCurrentState()->setTime(initTime);
95 solutionHistory->getCurrentState()->setIndex(initIndex);
99 tsc->setTimeStepControlStrategy(tscs);
100 tsc->setInitTime(initTime);
101 tsc->setFinalTime(100.0);
102 tsc->setMinTimeStep(0.01);
103 tsc->setInitTimeStep(0.02);
104 tsc->setMaxTimeStep(0.05);
105 tsc->setInitIndex(initIndex);
106 tsc->setFinalIndex(100);
108 TEUCHOS_TEST_FOR_EXCEPT(!tsc->isInitialized());
112 solutionHistory->initWorkingState();
114 tsc->setNextTimeStep(solutionHistory, status);
117 auto workingState = solutionHistory->getWorkingState();
118 TEST_FLOATING_EQUALITY(workingState->getTimeStep(), 0.02, 1.0e-14);
119 TEST_FLOATING_EQUALITY(workingState->getTime(), 1.02, 1.0e-14);
128 auto pl = tscsc->getValidParameters();
130 TEST_COMPARE(pl->get<std::string>(
"Strategy Type"), ==,
"Constant");
131 TEST_FLOATING_EQUALITY(pl->get<
double>(
"Time Step"), 0.0, 1.0e-14);
134 std::ostringstream unusedParameters;
135 pl->unused(unusedParameters);
136 TEST_COMPARE(unusedParameters.str(), ==,
"");
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...