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::RCP;
37 using Teuchos::rcp;
38 using Teuchos::rcp_const_cast;
39 using Teuchos::rcp_dynamic_cast;
41 using Teuchos::sublist;
42 using Teuchos::getParametersFromXmlFile;
43 
47 
48 
49 // ************************************************************
50 // ************************************************************
52 {
53  // Read params from .xml file
54  RCP<ParameterList> pList =
55  getParametersFromXmlFile("Tempus_Subcycling_SinCos.xml");
56 
57  //std::ofstream ftmp("PL.txt");
58  //pList->print(ftmp);
59  //ftmp.close();
60 
61  // Setup the SinCosModel
62  RCP<ParameterList> scm_pl = sublist(pList, "SinCosModel", true);
63  auto model = rcp(new SinCosModel<double> (scm_pl));
64 
65  RCP<ParameterList> tempusPL = sublist(pList, "Tempus", true);
66 
67  // Test constructor IntegratorBasic(tempusPL, model)
68  {
70  Tempus::createIntegratorBasic<double>(tempusPL, model);
71 
72  RCP<ParameterList> stepperPL = sublist(tempusPL, "Demo Stepper", true);
73  RCP<const ParameterList> defaultPL =
74  integrator->getStepper()->getValidParameters();
75 
76  bool pass = haveSameValuesSorted(*stepperPL, *defaultPL, true);
77  if (!pass) {
78  std::cout << std::endl;
79  std::cout << "stepperPL -------------- \n" << *stepperPL << std::endl;
80  std::cout << "defaultPL -------------- \n" << *defaultPL << std::endl;
81  }
82  TEST_ASSERT(pass)
83  }
84 
85  // Test constructor IntegratorBasic(model, stepperType)
86  {
88  Tempus::createIntegratorBasic<double>(model, "Forward Euler");
89 
90  RCP<ParameterList> stepperPL = sublist(tempusPL, "Demo Stepper", true);
91  RCP<const ParameterList> defaultPL =
92  integrator->getStepper()->getValidParameters();
93 
94  bool pass = haveSameValuesSorted(*stepperPL, *defaultPL, true);
95  if (!pass) {
96  std::cout << std::endl;
97  std::cout << "stepperPL -------------- \n" << *stepperPL << std::endl;
98  std::cout << "defaultPL -------------- \n" << *defaultPL << std::endl;
99  }
100  TEST_ASSERT(pass)
101  }
102 }
103 
104 
105 // ************************************************************
106 // ************************************************************
107 TEUCHOS_UNIT_TEST(Subcycling, ConstructingFromDefaults)
108 {
109  double dt = 0.4;
110 
111  // Setup the SinCosModel ------------------------------------
112  auto model = rcp(new SinCosModel<double>());
113  auto modelME = rcp_dynamic_cast<const Thyra::ModelEvaluator<double> > (model);
114 
115  // Setup Stepper for field solve ----------------------------
116  auto stepper = rcp(new Tempus::StepperSubcycling<double>());
117  auto stepperFE = Tempus::createStepperForwardEuler(modelME, Teuchos::null);
118  stepper->setSubcyclingStepper(stepperFE);
119 
120  stepper->setSubcyclingMinTimeStep (0.1);
121  stepper->setSubcyclingInitTimeStep (0.1);
122  stepper->setSubcyclingMaxTimeStep (0.1);
123  stepper->setSubcyclingMaxFailures (10);
124  stepper->setSubcyclingMaxConsecFailures(5);
125  stepper->setSubcyclingScreenOutputIndexInterval(1);
126  stepper->setSubcyclingIntegratorObserver(
128  stepper->setSubcyclingPrintDtChanges (true);
129 
130  // Set subcycling strategy.
131  auto subStrategy = rcp(new Tempus::TimeStepControlStrategyConstant<double>(dt));
132  stepper->setSubcyclingTimeStepControlStrategy(subStrategy);
133 
134  // Setup TimeStepControl ------------------------------------
135  auto timeStepControl = rcp(new Tempus::TimeStepControl<double>());
136  timeStepControl->setInitIndex(0);
137  timeStepControl->setFinalIndex(10);
138  timeStepControl->setInitTime (0.0);
139  timeStepControl->setFinalTime(1.0);
140  timeStepControl->setInitTimeStep(dt);
141 
142  // Set TimeStepControl strategy.
144  strategy->initialize();
145  timeStepControl->setTimeStepControlStrategy(strategy);
146 
147  timeStepControl->initialize();
148 
149  // Setup initial condition SolutionState --------------------
150  auto inArgsIC = stepper->getModel()->getNominalValues();
151  auto icSolution = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
152  auto icState = Tempus::createSolutionStateX(icSolution);
153  icState->setTime (timeStepControl->getInitTime());
154  icState->setIndex (timeStepControl->getInitIndex());
155  icState->setTimeStep(0.0); // dt for ICs are indicated by zero.
156  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
157 
158  // Setup SolutionHistory ------------------------------------
159  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
160  solutionHistory->setName("Forward States");
161  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
162  solutionHistory->setStorageLimit(2);
163  solutionHistory->addState(icState);
164 
165  // Ensure ICs are consistent and stepper memory is set (e.g., xDot is set).
166  stepper->setInitialConditions(solutionHistory);
167  stepper->initialize();
168 
169  // Setup Integrator -----------------------------------------
171  Tempus::createIntegratorBasic<double>();
172  integrator->setStepper(stepper);
173  integrator->setTimeStepControl(timeStepControl);
174  integrator->setSolutionHistory(solutionHistory);
175  integrator->setScreenOutputIndexInterval(1);
176  //integrator->setObserver(...);
177  integrator->initialize();
178 
179 
180  // Integrate to timeMax
181  bool integratorStatus = integrator->advanceTime();
182  TEST_ASSERT(integratorStatus)
183 
184 
185  // Test if at 'Final Time'
186  double time = integrator->getTime();
187  double timeFinal = 1.0;
188  TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
189 
190  // Time-integrated solution and the exact solution
191  RCP<Thyra::VectorBase<double> > x = integrator->getX();
193  model->getExactSolution(time).get_x();
194 
195  // Calculate the error
196  RCP<Thyra::VectorBase<double> > xdiff = x->clone_v();
197  Thyra::V_StVpStV(xdiff.ptr(), 1.0, *x_exact, -1.0, *(x));
198 
199  // Check the order and intercept
200  std::cout << " Stepper = " << stepper->description() << std::endl;
201  std::cout << " =========================" << std::endl;
202  std::cout << " Exact solution : " << get_ele(*(x_exact), 0) << " "
203  << get_ele(*(x_exact), 1) << std::endl;
204  std::cout << " Computed solution: " << get_ele(*(x ), 0) << " "
205  << get_ele(*(x ), 1) << std::endl;
206  std::cout << " Difference : " << get_ele(*(xdiff ), 0) << " "
207  << get_ele(*(xdiff ), 1) << std::endl;
208  std::cout << " =========================" << std::endl;
209  TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.882508, 1.0e-4 );
210  TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.570790, 1.0e-4 );
211 }
212 
213 
214 // ************************************************************
215 // ************************************************************
216 TEUCHOS_UNIT_TEST(Subcycling, SinCosAdapt)
217 {
219  std::vector<RCP<Thyra::VectorBase<double>>> solutions;
220  std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
221  std::vector<double> StepSize;
222 
223  double dt = 0.05;
224 
225  // Setup the SinCosModel
226  const int nTimeStepSizes = 2;
227  std::string output_file_string = "Tempus_Subcycling_SinCos";
228  std::string output_file_name = output_file_string + ".dat";
229  std::string err_out_file_name = output_file_string + "-Error.dat";
230  double time = 0.0;
231  for (int n=0; n<nTimeStepSizes; n++) {
232 
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 = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
274  auto icState = Tempus::createSolutionStateX(icSolution);
275  icState->setTime (timeStepControl->getInitTime());
276  icState->setIndex (timeStepControl->getInitIndex());
277  icState->setTimeStep(0.0); // dt for ICs are zero.
278  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
279 
280  // Setup SolutionHistory ------------------------------------
281  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
282  solutionHistory->setName("Forward States");
283  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
284  solutionHistory->setStorageLimit(2);
285  solutionHistory->addState(icState);
286 
287  // Ensure ICs are consistent and stepper memory is set (e.g., xDot is set).
288  stepper->setInitialConditions(solutionHistory);
289  stepper->initialize();
290 
291  // Setup Integrator -----------------------------------------
292  integrator = Tempus::createIntegratorBasic<double>();
293  integrator->setStepper(stepper);
294  integrator->setTimeStepControl(timeStepControl);
295  integrator->setSolutionHistory(solutionHistory);
296  integrator->setScreenOutputIndexInterval(10);
297  //integrator->setObserver(...);
298  integrator->initialize();
299 
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", "r");
320  // 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 = (*solutionHistory)[i];
329  // double time_i = solutionState->getTime();
330  // //Throw error if time does not match time in gold file to specified tolerance
331  // 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()),solutionExact.ptr());
352  solutions.push_back(solutionExact);
353  }
354  }
355 
356  // Check the order and intercept
357  if (nTimeStepSizes > 1) {
358  double xSlope = 0.0;
359  double xDotSlope = 0.0;
360  std::vector<double> xErrorNorm;
361  std::vector<double> xDotErrorNorm;
362  RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
363  //double order = stepper->getOrder();
364  writeOrderError("Tempus_BDF2_SinCos-Error.dat",
365  stepper, StepSize,
366  solutions, xErrorNorm, xSlope,
367  solutionsDot, xDotErrorNorm, xDotSlope);
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 // ************************************************************
381 TEUCHOS_UNIT_TEST(Subcycling, VanDerPolOperatorSplit)
382 {
384  std::vector<RCP<Thyra::VectorBase<double>>> solutions;
385  std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
386  std::vector<double> StepSize;
387  std::vector<double> xErrorNorm;
388  std::vector<double> xDotErrorNorm;
389  const int nTimeStepSizes = 4; // 8 for Error plot
390  double dt = 0.1;
391  double time = 0.0;
392  for (int n=0; n<nTimeStepSizes; n++) {
393 
394  // Set the step size
395  dt /= 2;
396  if (n == nTimeStepSizes-1) dt /= 10.0;
397 
398  // Setup the explicit and implicit VanDerPol ModelEvaluators
399  auto tmpModel = rcp(new VanDerPol_IMEX_ExplicitModel<double>());
400  auto pl = Teuchos::rcp_const_cast<Teuchos::ParameterList> (
401  tmpModel->getValidParameters());
402  pl->set("Coeff epsilon", 0.1);
407 
408  // Setup Steppers for field solve ---------------------------
409 
410  // Explicit Subcycling Stepper
411  auto stepperSC = rcp(new Tempus::StepperSubcycling<double>());
412  auto stepperFE = Tempus::createStepperForwardEuler(explicitModel,Teuchos::null);
413  stepperFE->setUseFSAL(false);
414  stepperFE->initialize();
415  stepperSC->setSubcyclingStepper(stepperFE);
416 
417  stepperSC->setSubcyclingMinTimeStep (0.00001);
418  stepperSC->setSubcyclingInitTimeStep (dt/10.0);
419  stepperSC->setSubcyclingMaxTimeStep (dt/10.0);
420  stepperSC->setSubcyclingMaxFailures (10);
421  stepperSC->setSubcyclingMaxConsecFailures(5);
422  stepperSC->setSubcyclingScreenOutputIndexInterval(1);
423  //stepper->setSubcyclingIntegratorObserver(
424  // Teuchos::rcp(new Tempus::IntegratorObserverSubcycling<double>()));
425  //stepperSC->setSubcyclingPrintDtChanges (true);
426 
427  auto strategySC = rcp(new Tempus::TimeStepControlStrategyBasicVS<double>());
428  strategySC->setMinEta(0.000001);
429  strategySC->setMaxEta(0.01);
430  strategySC->initialize();
431  stepperSC->setSubcyclingTimeStepControlStrategy(strategySC);
432 
433  // Implicit Stepper
434  auto stepperBE = 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 Tempus::TimeStepControlStrategyBasicVS<double>());
454  //strategy->setMinEta(1.0e-6);
455  //strategy->setMaxEta(5.0);
456  //strategy->initialize();
457  //timeStepControl->getTimeStepControlStrategy()->clearObservers();
458  //timeStepControl->getTimeStepControlStrategy()->addStrategy(strategy);
459 
460  timeStepControl->initialize();
461 
462  // Setup initial condition SolutionState --------------------
463  auto inArgsIC = stepper->getModel()->getNominalValues();
464  auto icX = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
465  auto icXDot = rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x_dot());
466  auto icState = Tempus::createSolutionStateX(icX, icXDot);
467  icState->setTime (timeStepControl->getInitTime());
468  icState->setIndex (timeStepControl->getInitIndex());
469  icState->setTimeStep(0.0); // dt for ICs are zero.
470  icState->setOrder (stepper->getOrder());
471  icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing.
472 
473  // Setup SolutionHistory ------------------------------------
474  auto solutionHistory = rcp(new Tempus::SolutionHistory<double>());
475  solutionHistory->setName("Forward States");
476  solutionHistory->setStorageType(Tempus::STORAGE_TYPE_UNLIMITED);
477  //solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC);
478  solutionHistory->setStorageLimit(3);
479  solutionHistory->addState(icState);
480 
481  // Ensure ICs are consistent and stepper memory is set (e.g., xDot is set).
482  stepperSC->setInitialConditions(solutionHistory);
483  stepper->initialize();
484 
485  // Setup Integrator -----------------------------------------
486  integrator = Tempus::createIntegratorBasic<double>();
487  integrator->setStepper(stepper);
488  integrator->setTimeStepControl(timeStepControl);
489  integrator->setSolutionHistory(solutionHistory);
490  integrator->setScreenOutputIndexInterval(10);
491  //integrator->setObserver(...);
492  integrator->initialize();
493 
494 
495  // Integrate to timeMax
496  bool integratorStatus = integrator->advanceTime();
497  TEST_ASSERT(integratorStatus)
498 
499  // Test if at 'Final Time'
500  time = integrator->getTime();
501  double timeFinal = 2.0;
502  double tol = 100.0 * std::numeric_limits<double>::epsilon();
503  TEST_FLOATING_EQUALITY(time, timeFinal, tol);
504 
505  // Store off the final solution and step size
506  StepSize.push_back(dt);
507  auto solution = Thyra::createMember(implicitModel->get_x_space());
508  Thyra::copy(*(integrator->getX()),solution.ptr());
509  solutions.push_back(solution);
510  auto solutionDot = Thyra::createMember(implicitModel->get_x_space());
511  Thyra::copy(*(integrator->getXDot()),solutionDot.ptr());
512  solutionsDot.push_back(solutionDot);
513 
514  // Output finest temporal solution for plotting
515  // This only works for ONE MPI process
516  if ((n == 0) || (n == nTimeStepSizes-1)) {
517  std::string fname = "Tempus_Subcycling_VanDerPol-Ref.dat";
518  if (n == 0) fname = "Tempus_Subcycling_VanDerPol.dat";
519  writeSolution(fname, integrator->getSolutionHistory());
520  //solutionHistory->printHistory("medium");
521  }
522  }
523 
524  // Check the order and intercept
525  double xSlope = 0.0;
526  double xDotSlope = 0.0;
527  RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
528  //double order = stepper->getOrder();
529  writeOrderError("Tempus_Subcycling_VanDerPol-Error.dat",
530  stepper, StepSize,
531  solutions, xErrorNorm, xSlope,
532  solutionsDot, xDotErrorNorm, xDotSlope);
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 
543 } // 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)
#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.
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)
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. SolutionState contains the metadata for solutions and th...