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