Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperFactory.hpp
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 #ifndef Tempus_StepperFactory_hpp
10 #define Tempus_StepperFactory_hpp
11 
12 #include "Teuchos_ParameterList.hpp"
13 #include "Tempus_StepperForwardEuler.hpp"
14 #include "Tempus_StepperBackwardEuler.hpp"
15 #include "Tempus_StepperExplicitRK.hpp"
16 #include "Tempus_StepperBDF2.hpp"
17 #include "Tempus_StepperNewmarkImplicitAForm.hpp"
18 #include "Tempus_StepperNewmarkImplicitDForm.hpp"
19 #include "Tempus_StepperNewmarkExplicitAForm.hpp"
20 #include "Tempus_StepperHHTAlpha.hpp"
22 #include "Tempus_StepperIMEX_RK.hpp"
23 #include "Tempus_StepperIMEX_RK_Partition.hpp"
24 #include "Tempus_StepperLeapfrog.hpp"
25 #include "Tempus_StepperOperatorSplit.hpp"
26 #include "Tempus_StepperTrapezoidal.hpp"
27 #include "Tempus_StepperSubcycling.hpp"
28 
29 #include "NOX_Thyra.H"
30 
31 namespace Tempus {
32 
33 /** \brief Stepper factory.
34  *
35  * <b>Adding Steppers</b>
36  * -#
37  */
38 template<class Scalar>
39 class StepperFactory
40 {
41 public:
42 
43  /// Constructor
45 
46  /// Destructor
47  virtual ~StepperFactory() {}
48 
49  /// Create default stepper from stepper type (e.g., "Forward Euler").
50  Teuchos::RCP<Stepper<Scalar> > createStepper(
51  std::string stepperType = "Forward Euler",
52  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >&
53  model = Teuchos::null)
54  {
55  if (stepperType == "") stepperType = "Forward Euler";
56  return this->createStepper(model, stepperType, Teuchos::null);
57  }
58 
59  /// Create stepper from ParameterList with its details.
60  Teuchos::RCP<Stepper<Scalar> > createStepper(
61  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
62  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >&
63  model = Teuchos::null)
64  {
65  std::string stepperType = "Forward Euler";
66  if (stepperPL != Teuchos::null)
67  stepperType = stepperPL->get<std::string>("Stepper Type","Forward Euler");
68  return this->createStepper(model, stepperType, stepperPL);
69  }
70 
71  /// Create stepper from ParameterList with its details.
72  Teuchos::RCP<Stepper<Scalar> > createMultiSteppers(
73  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
74  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > models)
75  {
76  std::string stepperType = "Operator Split";
77  if (stepperPL != Teuchos::null)
78  stepperType = stepperPL->get<std::string>("Stepper Type");
79  return this->createStepper(models, stepperType, stepperPL);
80  }
81 
82 
83  // ---------------------------------------------------------------------------
84 
85  /// Set Stepper member data from the ParameterList.
87  Teuchos::RCP<Stepper<Scalar> > stepper,
88  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
89  {
90  if (stepperPL != Teuchos::null) {
91  auto stepperType =
92  stepperPL->get<std::string>("Stepper Type", stepper->getStepperType());
93  TEUCHOS_TEST_FOR_EXCEPTION(
94  stepperType != stepper->getStepperType() ,std::runtime_error,
95  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
96  " does not match type for stepper Stepper (='"
97  + stepper->getStepperType() + "').");
98  stepper->setStepperType(stepperType);
99 
100  stepper->setUseFSAL(
101  stepperPL->get<bool>("Use FSAL", stepper->getUseFSALDefault()));
102 
103  stepper->setICConsistency(
104  stepperPL->get<std::string>("Initial Condition Consistency",
105  stepper->getICConsistencyDefault()));
106 
107  stepper->setICConsistencyCheck(
108  stepperPL->get<bool>("Initial Condition Consistency Check",
109  stepper->getICConsistencyCheckDefault()));
110  }
111  }
112 
113 
114  /// Create a tableau from the ParameterList.
115  Teuchos::RCP<RKButcherTableau<Scalar> > createTableau(
116  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
117  {
118  using Teuchos::as;
119  using Teuchos::RCP;
120  using Teuchos::rcp_const_cast;
121  using Teuchos::ParameterList;
122 
123  TEUCHOS_TEST_FOR_EXCEPTION(stepperPL == Teuchos::null,std::runtime_error,
124  "Error parsing general tableau. ParameterList is null.\n");
125 
126  Teuchos::RCP<RKButcherTableau<Scalar> > tableau;
127 
128  RCP<ParameterList> tableauPL = sublist(stepperPL,"Tableau",true);
129  std::size_t numStages = 0;
130  int order = tableauPL->get<int>("order");
131  Teuchos::SerialDenseMatrix<int,Scalar> A;
132  Teuchos::SerialDenseVector<int,Scalar> b;
133  Teuchos::SerialDenseVector<int,Scalar> c;
134  Teuchos::SerialDenseVector<int,Scalar> bstar;
135 
136  // read in the A matrix
137  {
138  std::vector<std::string> A_row_tokens;
139  Tempus::StringTokenizer(A_row_tokens, tableauPL->get<std::string>("A"),
140  ";",true);
141 
142  // this is the only place where numStages is set
143  numStages = A_row_tokens.size();
144 
145  // allocate the matrix
146  A.shape(as<int>(numStages),as<int>(numStages));
147 
148  // fill the rows
149  for(std::size_t row=0;row<numStages;row++) {
150  // parse the row (tokenize on space)
151  std::vector<std::string> tokens;
152  Tempus::StringTokenizer(tokens,A_row_tokens[row]," ",true);
153 
154  std::vector<double> values;
155  Tempus::TokensToDoubles(values,tokens);
156 
157  TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=numStages,std::runtime_error,
158  "Error parsing A matrix, wrong number of stages in row "
159  << row << ".\n");
160 
161  for(std::size_t col=0;col<numStages;col++)
162  A(row,col) = values[col];
163  }
164  }
165 
166  // size b and c vectors
167  b.size(as<int>(numStages));
168  c.size(as<int>(numStages));
169 
170  // read in the b vector
171  {
172  std::vector<std::string> tokens;
173  Tempus::StringTokenizer(tokens,tableauPL->get<std::string>("b")," ",true);
174  std::vector<double> values;
175  Tempus::TokensToDoubles(values,tokens);
176 
177  TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=numStages,std::runtime_error,
178  "Error parsing b vector, wrong number of stages.\n");
179 
180  for(std::size_t i=0;i<numStages;i++)
181  b(i) = values[i];
182  }
183 
184  // read in the c vector
185  {
186  std::vector<std::string> tokens;
187  Tempus::StringTokenizer(tokens,tableauPL->get<std::string>("c")," ",true);
188  std::vector<double> values;
189  Tempus::TokensToDoubles(values,tokens);
190 
191  TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=numStages,std::runtime_error,
192  "Error parsing c vector, wrong number of stages.\n");
193 
194  for(std::size_t i=0;i<numStages;i++)
195  c(i) = values[i];
196  }
197 
198  if (tableauPL->isParameter("bstar") and
199  tableauPL->get<std::string>("bstar") != "") {
200  bstar.size(as<int>(numStages));
201  // read in the bstar vector
202  {
203  std::vector<std::string> tokens;
205  tokens, tableauPL->get<std::string>("bstar"), " ", true);
206  std::vector<double> values;
207  Tempus::TokensToDoubles(values,tokens);
208 
209  TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=numStages,std::runtime_error,
210  "Error parsing bstar vector, wrong number of stages.\n"
211  " Number of RK stages = " << numStages << "\n"
212  " Number of bstar values = " << values.size() << "\n");
213 
214  for(std::size_t i=0;i<numStages;i++)
215  bstar(i) = values[i];
216  }
217  tableau = rcp(new RKButcherTableau<Scalar>(
218  "From ParameterList",A,b,c,order,order,order,bstar));
219  } else {
220  tableau = rcp(new RKButcherTableau<Scalar>(
221  "From ParameterList",A,b,c,order,order,order));
222  }
223  return tableau;
224  }
225 
226 
227  /// Set StepperExplicit member data from the ParameterList.
229  Teuchos::RCP<StepperExplicit<Scalar> > stepper,
230  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
231  {
232  if (stepperPL != Teuchos::null) {
233  stepperPL->validateParametersAndSetDefaults(
234  *stepper->getValidParameters());
235  setStepperValues(stepper, stepperPL);
236  }
237  }
238 
239  /// Set StepperImplicit member data from the ParameterList.
241  Teuchos::RCP<StepperImplicit<Scalar> > stepper,
242  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
243  {
244  auto solver = rcp(new Thyra::NOXNonlinearSolver());
245  auto solverPL = Tempus::defaultSolverParameters();
246  auto subPL = sublist(solverPL, "NOX");
247  solver->setParameterList(subPL);
248  if (stepperPL != Teuchos::null) {
249  // Can not validate because of optional Parameters, e.g., 'Solver Name'.
250  //stepperPL->validateParametersAndSetDefaults(
251  // *stepper->getValidParameters());
252  setStepperValues(stepper, stepperPL);
253  stepper->setZeroInitialGuess(
254  stepperPL->get<bool>("Zero Initial Guess", false));
255  }
256  }
257 
258  /// Set StepperRK member data from the ParameterList.
260  Teuchos::RCP<StepperExplicitRK<Scalar> > stepper,
261  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
262  {
263  if (stepperPL != Teuchos::null) {
264  stepperPL->validateParametersAndSetDefaults(
265  *stepper->getValidParameters());
266  setStepperValues(stepper, stepperPL);
267  stepper->setUseEmbedded(
268  stepperPL->get<bool>("Use Embedded",stepper->getUseEmbeddedDefault()));
269  }
270  }
271 
272  /// Set solver from ParameterList.
274  Teuchos::RCP<StepperImplicit<Scalar> > stepper,
275  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
276  {
277  auto solver = rcp(new Thyra::NOXNonlinearSolver());
278  auto defaultSolverPL = Tempus::defaultSolverParameters();
279  auto subPL = sublist(defaultSolverPL, "NOX");
280  solver->setParameterList(subPL);
281  if (stepperPL != Teuchos::null) {
282  std::string solverName = stepperPL->get<std::string>("Solver Name");
283  if ( stepperPL->isSublist(solverName) ) {
284  auto solverPL = Teuchos::parameterList();
285  solverPL = Teuchos::sublist(stepperPL, solverName);
286  Teuchos::RCP<Teuchos::ParameterList> noxPL =
287  Teuchos::sublist(solverPL,"NOX",true);
288  solver->setParameterList(noxPL);
289  }
290  }
291  stepper->setSolver(solver);
292  }
293 
294  /// Set StepperDIRK member data from the ParameterList.
296  Teuchos::RCP<StepperDIRK<Scalar> > stepper,
297  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
298  {
299  auto solver = rcp(new Thyra::NOXNonlinearSolver());
300  auto solverPL = Tempus::defaultSolverParameters();
301  auto subPL = sublist(solverPL, "NOX");
302  solver->setParameterList(subPL);
303  if (stepperPL != Teuchos::null) {
304  // Can not validate because of optional Parameters, e.g., 'Solver Name'.
305  //stepperPL->validateParametersAndSetDefaults(
306  // *stepper->getValidParameters());
307  setStepperValues(stepper, stepperPL);
308  stepper->setUseEmbedded(
309  stepperPL->get<bool>("Use Embedded",stepper->getUseEmbeddedDefault()));
310  stepper->setZeroInitialGuess(
311  stepperPL->get<bool>("Zero Initial Guess", false));
312  }
313  }
314 
316  Teuchos::RCP<StepperIMEX_RK_Partition<Scalar> > stepper,
317  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
318  std::string stepperType)
319  {
320  using Teuchos::RCP;
321  if (stepperType == "") {
322  if (stepperPL == Teuchos::null)
323  stepperType = "Partitioned IMEX RK SSP2";
324  else
325  stepperType = stepperPL->get<std::string>("Stepper Type",
326  "Partitioned IMEX RK SSP2");
327  }
328 
329  if (stepperType != "General Partitioned IMEX RK") {
330  stepper->setTableaus(stepperType);
331  } else {
332  if (stepperPL != Teuchos::null) {
333  Teuchos::RCP<const RKButcherTableau<Scalar> > explicitTableau;
334  Teuchos::RCP<const RKButcherTableau<Scalar> > implicitTableau;
335  if (stepperPL->isSublist("IMEX-RK Explicit Stepper")) {
336  RCP<Teuchos::ParameterList> explicitPL = Teuchos::rcp(
337  new Teuchos::ParameterList(
338  stepperPL->sublist("IMEX-RK Explicit Stepper")));
339  auto stepperTemp = createStepper(explicitPL, Teuchos::null);
340  auto stepperERK = Teuchos::rcp_dynamic_cast<StepperExplicitRK<Scalar> > (
341  stepperTemp,true);
342  TEUCHOS_TEST_FOR_EXCEPTION(stepperERK == Teuchos::null, std::logic_error,
343  "Error - The explicit component of a general partitioned IMEX RK stepper was not specified as an ExplicitRK stepper");
344  explicitTableau = stepperERK->getTableau();
345  }
346 
347  if (stepperPL->isSublist("IMEX-RK Implicit Stepper")) {
348  RCP<Teuchos::ParameterList> implicitPL = Teuchos::rcp(
349  new Teuchos::ParameterList(
350  stepperPL->sublist("IMEX-RK Implicit Stepper")));
351  auto stepperTemp = createStepper(implicitPL, Teuchos::null);
352  auto stepperDIRK = Teuchos::rcp_dynamic_cast<StepperDIRK<Scalar> > (
353  stepperTemp,true);
354  TEUCHOS_TEST_FOR_EXCEPTION(stepperDIRK == Teuchos::null, std::logic_error,
355  "Error - The implicit component of a general partitioned IMEX RK stepper was not specified as an DIRK stepper");
356  implicitTableau = stepperDIRK->getTableau();
357  }
358 
359  TEUCHOS_TEST_FOR_EXCEPTION(
360  !(explicitTableau!=Teuchos::null && implicitTableau!=Teuchos::null), std::logic_error,
361  "Error - A parameter list was used to setup a general partitioned IMEX RK stepper, but did not "
362  "specify both an explicit and an implicit tableau!\n");
363 
364  stepper->setTableaus(stepperType, explicitTableau, implicitTableau);
365 
366  stepper->setOrder(stepperPL->get<int>("overall order", 1));
367  }
368  }
369  }
370 
371 
372  void setTableaus(Teuchos::RCP<StepperIMEX_RK<Scalar> > stepper,
373  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
374  std::string stepperType)
375  {
376  using Teuchos::RCP;
377  if (stepperType == "") {
378  if (stepperPL == Teuchos::null)
379  stepperType = "IMEX RK SSP2";
380  else
381  stepperType = stepperPL->get<std::string>("Stepper Type",
382  "IMEX RK SSP2");
383  }
384 
385  if (stepperType != "General IMEX RK") {
386  stepper->setTableaus(stepperType);
387  } else {
388  if (stepperPL != Teuchos::null) {
389  Teuchos::RCP<const RKButcherTableau<Scalar> > explicitTableau;
390  Teuchos::RCP<const RKButcherTableau<Scalar> > implicitTableau;
391  if (stepperPL->isSublist("IMEX-RK Explicit Stepper")) {
392  RCP<Teuchos::ParameterList> explicitPL = Teuchos::rcp(
393  new Teuchos::ParameterList(
394  stepperPL->sublist("IMEX-RK Explicit Stepper")));
395  auto stepperTemp = createStepper(explicitPL, Teuchos::null);
396  auto stepperERK = Teuchos::rcp_dynamic_cast<StepperExplicitRK<Scalar> > (
397  stepperTemp,true);
398  TEUCHOS_TEST_FOR_EXCEPTION(stepperERK == Teuchos::null, std::logic_error,
399  "Error - The explicit component of a general IMEX RK stepper was not specified as an ExplicitRK stepper");
400  explicitTableau = stepperERK->getTableau();
401  }
402 
403  if (stepperPL->isSublist("IMEX-RK Implicit Stepper")) {
404  RCP<Teuchos::ParameterList> implicitPL = Teuchos::rcp(
405  new Teuchos::ParameterList(
406  stepperPL->sublist("IMEX-RK Implicit Stepper")));
407  auto stepperTemp = createStepper(implicitPL, Teuchos::null);
408  auto stepperDIRK = Teuchos::rcp_dynamic_cast<StepperDIRK<Scalar> > (
409  stepperTemp,true);
410  TEUCHOS_TEST_FOR_EXCEPTION(stepperDIRK == Teuchos::null, std::logic_error,
411  "Error - The implicit component of a general IMEX RK stepper was not specified as an DIRK stepper");
412  implicitTableau = stepperDIRK->getTableau();
413  }
414 
415  TEUCHOS_TEST_FOR_EXCEPTION(
416  !(explicitTableau!=Teuchos::null && implicitTableau!=Teuchos::null), std::logic_error,
417  "Error - A parameter list was used to setup a general IMEX RK stepper, but did not "
418  "specify both an explicit and an implicit tableau!\n");
419 
420  stepper->setTableaus(stepperType, explicitTableau, implicitTableau);
421  stepper->setOrder(stepperPL->get<int>("overall order", 1));
422  }
423  }
424  }
425 
426 
427  // ---------------------------------------------------------------------------
428  // Create individual Steppers.
429 
430  Teuchos::RCP<StepperSubcycling<Scalar> >
432  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
433  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
434  {
435  auto stepper = Teuchos::rcp(new StepperSubcycling<Scalar>());
436 
437  TEUCHOS_TEST_FOR_EXCEPTION(stepperPL != Teuchos::null, std::logic_error,
438  "Error - Construction of StepperSubcycling with a ParameterList\n"
439  "is not implemented yet!\n");
440 
441  if (stepperPL != Teuchos::null) {
442  setStepperValues(stepper, stepperPL);
443  //setStepperSubcyclingValues(stepper, stepperPL);
444  }
445  //else {
446  // integrator->setTempusParameterList(Teuchos::null);
447  //}
448 
449  if (model != Teuchos::null) {
450  stepper->setModel(model);
451  stepper->initialize();
452  }
453 
454  return stepper;
455  }
456 
457  Teuchos::RCP<StepperIMEX_RK_Partition<Scalar> >
459  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
460  std::string stepperType,
461  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
462  {
463  auto stepper = Teuchos::rcp(new StepperIMEX_RK_Partition<Scalar>());
464  stepper->setStepperType(stepperType);
465  setStepperImplicitValues(stepper, stepperPL);
466  setTableausPartition(stepper, stepperPL, stepperType);
467 
468  if (model != Teuchos::null) {
469  stepper->setModel(model);
470  setStepperSolverValues(stepper, stepperPL);
471  stepper->initialize();
472  }
473 
474  return stepper;
475  }
476 
477  Teuchos::RCP<StepperIMEX_RK<Scalar> >
479  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
480  std::string stepperType,
481  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
482  {
483  auto stepper = Teuchos::rcp(new StepperIMEX_RK<Scalar>());
484  stepper->setStepperType(stepperType);
485  setStepperImplicitValues(stepper, stepperPL);
486  setTableaus(stepper, stepperPL, stepperType);
487 
488  if (model != Teuchos::null) {
489  stepper->setModel(model);
490  setStepperSolverValues(stepper, stepperPL);
491  stepper->initialize();
492  }
493 
494  return stepper;
495  }
496 
497  Teuchos::RCP<StepperHHTAlpha<Scalar> >
499  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
500  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
501  {
502  auto stepper = Teuchos::rcp(new StepperHHTAlpha<Scalar>());
503  setStepperImplicitValues(stepper, stepperPL);
504  if (stepperPL != Teuchos::null) {
505  if (stepperPL->isSublist("HHT-Alpha Parameters")) {
506  auto hhtalphaPL = stepperPL->sublist("HHT-Alpha Parameters", true);
507  std::string schemeName =
508  hhtalphaPL.get<std::string>("Scheme Name", "Newmark Beta Average Acceleration");
509  stepper->setSchemeName(schemeName);
510  if (schemeName == "Newmark Beta User Defined") {
511  stepper->setBeta (hhtalphaPL.get<double>("Beta", 0.25));
512  stepper->setGamma(hhtalphaPL.get<double>("Gamma", 0.5 ));
513  }
514  stepper->setAlphaF(hhtalphaPL.get<double>("Alpha_f", 0.0));
515  stepper->setAlphaM(hhtalphaPL.get<double>("Alpha_m", 0.0));
516  } else {
517  stepper->setSchemeName("Newmark Beta Average Acceleration");
518  stepper->setAlphaF(0.0);
519  stepper->setAlphaM(0.0);
520  }
521  }
522 
523  if (model != Teuchos::null) {
524  stepper->setModel(model);
525  setStepperSolverValues(stepper, stepperPL);
526  stepper->initialize();
527  }
528 
529  return stepper;
530  }
531 
532  Teuchos::RCP<StepperNewmarkImplicitDForm<Scalar> >
534  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
535  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
536  {
537  auto stepper = Teuchos::rcp(new StepperNewmarkImplicitDForm<Scalar>());
538  setStepperImplicitValues(stepper, stepperPL);
539  if (stepperPL != Teuchos::null) {
540  if (stepperPL->isSublist("Newmark Parameters")) {
541  auto newmarkPL = stepperPL->sublist("Newmark Parameters", true);
542  std::string schemeName =
543  newmarkPL.get<std::string>("Scheme Name", "Average Acceleration");
544  stepper->setSchemeName(schemeName);
545  if (schemeName == "User Defined") {
546  stepper->setBeta (newmarkPL.get<double>("Beta", 0.25));
547  stepper->setGamma(newmarkPL.get<double>("Gamma", 0.5 ));
548  }
549  } else {
550  stepper->setSchemeName("Average Acceleration");
551  }
552  }
553 
554  if (model != Teuchos::null) {
555  stepper->setModel(model);
556  setStepperSolverValues(stepper, stepperPL);
557  stepper->initialize();
558  }
559 
560  return stepper;
561  }
562 
563  Teuchos::RCP<StepperNewmarkImplicitAForm<Scalar> >
565  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
566  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
567  {
568  auto stepper = Teuchos::rcp(new StepperNewmarkImplicitAForm<Scalar>());
569  setStepperImplicitValues(stepper, stepperPL);
570  if (stepperPL != Teuchos::null) {
571  if (stepperPL->isSublist("Newmark Parameters")) {
572  auto newmarkPL = stepperPL->sublist("Newmark Parameters", true);
573  std::string schemeName =
574  newmarkPL.get<std::string>("Scheme Name", "Average Acceleration");
575  stepper->setSchemeName(schemeName);
576  if (schemeName == "User Defined") {
577  stepper->setBeta (newmarkPL.get<double>("Beta", 0.25));
578  stepper->setGamma(newmarkPL.get<double>("Gamma", 0.5 ));
579  }
580  } else {
581  stepper->setSchemeName("Average Acceleration");
582  }
583  }
584 
585  if (model != Teuchos::null) {
586  stepper->setModel(model);
587  setStepperSolverValues(stepper, stepperPL);
588  stepper->initialize();
589  }
590 
591  return stepper;
592  }
593 
594  Teuchos::RCP<StepperBDF2<Scalar> >
596  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
597  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
598  {
599  auto stepper = Teuchos::rcp(new StepperBDF2<Scalar>());
600  setStepperImplicitValues(stepper, stepperPL);
601 
602  if (model != Teuchos::null) {
603  stepper->setModel(model);
604  setStepperSolverValues(stepper, stepperPL);
605  std::string startUpStepper = "DIRK 1 Stage Theta Method";
606  if (stepperPL != Teuchos::null) startUpStepper =
607  stepperPL->get<std::string>("Start Up Stepper Type", startUpStepper);
608  stepper->setStartUpStepper(startUpStepper);
609  stepper->initialize();
610  }
611 
612  return stepper;
613  }
614 
615  Teuchos::RCP<StepperTrapezoidal<Scalar> >
617  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
618  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
619  {
620  auto stepper = Teuchos::rcp(new StepperTrapezoidal<Scalar>());
621  setStepperImplicitValues(stepper, stepperPL);
622 
623  if (model != Teuchos::null) {
624  stepper->setModel(model);
625  setStepperSolverValues(stepper, stepperPL);
626  stepper->initialize();
627  }
628 
629  return stepper;
630  }
631 
632  Teuchos::RCP<StepperBackwardEuler<Scalar> >
634  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
635  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
636  {
637  auto stepper = Teuchos::rcp(new StepperBackwardEuler<Scalar>());
638  setStepperImplicitValues(stepper, stepperPL);
639 
640  if (model != Teuchos::null) {
641  stepper->setModel(model);
642  setStepperSolverValues(stepper, stepperPL);
643 
644  std::string predictor = "None";
645  if (stepperPL != Teuchos::null) predictor =
646  stepperPL->get<std::string>("Predictor Stepper Type", predictor);
647  stepper->setPredictor(predictor);
648 
649  stepper->initialize();
650  }
651 
652  return stepper;
653  }
654 
655  Teuchos::RCP<StepperNewmarkExplicitAForm<Scalar> >
657  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
658  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
659  {
660  auto stepper = Teuchos::rcp(new StepperNewmarkExplicitAForm<Scalar>());
661  setStepperExplicitValues(stepper, stepperPL);
662  if (stepperPL != Teuchos::null) {
663  Scalar gamma = stepperPL->sublist("Newmark Explicit Parameters")
664  .template get<double>("Gamma", 0.5);
665  stepper->setGamma(gamma);
666  }
667 
668  if (model != Teuchos::null) {
669  stepper->setModel(model);
670  stepper->initialize();
671  }
672 
673  return stepper;
674  }
675 
676  Teuchos::RCP<StepperLeapfrog<Scalar> >
678  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
679  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
680  {
681  auto stepper = Teuchos::rcp(new StepperLeapfrog<Scalar>());
682  setStepperExplicitValues(stepper, stepperPL);
683 
684  if (model != Teuchos::null) {
685  stepper->setModel(model);
686  stepper->initialize();
687  }
688 
689  return stepper;
690  }
691 
692  Teuchos::RCP<StepperForwardEuler<Scalar> >
694  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
695  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
696  {
697  auto stepper = Teuchos::rcp(new StepperForwardEuler<Scalar>());
698  setStepperExplicitValues(stepper, stepperPL);
699 
700  if (model != Teuchos::null) {
701  stepper->setModel(model);
702  stepper->initialize();
703  }
704 
705  return stepper;
706  }
707 
708  Teuchos::RCP<StepperERK_General<Scalar> >
710  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
711  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
712  {
713  auto stepper = Teuchos::rcp(new StepperERK_General<Scalar>());
714  setStepperRKValues(stepper, stepperPL);
715 
716  if (stepperPL != Teuchos::null) {
717  if (stepperPL->isParameter("Tableau")) {
718  auto t = createTableau(stepperPL);
719  stepper->setTableau( t->A(),t->b(),t->c(),
720  t->order(),t->orderMin(),t->orderMax(),
721  t->bstar() );
722  }
723  }
724  TEUCHOS_TEST_FOR_EXCEPTION(
725  stepper->getTableau()->isImplicit() == true, std::logic_error,
726  "Error - General ERK received an implicit Butcher Tableau!\n");
727 
728  if (model != Teuchos::null) {
729  stepper->setModel(model);
730  stepper->initialize();
731  }
732 
733  return stepper;
734  }
735 
736  Teuchos::RCP<StepperERK_ForwardEuler<Scalar> >
738  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
739  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
740  {
741  auto stepper = Teuchos::rcp(new StepperERK_ForwardEuler<Scalar>());
742  setStepperRKValues(stepper, stepperPL);
743 
744  if (model != Teuchos::null) {
745  stepper->setModel(model);
746  stepper->initialize();
747  }
748 
749  return stepper;
750  }
751 
752  Teuchos::RCP<StepperERK_4Stage4thOrder<Scalar> >
754  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
755  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
756  {
757  auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
758  setStepperRKValues(stepper, stepperPL);
759 
760  if (model != Teuchos::null) {
761  stepper->setModel(model);
762  stepper->initialize();
763  }
764 
765  return stepper;
766  }
767 
768  Teuchos::RCP<StepperERK_3_8Rule<Scalar> >
770  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
771  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
772  {
773  auto stepper = Teuchos::rcp(new StepperERK_3_8Rule<Scalar>());
774  setStepperRKValues(stepper, stepperPL);
775 
776  if (model != Teuchos::null) {
777  stepper->setModel(model);
778  stepper->initialize();
779  }
780 
781  return stepper;
782  }
783 
784  Teuchos::RCP<StepperERK_4Stage3rdOrderRunge<Scalar> >
786  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
787  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
788  {
789  auto stepper = Teuchos::rcp(new StepperERK_4Stage3rdOrderRunge<Scalar>());
790  setStepperRKValues(stepper, stepperPL);
791 
792  if (model != Teuchos::null) {
793  stepper->setModel(model);
794  stepper->initialize();
795  }
796 
797  return stepper;
798  }
799 
800  Teuchos::RCP<StepperERK_5Stage3rdOrderKandG<Scalar> >
802  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
803  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
804  {
805  auto stepper = Teuchos::rcp(new StepperERK_5Stage3rdOrderKandG<Scalar>());
806  setStepperRKValues(stepper, stepperPL);
807 
808  if (model != Teuchos::null) {
809  stepper->setModel(model);
810  stepper->initialize();
811  }
812 
813  return stepper;
814  }
815 
816  Teuchos::RCP<StepperERK_3Stage3rdOrder<Scalar> >
818  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
819  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
820  {
821  auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrder<Scalar>());
822  setStepperRKValues(stepper, stepperPL);
823 
824  if (model != Teuchos::null) {
825  stepper->setModel(model);
826  stepper->initialize();
827  }
828 
829  return stepper;
830  }
831 
832  Teuchos::RCP<StepperERK_3Stage3rdOrderTVD<Scalar> >
834  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
835  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
836  const std::string stepperType)
837  {
838  auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrderTVD<Scalar>());
839  stepper->setStepperType(stepperType);
840  setStepperRKValues(stepper, stepperPL);
841 
842  if (model != Teuchos::null) {
843  stepper->setModel(model);
844  stepper->initialize();
845  }
846 
847  return stepper;
848  }
849 
850  Teuchos::RCP<StepperERK_SSPERK54<Scalar> >
852  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
853  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
854  {
855  auto stepper = Teuchos::rcp(new StepperERK_SSPERK54<Scalar>());
856  setStepperRKValues(stepper, stepperPL);
857 
858  if (model != Teuchos::null) {
859  stepper->setModel(model);
860  stepper->initialize();
861  }
862 
863  return stepper;
864  }
865 
866  Teuchos::RCP<StepperERK_3Stage3rdOrderHeun<Scalar> >
868  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
869  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
870  {
871  auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrderHeun<Scalar>());
872  setStepperRKValues(stepper, stepperPL);
873 
874  if (model != Teuchos::null) {
875  stepper->setModel(model);
876  stepper->initialize();
877  }
878 
879  return stepper;
880  }
881 
882  Teuchos::RCP<StepperERK_Midpoint<Scalar> >
884  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
885  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
886  {
887  auto stepper = Teuchos::rcp(new StepperERK_Midpoint<Scalar>());
888  setStepperRKValues(stepper, stepperPL);
889 
890  if (model != Teuchos::null) {
891  stepper->setModel(model);
892  stepper->initialize();
893  }
894 
895  return stepper;
896  }
897 
898  Teuchos::RCP<StepperERK_Trapezoidal<Scalar> >
900  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
901  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
902  std::string stepperType)
903  {
904  auto stepper = Teuchos::rcp(new StepperERK_Trapezoidal<Scalar>());
905  stepper->setStepperType(stepperType);
906  setStepperRKValues(stepper, stepperPL);
907 
908  if (model != Teuchos::null) {
909  stepper->setModel(model);
910  stepper->initialize();
911  }
912 
913  return stepper;
914  }
915 
916  Teuchos::RCP<StepperERK_Ralston<Scalar> >
918  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
919  Teuchos::RCP<Teuchos::ParameterList> stepperPL,
920  std::string stepperType)
921  {
922  auto stepper = Teuchos::rcp(new StepperERK_Ralston<Scalar>());
923  stepper->setStepperType(stepperType);
924  setStepperRKValues(stepper, stepperPL);
925 
926  if (model != Teuchos::null) {
927  stepper->setModel(model);
928  stepper->initialize();
929  }
930 
931  return stepper;
932  }
933 
934  Teuchos::RCP<StepperERK_BogackiShampine32<Scalar> >
936  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
937  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
938  {
939  auto stepper = Teuchos::rcp(new StepperERK_BogackiShampine32<Scalar>());
940  setStepperRKValues(stepper, stepperPL);
941 
942  if (model != Teuchos::null) {
943  stepper->setModel(model);
944  stepper->initialize();
945  }
946 
947  return stepper;
948  }
949 
950  Teuchos::RCP<StepperERK_Merson45<Scalar> >
952  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
953  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
954  {
955  auto stepper = Teuchos::rcp(new StepperERK_Merson45<Scalar>());
956  setStepperRKValues(stepper, stepperPL);
957 
958  if (model != Teuchos::null) {
959  stepper->setModel(model);
960  stepper->initialize();
961  }
962 
963  return stepper;
964  }
965 
966 
967  Teuchos::RCP<StepperDIRK_General<Scalar> >
969  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
970  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
971  {
972  auto stepper = Teuchos::rcp(new StepperDIRK_General<Scalar>());
973  setStepperDIRKValues(stepper, stepperPL);
974 
975  if (stepperPL != Teuchos::null) {
976  if (stepperPL->isParameter("Tableau")) {
977  auto t = createTableau(stepperPL);
978  stepper->setTableau( t->A(),t->b(),t->c(),
979  t->order(),t->orderMin(),t->orderMax(),
980  t->bstar() );
981  }
982  }
983  TEUCHOS_TEST_FOR_EXCEPTION(
984  stepper->getTableau()->isDIRK() != true, std::logic_error,
985  "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
986 
987  if (model != Teuchos::null) {
988  stepper->setModel(model);
989  setStepperSolverValues(stepper, stepperPL);
990  stepper->initialize();
991  }
992 
993  return stepper;
994  }
995 
996  Teuchos::RCP<StepperDIRK_BackwardEuler<Scalar> >
998  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
999  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1000  {
1001  auto stepper = Teuchos::rcp(new StepperDIRK_BackwardEuler<Scalar>());
1002  setStepperDIRKValues(stepper, stepperPL);
1003 
1004  if (model != Teuchos::null) {
1005  stepper->setModel(model);
1006  setStepperSolverValues(stepper, stepperPL);
1007  stepper->initialize();
1008  }
1009 
1010  return stepper;
1011  }
1012 
1013  Teuchos::RCP<StepperSDIRK_2Stage2ndOrder<Scalar> >
1015  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1016  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1017  {
1018  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
1019  setStepperDIRKValues(stepper, stepperPL);
1020  if (stepperPL != Teuchos::null)
1021  stepper->setGamma(stepperPL->get<double>("gamma", 0.2928932188134524));
1022 
1023  if (model != Teuchos::null) {
1024  stepper->setModel(model);
1025  setStepperSolverValues(stepper, stepperPL);
1026  stepper->initialize();
1027  }
1028 
1029  return stepper;
1030  }
1031 
1032  Teuchos::RCP<StepperSDIRK_3Stage2ndOrder<Scalar> >
1034  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1035  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1036  {
1037  auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage2ndOrder<Scalar>());
1038  setStepperDIRKValues(stepper, stepperPL);
1039 
1040  if (model != Teuchos::null) {
1041  stepper->setModel(model);
1042  setStepperSolverValues(stepper, stepperPL);
1043  stepper->initialize();
1044  }
1045 
1046  return stepper;
1047  }
1048 
1049 
1050  Teuchos::RCP<StepperSDIRK_SSPDIRK22<Scalar> >
1052  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1053  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1054  {
1055  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK22<Scalar>());
1056  setStepperDIRKValues(stepper, stepperPL);
1057  //if (stepperPL != Teuchos::null)
1058  //stepper->setGamma(stepperPL->get<double>("gamma", 0.2928932188134524));
1059 
1060  if (model != Teuchos::null) {
1061  stepper->setModel(model);
1062  setStepperSolverValues(stepper, stepperPL);
1063  stepper->initialize();
1064  }
1065 
1066  return stepper;
1067  }
1068 
1069  Teuchos::RCP<StepperSDIRK_SSPDIRK32<Scalar> >
1071  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1072  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1073  {
1074  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK32<Scalar>());
1075  setStepperDIRKValues(stepper, stepperPL);
1076  //if (stepperPL != Teuchos::null)
1077  //stepper->setGamma(stepperPL->get<double>("gamma", 0.2928932188134524));
1078 
1079  if (model != Teuchos::null) {
1080  stepper->setModel(model);
1081  setStepperSolverValues(stepper, stepperPL);
1082  stepper->initialize();
1083  }
1084 
1085  return stepper;
1086  }
1087 
1088  Teuchos::RCP<StepperSDIRK_SSPDIRK23<Scalar> >
1090  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1091  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1092  {
1093  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK23<Scalar>());
1094  setStepperDIRKValues(stepper, stepperPL);
1095  //if (stepperPL != Teuchos::null)
1096  //stepper->setGamma(stepperPL->get<double>("gamma", 0.2928932188134524));
1097 
1098  if (model != Teuchos::null) {
1099  stepper->setModel(model);
1100  setStepperSolverValues(stepper, stepperPL);
1101  stepper->initialize();
1102  }
1103 
1104  return stepper;
1105  }
1106 
1107  Teuchos::RCP<StepperSDIRK_SSPDIRK33<Scalar> >
1109  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1110  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1111  {
1112  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK33<Scalar>());
1113  setStepperDIRKValues(stepper, stepperPL);
1114  //if (stepperPL != Teuchos::null)
1115  //stepper->setGamma(stepperPL->get<double>("gamma", 0.2928932188134524));
1116 
1117  if (model != Teuchos::null) {
1118  stepper->setModel(model);
1119  setStepperSolverValues(stepper, stepperPL);
1120  stepper->initialize();
1121  }
1122 
1123  return stepper;
1124  }
1125 
1126 
1127  Teuchos::RCP<StepperSDIRK_2Stage3rdOrder<Scalar> >
1129  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1130  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1131  {
1132  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage3rdOrder<Scalar>());
1133  setStepperDIRKValues(stepper, stepperPL);
1134  if (stepperPL != Teuchos::null) {
1135  stepper->setGammaType(
1136  stepperPL->get<std::string>("Gamma Type", "3rd Order A-stable"));
1137  stepper->setGamma(stepperPL->get<double>("gamma", 0.7886751345948128));
1138  }
1139 
1140  if (model != Teuchos::null) {
1141  stepper->setModel(model);
1142  setStepperSolverValues(stepper, stepperPL);
1143  stepper->initialize();
1144  }
1145 
1146  return stepper;
1147  }
1148 
1149  Teuchos::RCP<StepperEDIRK_2Stage3rdOrder<Scalar> >
1151  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1152  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1153  {
1154  auto stepper = Teuchos::rcp(new StepperEDIRK_2Stage3rdOrder<Scalar>());
1155  setStepperDIRKValues(stepper, stepperPL);
1156 
1157  if (model != Teuchos::null) {
1158  stepper->setModel(model);
1159  setStepperSolverValues(stepper, stepperPL);
1160  stepper->initialize();
1161  }
1162 
1163  return stepper;
1164  }
1165 
1166  Teuchos::RCP<StepperDIRK_1StageTheta<Scalar> >
1168  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1169  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1170  {
1171  auto stepper = Teuchos::rcp(new StepperDIRK_1StageTheta<Scalar>());
1172  setStepperDIRKValues(stepper, stepperPL);
1173  if (stepperPL != Teuchos::null) {
1174  stepper->setTheta(stepperPL->get<double>("theta", 0.5));
1175  }
1176 
1177  if (model != Teuchos::null) {
1178  stepper->setModel(model);
1179  setStepperSolverValues(stepper, stepperPL);
1180  stepper->initialize();
1181  }
1182 
1183  return stepper;
1184  }
1185 
1186  Teuchos::RCP<StepperEDIRK_2StageTheta<Scalar> >
1188  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1189  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1190  {
1191  auto stepper = Teuchos::rcp(new StepperEDIRK_2StageTheta<Scalar>());
1192  setStepperDIRKValues(stepper, stepperPL);
1193  if (stepperPL != Teuchos::null) {
1194  stepper->setTheta(stepperPL->get<double>("theta", 0.5));
1195  }
1196 
1197  if (model != Teuchos::null) {
1198  stepper->setModel(model);
1199  setStepperSolverValues(stepper, stepperPL);
1200  stepper->initialize();
1201  }
1202 
1203  return stepper;
1204  }
1205 
1206  Teuchos::RCP<StepperEDIRK_TrapezoidalRule<Scalar> >
1208  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1209  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1210  {
1211  // This stepper goes by various names (e.g., 'RK Trapezoidal Rule'
1212  // and 'RK Crank-Nicolson'). Make sure it is set to the default name.
1213  if (stepperPL != Teuchos::null)
1214  stepperPL->set<std::string>("Stepper Type", "RK Trapezoidal Rule");
1215 
1216  auto stepper = Teuchos::rcp(new StepperEDIRK_TrapezoidalRule<Scalar>());
1217  setStepperDIRKValues(stepper, stepperPL);
1218 
1219  if (model != Teuchos::null) {
1220  stepper->setModel(model);
1221  setStepperSolverValues(stepper, stepperPL);
1222  stepper->initialize();
1223  }
1224 
1225  return stepper;
1226  }
1227 
1228  Teuchos::RCP<StepperSDIRK_ImplicitMidpoint<Scalar> >
1230  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1231  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1232  {
1233  auto stepper = Teuchos::rcp(new StepperSDIRK_ImplicitMidpoint<Scalar>());
1234  setStepperDIRKValues(stepper, stepperPL);
1235 
1236  if (model != Teuchos::null) {
1237  stepper->setModel(model);
1238  setStepperSolverValues(stepper, stepperPL);
1239  stepper->initialize();
1240  }
1241 
1242  return stepper;
1243  }
1244 
1245  Teuchos::RCP<StepperDIRK_1Stage1stOrderRadauIA<Scalar> >
1247  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1248  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1249  {
1250  auto stepper = Teuchos::rcp(new StepperDIRK_1Stage1stOrderRadauIA<Scalar>());
1251  setStepperDIRKValues(stepper, stepperPL);
1252 
1253  if (model != Teuchos::null) {
1254  stepper->setModel(model);
1255  setStepperSolverValues(stepper, stepperPL);
1256  stepper->initialize();
1257  }
1258 
1259  return stepper;
1260  }
1261 
1262  Teuchos::RCP<StepperDIRK_2Stage2ndOrderLobattoIIIB<Scalar> >
1264  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1265  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1266  {
1267  auto stepper = Teuchos::rcp(new StepperDIRK_2Stage2ndOrderLobattoIIIB<Scalar>());
1268  setStepperDIRKValues(stepper, stepperPL);
1269 
1270  if (model != Teuchos::null) {
1271  stepper->setModel(model);
1272  setStepperSolverValues(stepper, stepperPL);
1273  stepper->initialize();
1274  }
1275 
1276  return stepper;
1277  }
1278 
1279  Teuchos::RCP<StepperSDIRK_5Stage4thOrder<Scalar> >
1281  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1282  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1283  {
1284  auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage4thOrder<Scalar>());
1285  setStepperDIRKValues(stepper, stepperPL);
1286 
1287  if (model != Teuchos::null) {
1288  stepper->setModel(model);
1289  setStepperSolverValues(stepper, stepperPL);
1290  stepper->initialize();
1291  }
1292 
1293  return stepper;
1294  }
1295 
1296  Teuchos::RCP<StepperSDIRK_3Stage4thOrder<Scalar> >
1298  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1299  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1300  {
1301  auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage4thOrder<Scalar>());
1302  setStepperDIRKValues(stepper, stepperPL);
1303 
1304  if (model != Teuchos::null) {
1305  stepper->setModel(model);
1306  setStepperSolverValues(stepper, stepperPL);
1307  stepper->initialize();
1308  }
1309 
1310  return stepper;
1311  }
1312 
1313  Teuchos::RCP<StepperSDIRK_5Stage5thOrder<Scalar> >
1315  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1316  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1317  {
1318  auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage5thOrder<Scalar>());
1319  setStepperDIRKValues(stepper, stepperPL);
1320 
1321  if (model != Teuchos::null) {
1322  stepper->setModel(model);
1323  setStepperSolverValues(stepper, stepperPL);
1324  stepper->initialize();
1325  }
1326 
1327  return stepper;
1328  }
1329 
1330  Teuchos::RCP<StepperSDIRK_21Pair<Scalar> >
1332  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1333  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1334  {
1335  auto stepper = Teuchos::rcp(new StepperSDIRK_21Pair<Scalar>());
1336  setStepperDIRKValues(stepper, stepperPL);
1337 
1338  if (model != Teuchos::null) {
1339  stepper->setModel(model);
1340  setStepperSolverValues(stepper, stepperPL);
1341  stepper->initialize();
1342  }
1343 
1344  return stepper;
1345  }
1346 
1347  // ---------------------------------------------------------------------------
1348 
1349 private:
1350 
1351  /// Very simple factory method
1352  Teuchos::RCP<Stepper<Scalar> > createStepper(
1353  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1354  std::string stepperType,
1355  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1356  {
1357  using Teuchos::rcp;
1358  if (stepperType == "Forward Euler")
1359  return createStepperForwardEuler(model, stepperPL);
1360  else if (stepperType == "Backward Euler")
1361  return createStepperBackwardEuler(model, stepperPL);
1362  else if (stepperType == "Trapezoidal Method")
1363  return createStepperTrapezoidal(model, stepperPL);
1364  else if (stepperType == "BDF2")
1365  return createStepperBDF2(model, stepperPL);
1366  else if (stepperType == "Newmark Implicit a-Form")
1367  return createStepperNewmarkImplicitAForm(model, stepperPL);
1368  else if (stepperType == "Newmark Implicit d-Form")
1369  return createStepperNewmarkImplicitDForm(model, stepperPL);
1370  else if (stepperType == "Newmark Explicit a-Form")
1371  return createStepperNewmarkExplicitAForm(model, stepperPL);
1372  else if (stepperType == "HHT-Alpha")
1373  return createStepperHHTAlpha(model, stepperPL);
1374  else if (stepperType == "General ERK" )
1375  return createStepperERK_General(model, stepperPL);
1376  else if (stepperType == "RK Forward Euler" || stepperType == "RK1" )
1377  return createStepperERK_ForwardEuler(model, stepperPL);
1378  else if (stepperType == "RK Explicit 4 Stage" )
1379  return createStepperERK_4Stage4thOrder(model, stepperPL);
1380  else if (stepperType == "RK Explicit 3/8 Rule" )
1381  return createStepperERK_3_8Rule(model, stepperPL);
1382  else if (stepperType == "RK Explicit 4 Stage 3rd order by Runge" )
1383  return createStepperERK_4Stage3rdOrderRunge(model, stepperPL);
1384  else if (stepperType == "RK Explicit 5 Stage 3rd order by Kinnmark and Gray" )
1385  return createStepperERK_5Stage3rdOrderKandG(model, stepperPL);
1386  else if (stepperType == "RK Explicit 3 Stage 3rd order" )
1387  return createStepperERK_3Stage3rdOrder(model, stepperPL);
1388  else if (stepperType == "RK Explicit 3 Stage 3rd order TVD" ||
1389  stepperType == "SSPERK33" || stepperType == "SSPRK3" )
1390  return createStepperERK_3Stage3rdOrderTVD(model, stepperPL, stepperType);
1391  else if (stepperType == "RK Explicit 3 Stage 3rd order by Heun" )
1392  return createStepperERK_3Stage3rdOrderHeun(model, stepperPL);
1393  else if (stepperType == "RK Explicit Midpoint" )
1394  return createStepperERK_Midpoint(model, stepperPL);
1395  else if (stepperType == "RK Explicit Trapezoidal" ||
1396  stepperType == "Heuns Method" || stepperType == "SSPERK22" ||
1397  stepperType == "SSPRK2" )
1398  return createStepperERK_Trapezoidal(model, stepperPL, stepperType);
1399  else if (stepperType == "RK Explicit Ralston" || stepperType == "RK2" )
1400  return createStepperERK_Ralston(model, stepperPL, stepperType);
1401  else if (stepperType == "SSPERK54" )
1402  return createStepperERK_SSPERK54(model, stepperPL);
1403  else if (stepperType == "Bogacki-Shampine 3(2) Pair" )
1404  return createStepperERK_BogackiShampine32(model, stepperPL);
1405  else if (stepperType == "Merson 4(5) Pair" )
1406  return createStepperERK_Merson45(model, stepperPL);
1407  else if (stepperType == "General DIRK" )
1408  return createStepperDIRK_General(model, stepperPL);
1409  else if (stepperType == "RK Backward Euler" )
1410  return createStepperDIRK_BackwardEuler(model, stepperPL);
1411  else if (stepperType == "SDIRK 2 Stage 2nd order" )
1412  return createStepperSDIRK_2Stage2ndOrder(model, stepperPL);
1413  else if (stepperType == "SSPDIRK22" )
1414  return createStepperSDIRK_SSPDIRK22(model, stepperPL);
1415  else if (stepperType == "SDIRK 3 Stage 2nd order" )
1416  return createStepperSDIRK_3Stage2ndOrder(model, stepperPL);
1417  else if (stepperType == "SSPDIRK32" )
1418  return createStepperSDIRK_SSPDIRK32(model, stepperPL);
1419  else if (stepperType == "SSPDIRK23" )
1420  return createStepperSDIRK_SSPDIRK23(model, stepperPL);
1421  else if (stepperType == "SSPDIRK33" )
1422  return createStepperSDIRK_SSPDIRK33(model, stepperPL);
1423  else if (stepperType == "SDIRK 2 Stage 3rd order" )
1424  return createStepperSDIRK_2Stage3rdOrder(model, stepperPL);
1425  else if (stepperType == "EDIRK 2 Stage 3rd order" )
1426  return createStepperEDIRK_2Stage3rdOrder(model, stepperPL);
1427  else if (stepperType == "DIRK 1 Stage Theta Method" )
1428  return createStepperDIRK_1StageTheta(model, stepperPL);
1429  else if (stepperType == "EDIRK 2 Stage Theta Method" )
1430  return createStepperEDIRK_2StageTheta(model, stepperPL);
1431  else if (stepperType == "RK Trapezoidal Rule" ||
1432  stepperType == "RK Crank-Nicolson" )
1433  return createStepperEDIRK_TrapezoidalRule(model, stepperPL);
1434  else if (stepperType == "RK Implicit Midpoint" )
1435  return createStepperSDIRK_ImplicitMidpoint(model, stepperPL);
1436  else if (stepperType == "RK Implicit 1 Stage 1st order Radau IA" )
1437  return createStepperDIRK_1Stage1stOrderRadauIA(model, stepperPL);
1438  else if (stepperType == "RK Implicit 2 Stage 2nd order Lobatto IIIB" )
1439  return createStepperDIRK_2Stage2ndOrderLobattoIIIB(model, stepperPL);
1440  else if (stepperType == "SDIRK 5 Stage 4th order" )
1441  return createStepperSDIRK_5Stage4thOrder(model, stepperPL);
1442  else if (stepperType == "SDIRK 3 Stage 4th order" )
1443  return createStepperSDIRK_3Stage4thOrder(model, stepperPL);
1444  else if (stepperType == "SDIRK 5 Stage 5th order" )
1445  return createStepperSDIRK_5Stage5thOrder(model, stepperPL);
1446  else if ( stepperType == "SDIRK 2(1) Pair" )
1447  return createStepperSDIRK_21Pair(model, stepperPL);
1448  else if (
1449  stepperType == "IMEX RK 1st order" ||
1450  stepperType == "SSP1_111" ||
1451  stepperType == "IMEX RK SSP2" ||
1452  stepperType == "IMEX RK SSP3" ||
1453  stepperType == "SSP3_332" ||
1454  stepperType == "SSP2_222" ||
1455  stepperType == "SSP2_222_L" ||
1456  stepperType == "SSP2_222_A" ||
1457  stepperType == "IMEX RK ARS 233" ||
1458  stepperType == "ARS 233" ||
1459  stepperType == "General IMEX RK" )
1460  return createStepperIMEX_RK(model, stepperType, stepperPL);
1461  else if (
1462  stepperType == "Partitioned IMEX RK 1st order" ||
1463  stepperType == "Partitioned IMEX RK SSP2" ||
1464  stepperType == "Partitioned IMEX RK ARS 233" ||
1465  stepperType == "General Partitioned IMEX RK" )
1466  return createStepperIMEX_RK_Partition(model, stepperType, stepperPL);
1467  else if (stepperType == "Leapfrog")
1468  return createStepperLeapfrog(model, stepperPL);
1469  else if (stepperType == "Subcycling")
1470  return createStepperSubcycling(model, stepperPL);
1471  else {
1472  Teuchos::RCP<Teuchos::FancyOStream> out =
1473  Teuchos::VerboseObjectBase::getDefaultOStream();
1474  Teuchos::OSTab ostab(out,1,"StepperFactory::createStepper");
1475  *out
1476  << "Unknown Stepper Type! ('"+stepperType+"').\n"
1477  << "Here is a list of available Steppers.\n"
1478  << " One-Step Methods:\n"
1479  << " 'Forward Euler'\n"
1480  << " 'Backward Euler'\n"
1481  << " 'Trapezoidal Method'\n"
1482  << " Multi-Step Methods:\n"
1483  << " 'BDF2'\n"
1484  << " Second-order PDE Methods:\n"
1485  << " 'Leapfrog'\n"
1486  << " 'Newmark Implicit a-Form'\n"
1487  << " 'Newmark Implicit d-Form'\n"
1488  << " 'Newmark Explicit a-Form'\n"
1489  << " 'HHT-Alpha'\n"
1490  << " Explicit Runge-Kutta Methods:\n"
1491  << " 'RK Forward Euler (RK1)'\n"
1492  << " 'RK Explicit 4 Stage'\n"
1493  << " 'RK Explicit 3/8 Rule'\n"
1494  << " 'RK Explicit 4 Stage 3rd order by Runge'\n"
1495  << " 'RK Explicit 5 Stage 3rd order by Kinnmark and Gray'\n"
1496  << " 'RK Explicit 3 Stage 3rd order'\n"
1497  << " 'RK Explicit 3 Stage 3rd order TVD'\n"
1498  << " 'RK Explicit 3 Stage 3rd order by Heun'\n"
1499  << " 'RK Explicit Midpoint'\n"
1500  << " 'RK Explicit Trapezoidal' or 'Heuns Method'\n"
1501  << " 'Bogacki-Shampine 3(2) Pair'\n"
1502  << " 'SSPERK22 (SSPRK2)'\n"
1503  << " 'SSPERK33 (SSPRK3)'\n"
1504  << " 'SSPERK54'\n"
1505  << " 'General ERK'\n"
1506  << " Implicit Runge-Kutta Methods:\n"
1507  << " 'RK Backward Euler'\n"
1508  << " 'DIRK 1 Stage Theta Method'\n"
1509  << " 'RK Implicit Midpoint'\n"
1510  << " 'SDIRK 1 Stage 1st order'\n"
1511  << " 'SDIRK 2 Stage 2nd order'\n"
1512  << " 'SDIRK 2 Stage 3rd order'\n"
1513  << " 'EDIRK 2 Stage 3rd order'\n"
1514  << " 'EDIRK 2 Stage Theta Method'\n"
1515  << " 'SDIRK 3 Stage 4th order'\n"
1516  << " 'SDIRK 5 Stage 4th order'\n"
1517  << " 'SDIRK 5 Stage 5th order'\n"
1518  << " 'SSPDIRK22'\n"
1519  << " 'SSPDIRK32'\n"
1520  << " 'SSPDIRK23'\n"
1521  << " 'SSPDIRK33'\n"
1522  << " 'SDIRK 2(1) Pair'\n"
1523  << " 'SDIRK 3 Stage 2nd order'\n"
1524  << " 'RK Trapezoidal Rule' or 'RK Crank-Nicolson'\n"
1525  << " 'General DIRK'\n"
1526  << " Implicit-Explicit (IMEX) Methods:\n"
1527  << " 'IMEX RK 1st order'\n"
1528  << " 'SSP1_111'\n"
1529  << " 'IMEX RK SSP2 (SSP2_222)'\n"
1530  << " 'IMEX RK SSP3 (SSP3_332)'\n"
1531  << " 'IMEX RK ARS 233'\n"
1532  << " 'General IMEX RK'\n"
1533  << " 'Partitioned IMEX RK 1st order'\n"
1534  << " 'Partitioned IMEX RK SSP2'\n"
1535  << " 'Partitioned IMEX RK ARS 233'\n"
1536  << " 'General Partitioned IMEX RK'\n"
1537  << " Steppers with subSteppers:\n"
1538  << " 'Operator Split'\n"
1539  << std::endl;
1540  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
1541  "Unknown 'Stepper Type' = " << stepperType);
1542  }
1543  }
1544 
1545 // ==========================================================================
1546 
1548  Teuchos::RCP<StepperOperatorSplit<Scalar> > stepper,
1549  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels,
1550  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1551  {
1552  if (stepperPL != Teuchos::null) {
1553  using Teuchos::RCP;
1554  using Teuchos::ParameterList;
1555 
1556  // Parse Stepper List String
1557  std::vector<std::string> stepperListStr;
1558  stepperListStr.clear();
1559  std::string str = stepperPL->get<std::string>("Stepper List");
1560  std::string delimiters(",");
1561  // Skip delimiters at the beginning
1562  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
1563  // Find the first delimiter
1564  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
1565  while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
1566  std::string token = str.substr(lastPos,pos-lastPos);
1567  // Strip single quotes
1568  std::string::size_type beg = token.find_first_of("'") + 1;
1569  std::string::size_type end = token.find_last_of ("'");
1570  stepperListStr.push_back(token.substr(beg,end-beg));
1571 
1572  lastPos = str.find_first_not_of(delimiters, pos); // Skip delimiters
1573  pos = str.find_first_of(delimiters, lastPos); // Find next delimiter
1574  }
1575 
1576  TEUCHOS_TEST_FOR_EXCEPTION(stepperListStr.size() != appModels.size(),
1577  std::logic_error, "Error - Number of models and Steppers do not match!\n"
1578  << " There are " << appModels.size() << " models.\n"
1579  << " There are " << stepperListStr.size() << " steppers.\n"
1580  << " " << str << "\n");
1581 
1582  typename
1583  std::vector<RCP<const Thyra::ModelEvaluator<Scalar> > >::iterator
1584  aMI = appModels.begin();
1585  typename std::vector<std::string>::iterator sLSI = stepperListStr.begin();
1586 
1587  for (; aMI<appModels.end() || sLSI<stepperListStr.end(); aMI++, sLSI++) {
1588  RCP<ParameterList> subStepperPL = Teuchos::sublist(stepperPL,*sLSI,true);
1589  bool useFSAL = subStepperPL->template get<bool>("Use FSAL",false);
1590  auto subStepper = createStepper(subStepperPL, *aMI);
1591  if (useFSAL) {
1592  Teuchos::RCP<Teuchos::FancyOStream> out =
1593  Teuchos::VerboseObjectBase::getDefaultOStream();
1594  Teuchos::OSTab ostab(out,1,"StepperFactory::createSubSteppers()");
1595  *out << "Warning -- subStepper = '"
1596  << subStepper->getStepperType() << "' has \n"
1597  << " subStepper->getUseFSAL() = " << useFSAL << ".\n"
1598  << " subSteppers usually can not use the FSAL priniciple with\n"
1599  << " operator splitting. Proceeding with it set to true.\n"
1600  << std::endl;
1601  }
1602  stepper->addStepper(subStepper, useFSAL);
1603  }
1604  }
1605  }
1606 
1607  Teuchos::RCP<StepperOperatorSplit<Scalar> >
1609  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels,
1610  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1611  {
1612  auto stepper = Teuchos::rcp(new StepperOperatorSplit<Scalar>());
1613 
1614  if (stepperPL != Teuchos::null) {
1615  setStepperValues(stepper, stepperPL);
1616  stepper->setOrderMin(stepperPL->get<int>("Minimum Order", 1));
1617  stepper->setOrder (stepperPL->get<int>("Order", 1));
1618  stepper->setOrderMax(stepperPL->get<int>("Maximum Order", 1));
1619  }
1620 
1621  if ( !(appModels.empty()) ) {
1622  createSubSteppers(stepper, appModels, stepperPL);
1623  stepper->initialize();
1624  }
1625 
1626  return stepper;
1627  }
1628 
1629 // --------------------------------------------------------------------------
1630  Teuchos::RCP<Stepper<Scalar> > createStepper(
1631  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > models,
1632  std::string stepperType,
1633  Teuchos::RCP<Teuchos::ParameterList> stepperPL)
1634  {
1635  if (stepperType == "Operator Split")
1636  return createStepperOperatorSplit(models, stepperPL);
1637  else {
1638  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
1639  "Unknown 'Stepper Type' = " << stepperType);
1640  }
1641  }
1642 
1643 };
1644 
1645 
1646 } // namespace Tempus
1647 #endif // Tempus_StepperFactory_hpp
BDF2 (Backward-Difference-Formula-2) time stepper.
Teuchos::RCP< StepperHHTAlpha< Scalar > > createStepperHHTAlpha(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
virtual ~StepperFactory()
Destructor.
General Implicit Runge-Kutta Butcher Tableau.
Teuchos::RCP< StepperDIRK_1Stage1stOrderRadauIA< Scalar > > createStepperDIRK_1Stage1stOrderRadauIA(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< Stepper< Scalar > > createStepper(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > models, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Trapezoidal method time stepper.
RK Implicit 2 Stage 2nd order Lobatto IIIB.
Teuchos::RCP< StepperBDF2< Scalar > > createStepperBDF2(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperDIRK_1StageTheta< Scalar > > createStepperDIRK_1StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperEDIRK_2Stage3rdOrder< Scalar > > createStepperEDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Explicit Runge-Kutta time stepper.
void setStepperExplicitValues(Teuchos::RCP< StepperExplicit< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set StepperExplicit member data from the ParameterList.
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< StepperSDIRK_2Stage3rdOrder< Scalar > > createStepperSDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Backward Euler Runge-Kutta Butcher Tableau.
Teuchos::RCP< StepperSDIRK_3Stage2ndOrder< Scalar > > createStepperSDIRK_3Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_5Stage5thOrder< Scalar > > createStepperSDIRK_5Stage5thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperLeapfrog< Scalar > > createStepperLeapfrog(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
General Explicit Runge-Kutta Butcher Tableau.
Teuchos::RCP< RKButcherTableau< Scalar > > createTableau(Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Create a tableau from the ParameterList.
Teuchos::RCP< StepperIMEX_RK< Scalar > > createStepperIMEX_RK(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
Teuchos::RCP< StepperIMEX_RK_Partition< Scalar > > createStepperIMEX_RK_Partition(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
Teuchos::RCP< StepperERK_Midpoint< Scalar > > createStepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperTrapezoidal< Scalar > > createStepperTrapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_3Stage4thOrder< Scalar > > createStepperSDIRK_3Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_SSPDIRK23< Scalar > > createStepperSDIRK_SSPDIRK23(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Strong Stability Preserving Explicit RK Butcher Tableau.
void setStepperRKValues(Teuchos::RCP< StepperExplicitRK< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set StepperRK member data from the ParameterList.
RK Explicit 4 Stage 3rd order by Runge.
Teuchos::RCP< StepperSDIRK_21Pair< Scalar > > createStepperSDIRK_21Pair(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
void setStepperValues(Teuchos::RCP< Stepper< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set Stepper member data from the ParameterList.
void setStepperSolverValues(Teuchos::RCP< StepperImplicit< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set solver from ParameterList.
void TokensToDoubles(std::vector< double > &values, const std::vector< std::string > &tokens)
Turn a vector of tokens into a vector of doubles.
Teuchos::RCP< StepperERK_Merson45< Scalar > > createStepperERK_Merson45(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
RK Trapezoidal Rule (A.K.A. RK Crank-Nicolson)
Partitioned Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
Teuchos::RCP< Teuchos::ParameterList > defaultSolverParameters()
Returns the default solver ParameterList for implicit Steppers.
Teuchos::RCP< StepperERK_ForwardEuler< Scalar > > createStepperERK_ForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< Stepper< Scalar > > createStepper(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Very simple factory method.
OperatorSplit stepper loops through the Stepper list.
Thyra Base interface for time steppers.
Explicit RK 3/8th Rule Butcher Tableau.
Diagonally Implicit Runge-Kutta (DIRK) time stepper.
Teuchos::RCP< StepperSDIRK_SSPDIRK22< Scalar > > createStepperSDIRK_SSPDIRK22(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Thyra Base interface for implicit time steppers.
Teuchos::RCP< StepperSDIRK_SSPDIRK33< Scalar > > createStepperSDIRK_SSPDIRK33(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperForwardEuler< Scalar > > createStepperForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_SSPERK54< Scalar > > createStepperERK_SSPERK54(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperBackwardEuler< Scalar > > createStepperBackwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSubcycling< Scalar > > createStepperSubcycling(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_4Stage3rdOrderRunge< Scalar > > createStepperERK_4Stage3rdOrderRunge(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Explicit RK Bogacki-Shampine Butcher Tableau.
void createSubSteppers(Teuchos::RCP< StepperOperatorSplit< Scalar > > stepper, std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > appModels, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_5Stage4thOrder< Scalar > > createStepperSDIRK_5Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_5Stage3rdOrderKandG< Scalar > > createStepperERK_5Stage3rdOrderKandG(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_3_8Rule< Scalar > > createStepperERK_3_8Rule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_General< Scalar > > createStepperERK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< Stepper< Scalar > > createStepper(Teuchos::RCP< Teuchos::ParameterList > stepperPL, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model=Teuchos::null)
Create stepper from ParameterList with its details.
Teuchos::RCP< Stepper< Scalar > > createStepper(std::string stepperType="Forward Euler", const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model=Teuchos::null)
Create default stepper from stepper type (e.g., &quot;Forward Euler&quot;).
Teuchos::RCP< StepperEDIRK_TrapezoidalRule< Scalar > > createStepperEDIRK_TrapezoidalRule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperDIRK_BackwardEuler< Scalar > > createStepperDIRK_BackwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperOperatorSplit< Scalar > > createStepperOperatorSplit(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > appModels, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperNewmarkImplicitAForm< Scalar > > createStepperNewmarkImplicitAForm(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperDIRK_General< Scalar > > createStepperDIRK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Forward Euler Runge-Kutta Butcher Tableau.
void StringTokenizer(std::vector< std::string > &tokens, const std::string &str, const std::string delimiters, bool trim)
Tokenize a string, put tokens in a vector.
Teuchos::RCP< Stepper< Scalar > > createMultiSteppers(Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > models)
Create stepper from ParameterList with its details.
Explicit RK Merson Butcher Tableau.
Runge-Kutta 4th order Butcher Tableau.
void setTableaus(Teuchos::RCP< StepperIMEX_RK< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::string stepperType)
Teuchos::RCP< StepperEDIRK_2StageTheta< Scalar > > createStepperEDIRK_2StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_Ralston< Scalar > > createStepperERK_Ralston(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::string stepperType)
Teuchos::RCP< StepperNewmarkImplicitDForm< Scalar > > createStepperNewmarkImplicitDForm(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperNewmarkExplicitAForm< Scalar > > createStepperNewmarkExplicitAForm(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_ImplicitMidpoint< Scalar > > createStepperSDIRK_ImplicitMidpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_3Stage3rdOrderHeun< Scalar > > createStepperERK_3Stage3rdOrderHeun(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_Trapezoidal< Scalar > > createStepperERK_Trapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::string stepperType)
Teuchos::RCP< StepperDIRK_2Stage2ndOrderLobattoIIIB< Scalar > > createStepperDIRK_2Stage2ndOrderLobattoIIIB(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
void setTableausPartition(Teuchos::RCP< StepperIMEX_RK_Partition< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::string stepperType)
void setStepperImplicitValues(Teuchos::RCP< StepperImplicit< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set StepperImplicit member data from the ParameterList.
Teuchos::RCP< StepperSDIRK_2Stage2ndOrder< Scalar > > createStepperSDIRK_2Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperSDIRK_SSPDIRK32< Scalar > > createStepperSDIRK_SSPDIRK32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Thyra Base interface for implicit time steppers.
Teuchos::RCP< StepperERK_3Stage3rdOrder< Scalar > > createStepperERK_3Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Newmark time stepper in acceleration form (a-form).
void setStepperDIRKValues(Teuchos::RCP< StepperDIRK< Scalar > > stepper, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Set StepperDIRK member data from the ParameterList.
RK Explicit 3 Stage 3rd order by Heun.
Teuchos::RCP< StepperERK_BogackiShampine32< Scalar > > createStepperERK_BogackiShampine32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< StepperERK_3Stage3rdOrderTVD< Scalar > > createStepperERK_3Stage3rdOrderTVD(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL, const std::string stepperType)
Teuchos::RCP< StepperERK_4Stage4thOrder< Scalar > > createStepperERK_4Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.