91int main(
int argc,
char *argv[])
97 Teuchos::RCP<const Thyra::ModelEvaluator<double> >
102 model->getNominalValues().get_x()->clone_v());
103 solState->setIndex (0);
104 solState->setTime (0.0);
105 solState->setTimeStep(0.0);
109 auto solHistory = Tempus::createSolutionHistoryState<double>(solState);
113 stepper->setModel(model);
114 stepper->initialize();
115 stepper->setInitialConditions(solHistory);
119 timeStepControl->setFinalTime(2.0);
120 timeStepControl->setNumTimeSteps(2000);
121 timeStepControl->initialize();
127 cout << std::setw(8) <<
"index"
128 << std::setw(10) <<
"time"
129 << std::setw(12) <<
"x_0"
130 << std::setw(12) <<
"x_1" << endl;
132 auto currentState = solHistory->getCurrentState();
133 cout << std::setw(8) << currentState->getIndex()
134 << std::setw(10) << std::setprecision(3) << currentState->getTime()
135 << std::setw(12) << std::setprecision(4) << Thyra::get_ele(*(currentState->getX()), 0)
136 << std::setw(12) << std::setprecision(4) << Thyra::get_ele(*(currentState->getX()), 1)
141 timeStepControl->timeInRange(solHistory->getCurrentTime()) &&
142 timeStepControl->indexInRange(solHistory->getCurrentIndex())) {
145 solHistory->initWorkingState();
148 timeStepControl->setNextTimeStep(solHistory, integratorStatus);
151 stepper->takeStep(solHistory);
154 solHistory->promoteWorkingState();
157 if (solHistory->getCurrentState()->getIndex() % 100 == 0) {
158 currentState = solHistory->getCurrentState();
159 cout << std::setw(8) << currentState->getIndex()
160 << std::setw(10) << std::setprecision(3) << currentState->getTime()
161 << std::setw(12) << std::setprecision(4) << Thyra::get_ele(*(currentState->getX()), 0)
162 << std::setw(12) << std::setprecision(4) << Thyra::get_ele(*(currentState->getX()), 1)
168 auto finalState = solHistory->getCurrentState();
172 if (passed && regressionPassed) success =
true;
174 TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
177 cout <<
"\nEnd Result: Test Passed!" << std::endl;
179 return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
bool tutorialRegressionTest(const Teuchos::RCP< Thyra::VectorBase< double > > &x_n, std::ostream &out=std::cout, const double relTol=Teuchos::as< double >(1.0e-8))
Regression check for the Tempus tutorial van der Pol examples.
Teuchos::RCP< SolutionState< Scalar > > createSolutionStateX(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &xdot=Teuchos::null, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &xdotdot=Teuchos::null)
Nonmember constructor from non-const solution vectors, x.