99 double epsilon = 1.0e-1;
104 xDot_n[1] = -2.0/epsilon;
107 double finalTime = 2.0;
108 int nTimeSteps = 2000;
109 const double constDT = finalTime/nTimeSteps;
113 cout << std::setw(8) <<
"index"
114 << std::setw(10) <<
"time"
115 << std::setw(12) <<
"x_0"
116 << std::setw(12) <<
"x_1" << endl;
118 cout << std::setw(8) << n
119 << std::setw(10) << std::setprecision(3) << time
120 << std::setw(12) << std::setprecision(4) << x_n[0]
121 << std::setw(12) << std::setprecision(4) << x_n[1] << endl;
124 while (passed && time < finalTime && n < nTimeSteps) {
137 xDot_n[1] = ((1.0 - x_n[0]*x_n[0])*x_n[1] - x_n[0])/epsilon;
140 x_np1[0] = x_n[0] + dt*xDot_n[0];
141 x_np1[1] = x_n[1] + dt*xDot_n[1];
144 if ( std::isnan(x_n[0]) || std::isnan(x_n[1]) ) {
155 cout << std::setw(8) << n
156 << std::setw(10) << std::setprecision(3) << time
157 << std::setw(12) << std::setprecision(4) << x_n[0]
158 << std::setw(12) << std::setprecision(4) << x_n[1] << endl;
164 if (passed && regressionPassed) success =
true;
166 TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
169 cout <<
"\nEnd Result: Test Passed!" << std::endl;
171 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.