Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_SubcyclingTest.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #include "Teuchos_UnitTestHarness.hpp"
10 #include "Teuchos_XMLParameterListHelpers.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
12 
13 #include "Thyra_VectorStdOps.hpp"
14 
15 #include "Tempus_IntegratorBasic.hpp"
16 #include "Tempus_IntegratorObserverSubcycling.hpp"
17 
19 #include "Tempus_StepperSubcycling.hpp"
21 
22 #include "../TestModels/SinCosModel.hpp"
23 #include "../TestModels/VanDerPol_IMEX_ExplicitModel.hpp"
24 #include "../TestModels/VanDerPol_IMEX_ImplicitModel.hpp"
25 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
26 
27 #include <fstream>
28 #include <vector>
29 
30 namespace Tempus_Test {
31 
32 using Teuchos::RCP;
33 using Teuchos::rcp;
34 using Teuchos::rcp_const_cast;
35 using Teuchos::ParameterList;
36 using Teuchos::sublist;
37 using Teuchos::getParametersFromXmlFile;
38 
42 
43 
44 // ************************************************************
45 // ************************************************************
46 TEUCHOS_UNIT_TEST(Subcycling, ParameterList)
47 {
48  // Read params from .xml file
49  RCP<ParameterList> pList =
50  getParametersFromXmlFile("Tempus_Subcycling_SinCos.xml");
51 
52  //std::ofstream ftmp("PL.txt");
53  //pList->print(ftmp);
54  //ftmp.close();
55 
56  // Setup the SinCosModel
57  RCP<ParameterList> scm_pl = sublist(pList, "SinCosModel", true);
58  auto model = rcp(new SinCosModel<double> (scm_pl));
59 
60  RCP<ParameterList> tempusPL = sublist(pList, "Tempus", true);
61 
62  // Test constructor IntegratorBasic(tempusPL, model)
63  {
64  RCP<Tempus::IntegratorBasic<double> > integrator =
65  Tempus::integratorBasic<double>(tempusPL, model);
66 
67  RCP<ParameterList> stepperPL = sublist(tempusPL, "Demo Stepper", true);
68  RCP<const ParameterList> defaultPL =
69  integrator->getStepper()->getValidParameters();
70 
71  bool pass = haveSameValues(*stepperPL, *defaultPL, true);
72  if (!pass) {
73  std::cout << std::endl;
74  std::cout << "stepperPL -------------- \n" << *stepperPL << std::endl;
75  std::cout << "defaultPL -------------- \n" << *defaultPL << std::endl;
76  }
77  TEST_ASSERT(pass)
78  }
79 
80  // Test constructor IntegratorBasic(model, stepperType)
81  {
82  RCP<Tempus::IntegratorBasic<double> > integrator =
83  Tempus::integratorBasic<double>(model, "Forward Euler");
84 
85  RCP<ParameterList> stepperPL = sublist(tempusPL, "Demo Stepper", true);
86  RCP<const ParameterList> defaultPL =
87  integrator->getStepper()->getValidParameters();
88 
89  bool pass = haveSameValues(*stepperPL, *defaultPL, true);
90  if (!pass) {
91  std::cout << std::endl;
92  std::cout << "stepperPL -------------- \n" << *stepperPL << std::endl;
93  std::cout << "defaultPL -------------- \n" << *defaultPL << std::endl;
94  }
95  TEST_ASSERT(pass)
96  }
97 }
98 
99 
100 // ************************************************************
101 // ************************************************************
102 TEUCHOS_UNIT_TEST(Subcycling, ConstructingFromDefaults)
103 {
104  double dt = 0.4;
105 
106  // Setup the SinCosModel ------------------------------------
107  auto model = rcp(new SinCosModel<double>());
108 
109  // Setup Stepper for field solve ----------------------------
110  auto stepper = rcp(new Tempus::StepperSubcycling<double>());
111  auto sf = Teuchos::rcp(new Tempus::StepperFactory<double>());
112  auto stepperFE = sf->createStepperForwardEuler(model, Teuchos::null);
113  stepper->setSubcyclingStepper(stepperFE);
114 
115  stepper->setSubcyclingMinTimeStep (0.1);
116  stepper->setSubcyclingInitTimeStep (0.1);
117  stepper->setSubcyclingMaxTimeStep (0.1);
118  stepper->setSubcyclingStepType ("Constant");
119  stepper->setSubcyclingMaxFailures (10);
120  stepper->setSubcyclingMaxConsecFailures(5);
121  stepper->setSubcyclingScreenOutputIndexInterval(1);
122  stepper->setSubcyclingIntegratorObserver(
124  stepper->setSubcyclingPrintDtChanges (true);
125 
126  stepper->initialize();
127 
128  // Setup TimeStepControl ------------------------------------
129  auto timeStepControl = rcp(new Tempus::TimeStepControl<double>());
130  timeStepControl->setStepType ("Constant");
131  timeStepControl->setInitIndex(0);
132  timeStepControl->setInitTime (0.0);
133  timeStepControl->setFinalTime(1.0);
134  timeStepControl->setInitTimeStep(dt);
135  timeStepControl->initialize();
136 
137  // Setup initial condition SolutionState --------------------
138  Thyra::ModelEvaluatorBase::InArgs<double> inArgsIC =
139  stepper->getModel()->getNominalValues();
140  auto icSolution = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
141  auto icState = Tempus::createSolutionStateX(icSolution);
142  icState->setTime (timeStepControl->getInitTime());
143  icState->setIndex (timeStepControl->getInitIndex());
144  icState->setTimeStep(0.0); // dt for ICs are indicated by zero.
145  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
146 
147  // Setup SolutionHistory ------------------------------------
148  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
149  solutionHistory->setName("Forward States");
150  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
151  solutionHistory->setStorageLimit(2);
152  solutionHistory->addState(icState);
153 
154  // Setup Integrator -----------------------------------------
155  RCP<Tempus::IntegratorBasic<double> > integrator =
156  Tempus::integratorBasic<double>();
157  integrator->setStepperWStepper(stepper);
158  integrator->setTimeStepControl(timeStepControl);
159  integrator->setSolutionHistory(solutionHistory);
160  integrator->setScreenOutputIndexInterval(10);
161  //integrator->setObserver(...);
162  integrator->initialize();
163 
164 
165  // Integrate to timeMax
166  bool integratorStatus = integrator->advanceTime();
167  TEST_ASSERT(integratorStatus)
168 
169 
170  // Test if at 'Final Time'
171  double time = integrator->getTime();
172  double timeFinal = 1.0;
173  TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
174 
175  // Time-integrated solution and the exact solution
176  RCP<Thyra::VectorBase<double> > x = integrator->getX();
177  RCP<const Thyra::VectorBase<double> > x_exact =
178  model->getExactSolution(time).get_x();
179 
180  // Calculate the error
181  RCP<Thyra::VectorBase<double> > xdiff = x->clone_v();
182  Thyra::V_StVpStV(xdiff.ptr(), 1.0, *x_exact, -1.0, *(x));
183 
184  // Check the order and intercept
185  std::cout << " Stepper = " << stepper->description() << std::endl;
186  std::cout << " =========================" << std::endl;
187  std::cout << " Exact solution : " << get_ele(*(x_exact), 0) << " "
188  << get_ele(*(x_exact), 1) << std::endl;
189  std::cout << " Computed solution: " << get_ele(*(x ), 0) << " "
190  << get_ele(*(x ), 1) << std::endl;
191  std::cout << " Difference : " << get_ele(*(xdiff ), 0) << " "
192  << get_ele(*(xdiff ), 1) << std::endl;
193  std::cout << " =========================" << std::endl;
194  TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.882508, 1.0e-4 );
195  TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.570790, 1.0e-4 );
196 }
197 
198 
199 // ************************************************************
200 // ************************************************************
201 TEUCHOS_UNIT_TEST(Subcycling, SinCosAdapt)
202 {
203  RCP<Tempus::IntegratorBasic<double> > integrator;
204  std::vector<RCP<Thyra::VectorBase<double>>> solutions;
205  std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
206  std::vector<double> StepSize;
207 
208  double dt = 0.05;
209 
210  // Setup the SinCosModel
211  const int nTimeStepSizes = 2;
212  std::string output_file_string = "Tempus_Subcycling_SinCos";
213  std::string output_file_name = output_file_string + ".dat";
214  std::string err_out_file_name = output_file_string + "-Error.dat";
215  double time = 0.0;
216  for (int n=0; n<nTimeStepSizes; n++) {
217 
218  dt /= 2;
219 
220  // Setup the SinCosModel ------------------------------------
221  auto model = rcp(new SinCosModel<double>());
222 
223  // Setup Stepper for field solve ----------------------------
224  auto stepper = rcp(new Tempus::StepperSubcycling<double>());
225  auto sf = Teuchos::rcp(new Tempus::StepperFactory<double>());
226  auto stepperFE = sf->createStepperForwardEuler(model, Teuchos::null);
227  stepper->setSubcyclingStepper(stepperFE);
228 
229  stepper->setSubcyclingMinTimeStep (dt/10.0);
230  stepper->setSubcyclingInitTimeStep (dt/10.0);
231  stepper->setSubcyclingMaxTimeStep (dt);
232  stepper->setSubcyclingStepType ("Variable");
233  stepper->setSubcyclingMaxFailures (10);
234  stepper->setSubcyclingMaxConsecFailures(5);
235  stepper->setSubcyclingScreenOutputIndexInterval(1);
236  //stepper->setSubcyclingIntegratorObserver(
237  // Teuchos::rcp(new Tempus::IntegratorObserverSubcycling<double>()));
238  //stepper->setSubcyclingPrintDtChanges (true);
239 
240  // Set variable strategy.
241  auto strategy = rcp(new Tempus::TimeStepControlStrategyBasicVS<double>());
242  strategy->setMinEta(0.02);
243  strategy->setMaxEta(0.04);
244  stepper->setSubcyclingTimeStepControlStrategy(strategy);
245 
246  stepper->initialize();
247 
248  // Setup TimeStepControl ------------------------------------
249  auto timeStepControl = rcp(new Tempus::TimeStepControl<double>());
250  timeStepControl->setStepType ("Constant");
251  timeStepControl->setInitIndex(0);
252  timeStepControl->setInitTime (0.0);
253  timeStepControl->setFinalTime(1.0);
254  timeStepControl->setMinTimeStep (dt);
255  timeStepControl->setInitTimeStep(dt);
256  timeStepControl->setMaxTimeStep (dt);
257  timeStepControl->initialize();
258 
259  // Setup initial condition SolutionState --------------------
260  Thyra::ModelEvaluatorBase::InArgs<double> inArgsIC =
261  stepper->getModel()->getNominalValues();
262  auto icSolution = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
263  auto icState = Tempus::createSolutionStateX(icSolution);
264  icState->setTime (timeStepControl->getInitTime());
265  icState->setIndex (timeStepControl->getInitIndex());
266  icState->setTimeStep(0.0); // dt for ICs are zero.
267  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
268 
269  // Setup SolutionHistory ------------------------------------
270  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
271  solutionHistory->setName("Forward States");
272  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
273  solutionHistory->setStorageLimit(2);
274  solutionHistory->addState(icState);
275 
276  // Setup Integrator -----------------------------------------
277  integrator = Tempus::integratorBasic<double>();
278  integrator->setStepperWStepper(stepper);
279  integrator->setTimeStepControl(timeStepControl);
280  integrator->setSolutionHistory(solutionHistory);
281  integrator->setScreenOutputIndexInterval(10);
282  //integrator->setObserver(...);
283  integrator->initialize();
284 
285 
286  // Integrate to timeMax
287  bool integratorStatus = integrator->advanceTime();
288  TEST_ASSERT(integratorStatus)
289 
290  // Test if at 'Final Time'
291  time = integrator->getTime();
292  double timeFinal = 1.0;
293  TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
294 
295  // Time-integrated solution and the exact solution
296  RCP<Thyra::VectorBase<double> > x = integrator->getX();
297  RCP<const Thyra::VectorBase<double> > x_exact =
298  model->getExactSolution(time).get_x();
299 
300  //// Plot sample solution and exact solution
301  //if (n == 0) {
302  // std::ofstream ftmp(output_file_name);
303  // //Warning: the following assumes serial run
304  // FILE *gold_file = fopen("Tempus_Subcycling_SinCos_AdaptDt_gold.dat", "r");
305  // RCP<const SolutionHistory<double> > solutionHistory =
306  // integrator->getSolutionHistory();
307  // RCP<const Thyra::VectorBase<double> > x_exact_plot;
308  // for (int i=0; i<solutionHistory->getNumStates(); i++) {
309  // char time_gold_char[100];
310  // fgets(time_gold_char, 100, gold_file);
311  // double time_gold;
312  // sscanf(time_gold_char, "%lf", &time_gold);
313  // RCP<const SolutionState<double> > solutionState = (*solutionHistory)[i];
314  // double time_i = solutionState->getTime();
315  // //Throw error if time does not match time in gold file to specified tolerance
316  // TEST_FLOATING_EQUALITY( time_i, time_gold, 1.0e-5 );
317  // RCP<const Thyra::VectorBase<double> > x_plot = solutionState->getX();
318  // x_exact_plot = model->getExactSolution(time_i).get_x();
319  // ftmp << time_i << " "
320  // << get_ele(*(x_plot), 0) << " "
321  // << get_ele(*(x_plot), 1) << " "
322  // << get_ele(*(x_exact_plot), 0) << " "
323  // << get_ele(*(x_exact_plot), 1) << std::endl;
324  // }
325  // ftmp.close();
326  //}
327 
328  // Store off the final solution and step size
329  StepSize.push_back(dt);
330  auto solution = Thyra::createMember(model->get_x_space());
331  Thyra::copy(*(integrator->getX()),solution.ptr());
332  solutions.push_back(solution);
333  if (n == nTimeStepSizes-1) { // Add exact solution last in vector.
334  StepSize.push_back(0.0);
335  auto solutionExact = Thyra::createMember(model->get_x_space());
336  Thyra::copy(*(model->getExactSolution(time).get_x()),solutionExact.ptr());
337  solutions.push_back(solutionExact);
338  }
339  }
340 
341  // Check the order and intercept
342  if (nTimeStepSizes > 1) {
343  double xSlope = 0.0;
344  double xDotSlope = 0.0;
345  std::vector<double> xErrorNorm;
346  std::vector<double> xDotErrorNorm;
347  RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
348  //double order = stepper->getOrder();
349  writeOrderError("Tempus_BDF2_SinCos-Error.dat",
350  stepper, StepSize,
351  solutions, xErrorNorm, xSlope,
352  solutionsDot, xDotErrorNorm, xDotSlope);
353 
354  TEST_FLOATING_EQUALITY( xSlope, 1.00137, 0.01 );
355  //TEST_FLOATING_EQUALITY( xDotSlope, 1.95089, 0.01 );
356  TEST_FLOATING_EQUALITY( xErrorNorm[0], 0.00387948, 1.0e-4 );
357  //TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.000197325, 1.0e-4 );
358  }
359 
360  Teuchos::TimeMonitor::summarize();
361 }
362 
363 
364 // ************************************************************
365 // ************************************************************
366 TEUCHOS_UNIT_TEST(Subcycling, VanDerPolOperatorSplit)
367 {
368  RCP<Tempus::IntegratorBasic<double> > integrator;
369  std::vector<RCP<Thyra::VectorBase<double>>> solutions;
370  std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
371  std::vector<double> StepSize;
372  std::vector<double> xErrorNorm;
373  std::vector<double> xDotErrorNorm;
374  const int nTimeStepSizes = 4; // 8 for Error plot
375  double dt = 0.1;
376  double time = 0.0;
377  for (int n=0; n<nTimeStepSizes; n++) {
378 
379  // Set the step size
380  dt /= 2;
381  if (n == nTimeStepSizes-1) dt /= 10.0;
382 
383  // Setup the explicit and implicit VanDerPol ModelEvaluators
384  auto tmpModel = rcp(new VanDerPol_IMEX_ExplicitModel<double>());
385  auto pl = Teuchos::rcp_const_cast<Teuchos::ParameterList> (
386  tmpModel->getValidParameters());
387  pl->set("Coeff epsilon", 0.1);
388  auto explicitModel = rcp(new VanDerPol_IMEX_ExplicitModel<double>(pl));
389  auto implicitModel = rcp(new VanDerPol_IMEX_ImplicitModel<double>(pl));
390 
391  // Setup Steppers for field solve ---------------------------
392  auto sf = Teuchos::rcp(new Tempus::StepperFactory<double>());
393 
394  // Explicit Subcycling Stepper
395  auto stepperSC = rcp(new Tempus::StepperSubcycling<double>());
396  auto stepperFE = sf->createStepperForwardEuler(explicitModel,Teuchos::null);
397  stepperFE->setUseFSAL(false);
398  stepperFE->initialize();
399  stepperSC->setSubcyclingStepper(stepperFE);
400 
401  stepperSC->setSubcyclingMinTimeStep (0.00001);
402  stepperSC->setSubcyclingInitTimeStep (dt/10.0);
403  stepperSC->setSubcyclingMaxTimeStep (dt/10.0);
404  stepperSC->setSubcyclingMaxFailures (10);
405  stepperSC->setSubcyclingMaxConsecFailures(5);
406  stepperSC->setSubcyclingScreenOutputIndexInterval(1);
407  //stepper->setSubcyclingIntegratorObserver(
408  // Teuchos::rcp(new Tempus::IntegratorObserverSubcycling<double>()));
409  //stepperSC->setSubcyclingPrintDtChanges (true);
410 
411  //stepperSC->setSubcyclingStepType ("Constant");
412  stepperSC->setSubcyclingStepType ("Variable");
413  auto strategySC = rcp(new Tempus::TimeStepControlStrategyBasicVS<double>());
414  strategySC->setMinEta(0.000001);
415  strategySC->setMaxEta(0.01);
416  stepperSC->setSubcyclingTimeStepControlStrategy(strategySC);
417  stepperSC->initialize();
418 
419  // Implicit Stepper
420  auto stepperBE =
421  sf->createStepperBackwardEuler(implicitModel, Teuchos::null);
422 
423  // Operator-Split Stepper
424  auto stepper = rcp(new Tempus::StepperOperatorSplit<double>());
425  stepper->addStepper(stepperSC);
426  stepper->addStepper(stepperBE);
427  stepper->initialize();
428 
429  // Setup TimeStepControl ------------------------------------
430  auto timeStepControl = rcp(new Tempus::TimeStepControl<double>());
431  timeStepControl->setInitIndex(0);
432  timeStepControl->setInitTime (0.0);
433  //timeStepControl->setFinalIndex(2);
434  timeStepControl->setFinalTime(2.0);
435  timeStepControl->setMinTimeStep (0.000001);
436  timeStepControl->setStepType ("Constant");
437  timeStepControl->setInitTimeStep(dt);
438  timeStepControl->setMaxTimeStep (dt);
439 
440  //timeStepControl->setStepType ("Variable");
441  //timeStepControl->setInitTimeStep(dt/2.0);
442  //timeStepControl->setMaxTimeStep (dt);
443  //auto strategy = rcp(new Tempus::TimeStepControlStrategyBasicVS<double>());
444  //strategy->setMinEta(1.0e-6);
445  //strategy->setMaxEta(5.0);
446  //timeStepControl->getTimeStepControlStrategy()->clearObservers();
447  //timeStepControl->getTimeStepControlStrategy()->addStrategy(strategy);
448 
449  timeStepControl->initialize();
450 
451  // Setup initial condition SolutionState --------------------
452  Thyra::ModelEvaluatorBase::InArgs<double> inArgsIC =
453  stepper->getModel()->getNominalValues();
454  auto icX = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
455  auto icXDot = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x_dot());
456  auto icState = Tempus::createSolutionStateX(icX, icXDot);
457  icState->setTime (timeStepControl->getInitTime());
458  icState->setIndex (timeStepControl->getInitIndex());
459  icState->setTimeStep(0.0); // dt for ICs are zero.
460  icState->setOrder (stepper->getOrder());
461  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
462 
463  // Setup SolutionHistory ------------------------------------
464  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
465  solutionHistory->setName("Forward States");
466  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_UNLIMITED);
467  //solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
468  solutionHistory->setStorageLimit(3);
469  solutionHistory->addState(icState);
470 
471  // Setup Integrator -----------------------------------------
472  integrator = Tempus::integratorBasic<double>();
473  integrator->setStepperWStepper(stepper);
474  integrator->setTimeStepControl(timeStepControl);
475  integrator->setSolutionHistory(solutionHistory);
476  integrator->setScreenOutputIndexInterval(10);
477  //integrator->setObserver(...);
478  integrator->initialize();
479 
480 
481  // Integrate to timeMax
482  bool integratorStatus = integrator->advanceTime();
483  TEST_ASSERT(integratorStatus)
484 
485  // Test if at 'Final Time'
486  time = integrator->getTime();
487  double timeFinal = 2.0;
488  double tol = 100.0 * std::numeric_limits<double>::epsilon();
489  TEST_FLOATING_EQUALITY(time, timeFinal, tol);
490 
491  // Store off the final solution and step size
492  StepSize.push_back(dt);
493  auto solution = Thyra::createMember(implicitModel->get_x_space());
494  Thyra::copy(*(integrator->getX()),solution.ptr());
495  solutions.push_back(solution);
496  auto solutionDot = Thyra::createMember(implicitModel->get_x_space());
497  Thyra::copy(*(integrator->getXdot()),solutionDot.ptr());
498  solutionsDot.push_back(solutionDot);
499 
500  // Output finest temporal solution for plotting
501  // This only works for ONE MPI process
502  if ((n == 0) or (n == nTimeStepSizes-1)) {
503  std::string fname = "Tempus_Subcycling_VanDerPol-Ref.dat";
504  if (n == 0) fname = "Tempus_Subcycling_VanDerPol.dat";
505  writeSolution(fname, integrator->getSolutionHistory());
506  //solutionHistory->printHistory("medium");
507  }
508  }
509 
510  // Check the order and intercept
511  double xSlope = 0.0;
512  double xDotSlope = 0.0;
513  RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
514  //double order = stepper->getOrder();
515  writeOrderError("Tempus_Subcycling_VanDerPol-Error.dat",
516  stepper, StepSize,
517  solutions, xErrorNorm, xSlope,
518  solutionsDot, xDotErrorNorm, xDotSlope);
519 
520  TEST_FLOATING_EQUALITY( xSlope, 1.25708, 0.05 );
521  TEST_FLOATING_EQUALITY( xDotSlope, 1.20230, 0.05 );
522  TEST_FLOATING_EQUALITY( xErrorNorm[0], 0.37156, 1.0e-4 );
523  TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 3.11651, 1.0e-4 );
524 
525  Teuchos::TimeMonitor::summarize();
526 }
527 
528 
529 } // namespace Tempus_Test
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.
StepControlStrategy class for TimeStepControl.
Sine-Cosine model problem from Rythmos. This is a canonical Sine-Cosine differential equation with a...
void writeSolution(const std::string filename, Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > solutionHistory)
OperatorSplit stepper loops through the Stepper list.
void writeOrderError(const std::string filename, Teuchos::RCP< Tempus::Stepper< Scalar > > stepper, std::vector< Scalar > &StepSize, std::vector< Teuchos::RCP< Thyra::VectorBase< Scalar >>> &solutions, std::vector< Scalar > &xErrorNorm, Scalar &xSlope, std::vector< Teuchos::RCP< Thyra::VectorBase< Scalar >>> &solutionsDot, std::vector< Scalar > &xDotErrorNorm, Scalar &xDotSlope, std::vector< Teuchos::RCP< Thyra::VectorBase< Scalar >>> &solutionsDotDot, std::vector< Scalar > &xDotDotErrorNorm, Scalar &xDotDotSlope)
TEUCHOS_UNIT_TEST(BackwardEuler, SinCos_ASA)
TimeStepControl manages the time step size. There several mechanicisms that effect the time step size...
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Keep a fix number of states.
IntegratorObserverSubcycling class for time integrators. This basic class has simple no-op functions...
Solution state for integrators and steppers. SolutionState contains the metadata for solutions and th...