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