Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperRKButcherTableau.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_StepperRKButcherTableau_hpp
10 #define Tempus_StepperRKButcherTableau_hpp
11 
12 // disable clang warnings
13 #ifdef __clang__
14 #pragma clang system_header
15 #endif
16 
17 #include "Tempus_StepperExplicitRK.hpp"
18 #include "Tempus_StepperDIRK.hpp"
20 
21 
22 namespace Tempus {
23 
24 
25 // ----------------------------------------------------------------------------
26 /** \brief Forward Euler Runge-Kutta Butcher Tableau
27  *
28  * The tableau for Forward Euler (order=1) is
29  * \f[
30  * \begin{array}{c|c}
31  * c & A \\ \hline
32  * & b^T
33  * \end{array}
34  * \;\;\;\;\mbox{ where }\;\;\;\;
35  * \begin{array}{c|c} 0 & 0 \\ \hline
36  * & 1 \end{array}
37  * \f]
38  */
39 template<class Scalar>
41  virtual public StepperExplicitRK<Scalar>
42 {
43 public:
44  /** \brief Default constructor.
45  *
46  * Requires subsequent setModel() and initialize()
47  * calls before calling takestep().
48  */
50  {
51  this->setStepperType("RK Forward Euler");
52  this->setupTableau();
53  this->setupDefault();
54  }
55 
56 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
58  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
59  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
60  bool useFSAL,
61  std::string ICConsistency,
62  bool ICConsistencyCheck,
63  bool useEmbedded)
64  {
65  this->setStepperType("RK Forward Euler");
66  this->setupTableau();
67  this->setup(appModel, obs, useFSAL, ICConsistency,
68  ICConsistencyCheck, useEmbedded);
69  }
70 #endif
72  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
73  bool useFSAL,
74  std::string ICConsistency,
75  bool ICConsistencyCheck,
76  bool useEmbedded,
77  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
78  {
79  this->setStepperType("RK Forward Euler");
80  this->setupTableau();
81  this->setup(appModel, useFSAL, ICConsistency,
82  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
83  }
84 
85  std::string getDescription() const
86  {
87  std::ostringstream Description;
88  Description << this->getStepperType() << "\n"
89  << "c = [ 0 ]'\n"
90  << "A = [ 0 ]\n"
91  << "b = [ 1 ]'";
92  return Description.str();
93  }
94 
95 protected:
96 
97  void setupTableau()
98  {
99  typedef Teuchos::ScalarTraits<Scalar> ST;
100  Teuchos::SerialDenseMatrix<int,Scalar> A(1,1);
101  Teuchos::SerialDenseVector<int,Scalar> b(1);
102  Teuchos::SerialDenseVector<int,Scalar> c(1);
103  A(0,0) = ST::zero();
104  b(0) = ST::one();
105  c(0) = ST::zero();
106  int order = 1;
107 
108  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
109  this->getStepperType(),A,b,c,order,order,order));
110  }
111 };
112 
113 
114 // ----------------------------------------------------------------------------
115 /** \brief Runge-Kutta 4th order Butcher Tableau
116  *
117  * The tableau for RK4 (order=4) is
118  * \f[
119  * \begin{array}{c|c}
120  * c & A \\ \hline
121  * & b^T
122  * \end{array}
123  * \;\;\;\;\mbox{ where }\;\;\;\;
124  * \begin{array}{c|cccc} 0 & 0 & & & \\
125  * 1/2 & 1/2 & 0 & & \\
126  * 1/2 & 0 & 1/2 & 0 & \\
127  * 1 & 0 & 0 & 1 & 0 \\ \hline
128  * & 1/6 & 1/3 & 1/3 & 1/6 \end{array}
129  * \f]
130  */
131 template<class Scalar>
133  virtual public StepperExplicitRK<Scalar>
134 {
135 public:
136  /** \brief Default constructor.
137  *
138  * Requires subsequent setModel() and initialize()
139  * calls before calling takestep().
140  */
142  {
143  this->setStepperType("RK Explicit 4 Stage");
144  this->setupTableau();
145  this->setupDefault();
146  }
147 
148 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
150  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
151  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
152  bool useFSAL,
153  std::string ICConsistency,
154  bool ICConsistencyCheck,
155  bool useEmbedded)
156  {
157  this->setStepperType("RK Explicit 4 Stage");
158  this->setupTableau();
159  this->setup(appModel, obs, useFSAL, ICConsistency,
160  ICConsistencyCheck, useEmbedded);
161  }
162 #endif
164  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
165  bool useFSAL,
166  std::string ICConsistency,
167  bool ICConsistencyCheck,
168  bool useEmbedded,
169  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
170  {
171  this->setStepperType("RK Explicit 4 Stage");
172  this->setupTableau();
173  this->setup(appModel, useFSAL, ICConsistency,
174  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
175  }
176 
177  std::string getDescription() const
178  {
179  std::ostringstream Description;
180  Description << this->getStepperType() << "\n"
181  << "\"The\" Runge-Kutta Method (explicit):\n"
182  << "Solving Ordinary Differential Equations I:\n"
183  << "Nonstiff Problems, 2nd Revised Edition\n"
184  << "E. Hairer, S.P. Norsett, G. Wanner\n"
185  << "Table 1.2, pg 138\n"
186  << "c = [ 0 1/2 1/2 1 ]'\n"
187  << "A = [ 0 ] \n"
188  << " [ 1/2 0 ]\n"
189  << " [ 0 1/2 0 ]\n"
190  << " [ 0 0 1 0 ]\n"
191  << "b = [ 1/6 1/3 1/3 1/6 ]'";
192  return Description.str();
193  }
194 
196  {
197  typedef Teuchos::ScalarTraits<Scalar> ST;
198  const Scalar one = ST::one();
199  const Scalar zero = ST::zero();
200  const Scalar onehalf = one/(2*one);
201  const Scalar onesixth = one/(6*one);
202  const Scalar onethird = one/(3*one);
203 
204  int NumStages = 4;
205  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
206  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
207  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
208 
209  // Fill A:
210  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
211  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
212  A(2,0) = zero; A(2,1) = onehalf; A(2,2) = zero; A(2,3) = zero;
213  A(3,0) = zero; A(3,1) = zero; A(3,2) = one; A(3,3) = zero;
214 
215  // Fill b:
216  b(0) = onesixth; b(1) = onethird; b(2) = onethird; b(3) = onesixth;
217 
218  // fill c:
219  c(0) = zero; c(1) = onehalf; c(2) = onehalf; c(3) = one;
220 
221  int order = 4;
222 
223  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
224  this->getStepperType(),A,b,c,order,order,order));
225  }
226 };
227 
228 
229 // ----------------------------------------------------------------------------
230 /** \brief Explicit RK Bogacki-Shampine Butcher Tableau
231  *
232  * The tableau (order=3(2)) is
233  * \f[
234  * \begin{array}{c|c}
235  * c & A \\ \hline
236  * & b^T \\
237  * & b^{*T}
238  * \end{array}
239  * \;\;\;\;\mbox{ where }\;\;\;\;
240  * \begin{array}{c|cccc} 0 & 0 & & & \\
241  * 1/2 & 1/2 & 0 & & \\
242  * 3/4 & 0 & 3/4 & 0 & \\
243  * 1 & 2/9 & 1/3 & 4/9 & 0 \\ \hline
244  * & 2/9 & 1/3 & 4/9 & 0 \\
245  * & 7/24 & 1/4 & 1/3 & 1/8 \end{array}
246  * \f]
247  * Reference: P. Bogacki and L.F. Shampine.
248  * A 3(2) pair of Runge–Kutta formulas.
249  * Applied Mathematics Letters, 2(4):321 – 325, 1989.
250  */
251 template<class Scalar>
253  virtual public StepperExplicitRK<Scalar>
254 {
255 public:
256  /** \brief Default constructor.
257  *
258  * Requires subsequent setModel() and initialize()
259  * calls before calling takestep().
260  */
262  {
263  this->setStepperType("Bogacki-Shampine 3(2) Pair");
264  this->setupTableau();
265  this->setupDefault();
266  }
267 
268 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
270  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
271  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
272  bool useFSAL,
273  std::string ICConsistency,
274  bool ICConsistencyCheck,
275  bool useEmbedded)
276  {
277  this->setStepperType("Bogacki-Shampine 3(2) Pair");
278  this->setupTableau();
279  this->setup(appModel, obs, useFSAL, ICConsistency,
280  ICConsistencyCheck, useEmbedded);
281  }
282 #endif
284  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
285  bool useFSAL,
286  std::string ICConsistency,
287  bool ICConsistencyCheck,
288  bool useEmbedded,
289  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
290  {
291  this->setStepperType("Bogacki-Shampine 3(2) Pair");
292  this->setupTableau();
293  this->setup(appModel, useFSAL, ICConsistency,
294  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
295  }
296 
297  std::string getDescription() const
298  {
299  std::ostringstream Description;
300  Description << this->getStepperType() << "\n"
301  << "P. Bogacki and L.F. Shampine.\n"
302  << "A 3(2) pair of Runge–Kutta formulas.\n"
303  << "Applied Mathematics Letters, 2(4):321 – 325, 1989.\n"
304  << "c = [ 0 1/2 3/4 1 ]'\n"
305  << "A = [ 0 ]\n"
306  << " [ 1/2 0 ]\n"
307  << " [ 0 3/4 0 ]\n"
308  << " [ 2/9 1/3 4/9 0 ]\n"
309  << "b = [ 2/9 1/3 4/9 0 ]'\n"
310  << "bstar = [ 7/24 1/4 1/3 1/8 ]'";
311  return Description.str();
312  }
313 
314 protected:
315 
317  {
318  typedef Teuchos::ScalarTraits<Scalar> ST;
319  using Teuchos::as;
320  int NumStages = 4;
321  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
322  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
323  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
324  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
325 
326  const Scalar one = ST::one();
327  const Scalar zero = ST::zero();
328  const Scalar onehalf = one/(2*one);
329  const Scalar onethird = one/(3*one);
330  const Scalar threefourths = (3*one)/(4*one);
331  const Scalar twoninths = (2*one)/(9*one);
332  const Scalar fourninths = (4*one)/(9*one);
333 
334  // Fill A:
335  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
336  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
337  A(2,0) = zero; A(2,1) =threefourths; A(2,2) = zero; A(2,3) = zero;
338  A(3,0) =twoninths; A(3,1) = onethird; A(3,2) =fourninths; A(3,3) = zero;
339 
340  // Fill b:
341  b(0) = A(3,0); b(1) = A(3,1); b(2) = A(3,2); b(3) = A(3,3);
342 
343  // Fill c:
344  c(0) = zero; c(1) = onehalf; c(2) = threefourths; c(3) = one;
345 
346  // Fill bstar
347  bstar(0) = as<Scalar>(7*one/(24*one));
348  bstar(1) = as<Scalar>(1*one/(4*one));
349  bstar(2) = as<Scalar>(1*one/(3*one));
350  bstar(3) = as<Scalar>(1*one/(8*one));
351  int order = 3;
352 
353  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
354  this->getStepperType(),A,b,c,order,order,order,bstar));
355  }
356 };
357 
358 
359 // ----------------------------------------------------------------------------
360 /** \brief Explicit RK Merson Butcher Tableau
361  *
362  * The tableau (order=4(5)) is
363  * \f[
364  * \begin{array}{c|c}
365  * c & A \\ \hline
366  * & b^T \\
367  * & b^{*T}
368  * \end{array}
369  * \;\;\;\;\mbox{ where }\;\;\;\;
370  * \begin{array}{c|ccccc} 0 & 0 & & & & \\
371  * 1/3 & 1/3 & 0 & & & \\
372  * 1/3 & 1/6 & 1/6 & 0 & & \\
373  * 1/2 & 1/8 & 0 & 3/8 & & \\
374  * 1 & 1/2 & 0 & -3/2 & 2 & \\ \hline
375  * & 1/6 & 0 & 0 & 2/3 & 1/6 \\
376  * & 1/10 & 0 & 3/10 & 2/5 & 1/5 \end{array}
377  * \f]
378  * Reference: E. Hairer, S.P. Norsett, G. Wanner,
379  * "Solving Ordinary Differential Equations I:
380  * Nonstiff Problems", 2nd Revised Edition,
381  * Table 4.1, pg 167.
382  *
383  */
384 template<class Scalar>
386  virtual public StepperExplicitRK<Scalar>
387 {
388 public:
389  /** \brief Default constructor.
390  *
391  * Requires subsequent setModel() and initialize()
392  * calls before calling takestep().
393  */
395  {
396  this->setStepperType("Merson 4(5) Pair");
397  this->setupTableau();
398  this->setupDefault();
399  }
400 
401 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
403  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
404  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
405  bool useFSAL,
406  std::string ICConsistency,
407  bool ICConsistencyCheck,
408  bool useEmbedded)
409  {
410  this->setStepperType("Merson 4(5) Pair");
411  this->setupTableau();
412  this->setup(appModel, obs, useFSAL, ICConsistency,
413  ICConsistencyCheck, useEmbedded);
414  }
415 #endif
417  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
418  bool useFSAL,
419  std::string ICConsistency,
420  bool ICConsistencyCheck,
421  bool useEmbedded,
422  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
423  {
424  this->setStepperType("Merson 4(5) Pair");
425  this->setupTableau();
426  this->setup(appModel, useFSAL, ICConsistency,
427  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
428  }
429 
430  std::string getDescription() const
431  {
432  std::ostringstream Description;
433  Description << this->getStepperType() << "\n"
434  << "Solving Ordinary Differential Equations I:\n"
435  << "Nonstiff Problems, 2nd Revised Edition\n"
436  << "E. Hairer, S.P. Norsett, G. Wanner\n"
437  << "Table 4.1, pg 167\n"
438  << "c = [ 0 1/3 1/3 1/2 1 ]'\n"
439  << "A = [ 0 ]\n"
440  << " [ 1/3 0 ]\n"
441  << " [ 1/6 1/6 0 ]\n"
442  << " [ 1/8 0 3/8 0 ]\n"
443  << " [ 1/2 0 -3/2 2 0 ]\n"
444  << "b = [ 1/6 0 0 2/3 1/6 ]'\n"
445  << "bstar = [ 1/10 0 3/10 2/5 1/5 ]'";
446  return Description.str();
447  }
448 
449 
450 protected:
451 
453  {
454  typedef Teuchos::ScalarTraits<Scalar> ST;
455  using Teuchos::as;
456  int NumStages = 5;
457  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages, true);
458  Teuchos::SerialDenseVector<int,Scalar> b(NumStages, true);
459  Teuchos::SerialDenseVector<int,Scalar> c(NumStages, true);
460  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages, true);
461 
462  const Scalar one = ST::one();
463  const Scalar zero = ST::zero();
464 
465  // Fill A:
466  A(1,0) = as<Scalar>(one/(3*one));;
467 
468  A(2,0) = as<Scalar>(one/(6*one));;
469  A(2,1) = as<Scalar>(one/(6*one));;
470 
471  A(3,0) = as<Scalar>(one/(8*one));;
472  A(3,2) = as<Scalar>(3*one/(8*one));;
473 
474  A(4,0) = as<Scalar>(one/(2*one));;
475  A(4,2) = as<Scalar>(-3*one/(2*one));;
476  A(4,3) = 2*one;
477 
478  // Fill b:
479  b(0) = as<Scalar>(one/(6*one));
480  b(3) = as<Scalar>(2*one/(3*one));
481  b(4) = as<Scalar>(one/(6*one));
482 
483  // Fill c:
484  c(0) = zero;
485  c(1) = as<Scalar>(1*one/(3*one));
486  c(2) = as<Scalar>(1*one/(3*one));
487  c(3) = as<Scalar>(1*one/(2*one));
488  c(4) = one;
489 
490  // Fill bstar
491  bstar(0) = as<Scalar>(1*one/(10*one));
492  bstar(2) = as<Scalar>(3*one/(10*one));
493  bstar(3) = as<Scalar>(2*one/(5*one));
494  bstar(4) = as<Scalar>(1*one/(5*one));
495  int order = 4;
496 
497  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
498  this->getStepperType(),A,b,c,order,order,order,bstar));
499  }
500 };
501 
502 
503 // ----------------------------------------------------------------------------
504 /** \brief Explicit RK 3/8th Rule Butcher Tableau
505  *
506  * The tableau (order=4) is
507  * \f[
508  * \begin{array}{c|c}
509  * c & A \\ \hline
510  * & b^T
511  * \end{array}
512  * \;\;\;\;\mbox{ where }\;\;\;\;
513  * \begin{array}{c|cccc} 0 & 0 & & & \\
514  * 1/3 & 1/3 & 0 & & \\
515  * 2/3 &-1/3 & 1 & 0 & \\
516  * 1 & 1 & -1 & 1 & 0 \\ \hline
517  * & 1/8 & 3/8 & 3/8 & 1/8 \end{array}
518  * \f]
519  * Reference: E. Hairer, S.P. Norsett, G. Wanner,
520  * "Solving Ordinary Differential Equations I:
521  * Nonstiff Problems", 2nd Revised Edition,
522  * Table 1.2, pg 138.
523  */
524 template<class Scalar>
526  virtual public StepperExplicitRK<Scalar>
527 {
528 public:
529 
531  {
532  this->setStepperType("RK Explicit 3/8 Rule");
533  this->setupTableau();
534  this->setupDefault();
535  }
536 
537 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
539  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
540  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
541  bool useFSAL,
542  std::string ICConsistency,
543  bool ICConsistencyCheck,
544  bool useEmbedded)
545  {
546  this->setStepperType("RK Explicit 3/8 Rule");
547  this->setupTableau();
548  this->setup(appModel, obs, useFSAL, ICConsistency,
549  ICConsistencyCheck, useEmbedded);
550  }
551 #endif
553  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
554  bool useFSAL,
555  std::string ICConsistency,
556  bool ICConsistencyCheck,
557  bool useEmbedded,
558  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
559  {
560  this->setStepperType("RK Explicit 3/8 Rule");
561  this->setupTableau();
562  this->setup(appModel, useFSAL, ICConsistency,
563  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
564  }
565 
566  std::string getDescription() const
567  {
568  std::ostringstream Description;
569  Description << this->getStepperType() << "\n"
570  << "Solving Ordinary Differential Equations I:\n"
571  << "Nonstiff Problems, 2nd Revised Edition\n"
572  << "E. Hairer, S.P. Norsett, G. Wanner\n"
573  << "Table 1.2, pg 138\n"
574  << "c = [ 0 1/3 2/3 1 ]'\n"
575  << "A = [ 0 ]\n"
576  << " [ 1/3 0 ]\n"
577  << " [-1/3 1 0 ]\n"
578  << " [ 1 -1 1 0 ]\n"
579  << "b = [ 1/8 3/8 3/8 1/8 ]'";
580  return Description.str();
581  }
582 
583 
584 protected:
585 
587  {
588  typedef Teuchos::ScalarTraits<Scalar> ST;
589  using Teuchos::as;
590  int NumStages = 4;
591  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
592  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
593  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
594 
595  const Scalar one = ST::one();
596  const Scalar zero = ST::zero();
597  const Scalar onethird = as<Scalar>(one/(3*one));
598  const Scalar twothirds = as<Scalar>(2*one/(3*one));
599  const Scalar oneeighth = as<Scalar>(one/(8*one));
600  const Scalar threeeighths = as<Scalar>(3*one/(8*one));
601 
602  // Fill A:
603  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
604  A(1,0) = onethird; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
605  A(2,0) = -onethird; A(2,1) = one; A(2,2) = zero; A(2,3) = zero;
606  A(3,0) = one; A(3,1) = -one; A(3,2) = one; A(3,3) = zero;
607 
608  // Fill b:
609  b(0) =oneeighth; b(1) =threeeighths; b(2) =threeeighths; b(3) =oneeighth;
610 
611  // Fill c:
612  c(0) = zero; c(1) = onethird; c(2) = twothirds; c(3) = one;
613 
614  int order = 4;
615 
616  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
617  this->getStepperType(),A,b,c,order,order,order));
618  }
619 };
620 
621 
622 // ----------------------------------------------------------------------------
623 /** \brief RK Explicit 4 Stage 3rd order by Runge
624  *
625  * The tableau (order=3) is
626  * \f[
627  * \begin{array}{c|c}
628  * c & A \\ \hline
629  * & b^T
630  * \end{array}
631  * \;\;\;\;\mbox{ where }\;\;\;\;
632  * \begin{array}{c|cccc} 0 & 0 & & & \\
633  * 1/2 & 1/2 & 0 & & \\
634  * 1 & 0 & 1 & 0 & \\
635  * 1 & 0 & 0 & 1 & 0 \\ \hline
636  * & 1/6 & 2/3 & 0 & 1/6 \end{array}
637  * \f]
638  * Reference: E. Hairer, S.P. Norsett, G. Wanner,
639  * "Solving Ordinary Differential Equations I:
640  * Nonstiff Problems", 2nd Revised Edition,
641  * Table 1.1, pg 135.
642  */
643 template<class Scalar>
645  virtual public StepperExplicitRK<Scalar>
646 {
647 public:
648  /** \brief Default constructor.
649  *
650  * Requires subsequent setModel() and initialize()
651  * calls before calling takestep().
652  */
654  {
655  this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
656  this->setupTableau();
657  this->setupDefault();
658  }
659 
660 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
662  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
663  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
664  bool useFSAL,
665  std::string ICConsistency,
666  bool ICConsistencyCheck,
667  bool useEmbedded)
668  {
669  this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
670  this->setupTableau();
671  this->setup(appModel, obs, useFSAL, ICConsistency,
672  ICConsistencyCheck, useEmbedded);
673  }
674 #endif
676  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
677  bool useFSAL,
678  std::string ICConsistency,
679  bool ICConsistencyCheck,
680  bool useEmbedded,
681  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
682  {
683  this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
684  this->setupTableau();
685  this->setup(appModel, useFSAL, ICConsistency,
686  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
687  }
688 
689  std::string getDescription() const
690  {
691  std::ostringstream Description;
692  Description << this->getStepperType() << "\n"
693  << "Solving Ordinary Differential Equations I:\n"
694  << "Nonstiff Problems, 2nd Revised Edition\n"
695  << "E. Hairer, S.P. Norsett, G. Wanner\n"
696  << "Table 1.1, pg 135\n"
697  << "c = [ 0 1/2 1 1 ]'\n"
698  << "A = [ 0 ]\n"
699  << " [ 1/2 0 ]\n"
700  << " [ 0 1 0 ]\n"
701  << " [ 0 0 1 0 ]\n"
702  << "b = [ 1/6 2/3 0 1/6 ]'";
703  return Description.str();
704  }
705 protected:
706 
708  {
709  typedef Teuchos::ScalarTraits<Scalar> ST;
710  int NumStages = 4;
711  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
712  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
713  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
714 
715  const Scalar one = ST::one();
716  const Scalar onehalf = one/(2*one);
717  const Scalar onesixth = one/(6*one);
718  const Scalar twothirds = 2*one/(3*one);
719  const Scalar zero = ST::zero();
720 
721  // Fill A:
722  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
723  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
724  A(2,0) = zero; A(2,1) = one; A(2,2) = zero; A(2,3) = zero;
725  A(3,0) = zero; A(3,1) = zero; A(3,2) = one; A(3,3) = zero;
726 
727  // Fill b:
728  b(0) = onesixth; b(1) = twothirds; b(2) = zero; b(3) = onesixth;
729 
730  // Fill c:
731  c(0) = zero; c(1) = onehalf; c(2) = one; c(3) = one;
732 
733  int order = 3;
734 
735  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
736  this->getStepperType(),A,b,c,order,order,order));
737  }
738 };
739 
740 
741 // ----------------------------------------------------------------------------
742 /** \brief RK Explicit 5 Stage 3rd order by Kinnmark and Gray
743  *
744  * The tableau (order=3) is
745  * \f[
746  * \begin{array}{c|c}
747  * c & A \\ \hline
748  * & b^T
749  * \end{array}
750  * \;\;\;\;\mbox{ where }\;\;\;\;
751  * \begin{array}{c|ccccc} 0 & 0 & & & & \\
752  * 1/5 & 1/5 & 0 & & & \\
753  * 1/5 & 0 & 1/5 & 0 & & \\
754  * 1/3 & 0 & 0 & 1/3 & 0 & \\
755  * 2/3 & 0 & 0 & 0 & 2/3 & 0 \\ \hline
756  * & 1/4 & 0 & 0 & 0 & 3/4 \end{array}
757  * \f]
758  * Reference: Modified by P. Ullrich. From the prim_advance_mod.F90
759  * routine in the HOMME atmosphere model code.
760  */
761 template<class Scalar>
763  virtual public StepperExplicitRK<Scalar>
764 {
765 public:
766  /** \brief Default constructor.
767  *
768  * Requires subsequent setModel() and initialize()
769  * calls before calling takestep().
770  */
772  {
773  this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
774  this->setupTableau();
775  this->setupDefault();
776  }
777 
778 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
780  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
781  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
782  bool useFSAL,
783  std::string ICConsistency,
784  bool ICConsistencyCheck,
785  bool useEmbedded)
786  {
787  this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
788  this->setupTableau();
789  this->setup(appModel, obs, useFSAL, ICConsistency,
790  ICConsistencyCheck, useEmbedded);
791  }
792 #endif
794  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
795  bool useFSAL,
796  std::string ICConsistency,
797  bool ICConsistencyCheck,
798  bool useEmbedded,
799  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
800  {
801  this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
802  this->setupTableau();
803  this->setup(appModel, useFSAL, ICConsistency,
804  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
805  }
806 
807  std::string getDescription() const
808  {
809  std::ostringstream Description;
810  Description << this->getStepperType() << "\n"
811  << "Kinnmark & Gray 5 stage, 3rd order scheme \n"
812  << "Modified by P. Ullrich. From the prim_advance_mod.F90 \n"
813  << "routine in the HOMME atmosphere model code.\n"
814  << "c = [ 0 1/5 1/5 1/3 2/3 ]'\n"
815  << "A = [ 0 ]\n"
816  << " [ 1/5 0 ]\n"
817  << " [ 0 1/5 0 ]\n"
818  << " [ 0 0 1/3 0 ]\n"
819  << " [ 0 0 0 2/3 0 ]\n"
820  << "b = [ 1/4 0 0 0 3/4 ]'";
821  return Description.str();
822  }
823 
824 protected:
825 
827  {
828  typedef Teuchos::ScalarTraits<Scalar> ST;
829  int NumStages = 5;
830  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
831  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
832  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
833 
834  const Scalar one = ST::one();
835  const Scalar onefifth = one/(5*one);
836  const Scalar onefourth = one/(4*one);
837  const Scalar onethird = one/(3*one);
838  const Scalar twothirds = 2*one/(3*one);
839  const Scalar threefourths = 3*one/(4*one);
840  const Scalar zero = ST::zero();
841 
842  // Fill A:
843  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero; A(0,4) = zero;
844  A(1,0) = onefifth; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero; A(1,4) = zero;
845  A(2,0) = zero; A(2,1) = onefifth; A(2,2) = zero; A(2,3) = zero; A(2,4) = zero;
846  A(3,0) = zero; A(3,1) = zero; A(3,2) = onethird; A(3,3) = zero; A(3,4) = zero;
847  A(4,0) = zero; A(4,1) = zero; A(4,2) = zero; A(4,3) = twothirds; A(4,4) = zero;
848 
849  // Fill b:
850  b(0) =onefourth; b(1) =zero; b(2) =zero; b(3) =zero; b(4) =threefourths;
851 
852  // Fill c:
853  c(0) =zero; c(1) =onefifth; c(2) =onefifth; c(3) =onethird; c(4) =twothirds;
854 
855  int order = 3;
856 
857  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
858  this->getStepperType(),A,b,c,order,order,order));
859  }
860 };
861 
862 
863 // ----------------------------------------------------------------------------
864 /** \brief RK Explicit 3 Stage 3rd order
865  *
866  * The tableau (order=3) is
867  * \f[
868  * \begin{array}{c|c}
869  * c & A \\ \hline
870  * & b^T
871  * \end{array}
872  * \;\;\;\;\mbox{ where }\;\;\;\;
873  * \begin{array}{c|ccc} 0 & 0 & & \\
874  * 1/2 & 1/2 & 0 & \\
875  * 1 & -1 & 2 & 0 \\ \hline
876  * & 1/6 & 4/6 & 1/6 \end{array}
877  * \f]
878  */
879 template<class Scalar>
881  virtual public StepperExplicitRK<Scalar>
882 {
883 public:
884  /** \brief Default constructor.
885  *
886  * Requires subsequent setModel() and initialize()
887  * calls before calling takestep().
888  */
890  {
891  this->setStepperType("RK Explicit 3 Stage 3rd order");
892  this->setupTableau();
893  this->setupDefault();
894  }
895 
896 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
898  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
899  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
900  bool useFSAL,
901  std::string ICConsistency,
902  bool ICConsistencyCheck,
903  bool useEmbedded)
904  {
905  this->setStepperType("RK Explicit 3 Stage 3rd order");
906  this->setupTableau();
907  this->setup(appModel, obs, useFSAL, ICConsistency,
908  ICConsistencyCheck, useEmbedded);
909  }
910 #endif
912  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
913  bool useFSAL,
914  std::string ICConsistency,
915  bool ICConsistencyCheck,
916  bool useEmbedded,
917  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
918  {
919  this->setStepperType("RK Explicit 3 Stage 3rd order");
920  this->setupTableau();
921  this->setup(appModel, useFSAL, ICConsistency,
922  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
923  }
924 
925  std::string getDescription() const
926  {
927  std::ostringstream Description;
928  Description << this->getStepperType() << "\n"
929  << "c = [ 0 1/2 1 ]'\n"
930  << "A = [ 0 ]\n"
931  << " [ 1/2 0 ]\n"
932  << " [ -1 2 0 ]\n"
933  << "b = [ 1/6 4/6 1/6 ]'";
934  return Description.str();
935  }
936 
937 protected:
938 
940  {
941  typedef Teuchos::ScalarTraits<Scalar> ST;
942  const Scalar one = ST::one();
943  const Scalar two = Teuchos::as<Scalar>(2*one);
944  const Scalar zero = ST::zero();
945  const Scalar onehalf = one/(2*one);
946  const Scalar onesixth = one/(6*one);
947  const Scalar foursixth = 4*one/(6*one);
948 
949  int NumStages = 3;
950  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
951  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
952  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
953 
954  // Fill A:
955  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
956  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero;
957  A(2,0) = -one; A(2,1) = two; A(2,2) = zero;
958 
959  // Fill b:
960  b(0) = onesixth; b(1) = foursixth; b(2) = onesixth;
961 
962  // fill c:
963  c(0) = zero; c(1) = onehalf; c(2) = one;
964 
965  int order = 3;
966 
967  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
968  this->getStepperType(),A,b,c,order,order,order));
969  }
970 };
971 
972 
973 // ----------------------------------------------------------------------------
974 /** \brief RK Explicit 3 Stage 3rd order TVD
975  *
976  * The tableau (order=3) is
977  * \f[
978  * \begin{array}{c|c}
979  * c & A \\ \hline
980  * & b^T
981  * \end{array}
982  * \;\;\;\;\mbox{ where }\;\;\;\;
983  * \begin{array}{c|ccc} 0 & 0 & & \\
984  * 1 & 1 & 0 & \\
985  * 1/2 & 1/4 & 1/4 & 0 \\ \hline
986  * & 1/6 & 1/6 & 4/6 \end{array}
987  * \f]
988  * Reference: Sigal Gottlieb and Chi-Wang Shu,
989  * 'Total Variation Diminishing Runge-Kutta Schemes',
990  * Mathematics of Computation,
991  * Volume 67, Number 221, January 1998, pp. 73-85.
992  *
993  * This is also written in the following set of updates.
994  \verbatim
995  u1 = u^n + dt L(u^n)
996  u2 = 3 u^n/4 + u1/4 + dt L(u1)/4
997  u^(n+1) = u^n/3 + 2 u2/2 + 2 dt L(u2)/3
998  \endverbatim
999  */
1000 template<class Scalar>
1002  virtual public StepperExplicitRK<Scalar>
1003 {
1004 public:
1005  /** \brief Default constructor.
1006  *
1007  * Requires subsequent setModel() and initialize()
1008  * calls before calling takestep().
1009  */
1011  {
1012  this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1013  this->setupTableau();
1014  this->setupDefault();
1015  }
1016 
1017 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1019  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1020  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1021  bool useFSAL,
1022  std::string ICConsistency,
1023  bool ICConsistencyCheck,
1024  bool useEmbedded)
1025  {
1026  this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1027  this->setupTableau();
1028  this->setup(appModel, obs, useFSAL, ICConsistency,
1029  ICConsistencyCheck, useEmbedded);
1030  }
1031 #endif
1033  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1034  bool useFSAL,
1035  std::string ICConsistency,
1036  bool ICConsistencyCheck,
1037  bool useEmbedded,
1038  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1039  {
1040  this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1041  this->setupTableau();
1042  this->setup(appModel, useFSAL, ICConsistency,
1043  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1044  }
1045 
1046  std::string getDescription() const
1047  {
1048  std::ostringstream Description;
1049  Description << this->getStepperType() << "\n"
1050  << "This Stepper is known as 'RK Explicit 3 Stage 3rd order TVD' or 'SSPERK33'.\n"
1051  << "Sigal Gottlieb and Chi-Wang Shu\n"
1052  << "`Total Variation Diminishing Runge-Kutta Schemes'\n"
1053  << "Mathematics of Computation\n"
1054  << "Volume 67, Number 221, January 1998, pp. 73-85\n"
1055  << "c = [ 0 1 1/2 ]'\n"
1056  << "A = [ 0 ]\n"
1057  << " [ 1 0 ]\n"
1058  << " [ 1/4 1/4 0 ]\n"
1059  << "b = [ 1/6 1/6 4/6 ]'\n"
1060  << "This is also written in the following set of updates.\n"
1061  << "u1 = u^n + dt L(u^n)\n"
1062  << "u2 = 3 u^n/4 + u1/4 + dt L(u1)/4\n"
1063  << "u^(n+1) = u^n/3 + 2 u2/2 + 2 dt L(u2)/3";
1064  return Description.str();
1065  }
1066 
1067 protected:
1068 
1070  {
1071  typedef Teuchos::ScalarTraits<Scalar> ST;
1072  using Teuchos::as;
1073  const Scalar one = ST::one();
1074  const Scalar zero = ST::zero();
1075  const Scalar onehalf = one/(2*one);
1076  const Scalar onefourth = one/(4*one);
1077  const Scalar onesixth = one/(6*one);
1078  const Scalar foursixth = 4*one/(6*one);
1079 
1080  int NumStages = 3;
1081  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1082  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1083  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1084  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1085 
1086  // Fill A:
1087  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
1088  A(1,0) = one; A(1,1) = zero; A(1,2) = zero;
1089  A(2,0) = onefourth; A(2,1) = onefourth; A(2,2) = zero;
1090 
1091  // Fill b:
1092  b(0) = onesixth; b(1) = onesixth; b(2) = foursixth;
1093 
1094  // fill c:
1095  c(0) = zero; c(1) = one; c(2) = onehalf;
1096 
1097  // Fill bstar:
1098  bstar(0) = as<Scalar>(0.291485418878409);
1099  bstar(1) = as<Scalar>(0.291485418878409);
1100  bstar(2) = as<Scalar>(0.417029162243181);
1101 
1102  int order = 3;
1103 
1104  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1105  this->getStepperType(),A,b,c,order,order,order,bstar));
1106  }
1107 };
1108 
1109 
1110 // ----------------------------------------------------------------------------
1111 /** \brief RK Explicit 3 Stage 3rd order by Heun
1112  *
1113  * The tableau (order=3) is
1114  * \f[
1115  * \begin{array}{c|c}
1116  * c & A \\ \hline
1117  * & b^T
1118  * \end{array}
1119  * \;\;\;\;\mbox{ where }\;\;\;\;
1120  * \begin{array}{c|ccc} 0 & 0 & & \\
1121  * 1/3 & 1/3 & 0 & \\
1122  * 2/3 & 0 & 2/3 & 0 \\ \hline
1123  * & 1/4 & 0 & 3/4 \end{array}
1124  * \f]
1125  * Reference: E. Hairer, S.P. Norsett, G. Wanner,
1126  * "Solving Ordinary Differential Equations I:
1127  * Nonstiff Problems", 2nd Revised Edition,
1128  * Table 1.1, pg 135.
1129  */
1130 template<class Scalar>
1132  virtual public StepperExplicitRK<Scalar>
1133 {
1134 public:
1135  /** \brief Default constructor.
1136  *
1137  * Requires subsequent setModel() and initialize()
1138  * calls before calling takestep().
1139  */
1141  {
1142  this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1143  this->setupTableau();
1144  this->setupDefault();
1145  }
1146 
1147 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1149  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1150  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1151  bool useFSAL,
1152  std::string ICConsistency,
1153  bool ICConsistencyCheck,
1154  bool useEmbedded)
1155  {
1156  this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1157  this->setupTableau();
1158  this->setup(appModel, obs, useFSAL, ICConsistency,
1159  ICConsistencyCheck, useEmbedded);
1160  }
1161 #endif
1163  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1164  bool useFSAL,
1165  std::string ICConsistency,
1166  bool ICConsistencyCheck,
1167  bool useEmbedded,
1168  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1169  {
1170  this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1171  this->setupTableau();
1172  this->setup(appModel, useFSAL, ICConsistency,
1173  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1174  }
1175 
1176  std::string getDescription() const
1177  {
1178  std::ostringstream Description;
1179  Description << this->getStepperType() << "\n"
1180  << "Solving Ordinary Differential Equations I:\n"
1181  << "Nonstiff Problems, 2nd Revised Edition\n"
1182  << "E. Hairer, S.P. Norsett, G. Wanner\n"
1183  << "Table 1.1, pg 135\n"
1184  << "c = [ 0 1/3 2/3 ]'\n"
1185  << "A = [ 0 ] \n"
1186  << " [ 1/3 0 ]\n"
1187  << " [ 0 2/3 0 ]\n"
1188  << "b = [ 1/4 0 3/4 ]'";
1189  return Description.str();
1190  }
1191 
1192 protected:
1193 
1195  {
1196  typedef Teuchos::ScalarTraits<Scalar> ST;
1197  const Scalar one = ST::one();
1198  const Scalar zero = ST::zero();
1199  const Scalar onethird = one/(3*one);
1200  const Scalar twothirds = 2*one/(3*one);
1201  const Scalar onefourth = one/(4*one);
1202  const Scalar threefourths = 3*one/(4*one);
1203 
1204  int NumStages = 3;
1205  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1206  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1207  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1208 
1209  // Fill A:
1210  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
1211  A(1,0) = onethird; A(1,1) = zero; A(1,2) = zero;
1212  A(2,0) = zero; A(2,1) = twothirds; A(2,2) = zero;
1213 
1214  // Fill b:
1215  b(0) = onefourth; b(1) = zero; b(2) = threefourths;
1216 
1217  // fill c:
1218  c(0) = zero; c(1) = onethird; c(2) = twothirds;
1219 
1220  int order = 3;
1221 
1222  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1223  this->getStepperType(),A,b,c,order,order,order));
1224  }
1225 };
1226 
1227 
1228 // ----------------------------------------------------------------------------
1229 /** \brief RK Explicit Midpoint
1230  *
1231  * The tableau (order=2) is
1232  * \f[
1233  * \begin{array}{c|c}
1234  * c & A \\ \hline
1235  * & b^T
1236  * \end{array}
1237  * \;\;\;\;\mbox{ where }\;\;\;\;
1238  * \begin{array}{c|cc} 0 & 0 & \\
1239  * 1/2 & 1/2 & 0 \\ \hline
1240  * & 0 & 1 \end{array}
1241  * \f]
1242  * Reference: E. Hairer, S.P. Norsett, G. Wanner,
1243  * "Solving Ordinary Differential Equations I:
1244  * Nonstiff Problems", 2nd Revised Edition,
1245  * Table 1.1, pg 135.
1246  */
1247 template<class Scalar>
1249  virtual public StepperExplicitRK<Scalar>
1250 {
1251 public:
1252  /** \brief Default constructor.
1253  *
1254  * Requires subsequent setModel() and initialize()
1255  * calls before calling takestep().
1256  */
1258  {
1259  this->setStepperType("RK Explicit Midpoint");
1260  this->setupTableau();
1261  this->setupDefault();
1262  }
1263 
1264 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1266  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1267  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1268  bool useFSAL,
1269  std::string ICConsistency,
1270  bool ICConsistencyCheck,
1271  bool useEmbedded)
1272  {
1273  this->setStepperType("RK Explicit Midpoint");
1274  this->setupTableau();
1275  this->setup(appModel, obs, useFSAL, ICConsistency,
1276  ICConsistencyCheck, useEmbedded);
1277  }
1278 #endif
1280  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1281  bool useFSAL,
1282  std::string ICConsistency,
1283  bool ICConsistencyCheck,
1284  bool useEmbedded,
1285  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1286  {
1287  this->setStepperType("RK Explicit Midpoint");
1288  this->setupTableau();
1289  this->setup(appModel, useFSAL, ICConsistency,
1290  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1291  }
1292 
1293  std::string getDescription() const
1294  {
1295  std::ostringstream Description;
1296  Description << this->getStepperType() << "\n"
1297  << "Solving Ordinary Differential Equations I:\n"
1298  << "Nonstiff Problems, 2nd Revised Edition\n"
1299  << "E. Hairer, S.P. Norsett, G. Wanner\n"
1300  << "Table 1.1, pg 135\n"
1301  << "c = [ 0 1/2 ]'\n"
1302  << "A = [ 0 ]\n"
1303  << " [ 1/2 0 ]\n"
1304  << "b = [ 0 1 ]'";
1305  return Description.str();
1306  }
1307 
1308 protected:
1309 
1311  {
1312  typedef Teuchos::ScalarTraits<Scalar> ST;
1313  const Scalar one = ST::one();
1314  const Scalar zero = ST::zero();
1315  const Scalar onehalf = one/(2*one);
1316 
1317  int NumStages = 2;
1318  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1319  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1320  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1321 
1322  // Fill A:
1323  A(0,0) = zero; A(0,1) = zero;
1324  A(1,0) = onehalf; A(1,1) = zero;
1325 
1326  // Fill b:
1327  b(0) = zero; b(1) = one;
1328 
1329  // fill c:
1330  c(0) = zero; c(1) = onehalf;
1331 
1332  int order = 2;
1333 
1334  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1335  this->getStepperType(),A,b,c,order,order,order));
1336  }
1337 };
1338 
1339 
1340 // ----------------------------------------------------------------------------
1341 /** \brief RK Explicit Ralston
1342  *
1343  * The tableau (order=2) is
1344  * \f[
1345  * \begin{array}{c|c}
1346  * c & A \\ \hline
1347  * & b^T
1348  * \end{array}
1349  * \;\;\;\;\mbox{ where }\;\;\;\;
1350  * \begin{array}{c|cc} 0 & 0 & \\
1351  * 2/3 & 2/3 & 0 \\ \hline
1352  * & 1/4 & 3/4 \end{array}
1353  * \f]
1354  */
1355 template<class Scalar>
1357  virtual public StepperExplicitRK<Scalar>
1358 {
1359 public:
1360  /** \brief Default constructor.
1361  *
1362  * Requires subsequent setModel() and initialize()
1363  * calls before calling takestep().
1364  */
1366  {
1367  this->setStepperType("RK Explicit Ralston");
1368  this->setupTableau();
1369  this->setupDefault();
1370  }
1371 
1372 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1374  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1375  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1376  bool useFSAL,
1377  std::string ICConsistency,
1378  bool ICConsistencyCheck,
1379  bool useEmbedded)
1380  {
1381  this->setStepperType("RK Explicit Ralston");
1382  this->setupTableau();
1383  this->setup(appModel, obs, useFSAL, ICConsistency,
1384  ICConsistencyCheck, useEmbedded);
1385  }
1386 #endif
1388  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1389  bool useFSAL,
1390  std::string ICConsistency,
1391  bool ICConsistencyCheck,
1392  bool useEmbedded,
1393  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1394  {
1395  this->setStepperType("RK Explicit Ralston");
1396  this->setupTableau();
1397  this->setup(appModel, useFSAL, ICConsistency,
1398  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1399  }
1400 
1401  std::string getDescription() const
1402  {
1403  std::ostringstream Description;
1404  Description << this->getStepperType() << "\n"
1405  << "This Stepper is known as 'RK Explicit Ralston' or 'RK2'.\n"
1406  << "c = [ 0 2/3 ]'\n"
1407  << "A = [ 0 ]\n"
1408  << " [ 2/3 0 ]\n"
1409  << "b = [ 1/4 3/4 ]'";
1410  return Description.str();
1411  }
1412 
1413 protected:
1414 
1416  {
1417  typedef Teuchos::ScalarTraits<Scalar> ST;
1418  const Scalar one = ST::one();
1419  const Scalar zero = ST::zero();
1420 
1421  const int NumStages = 2;
1422  const int order = 2;
1423  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1424  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1425  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1426 
1427  // Fill A:
1428  A(0,0) = zero; A(0,1) = zero; A(1,1) = zero;
1429  A(1,0) = (2*one)/(3*one);
1430 
1431  // Fill b:
1432  b(0) = (1*one)/(4*one);
1433  b(1) = (3*one)/(4*one);
1434 
1435  // fill c:
1436  c(0) = zero;
1437  c(1) = (2*one)/(3*one);
1438 
1439 
1440  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1441  this->getStepperType(),A,b,c,order,order,order));
1442  }
1443 };
1444 
1445 
1446 // ----------------------------------------------------------------------------
1447 /** \brief RK Explicit Trapezoidal
1448  *
1449  * The tableau (order=2) is
1450  * \f[
1451  * \begin{array}{c|c}
1452  * c & A \\ \hline
1453  * & b^T
1454  * \end{array}
1455  * \;\;\;\;\mbox{ where }\;\;\;\;
1456  * \begin{array}{c|cc} 0 & 0 & \\
1457  * 1 & 1 & 0 \\ \hline
1458  * & 1/2 & 1/2 \\
1459  * & 3/4 & 1/4 \end{array}
1460  * \f]
1461  */
1462 template<class Scalar>
1464  virtual public StepperExplicitRK<Scalar>
1465 {
1466 public:
1467  /** \brief Default constructor.
1468  *
1469  * Requires subsequent setModel() and initialize()
1470  * calls before calling takestep().
1471  */
1473  {
1474  this->setStepperType("RK Explicit Trapezoidal");
1475  this->setupTableau();
1476  this->setupDefault();
1477  }
1478 
1479 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1481  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1482  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1483  bool useFSAL,
1484  std::string ICConsistency,
1485  bool ICConsistencyCheck,
1486  bool useEmbedded)
1487  {
1488  this->setStepperType("RK Explicit Trapezoidal");
1489  this->setupTableau();
1490  this->setup(appModel, obs, useFSAL, ICConsistency,
1491  ICConsistencyCheck, useEmbedded);
1492  }
1493 #endif
1495  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1496  bool useFSAL,
1497  std::string ICConsistency,
1498  bool ICConsistencyCheck,
1499  bool useEmbedded,
1500  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1501  {
1502  this->setStepperType("RK Explicit Trapezoidal");
1503  this->setupTableau();
1504  this->setup(appModel, useFSAL, ICConsistency,
1505  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1506  }
1507 
1508  std::string getDescription() const
1509  {
1510  std::ostringstream Description;
1511  Description << this->getStepperType() << "\n"
1512  << "This Stepper is known as 'RK Explicit Trapezoidal' or 'Heuns Method' or 'SSPERK22'.\n"
1513  << "c = [ 0 1 ]'\n"
1514  << "A = [ 0 ]\n"
1515  << " [ 1 0 ]\n"
1516  << "b = [ 1/2 1/2 ]\n"
1517  << "bstart = [ 3/4 1/4 ]'";
1518  return Description.str();
1519  }
1520 
1521 protected:
1522 
1524  {
1525  typedef Teuchos::ScalarTraits<Scalar> ST;
1526  using Teuchos::as;
1527  const Scalar one = ST::one();
1528  const Scalar zero = ST::zero();
1529  const Scalar onehalf = one/(2*one);
1530 
1531  int NumStages = 2;
1532  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1533  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1534  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1535  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1536 
1537  // Fill A:
1538  A(0,0) = zero; A(0,1) = zero;
1539  A(1,0) = one; A(1,1) = zero;
1540 
1541  // Fill b:
1542  b(0) = onehalf; b(1) = onehalf;
1543 
1544  // fill c:
1545  c(0) = zero; c(1) = one;
1546 
1547  // Fill bstar
1548  bstar(0) = as<Scalar>(3*one/(4*one));
1549  bstar(1) = as<Scalar>(1*one/(4*one));
1550 
1551  int order = 2;
1552 
1553  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1554  this->getStepperType(),A,b,c,order,order,order,bstar));
1555  }
1556 };
1557 
1558 
1559 // ----------------------------------------------------------------------------
1560 /** \brief Strong Stability Preserving Explicit RK Butcher Tableau
1561  *
1562  * The tableau (stage=5, order=4) is
1563  * \f[
1564  * \begin{array}{c|c}
1565  * c & A \\ \hline
1566  * & b^T \\
1567  * & \hat{b}^T
1568  * \end{array}
1569  *
1570  * \f]
1571  * Reference: Gottlieb, S., Ketcheson, D.I., Shu, C.-W.
1572  * Strong Stability Preserving Runge–Kutta and Multistep Time Discretizations.
1573  * World Scientific Press, London (2011)
1574  *
1575  *
1576  */
1577 template<class Scalar>
1579  virtual public StepperExplicitRK<Scalar>
1580 {
1581  public:
1583  {
1584  this->setStepperType("SSPERK54");
1585  this->setupTableau();
1586  this->setupDefault();
1587  }
1588 
1589 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1591  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1592  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1593  bool useFSAL,
1594  std::string ICConsistency,
1595  bool ICConsistencyCheck,
1596  bool useEmbedded)
1597  {
1598  this->setStepperType("SSPERK54");
1599  this->setupTableau();
1600  this->setup(appModel, obs, useFSAL, ICConsistency,
1601  ICConsistencyCheck, useEmbedded);
1602  }
1603 #endif
1605  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1606  bool useFSAL,
1607  std::string ICConsistency,
1608  bool ICConsistencyCheck,
1609  bool useEmbedded,
1610  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1611  {
1612  this->setStepperType("SSPERK54");
1613  this->setupTableau();
1614  this->setup(appModel, useFSAL, ICConsistency,
1615  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1616  }
1617 
1618  std::string getDescription() const
1619  {
1620  std::ostringstream Description;
1621  Description << this->getStepperType() << "\n"
1622  << "Strong Stability Preserving Explicit RK (stage=5, order=4)\n"
1623  << std::endl;
1624  return Description.str();
1625  }
1626 
1627 protected:
1628 
1630  {
1631 
1632  typedef Teuchos::ScalarTraits<Scalar> ST;
1633  using Teuchos::as;
1634  const int NumStages = 5;
1635  const int order = 4;
1636  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1637  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1638  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1639  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1640  const Scalar zero = ST::zero();
1641 
1642  // Fill A:
1643  A(0,0) = A(0,1) = A(0,2) = A(0,3) = A(0,4) = zero;
1644 
1645  A(1,0) = as<Scalar>(0.391752226571889);
1646  A(1,1) = A(1,2) = A(1,3) = A(0,4) = zero;
1647 
1648  A(2,0) = as<Scalar>(0.217669096261169);
1649  A(2,1) = as<Scalar>(0.368410593050372);
1650  A(2,2) = A(2,3) = A(2,4) = zero;
1651 
1652  A(3,0) = as<Scalar>(0.082692086657811);
1653  A(3,1) = as<Scalar>(0.139958502191896);
1654  A(3,2) = as<Scalar>(0.251891774271693);
1655  A(3,3) = A(2,4) = zero;
1656 
1657  A(4,0) = as<Scalar>(0.067966283637115);
1658  A(4,1) = as<Scalar>(0.115034698504632);
1659  A(4,2) = as<Scalar>(0.207034898597385);
1660  A(4,3) = as<Scalar>(0.544974750228520);
1661  A(4,4) = zero;
1662 
1663  // Fill b:
1664  b(0) = as<Scalar>(0.146811876084786);
1665  b(1) = as<Scalar>(0.248482909444976);
1666  b(2) = as<Scalar>(0.104258830331980);
1667  b(3) = as<Scalar>(0.274438900901350);
1668  b(4) = as<Scalar>(0.226007483236908);
1669 
1670  // fill c:
1671  c(0) = zero;
1672  c(1) = A(1,0);
1673  c(2) = A(2,0) + A(2,1);
1674  c(3) = A(3,0) + A(3,1) + A(3,2);
1675  c(4) = A(4,0) + A(4,1) + A(4,2) + A(4,3);
1676 
1677  // Fill bstar:
1678  bstar(0) = as<Scalar>(0.130649104813131);
1679  bstar(1) = as<Scalar>(0.317716031201302);
1680  bstar(2) = as<Scalar>(0.000000869337261);
1681  bstar(3) = as<Scalar>(0.304581512634772);
1682  bstar(4) = as<Scalar>(0.247052482013534);
1683 
1684  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1685  this->getStepperType(),A,b,c,order,order,order,bstar));
1686  }
1687 };
1688 
1689 
1690 // ----------------------------------------------------------------------------
1691 /** \brief General Explicit Runge-Kutta Butcher Tableau
1692  *
1693  * The format of the Butcher Tableau parameter list is
1694  \verbatim
1695  <Parameter name="A" type="string" value="# # # ;
1696  # # # ;
1697  # # #">
1698  <Parameter name="b" type="string" value="# # #">
1699  <Parameter name="c" type="string" value="# # #">
1700  \endverbatim
1701  * Note the number of stages is implicit in the number of entries.
1702  * The number of stages must be consistent.
1703  *
1704  * Default tableau is RK4 (order=4):
1705  * \f[
1706  * \begin{array}{c|c}
1707  * c & A \\ \hline
1708  * & b^T
1709  * \end{array}
1710  * \;\;\;\;\mbox{ where }\;\;\;\;
1711  * \begin{array}{c|cccc} 0 & 0 & & & \\
1712  * 1/2 & 1/2 & 0 & & \\
1713  * 1/2 & 0 & 1/2 & 0 & \\
1714  * 1 & 0 & 0 & 1 & 0 \\ \hline
1715  * & 1/6 & 1/3 & 1/3 & 1/6 \end{array}
1716  * \f]
1717  */
1718 template<class Scalar>
1720  virtual public StepperExplicitRK<Scalar>
1721 {
1722 public:
1724  {
1725  this->setStepperType("General ERK");
1726  this->setupTableau();
1727  this->setupDefault();
1728  }
1729 
1730 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1732  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1733  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1734  bool useFSAL,
1735  std::string ICConsistency,
1736  bool ICConsistencyCheck,
1737  bool useEmbedded,
1738  const Teuchos::SerialDenseMatrix<int,Scalar>& A,
1739  const Teuchos::SerialDenseVector<int,Scalar>& b,
1740  const Teuchos::SerialDenseVector<int,Scalar>& c,
1741  const int order,
1742  const int orderMin,
1743  const int orderMax,
1744  const Teuchos::SerialDenseVector<int,Scalar>& bstar)
1745  {
1746  this->setStepperType("General ERK");
1747  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
1748 
1749  TEUCHOS_TEST_FOR_EXCEPTION(
1750  this->tableau_->isImplicit() == true, std::logic_error,
1751  "Error - General ERK received an implicit Butcher Tableau!\n");
1752 
1753  this->setup(appModel, obs, useFSAL, ICConsistency,
1754  ICConsistencyCheck, useEmbedded);
1755  }
1756 #endif
1758  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1759  bool useFSAL,
1760  std::string ICConsistency,
1761  bool ICConsistencyCheck,
1762  bool useEmbedded,
1763  const Teuchos::SerialDenseMatrix<int,Scalar>& A,
1764  const Teuchos::SerialDenseVector<int,Scalar>& b,
1765  const Teuchos::SerialDenseVector<int,Scalar>& c,
1766  const int order,
1767  const int orderMin,
1768  const int orderMax,
1769  const Teuchos::SerialDenseVector<int,Scalar>& bstar,
1770  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1771  {
1772  this->setStepperType("General ERK");
1773  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
1774 
1775  TEUCHOS_TEST_FOR_EXCEPTION(
1776  this->tableau_->isImplicit() == true, std::logic_error,
1777  "Error - General ERK received an implicit Butcher Tableau!\n");
1778 
1779  this->setup(appModel, useFSAL, ICConsistency,
1780  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1781  }
1782 
1783  virtual std::string getDescription() const
1784  {
1785  std::stringstream Description;
1786  Description << this->getStepperType() << "\n"
1787  << "The format of the Butcher Tableau parameter list is\n"
1788  << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
1789  << " # # # ;\n"
1790  << " # # #\"/>\n"
1791  << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
1792  << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
1793  << "Note the number of stages is implicit in the number of entries.\n"
1794  << "The number of stages must be consistent.\n"
1795  << "\n"
1796  << "Default tableau is RK4 (order=4):\n"
1797  << "c = [ 0 1/2 1/2 1 ]'\n"
1798  << "A = [ 0 ]\n"
1799  << " [ 1/2 0 ]\n"
1800  << " [ 0 1/2 0 ]\n"
1801  << " [ 0 0 1 0 ]\n"
1802  << "b = [ 1/6 1/3 1/3 1/6 ]'";
1803  return Description.str();
1804  }
1805 
1807  {
1808  if (this->tableau_ == Teuchos::null) {
1809  // Set tableau to the default if null, otherwise keep current tableau.
1810  auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
1811  auto t = stepper->getTableau();
1812  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1813  this->getStepperType(),
1814  t->A(),t->b(),t->c(),
1815  t->order(),t->orderMin(),t->orderMax(),
1816  t->bstar()));
1817  }
1818  }
1819 
1820  void setTableau(const Teuchos::SerialDenseMatrix<int,Scalar>& A,
1821  const Teuchos::SerialDenseVector<int,Scalar>& b,
1822  const Teuchos::SerialDenseVector<int,Scalar>& c,
1823  const int order,
1824  const int orderMin,
1825  const int orderMax,
1826  const Teuchos::SerialDenseVector<int,Scalar>&
1827  bstar = Teuchos::SerialDenseVector<int,Scalar>())
1828  {
1829  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1830  this->getStepperType(),A,b,c,order,orderMin,orderMax,bstar));
1831  this->isInitialized_ = false;
1832  }
1833 
1834  virtual std::string getDefaultICConsistency() const { return "Consistent"; }
1835 
1836  Teuchos::RCP<const Teuchos::ParameterList>
1838  {
1839  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1840  this->getValidParametersBasicERK(pl);
1841  pl->set<std::string>("Initial Condition Consistency",
1842  this->getDefaultICConsistency());
1843 
1844  // Tableau ParameterList
1845  Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
1846  tableauPL->set<std::string>("A",
1847  "0.0 0.0 0.0 0.0; 0.5 0.0 0.0 0.0; 0.0 0.5 0.0 0.0; 0.0 0.0 1.0 0.0");
1848  tableauPL->set<std::string>("b",
1849  "0.166666666666667 0.333333333333333 0.333333333333333 0.166666666666667");
1850  tableauPL->set<std::string>("c", "0.0 0.5 0.5 1.0");
1851  tableauPL->set<int>("order", 4);
1852  tableauPL->set<std::string>("bstar", "");
1853  pl->set("Tableau", *tableauPL);
1854 
1855  return pl;
1856  }
1857 };
1858 
1859 
1860 // ----------------------------------------------------------------------------
1861 /** \brief Backward Euler Runge-Kutta Butcher Tableau
1862  *
1863  * The tableau for Backward Euler (order=1) is
1864  * \f[
1865  * \begin{array}{c|c}
1866  * c & A \\ \hline
1867  * & b^T
1868  * \end{array}
1869  * \;\;\;\;\mbox{ where }\;\;\;\;
1870  * \begin{array}{c|c} 1 & 1 \\ \hline
1871  * & 1 \end{array}
1872  * \f]
1873  */
1874 template<class Scalar>
1876  virtual public StepperDIRK<Scalar>
1877 {
1878 public:
1879  /** \brief Default constructor.
1880  *
1881  * Requires subsequent setModel() and initialize()
1882  * calls before calling takeStep().
1883  */
1885  {
1886  this->setStepperType("RK Backward Euler");
1887  this->setupTableau();
1888  this->setupDefault();
1889  }
1890 
1891 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
1893  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1894  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
1895  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
1896  bool useFSAL,
1897  std::string ICConsistency,
1898  bool ICConsistencyCheck,
1899  bool useEmbedded,
1900  bool zeroInitialGuess)
1901  {
1902  this->setStepperType("RK Backward Euler");
1903  this->setupTableau();
1904  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
1905  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
1906  }
1907 #endif
1909  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1910  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
1911  bool useFSAL,
1912  std::string ICConsistency,
1913  bool ICConsistencyCheck,
1914  bool useEmbedded,
1915  bool zeroInitialGuess,
1916  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1917  {
1918  this->setStepperType("RK Backward Euler");
1919  this->setupTableau();
1920  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
1921  useEmbedded, zeroInitialGuess, stepperRKAppAction);
1922  }
1923 
1924  std::string getDescription() const
1925  {
1926  std::ostringstream Description;
1927  Description << this->getStepperType() << "\n"
1928  << "c = [ 1 ]'\n"
1929  << "A = [ 1 ]\n"
1930  << "b = [ 1 ]'";
1931  return Description.str();
1932  }
1933 
1934  virtual bool getICConsistencyCheckDefault() const { return false; }
1935 
1936  Teuchos::RCP<const Teuchos::ParameterList>
1938  {
1939  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1940  this->getValidParametersBasicDIRK(pl);
1941  pl->set<bool>("Initial Condition Consistency Check",
1943  return pl;
1944  }
1945 
1946 protected:
1947 
1949  {
1950  typedef Teuchos::ScalarTraits<Scalar> ST;
1951  int NumStages = 1;
1952  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1953  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
1954  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
1955 
1956  // Fill A:
1957  A(0,0) = ST::one();
1958 
1959  // Fill b:
1960  b(0) = ST::one();
1961 
1962  // Fill c:
1963  c(0) = ST::one();
1964 
1965  int order = 1;
1966 
1967  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1968  this->getStepperType(),A,b,c,order,order,order));
1969  }
1970 };
1971 
1972 
1973 // ----------------------------------------------------------------------------
1974 /** \brief SDIRK 2 Stage 2nd order
1975  *
1976  * The tableau (order=1 or 2) is
1977  * \f[
1978  * \begin{array}{c|c}
1979  * c & A \\ \hline
1980  * & b^T
1981  * \end{array}
1982  * \;\;\;\;\mbox{ where }\;\;\;\;
1983  * \begin{array}{c|cc} \gamma & \gamma & \\
1984  * 1 & 1-\gamma & \gamma \\ \hline
1985  * & 1-\gamma & \gamma \end{array}
1986  * \f]
1987  * The default value is \f$\gamma = (2 - \sqrt{2})/2\f$.
1988  * This will produce an L-stable 2nd order method with the stage
1989  * times within the timestep. Other values of gamma will still
1990  * produce an L-stable scheme, but will only be 1st order accurate.
1991  * L-stability is guaranteed because \f$A_{sj} = b_j\f$.
1992  *
1993  * Reference: U. M. Ascher and L. R. Petzold,
1994  * Computer Methods for ODEs and DAEs, p. 106.
1995  */
1996 template<class Scalar>
1998  virtual public StepperDIRK<Scalar>
1999 {
2000 public:
2001  /** \brief Default constructor.
2002  *
2003  * Requires subsequent setModel() and initialize()
2004  * calls before calling takestep().
2005  */
2007  {
2008  typedef Teuchos::ScalarTraits<Scalar> ST;
2009  const Scalar one = ST::one();
2010  gammaDefault_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
2011 
2012  this->setStepperType("SDIRK 2 Stage 2nd order");
2013  this->setGamma(gammaDefault_);
2014  this->setupTableau();
2015  this->setupDefault();
2016  }
2017 
2018 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2020  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2021  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2022  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2023  bool useFSAL,
2024  std::string ICConsistency,
2025  bool ICConsistencyCheck,
2026  bool useEmbedded,
2027  bool zeroInitialGuess,
2028  Scalar gamma = Scalar(0.2928932188134524))
2029  {
2030  typedef Teuchos::ScalarTraits<Scalar> ST;
2031  const Scalar one = ST::one();
2032  gammaDefault_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
2033 
2034  this->setStepperType("SDIRK 2 Stage 2nd order");
2035  this->setGamma(gamma);
2036  this->setupTableau();
2037  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2038  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2039  }
2040 #endif
2042  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2043  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2044  bool useFSAL,
2045  std::string ICConsistency,
2046  bool ICConsistencyCheck,
2047  bool useEmbedded,
2048  bool zeroInitialGuess,
2049  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2050  Scalar gamma = Scalar(0.2928932188134524))
2051  {
2052  typedef Teuchos::ScalarTraits<Scalar> ST;
2053  const Scalar one = ST::one();
2054  gammaDefault_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
2055 
2056  this->setStepperType("SDIRK 2 Stage 2nd order");
2057  this->setGamma(gamma);
2058  this->setupTableau();
2059  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2060  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2061  }
2062 
2063  void setGamma(Scalar gamma)
2064  {
2065  gamma_ = gamma;
2066  this->isInitialized_ = false;
2067  this->setupTableau();
2068  }
2069 
2070  Scalar getGamma() { return gamma_; }
2071 
2072  std::string getDescription() const
2073  {
2074  std::ostringstream Description;
2075  Description << this->getStepperType() << "\n"
2076  << "Computer Methods for ODEs and DAEs\n"
2077  << "U. M. Ascher and L. R. Petzold\n"
2078  << "p. 106\n"
2079  << "gamma = (2+-sqrt(2))/2\n"
2080  << "c = [ gamma 1 ]'\n"
2081  << "A = [ gamma 0 ]\n"
2082  << " [ 1-gamma gamma ]\n"
2083  << "b = [ 1-gamma gamma ]'";
2084  return Description.str();
2085  }
2086 
2087  virtual bool getICConsistencyCheckDefault() const { return false; }
2088 
2089  Teuchos::RCP<const Teuchos::ParameterList>
2091  {
2092  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2093  this->getValidParametersBasicDIRK(pl);
2094  pl->set<bool>("Initial Condition Consistency Check",
2096  pl->set<double>("gamma",gammaDefault_,
2097  "The default value is gamma = (2-sqrt(2))/2. "
2098  "This will produce an L-stable 2nd order method with the stage "
2099  "times within the timestep. Other values of gamma will still "
2100  "produce an L-stable scheme, but will only be 1st order accurate.");
2101 
2102  return pl;
2103  }
2104 
2105 protected:
2106 
2108  {
2109  typedef Teuchos::ScalarTraits<Scalar> ST;
2110  int NumStages = 2;
2111  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2112  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2113  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2114 
2115  const Scalar one = ST::one();
2116  const Scalar zero = ST::zero();
2117 
2118  // Fill A:
2119  A(0,0) = gamma_; A(0,1) = zero;
2120  A(1,0) = Teuchos::as<Scalar>( one - gamma_ ); A(1,1) = gamma_;
2121 
2122  // Fill b:
2123  b(0) = Teuchos::as<Scalar>( one - gamma_ ); b(1) = gamma_;
2124 
2125  // Fill c:
2126  c(0) = gamma_; c(1) = one;
2127 
2128  int order = 1;
2129  if ( std::abs((gamma_-gammaDefault_)/gamma_) < 1.0e-08 ) order = 2;
2130 
2131  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2132  this->getStepperType(),A,b,c,order,order,order));
2133  }
2134 
2135  private:
2137  Scalar gamma_;
2138 };
2139 
2140 
2141 // ----------------------------------------------------------------------------
2142 /** \brief SDIRK 3 Stage 2nd order
2143  *
2144  * The tableau (order=2) is
2145  * \f[
2146  * \begin{array}{c|c}
2147  * c & A \\ \hline
2148  * & b^T
2149  * \end{array}
2150  * \;\;\;\;\mbox{ where }\;\;\;\;
2151  * \begin{array}{c|ccc} \gamma & \gamma & & \\
2152  * 1-\gamma & 1-2\gamma & \gamma & \\
2153  * 1-2 & 1/2 -\gamma & 0 & \gamma \\ \hline
2154  * & 1/6 & 1/6 & 2/3
2155  * \end{array}
2156  * \f]
2157  * The value is \f$\gamma = 1/ (2 + \sqrt{2})\f$.
2158  * This will produce an L-stable 2nd order method with the stage
2159  * times within the timestep.
2160  *
2161  * Reference: Implicit-explicit Runge-Kutta schemes and applications to
2162  * hyperbolic systems with relaxation
2163  * L Pareschi, G Russo
2164  * Journal of Scientific computing, 2005 - Springer
2165  * Table 5
2166  */
2167 
2168 template<class Scalar>
2170  virtual public StepperDIRK<Scalar>
2171 {
2172 public:
2173  /** \brief Default constructor.
2174  *
2175  * Requires subsequent setModel() and initialize()
2176  * calls before calling takestep().
2177  */
2179  {
2180  this->setStepperType("SDIRK 3 Stage 2nd order");
2181  this->setupTableau();
2182  this->setupDefault();
2183  }
2184 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2186  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2187  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2188  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2189  bool useFSAL,
2190  std::string ICConsistency,
2191  bool ICConsistencyCheck,
2192  bool useEmbedded,
2193  bool zeroInitialGuess)
2194  {
2195 
2196  this->setStepperType("SDIRK 3 Stage 2nd order");
2197  this->setupTableau();
2198  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2199  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2200  }
2201 #endif
2203  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2204  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2205  bool useFSAL,
2206  std::string ICConsistency,
2207  bool ICConsistencyCheck,
2208  bool useEmbedded,
2209  bool zeroInitialGuess,
2210  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2211  {
2212 
2213  this->setStepperType("SDIRK 3 Stage 2nd order");
2214  this->setupTableau();
2215  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2216  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2217  }
2218 
2219  std::string getDescription() const
2220  {
2221  std::ostringstream Description;
2222  Description << this->getStepperType() << "\n"
2223  << "Implicit-explicit Runge-Kutta schemes and applications to\n"
2224  << "hyperbolic systems with relaxation\n"
2225  << "L Pareschi, G Russo\n"
2226  << "Journal of Scientific computing, 2005 - Springer\n"
2227  << "Table 5\n"
2228  << "gamma = 1/(2+sqrt(2))\n"
2229  << "c = [ gamma (1-gamma) 1/2 ]'\n"
2230  << "A = [ gamma 0 0 ]\n"
2231  << " [ 1-2gamma gamma 0 ]\n"
2232  << " [ 1/2-gamma 0 gamma ]\n"
2233  << "b = [ 1/6 1/6 2/3 ]'";
2234  return Description.str();
2235  }
2236 
2237  Teuchos::RCP<const Teuchos::ParameterList>
2239  {
2240  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2241  this->getValidParametersBasicDIRK(pl);
2242  pl->set<bool>("Initial Condition Consistency Check",
2244  return pl;
2245  }
2246 
2247 protected:
2248 
2250  {
2251  typedef Teuchos::ScalarTraits<Scalar> ST;
2252  using Teuchos::as;
2253  const int NumStages = 3;
2254  const int order = 2;
2255  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2256  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2257  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2258  const Scalar one = ST::one();
2259  const Scalar zero = ST::zero();
2260  const Scalar gamma = as<Scalar>(one - ( one / ST::squareroot(2*one) ) );
2261 
2262  // Fill A:
2263  A(0,0) = A(1,1) = A(2,2) = gamma;
2264  A(0,1) = A(0,2) = A(1,2) = A(2,1) = zero;
2265  A(1,0) = as<Scalar>(one - 2*gamma);
2266  A(2,0) = as<Scalar>( ( one/ (2.*one)) - gamma );
2267 
2268  // Fill b:
2269  b(0) = b(1) = ( one / (6*one) );
2270  b(2) = (2*one)/(3*one);
2271 
2272  // Fill c:
2273  c(0) = gamma;
2274  c(1) = one - gamma;
2275  c(2) = one / (2*one);
2276 
2277  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2278  this->getStepperType(),A,b,c,order,order,order));
2279  }
2280 
2281 };
2282 
2283 
2284 // ----------------------------------------------------------------------------
2285 /** \brief SDIRK 2 Stage 3rd order
2286  *
2287  * The tableau (order=2 or 3) is
2288  * \f[
2289  * \begin{array}{c|c}
2290  * c & A \\ \hline
2291  * & b^T
2292  * \end{array}
2293  * \;\;\;\;\mbox{ where }\;\;\;\;
2294  * \begin{array}{c|cc} \gamma & \gamma & \\
2295  * 1-\gamma & 1-2\gamma & \gamma \\ \hline
2296  * & 1/2 & 1/2 \end{array}
2297  * \f]
2298  * \f[
2299  * \gamma = \left\{ \begin{array}{cc}
2300  * (2\pm \sqrt{2})/2 & \mbox{then 2nd order and L-stable} \\
2301  * (3\pm \sqrt{3})/6 & \mbox{then 3rd order and A-stable}
2302  * \end{array} \right.
2303  * \f]
2304  * The default value is \f$\gamma = (3 + \sqrt{3})/6\f$.
2305  *
2306  * Reference: E. Hairer, S. P. Norsett, and G. Wanner,
2307  * Solving Ordinary Differential Equations I:
2308  * Nonstiff Problems, 2nd Revised Edition,
2309  * Table 7.2, pg 207.
2310  */
2311 template<class Scalar>
2313  virtual public StepperDIRK<Scalar>
2314 {
2315 public:
2316  /** \brief Default constructor.
2317  *
2318  * Requires subsequent setModel() and initialize()
2319  * calls before calling takestep().
2320  */
2322  {
2323  typedef Teuchos::ScalarTraits<Scalar> ST;
2324  using Teuchos::as;
2325  const Scalar one = ST::one();
2326  gammaDefault_ = as<Scalar>((3*one+ST::squareroot(3*one))/(6*one));
2327  gammaTypeDefault_ = "3rd Order A-stable";
2328 
2329  this->setStepperType("SDIRK 2 Stage 3rd order");
2330  this->setGammaType(gammaTypeDefault_);
2331  this->setGamma(gammaDefault_);
2332  this->setupTableau();
2333  this->setupDefault();
2334  }
2335 
2336 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2338  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2339  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2340  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2341  bool useFSAL,
2342  std::string ICConsistency,
2343  bool ICConsistencyCheck,
2344  bool useEmbedded,
2345  bool zeroInitialGuess,
2346  std::string gammaType = "3rd Order A-stable",
2347  Scalar gamma = Scalar(0.7886751345948128))
2348  {
2349  typedef Teuchos::ScalarTraits<Scalar> ST;
2350  using Teuchos::as;
2351  const Scalar one = ST::one();
2352  gammaDefault_ = as<Scalar>((3*one+ST::squareroot(3*one))/(6*one));
2353  gammaTypeDefault_ = "3rd Order A-stable";
2354 
2355  this->setStepperType("SDIRK 2 Stage 3rd order");
2356  this->setGammaType(gammaType);
2357  this->setGamma(gamma);
2358  this->setupTableau();
2359  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2360  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2361  }
2362 #endif
2364  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2365  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2366  bool useFSAL,
2367  std::string ICConsistency,
2368  bool ICConsistencyCheck,
2369  bool useEmbedded,
2370  bool zeroInitialGuess,
2371  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2372  std::string gammaType = "3rd Order A-stable",
2373  Scalar gamma = Scalar(0.7886751345948128))
2374  {
2375  typedef Teuchos::ScalarTraits<Scalar> ST;
2376  using Teuchos::as;
2377  const Scalar one = ST::one();
2378  gammaDefault_ = as<Scalar>((3*one+ST::squareroot(3*one))/(6*one));
2379  gammaTypeDefault_ = "3rd Order A-stable";
2380 
2381  this->setStepperType("SDIRK 2 Stage 3rd order");
2382  this->setGammaType(gammaType);
2383  this->setGamma(gamma);
2384  this->setupTableau();
2385  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2386  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2387  }
2388 
2389  void setGammaType(std::string gammaType)
2390  {
2391  TEUCHOS_TEST_FOR_EXCEPTION(
2392  !(gammaType == "3rd Order A-stable" or
2393  gammaType == "2nd Order L-stable" or
2394  gammaType == "gamma"), std::logic_error,
2395  "gammaType needs to be '3rd Order A-stable', '2nd Order L-stable' "
2396  "or 'gamma'.");
2397 
2398  gammaType_ = gammaType;
2399  this->isInitialized_ = false;
2400  this->setupTableau();
2401  }
2402 
2403  std::string getGammaType() { return gammaType_; }
2404 
2405  void setGamma(Scalar gamma)
2406  {
2407  if ( gammaType_ == "gamma" ) {
2408  gamma_ = gamma;
2409  this->setupTableau();
2410  }
2411  this->isInitialized_ = false;
2412  }
2413 
2414  Scalar getGamma() { return gamma_; }
2415 
2416  std::string getDescription() const
2417  {
2418  std::ostringstream Description;
2419  Description << this->getStepperType() << "\n"
2420  << "Solving Ordinary Differential Equations I:\n"
2421  << "Nonstiff Problems, 2nd Revised Edition\n"
2422  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2423  << "Table 7.2, pg 207\n"
2424  << "gamma = (3+sqrt(3))/6 -> 3rd order and A-stable\n"
2425  << "gamma = (2-sqrt(2))/2 -> 2nd order and L-stable\n"
2426  << "c = [ gamma 1-gamma ]'\n"
2427  << "A = [ gamma 0 ]\n"
2428  << " [ 1-2*gamma gamma ]\n"
2429  << "b = [ 1/2 1/2 ]'";
2430  return Description.str();
2431  }
2432 
2433  Teuchos::RCP<const Teuchos::ParameterList>
2435  {
2436  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2437  this->getValidParametersBasicDIRK(pl);
2438 
2439  pl->set<bool>("Initial Condition Consistency Check", false);
2440  pl->set<std::string>("Gamma Type", gammaTypeDefault_,
2441  "Valid values are '3rd Order A-stable' ((3+sqrt(3))/6.), "
2442  "'2nd Order L-stable' ((2-sqrt(2))/2) and 'gamma' (user defined). "
2443  "The default value is '3rd Order A-stable'.");
2444  pl->set<double>("gamma", gammaDefault_,
2445  "Equal to (3+sqrt(3))/6 if 'Gamma Type' = '3rd Order A-stable', or "
2446  "(2-sqrt(2))/2 if 'Gamma Type' = '2nd Order L-stable', or "
2447  "user-defined gamma value if 'Gamma Type = 'gamma'. "
2448  "The default value is gamma = (3+sqrt(3))/6, which matches "
2449  "the default 'Gamma Type' = '3rd Order A-stable'.");
2450 
2451  return pl;
2452  }
2453 
2454 protected:
2455 
2457  {
2458  typedef Teuchos::ScalarTraits<Scalar> ST;
2459  using Teuchos::as;
2460  int NumStages = 2;
2461  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2462  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2463  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2464  const Scalar one = ST::one();
2465  const Scalar zero = ST::zero();
2466 
2467  int order = 0;
2468  if (gammaType_ == "3rd Order A-stable") {
2469  order = 3;
2471  } else if (gammaType_ == "2nd Order L-stable") {
2472  order = 2;
2473  gamma_ = as<Scalar>( (2*one - ST::squareroot(2*one))/(2*one) );
2474  } else if (gammaType_ == "gamma") {
2475  order = 2;
2476  }
2477 
2478  // Fill A:
2479  A(0,0) = gamma_; A(0,1) = zero;
2480  A(1,0) = as<Scalar>(one - 2*gamma_); A(1,1) = gamma_;
2481 
2482  // Fill b:
2483  b(0) = as<Scalar>( one/(2*one) ); b(1) = as<Scalar>( one/(2*one) );
2484 
2485  // Fill c:
2486  c(0) = gamma_; c(1) = as<Scalar>( one - gamma_ );
2487 
2488  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2489  this->getStepperType(),A,b,c,order,2,3));
2490  }
2491 
2492  private:
2493  std::string gammaTypeDefault_;
2494  std::string gammaType_;
2496  Scalar gamma_;
2497 };
2498 
2499 
2500 // ----------------------------------------------------------------------------
2501 /** \brief EDIRK 2 Stage 3rd order
2502  *
2503  * The tableau (order=3) is
2504  * \f[
2505  * \begin{array}{c|c}
2506  * c & A \\ \hline
2507  * & b^T
2508  * \end{array}
2509  * \;\;\;\;\mbox{ where }\;\;\;\;
2510  * \begin{array}{c|cc} 0 & 0 & \\
2511  * 2/3 & 1/3 & 1/3 \\ \hline
2512  * & 1/4 & 3/4 \end{array}
2513  * \f]
2514  * Reference: E. Hairer, S. P. Norsett, and G. Wanner,
2515  * Solving Ordinary Differential Equations I:
2516  * Nonstiff Problems, 2nd Revised Edition,
2517  * Table 7.1, pg 205.
2518  */
2519 template<class Scalar>
2521  virtual public StepperDIRK<Scalar>
2522 {
2523 public:
2524  /** \brief Default constructor.
2525  *
2526  * Requires subsequent setModel() and initialize()
2527  * calls before calling takestep().
2528  */
2530  {
2531  this->setStepperType("EDIRK 2 Stage 3rd order");
2532  this->setupTableau();
2533  this->setupDefault();
2534  }
2535 
2536 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2538  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2539  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2540  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2541  bool useFSAL,
2542  std::string ICConsistency,
2543  bool ICConsistencyCheck,
2544  bool useEmbedded,
2545  bool zeroInitialGuess)
2546  {
2547  this->setStepperType("EDIRK 2 Stage 3rd order");
2548  this->setupTableau();
2549  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2550  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2551  }
2552 #endif
2554  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2555  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2556  bool useFSAL,
2557  std::string ICConsistency,
2558  bool ICConsistencyCheck,
2559  bool useEmbedded,
2560  bool zeroInitialGuess,
2561  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2562  {
2563  this->setStepperType("EDIRK 2 Stage 3rd order");
2564  this->setupTableau();
2565  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2566  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2567  }
2568 
2569  std::string getDescription() const
2570  {
2571  std::ostringstream Description;
2572  Description << this->getStepperType() << "\n"
2573  << "Hammer & Hollingsworth method\n"
2574  << "Solving Ordinary Differential Equations I:\n"
2575  << "Nonstiff Problems, 2nd Revised Edition\n"
2576  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2577  << "Table 7.1, pg 205\n"
2578  << "c = [ 0 2/3 ]'\n"
2579  << "A = [ 0 0 ]\n"
2580  << " [ 1/3 1/3 ]\n"
2581  << "b = [ 1/4 3/4 ]'";
2582  return Description.str();
2583  }
2584 
2585  virtual bool getICConsistencyCheckDefault() const { return false; }
2586 
2587  Teuchos::RCP<const Teuchos::ParameterList>
2589  {
2590  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2591  this->getValidParametersBasicDIRK(pl);
2592  pl->set<bool>("Initial Condition Consistency Check",
2594  return pl;
2595  }
2596 
2597 protected:
2598 
2600  {
2601  typedef Teuchos::ScalarTraits<Scalar> ST;
2602  using Teuchos::as;
2603  int NumStages = 2;
2604  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2605  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2606  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2607  const Scalar one = ST::one();
2608  const Scalar zero = ST::zero();
2609 
2610  // Fill A:
2611  A(0,0) = zero; A(0,1) = zero;
2612  A(1,0) = as<Scalar>( one/(3*one) ); A(1,1) = as<Scalar>( one/(3*one) );
2613 
2614  // Fill b:
2615  b(0) = as<Scalar>( one/(4*one) ); b(1) = as<Scalar>( 3*one/(4*one) );
2616 
2617  // Fill c:
2618  c(0) = zero; c(1) = as<Scalar>( 2*one/(3*one) );
2619  int order = 3;
2620 
2621  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2622  this->getStepperType(),A,b,c,order,order,order));
2623  }
2624 };
2625 
2626 
2627 // ----------------------------------------------------------------------------
2628 /** \brief SDIRK 1 Stage Theta
2629  *
2630  * The tableau (order = 1 or 2) is
2631  * \f[
2632  * \begin{array}{c|c}
2633  * c & A \\ \hline
2634  * & b^T
2635  * \end{array}
2636  * \;\;\;\;\mbox{ where }\;\;\;\;
2637  * \begin{array}{c|c} \theta & \theta \\
2638  * & 1 \end{array}
2639  * \f]
2640  * Valid values are \f$0 < \theta \leq 1\f$, where \f$\theta\f$ = 0
2641  * implies Forward Euler (not avialble with this stepepr as it makes it
2642  * explicit), \f$theta\f$ = 1/2 implies implicit midpoint
2643  * method (default), and \f$theta\f$ = 1 implies Backward Euler.
2644  * For \f$theta\f$ != 1/2, this method is first-order accurate,
2645  * and with \f$theta\f$ = 1/2, it is second-order accurate.
2646  * This method is A-stable, but becomes L-stable with \f$theta\f$ = 1.
2647  * (A.K.A. Generalized Implicit Midpoint Method.)
2648  *
2649  * Reference: Non-standard finite-difference methods
2650  * in dynamical systems, P. Kama,
2651  * Dissertation, University of Pretoria, pg. 49.
2652  */
2653 template<class Scalar>
2655  virtual public StepperDIRK<Scalar>
2656 {
2657 public:
2658  /** \brief Default constructor.
2659  *
2660  * Requires subsequent setModel() and initialize()
2661  * calls before calling takestep().
2662  */
2664  {
2665  typedef Teuchos::ScalarTraits<Scalar> ST;
2666  thetaDefault_ = ST::one()/(2*ST::one());
2667 
2668  this->setStepperType("DIRK 1 Stage Theta Method");
2669  this->setTheta(thetaDefault_);
2670  this->setupTableau();
2671  this->setupDefault();
2672  }
2673 
2674 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2676  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2677  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2678  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2679  bool useFSAL,
2680  std::string ICConsistency,
2681  bool ICConsistencyCheck,
2682  bool useEmbedded,
2683  bool zeroInitialGuess,
2684  Scalar theta = Scalar(0.5))
2685  {
2686  typedef Teuchos::ScalarTraits<Scalar> ST;
2687  thetaDefault_ = ST::one()/(2*ST::one());
2688 
2689  this->setStepperType("DIRK 1 Stage Theta Method");
2690  this->setTheta(theta);
2691  this->setupTableau();
2692  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2693  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2694  }
2695 #endif
2697  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2698  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2699  bool useFSAL,
2700  std::string ICConsistency,
2701  bool ICConsistencyCheck,
2702  bool useEmbedded,
2703  bool zeroInitialGuess,
2704  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2705  Scalar theta = Scalar(0.5))
2706  {
2707  typedef Teuchos::ScalarTraits<Scalar> ST;
2708  thetaDefault_ = ST::one()/(2*ST::one());
2709 
2710  this->setStepperType("DIRK 1 Stage Theta Method");
2711  this->setTheta(theta);
2712  this->setupTableau();
2713  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2714  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2715  }
2716 
2717  void setTheta(Scalar theta)
2718  {
2719  TEUCHOS_TEST_FOR_EXCEPTION(
2720  theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
2721  "'theta' can not be zero, as it makes this stepper explicit. \n"
2722  "Try using the 'RK Forward Euler' stepper.\n");
2723  theta_ = theta;
2724  this->setupTableau();
2725  this->isInitialized_ = false;
2726  }
2727 
2728  Scalar getTheta() { return theta_; }
2729 
2730  std::string getDescription() const
2731  {
2732  std::ostringstream Description;
2733  Description << this->getStepperType() << "\n"
2734  << "Non-standard finite-difference methods\n"
2735  << "in dynamical systems, P. Kama,\n"
2736  << "Dissertation, University of Pretoria, pg. 49.\n"
2737  << "Comment: Generalized Implicit Midpoint Method\n"
2738  << "c = [ theta ]'\n"
2739  << "A = [ theta ]\n"
2740  << "b = [ 1 ]'";
2741  return Description.str();
2742  }
2743 
2744  virtual bool getICConsistencyCheckDefault() const { return false; }
2745 
2746  Teuchos::RCP<const Teuchos::ParameterList>
2748  {
2749  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2750  this->getValidParametersBasicDIRK(pl);
2751 
2752  pl->set<bool>("Initial Condition Consistency Check",
2754  pl->set<double>("theta",thetaDefault_,
2755  "Valid values are 0 <= theta <= 1, where theta = 0 "
2756  "implies Forward Euler, theta = 1/2 implies implicit midpoint "
2757  "method (default), and theta = 1 implies Backward Euler. "
2758  "For theta != 1/2, this method is first-order accurate, "
2759  "and with theta = 1/2, it is second-order accurate. "
2760  "This method is A-stable, but becomes L-stable with theta=1.");
2761 
2762  return pl;
2763  }
2764 
2765 protected:
2766 
2768  {
2769  typedef Teuchos::ScalarTraits<Scalar> ST;
2770  int NumStages = 1;
2771  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2772  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2773  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2774  A(0,0) = theta_;
2775  b(0) = ST::one();
2776  c(0) = theta_;
2777 
2778  int order = 1;
2779  if ( std::abs((theta_-thetaDefault_)/theta_) < 1.0e-08 ) order = 2;
2780 
2781  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2782  this->getStepperType(),A,b,c,order,1,2));
2783  }
2784 
2785  private:
2787  Scalar theta_;
2788 };
2789 
2790 
2791 // ----------------------------------------------------------------------------
2792 /** \brief EDIRK 2 Stage Theta Method
2793  *
2794  * The tableau (order=3) is
2795  * \f[
2796  * \begin{array}{c|c}
2797  * c & A \\ \hline
2798  * & b^T
2799  * \end{array}
2800  * \;\;\;\;\mbox{ where }\;\;\;\;
2801  * \begin{array}{c|cc} 0 & 0 & \\
2802  * 1 & 1-\theta & \theta \\ \hline
2803  * & 1-\theta & \theta \end{array}
2804  * \f]
2805  * Valid values are \f$0 < \theta <= 1\f$, where \f$\theta\f$ = 0
2806  * implies Forward Euler (not avialble with this stepepr as it makes it
2807  * explicit), \f$\theta\f$ = 1/2 implies trapezoidal
2808  * method (default), and \f$\theta\f$ = 1 implies Backward Euler.
2809  * For \f$\theta\f$ != 1/2, this method is first-order accurate,
2810  * and with \f$\theta\f$ = 1/2, it is second-order accurate.
2811  * This method is A-stable, but becomes L-stable with \f$\theta\f$=1.
2812  *
2813  * Reference: Computer Methods for ODEs and DAEs,
2814  * U. M. Ascher and L. R. Petzold, p. 113.
2815  */
2816 template<class Scalar>
2818  virtual public StepperDIRK<Scalar>
2819 {
2820 public:
2821  /** \brief Default constructor.
2822  *
2823  * Requires subsequent setModel() and initialize()
2824  * calls before calling takestep().
2825  */
2827  {
2828  typedef Teuchos::ScalarTraits<Scalar> ST;
2829  thetaDefault_ = ST::one()/(2*ST::one());
2830 
2831  this->setStepperType("EDIRK 2 Stage Theta Method");
2832  this->setTheta(thetaDefault_);
2833  this->setupTableau();
2834  this->setupDefault();
2835  }
2836 
2837 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
2839  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2840  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
2841  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2842  bool useFSAL,
2843  std::string ICConsistency,
2844  bool ICConsistencyCheck,
2845  bool useEmbedded,
2846  bool zeroInitialGuess,
2847  Scalar theta = Scalar(0.5))
2848  {
2849  typedef Teuchos::ScalarTraits<Scalar> ST;
2850  thetaDefault_ = ST::one()/(2*ST::one());
2851 
2852  this->setStepperType("EDIRK 2 Stage Theta Method");
2853  this->setTheta(theta);
2854  this->setupTableau();
2855  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
2856  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
2857  }
2858 #endif
2860  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2861  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2862  bool useFSAL,
2863  std::string ICConsistency,
2864  bool ICConsistencyCheck,
2865  bool useEmbedded,
2866  bool zeroInitialGuess,
2867  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2868  Scalar theta = Scalar(0.5))
2869  {
2870  typedef Teuchos::ScalarTraits<Scalar> ST;
2871  thetaDefault_ = ST::one()/(2*ST::one());
2872 
2873  this->setStepperType("EDIRK 2 Stage Theta Method");
2874  this->setTheta(theta);
2875  this->setupTableau();
2876  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2877  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2878  }
2879 
2880  void setTheta(Scalar theta)
2881  {
2882  TEUCHOS_TEST_FOR_EXCEPTION(
2883  theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
2884  "'theta' can not be zero, as it makes this stepper explicit. \n"
2885  "Try using the 'RK Forward Euler' stepper.\n");
2886  theta_ = theta;
2887  this->isInitialized_ = false;
2888  this->setupTableau();
2889  }
2890 
2891  Scalar getTheta() { return theta_; }
2892 
2893  std::string getDescription() const
2894  {
2895  std::ostringstream Description;
2896  Description << this->getStepperType() << "\n"
2897  << "Computer Methods for ODEs and DAEs\n"
2898  << "U. M. Ascher and L. R. Petzold\n"
2899  << "p. 113\n"
2900  << "c = [ 0 1 ]'\n"
2901  << "A = [ 0 0 ]\n"
2902  << " [ 1-theta theta ]\n"
2903  << "b = [ 1-theta theta ]'";
2904  return Description.str();
2905  }
2906 
2907  virtual bool getICConsistencyCheckDefault() const { return false; }
2908 
2909  Teuchos::RCP<const Teuchos::ParameterList>
2911  {
2912  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2913  this->getValidParametersBasicDIRK(pl);
2914 
2915  pl->set<bool>("Initial Condition Consistency Check", false);
2916  pl->set<double>("theta",thetaDefault_,
2917  "Valid values are 0 < theta <= 1, where theta = 0 "
2918  "implies Forward Euler, theta = 1/2 implies trapezoidal "
2919  "method (default), and theta = 1 implies Backward Euler. "
2920  "For theta != 1/2, this method is first-order accurate, "
2921  "and with theta = 1/2, it is second-order accurate. "
2922  "This method is A-stable, but becomes L-stable with theta=1.");
2923 
2924  return pl;
2925  }
2926 
2927 protected:
2928 
2930  {
2931  typedef Teuchos::ScalarTraits<Scalar> ST;
2932  const Scalar one = ST::one();
2933  const Scalar zero = ST::zero();
2934 
2935  int NumStages = 2;
2936  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2937  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
2938  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
2939 
2940  // Fill A:
2941  A(0,0) = zero; A(0,1) = zero;
2942  A(1,0) = Teuchos::as<Scalar>( one - theta_ ); A(1,1) = theta_;
2943 
2944  // Fill b:
2945  b(0) = Teuchos::as<Scalar>( one - theta_ );
2946  b(1) = theta_;
2947 
2948  // Fill c:
2949  c(0) = zero;
2950  c(1) = one;
2951 
2952  int order = 1;
2953  if ( std::abs((theta_-thetaDefault_)/theta_) < 1.0e-08 ) order = 2;
2954 
2955  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2956  this->getStepperType(),A,b,c,order,1,2));
2957  }
2958 
2959  private:
2961  Scalar theta_;
2962 };
2963 
2964 
2965 // ----------------------------------------------------------------------------
2966 /** \brief RK Trapezoidal Rule (A.K.A. RK Crank-Nicolson)
2967  *
2968  * The tableau (order=3) is
2969  * \f[
2970  * \begin{array}{c|c}
2971  * c & A \\ \hline
2972  * & b^T
2973  * \end{array}
2974  * \;\;\;\;\mbox{ where }\;\;\;\;
2975  * \begin{array}{c|cc} 0 & 0 & \\
2976  * 1 & 1/2 & 1/2 \\ \hline
2977  * & 1/2 & 1/2 \end{array}
2978  * \f]
2979  * It is second-order accurate and A-stable.
2980  *
2981  * Reference: Computer Methods for ODEs and DAEs,
2982  * U. M. Ascher and L. R. Petzold, p. 113.
2983  */
2984 template<class Scalar>
2986  virtual public StepperDIRK<Scalar>
2987 {
2988 public:
2989  /** \brief Default constructor.
2990  *
2991  * Requires subsequent setModel() and initialize()
2992  * calls before calling takestep().
2993  */
2995  {
2996  this->setStepperType("RK Trapezoidal Rule");
2997  this->setupTableau();
2998  this->setupDefault();
2999  }
3000 
3001 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3003  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3004  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3005  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3006  bool useFSAL,
3007  std::string ICConsistency,
3008  bool ICConsistencyCheck,
3009  bool useEmbedded,
3010  bool zeroInitialGuess)
3011  {
3012  this->setStepperType("RK Trapezoidal Rule");
3013  this->setupTableau();
3014  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3015  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3016  }
3017 #endif
3019  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3020  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3021  bool useFSAL,
3022  std::string ICConsistency,
3023  bool ICConsistencyCheck,
3024  bool useEmbedded,
3025  bool zeroInitialGuess,
3026  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3027  {
3028  this->setStepperType("RK Trapezoidal Rule");
3029  this->setupTableau();
3030  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3031  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3032  }
3033 
3034  std::string getDescription() const
3035  {
3036  std::ostringstream Description;
3037  Description << this->getStepperType() << "\n"
3038  << "Also known as Crank-Nicolson Method.\n"
3039  << "c = [ 0 1 ]'\n"
3040  << "A = [ 0 0 ]\n"
3041  << " [ 1/2 1/2 ]\n"
3042  << "b = [ 1/2 1/2 ]'";
3043  return Description.str();
3044  }
3045 
3046  virtual bool getICConsistencyCheckDefault() const { return false; }
3047 
3048  Teuchos::RCP<const Teuchos::ParameterList>
3050  {
3051  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3052  this->getValidParametersBasicDIRK(pl);
3053  pl->set<bool>("Initial Condition Consistency Check",
3055  return pl;
3056  }
3057 
3058 protected:
3059 
3061  {
3062  typedef Teuchos::ScalarTraits<Scalar> ST;
3063  const Scalar one = ST::one();
3064  const Scalar zero = ST::zero();
3065  const Scalar onehalf = ST::one()/(2*ST::one());
3066 
3067  int NumStages = 2;
3068  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3069  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3070  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3071 
3072  // Fill A:
3073  A(0,0) = zero; A(0,1) = zero;
3074  A(1,0) = onehalf; A(1,1) = onehalf;
3075 
3076  // Fill b:
3077  b(0) = onehalf;
3078  b(1) = onehalf;
3079 
3080  // Fill c:
3081  c(0) = zero;
3082  c(1) = one;
3083 
3084  int order = 2;
3085 
3086  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3087  this->getStepperType(),A,b,c,order,order,order));
3088  }
3089 };
3090 
3091 
3092 // ----------------------------------------------------------------------------
3093 /** \brief SDIRK Implicit Midpoint
3094  *
3095  * The tableau (order = 1 or 2) is
3096  * \f[
3097  * \begin{array}{c|c}
3098  * c & A \\ \hline
3099  * & b^T
3100  * \end{array}
3101  * \;\;\;\;\mbox{ where }\;\;\;\;
3102  * \begin{array}{c|c} 1/2 & 1/2 \\ \hline
3103  * & 1 \end{array}
3104  * \f]
3105  * Implicit midpoint method is second-order accurate, and is A-stable.
3106  *
3107  * Reference: Solving Ordinary Differential Equations II:
3108  * Stiff and Differential-Algebraic Problems,
3109  * 2nd Revised Edition, E. Hairer and G. Wanner,
3110  * Table 5.2, pg 72.
3111  *
3112  * Solving Ordinary Differential Equations I:
3113  * Nonstiff Problems, 2nd Revised Edition,
3114  * E. Hairer, S. P. Norsett, and G. Wanner,
3115  * Table 7.1, pg 205,
3116  */
3117 template<class Scalar>
3119  virtual public StepperDIRK<Scalar>
3120 {
3121 public:
3122  /** \brief Default constructor.
3123  *
3124  * Requires subsequent setModel() and initialize()
3125  * calls before calling takestep().
3126  */
3128  {
3129  this->setStepperType("RK Implicit Midpoint");
3130  this->setupTableau();
3131  this->setupDefault();
3132  }
3133 
3134 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3136  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3137  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3138  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3139  bool useFSAL,
3140  std::string ICConsistency,
3141  bool ICConsistencyCheck,
3142  bool useEmbedded,
3143  bool zeroInitialGuess)
3144  {
3145  this->setStepperType("RK Implicit Midpoint");
3146  this->setupTableau();
3147  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3148  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3149  }
3150 #endif
3152  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3153  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3154  bool useFSAL,
3155  std::string ICConsistency,
3156  bool ICConsistencyCheck,
3157  bool useEmbedded,
3158  bool zeroInitialGuess,
3159  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3160  {
3161  this->setStepperType("RK Implicit Midpoint");
3162  this->setupTableau();
3163  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3164  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3165  }
3166 
3167  std::string getDescription() const
3168  {
3169  std::ostringstream Description;
3170  Description << this->getStepperType() << "\n"
3171  << "A-stable\n"
3172  << "Solving Ordinary Differential Equations II:\n"
3173  << "Stiff and Differential-Algebraic Problems,\n"
3174  << "2nd Revised Edition\n"
3175  << "E. Hairer and G. Wanner\n"
3176  << "Table 5.2, pg 72\n"
3177  << "Solving Ordinary Differential Equations I:\n"
3178  << "Nonstiff Problems, 2nd Revised Edition\n"
3179  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
3180  << "Table 7.1, pg 205\n"
3181  << "c = [ 1/2 ]'\n"
3182  << "A = [ 1/2 ]\n"
3183  << "b = [ 1 ]'";
3184  return Description.str();
3185  }
3186 
3187  virtual bool getICConsistencyCheckDefault() const { return false; }
3188 
3189  Teuchos::RCP<const Teuchos::ParameterList>
3191  {
3192  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3193  this->getValidParametersBasicDIRK(pl);
3194  pl->set<bool>("Initial Condition Consistency Check",
3196  return pl;
3197  }
3198 
3199 protected:
3200 
3202  {
3203  typedef Teuchos::ScalarTraits<Scalar> ST;
3204  int NumStages = 1;
3205  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3206  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3207  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3208  const Scalar onehalf = ST::one()/(2*ST::one());
3209  const Scalar one = ST::one();
3210 
3211  // Fill A:
3212  A(0,0) = onehalf;
3213 
3214  // Fill b:
3215  b(0) = one;
3216 
3217  // Fill c:
3218  c(0) = onehalf;
3219 
3220  int order = 2;
3221 
3222  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3223  this->getStepperType(),A,b,c,order,order,order));
3224  }
3225 };
3226 
3227 
3228 // ----------------------------------------------------------------------------
3229 /** \brief Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau
3230  *
3231  * The tableau (stage=2, order=2) is
3232  * \f[
3233  * \begin{array}{c|c}
3234  * c & A \\ \hline
3235  * & b^T \\
3236  * & \hat{b}^T
3237  * \end{array}
3238  * \;\;\;\;\mbox{ where }\;\;\;\;
3239  * \begin{array}{c|cccc} 1/4 & 1/4 & \\
3240  * 3/4 & 1/2 & 1/4 \\ \hline
3241  * & 1/2 & 1/2 \end{array}
3242  * \f]
3243  * Reference: Gottlieb, S., Ketcheson, D.I., Shu, C.-W.
3244  * Strong Stability Preserving Runge–Kutta and Multistep Time Discretizations.
3245  * World Scientific Press, London (2011)
3246  */
3247 template<class Scalar>
3249  virtual public StepperDIRK<Scalar>
3250 {
3251  public:
3253  {
3254  this->setStepperType("SSPDIRK22");
3255  this->setupTableau();
3256  this->setupDefault();
3257  }
3258 
3259 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3261  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3262  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3263  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3264  bool useFSAL,
3265  std::string ICConsistency,
3266  bool ICConsistencyCheck,
3267  bool useEmbedded,
3268  bool zeroInitialGuess)
3269  {
3270  this->setStepperType("SSPDIRK22");
3271  this->setupTableau();
3272  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3273  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3274  }
3275 #endif
3277  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3278  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3279  bool useFSAL,
3280  std::string ICConsistency,
3281  bool ICConsistencyCheck,
3282  bool useEmbedded,
3283  bool zeroInitialGuess,
3284  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3285  {
3286  this->setStepperType("SSPDIRK22");
3287  this->setupTableau();
3288  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3289  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3290  }
3291 
3292  std::string getDescription() const
3293  {
3294  std::ostringstream Description;
3295  Description << this->getStepperType() << "\n"
3296  << "Strong Stability Preserving Diagonally-Implicit RK (stage=2, order=2)\n"
3297  << "SSP-Coef = 4\n"
3298  << "c = [ 1/4 3/4 ]'\n"
3299  << "A = [ 1/4 ]\n"
3300  << " [ 1/2 1/4 ]\n"
3301  << "b = [ 1/2 1/2 ]\n" << std::endl;
3302  return Description.str();
3303  }
3304 
3305  virtual bool getICConsistencyCheckDefault() const { return false; }
3306 
3307  Teuchos::RCP<const Teuchos::ParameterList>
3309  {
3310  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3311  this->getValidParametersBasicDIRK(pl);
3312  pl->set<bool>("Initial Condition Consistency Check",
3314  return pl;
3315  }
3316 
3317 protected:
3318 
3320  {
3321  typedef Teuchos::ScalarTraits<Scalar> ST;
3322  using Teuchos::as;
3323  const int NumStages = 2;
3324  const int order = 2;
3325  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3326  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3327  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3328 
3329  const Scalar one = ST::one();
3330  const Scalar zero = ST::zero();
3331  const Scalar onehalf = one/(2*one);
3332  const Scalar onefourth = one/(4*one);
3333 
3334  // Fill A:
3335  A(0,0) = A(1,1) = onefourth;
3336  A(0,1) = zero;
3337  A(1,0) = onehalf;
3338 
3339  // Fill b:
3340  b(0) = b(1) = onehalf;
3341 
3342  // Fill c:
3343  c(0) = A(0,0);
3344  c(1) = A(1,0) + A(1,1);
3345 
3346  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3347  this->getStepperType(),A,b,c,order,order,order));
3348  }
3349 };
3350 
3351 
3352 // ----------------------------------------------------------------------------
3353 /** \brief Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau
3354  *
3355  * The tableau (stage=3, order=2) is
3356  * \f[
3357  * \begin{array}{c|c}
3358  * c & A \\ \hline
3359  * & b^T \\
3360  * & \hat{b}^T
3361  * \end{array}
3362  * \;\;\;\;\mbox{ where }\;\;\;\;
3363  * \begin{array}{c|cccc} 1/6 & 1/6 & \\
3364  * 1/2 & 1/3 & 1/6 & \\
3365  * 5/6 & 1/3 & 1/3 & 1/3 \\ \hline
3366  * & 1/3 & 1/3 & 1/3 \end{array}
3367  * \f]
3368  * Reference: Gottlieb, S., Ketcheson, D.I., Shu, C.-W.
3369  * Strong Stability Preserving Runge–Kutta and Multistep Time Discretizations.
3370  * World Scientific Press, London (2011)
3371  */
3372 template<class Scalar>
3374  virtual public StepperDIRK<Scalar>
3375 {
3376  public:
3378  {
3379  this->setStepperType("SSPDIRK32");
3380  this->setupTableau();
3381  this->setupDefault();
3382  }
3383 
3384 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3386  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3387  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3388  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3389  bool useFSAL,
3390  std::string ICConsistency,
3391  bool ICConsistencyCheck,
3392  bool useEmbedded,
3393  bool zeroInitialGuess)
3394  {
3395  this->setStepperType("SSPDIRK32");
3396  this->setupTableau();
3397  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3398  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3399  }
3400 #endif
3402  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3403  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3404  bool useFSAL,
3405  std::string ICConsistency,
3406  bool ICConsistencyCheck,
3407  bool useEmbedded,
3408  bool zeroInitialGuess,
3409  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3410  {
3411  this->setStepperType("SSPDIRK32");
3412  this->setupTableau();
3413  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3414  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3415  }
3416 
3417  std::string getDescription() const
3418  {
3419  std::ostringstream Description;
3420  Description << this->getStepperType() << "\n"
3421  << "Strong Stability Preserving Diagonally-Implicit RK (stage=3, order=2)\n"
3422  << "SSP-Coef = 6\n"
3423  << "c = [ 1/6 1/2 5/6 ]'\n"
3424  << "A = [ 1/6 ]\n"
3425  << " [ 1/3 1/6 ]\n"
3426  << " [ 1/3 1/3 1/6 ]\n"
3427  << "b = [ 1/3 1/3 1/3 ]\n" << std::endl;
3428  return Description.str();
3429  }
3430 
3431  virtual bool getICConsistencyCheckDefault() const { return false; }
3432 
3433  Teuchos::RCP<const Teuchos::ParameterList>
3435  {
3436  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3437  this->getValidParametersBasicDIRK(pl);
3438  pl->set<bool>("Initial Condition Consistency Check",
3440  return pl;
3441  }
3442 
3443 protected:
3444 
3446  {
3447 
3448  typedef Teuchos::ScalarTraits<Scalar> ST;
3449  using Teuchos::as;
3450  const int NumStages = 3;
3451  const int order = 2;
3452  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3453  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3454  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3455 
3456  const Scalar one = ST::one();
3457  const Scalar zero = ST::zero();
3458  const Scalar onethird = one/(3*one);
3459  const Scalar onesixth = one/(6*one);
3460 
3461  // Fill A:
3462  A(0,0) = A(1,1) = A(2,2) = onesixth;
3463  A(1,0) = A(2,0) = A(2,1) = onethird;
3464  A(0,1) = A(0,2) = A(1,2) = zero;
3465 
3466  // Fill b:
3467  b(0) = b(1) = b(2) = onethird;
3468 
3469  // Fill c:
3470  c(0) = A(0,0);
3471  c(1) = A(1,0) + A(1,1);
3472  c(2) = A(2,0) + A(2,1) + A(2,2);
3473 
3474  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3475  this->getStepperType(),A,b,c,order,order,order));
3476  }
3477 };
3478 
3479 
3480 // ----------------------------------------------------------------------------
3481 /** \brief Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau
3482  *
3483  * The tableau (stage=2, order=3) is
3484  * \f[
3485  * \begin{array}{c|c}
3486  * c & A \\ \hline
3487  * & b^T \\
3488  * & \hat{b}^T
3489  * \end{array}
3490  * \;\;\;\;\mbox{ where }\;\;\;\;
3491  * \begin{array}{c|cccc} 1/(3+\sqrt{3}) & 1/(3+\sqrt{3}) & \\
3492  * (1/6)(3+\sqrt{3}) & 1/\sqrt{3} & 1/(3+\sqrt{3}) \\ \hline
3493  * & 1/2 & 1/2 \end{array}
3494  * \f]
3495  * Reference: Gottlieb, S., Ketcheson, D.I., Shu, C.-W.
3496  * Strong Stability Preserving Runge–Kutta and Multistep Time Discretizations.
3497  * World Scientific Press, London (2011)
3498  */
3499 template<class Scalar>
3501  virtual public StepperDIRK<Scalar>
3502 {
3503  public:
3505  {
3506  this->setStepperType("SSPDIRK23");
3507  this->setupTableau();
3508  this->setupDefault();
3509  }
3510 
3511 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3513  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3514  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3515  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3516  bool useFSAL,
3517  std::string ICConsistency,
3518  bool ICConsistencyCheck,
3519  bool useEmbedded,
3520  bool zeroInitialGuess)
3521  {
3522  this->setStepperType("SSPDIRK23");
3523  this->setupTableau();
3524  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3525  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3526  }
3527 #endif
3529  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3530  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3531  bool useFSAL,
3532  std::string ICConsistency,
3533  bool ICConsistencyCheck,
3534  bool useEmbedded,
3535  bool zeroInitialGuess,
3536  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3537  {
3538  this->setStepperType("SSPDIRK23");
3539  this->setupTableau();
3540  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3541  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3542  }
3543 
3544  std::string getDescription() const
3545  {
3546  std::ostringstream Description;
3547  Description << this->getStepperType() << "\n"
3548  << "Strong Stability Preserving Diagonally-Implicit RK (stage=2, order=3)\n"
3549  << "SSP-Coef = 1 + sqrt( 3 )\n"
3550  << "c = [ 1/(3 + sqrt( 3 )) (1/6)(3 + sqrt( 3 )) ] '\n"
3551  << "A = [ 1/(3 + sqrt( 3 )) ] \n"
3552  << " [ 1/sqrt( 3 ) 1/(3 + sqrt( 3 )) ] \n"
3553  << "b = [ 1/2 1/2 ] \n" << std::endl;
3554  return Description.str();
3555  }
3556 
3557  virtual bool getICConsistencyCheckDefault() const { return false; }
3558 
3559  Teuchos::RCP<const Teuchos::ParameterList>
3561  {
3562  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3563  this->getValidParametersBasicDIRK(pl);
3564  pl->set<bool>("Initial Condition Consistency Check",
3566  return pl;
3567  }
3568 
3569 protected:
3570 
3572  {
3573 
3574  typedef Teuchos::ScalarTraits<Scalar> ST;
3575  using Teuchos::as;
3576  const int NumStages = 2;
3577  const int order = 3;
3578  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3579  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3580  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3581 
3582  const Scalar one = ST::one();
3583  const Scalar zero = ST::zero();
3584  const Scalar onehalf = one/(2*one);
3585  const Scalar rootthree = ST::squareroot(3*one);
3586 
3587  // Fill A:
3588  A(0,0) = A(1,1) = one/(3*one + rootthree);
3589  A(1,0) = one/rootthree;
3590  A(0,1) = zero;
3591 
3592  // Fill b:
3593  b(0) = b(1) = onehalf;
3594 
3595  // Fill c:
3596  c(0) = A(0,0);
3597  c(1) = A(1,0) + A(1,1);
3598 
3599  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3600  this->getStepperType(),A,b,c,order,order,order));
3601  }
3602 };
3603 
3604 
3605 // ----------------------------------------------------------------------------
3606 /** \brief Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau
3607  *
3608  * The tableau (stage=3, order=3) is
3609  * \f[
3610  * \begin{array}{c|c}
3611  * c & A \\ \hline
3612  * & b^T \\
3613  * & \hat{b}^T
3614  * \end{array}
3615  * \;\;\;\;\mbox{ where }\;\;\;\;
3616  * \begin{array}{c|cccc} 1/6 & 1/6 & \\
3617  * 1/2 & 1/3 & 1/6 & \\
3618  * 5/6 & 1/3 & 1/3 & 1/3 \\ \hline
3619  * & 1/3 & 1/3 & 1/3 \end{array}
3620  * \f]
3621  * Reference: Gottlieb, S., Ketcheson, D.I., Shu, C.-W.
3622  * Strong Stability Preserving Runge–Kutta and Multistep Time Discretizations.
3623  * World Scientific Press, London (2011)
3624  */
3625 template<class Scalar>
3627  virtual public StepperDIRK<Scalar>
3628 {
3629  public:
3631  {
3632  this->setStepperType("SSPDIRK33");
3633  this->setupTableau();
3634  this->setupDefault();
3635  }
3636 
3637 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3639  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3640  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3641  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3642  bool useFSAL,
3643  std::string ICConsistency,
3644  bool ICConsistencyCheck,
3645  bool useEmbedded,
3646  bool zeroInitialGuess)
3647  {
3648  this->setStepperType("SSPDIRK33");
3649  this->setupTableau();
3650  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3651  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3652  }
3653 #endif
3655  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3656  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3657  bool useFSAL,
3658  std::string ICConsistency,
3659  bool ICConsistencyCheck,
3660  bool useEmbedded,
3661  bool zeroInitialGuess,
3662  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3663  {
3664  this->setStepperType("SSPDIRK33");
3665  this->setupTableau();
3666  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3667  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3668  }
3669 
3670  std::string getDescription() const
3671  {
3672  std::ostringstream Description;
3673  Description << this->getStepperType() << "\n"
3674  << "Strong Stability Preserving Diagonally-Implicit RK (stage=3, order=3)\n"
3675  << "SSP-Coef = 2 + 2 sqrt(2)\n"
3676  << "c = [ 1/( 4 + 2 sqrt(2) 1/2 (1/4)(2 + sqrt(2) ] '\n"
3677  << "A = [ 1/( 4 + 2 sqrt(2) ] \n"
3678  << " [ 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) ] \n"
3679  << " [ 1/(2 sqrt(2) 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) ] \n"
3680  << "b = [ 1/3 1/3 1/3 ] \n"
3681  << std::endl;
3682  return Description.str();
3683  }
3684 
3685  virtual bool getICConsistencyCheckDefault() const { return false; }
3686 
3687  Teuchos::RCP<const Teuchos::ParameterList>
3689  {
3690  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3691  this->getValidParametersBasicDIRK(pl);
3692  pl->set<bool>("Initial Condition Consistency Check",
3694  return pl;
3695  }
3696 
3697 protected:
3698 
3700  {
3701 
3702  typedef Teuchos::ScalarTraits<Scalar> ST;
3703  using Teuchos::as;
3704  const int NumStages = 3;
3705  const int order = 3;
3706  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3707  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3708  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3709 
3710  const Scalar one = ST::one();
3711  const Scalar zero = ST::zero();
3712  const Scalar onethird = one/(3*one);
3713  const Scalar rootwo = ST::squareroot(2*one);
3714 
3715  // Fill A:
3716  A(0,0) = A(1,1) = A(2,2) = one / (4*one + 2*rootwo);
3717  A(1,0) = A(2,0) = A(2,1) = one / (2*rootwo);
3718  A(0,1) = A(0,2) = A(1,2) = zero;
3719 
3720  // Fill b:
3721  b(0) = b(1) = b(2) = onethird;
3722 
3723  // Fill c:
3724  c(0) = A(0,0);
3725  c(1) = A(1,0) + A(1,1);
3726  c(2) = A(2,0) + A(2,1) + A(2,2);
3727 
3728  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3729  this->getStepperType(),A,b,c,order,order,order));
3730  }
3731 };
3732 
3733 
3734 // ----------------------------------------------------------------------------
3735 /** \brief RK Implicit 1 Stage 1st order Radau IA
3736  *
3737  * The tableau (order = 1) is
3738  * \f[
3739  * \begin{array}{c|c}
3740  * c & A \\ \hline
3741  * & b^T
3742  * \end{array}
3743  * \;\;\;\;\mbox{ where }\;\;\;\;
3744  * \begin{array}{c|c} 0 & 1 \\ \hline
3745  * & 1 \end{array}
3746  * \f]
3747  * and is A-stable.
3748  * Reference: Solving Ordinary Differential Equations II:
3749  * Stiff and Differential-Algebraic Problems,
3750  * 2nd Revised Edition, E. Hairer and G. Wanner,
3751  * Table 5.3, pg 73.
3752  */
3753 template<class Scalar>
3755  virtual public StepperDIRK<Scalar>
3756 {
3757 public:
3758  /** \brief Default constructor.
3759  *
3760  * Requires subsequent setModel() and initialize()
3761  * calls before calling takestep().
3762  */
3764  {
3765  this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
3766  this->setupTableau();
3767  this->setupDefault();
3768  }
3769 
3770 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3772  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3773  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3774  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3775  bool useFSAL,
3776  std::string ICConsistency,
3777  bool ICConsistencyCheck,
3778  bool useEmbedded,
3779  bool zeroInitialGuess)
3780  {
3781  this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
3782  this->setupTableau();
3783  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3784  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3785  }
3786 #endif
3788  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3789  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3790  bool useFSAL,
3791  std::string ICConsistency,
3792  bool ICConsistencyCheck,
3793  bool useEmbedded,
3794  bool zeroInitialGuess,
3795  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3796  {
3797  this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
3798  this->setupTableau();
3799  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3800  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3801  }
3802 
3803  std::string getDescription() const
3804  {
3805  std::ostringstream Description;
3806  Description << this->getStepperType() << "\n"
3807  << "A-stable\n"
3808  << "Solving Ordinary Differential Equations II:\n"
3809  << "Stiff and Differential-Algebraic Problems,\n"
3810  << "2nd Revised Edition\n"
3811  << "E. Hairer and G. Wanner\n"
3812  << "Table 5.3, pg 73\n"
3813  << "c = [ 0 ]'\n"
3814  << "A = [ 1 ]\n"
3815  << "b = [ 1 ]'";
3816  return Description.str();
3817  }
3818 
3819  virtual bool getICConsistencyCheckDefault() const { return false; }
3820 
3821  Teuchos::RCP<const Teuchos::ParameterList>
3823  {
3824  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3825  this->getValidParametersBasicDIRK(pl);
3826  pl->set<bool>("Initial Condition Consistency Check",
3828  return pl;
3829  }
3830 
3831 protected:
3832 
3834  {
3835  typedef Teuchos::ScalarTraits<Scalar> ST;
3836  int NumStages = 1;
3837  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3838  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3839  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3840  const Scalar one = ST::one();
3841  const Scalar zero = ST::zero();
3842  A(0,0) = one;
3843  b(0) = one;
3844  c(0) = zero;
3845  int order = 1;
3846 
3847  auto emptyBStar = Teuchos::SerialDenseVector<int,Scalar>();
3848  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3849  this->getStepperType(),A,b,c,order,order,order,emptyBStar,false));
3850  }
3851 };
3852 
3853 
3854 // ----------------------------------------------------------------------------
3855 /** \brief RK Implicit 2 Stage 2nd order Lobatto IIIB
3856  *
3857  * The tableau (order = 2) is
3858  * \f[
3859  * \begin{array}{c|c}
3860  * c & A \\ \hline
3861  * & b^T
3862  * \end{array}
3863  * \;\;\;\;\mbox{ where }\;\;\;\;
3864  * \begin{array}{c|cc} 0 & 1/2 & 0 \\
3865  * 1 & 1/2 & 0 \\ \hline
3866  * & 1/2 & 1/2 \end{array}
3867  * \f]
3868  * It is second-order accurate and A-stable.
3869  *
3870  * Reference: Solving Ordinary Differential Equations II:
3871  * Stiff and Differential-Algebraic Problems,
3872  * 2nd Revised Edition, E. Hairer and G. Wanner,
3873  * Table 5.9, pg 76.
3874  */
3875 template<class Scalar>
3877  virtual public StepperDIRK<Scalar>
3878 {
3879 public:
3880  /** \brief Default constructor.
3881  *
3882  * Requires subsequent setModel() and initialize()
3883  * calls before calling takestep().
3884  */
3886  {
3887  this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
3888  this->setupTableau();
3889  this->setupDefault();
3890  }
3891 
3892 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
3894  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3895  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
3896  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3897  bool useFSAL,
3898  std::string ICConsistency,
3899  bool ICConsistencyCheck,
3900  bool useEmbedded,
3901  bool zeroInitialGuess)
3902  {
3903  this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
3904  this->setupTableau();
3905  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
3906  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
3907  }
3908 #endif
3910  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3911  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3912  bool useFSAL,
3913  std::string ICConsistency,
3914  bool ICConsistencyCheck,
3915  bool useEmbedded,
3916  bool zeroInitialGuess,
3917  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3918  {
3919  this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
3920  this->setupTableau();
3921  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3922  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3923  }
3924 
3925  std::string getDescription() const
3926  {
3927  std::ostringstream Description;
3928  Description << this->getStepperType() << "\n"
3929  << "A-stable\n"
3930  << "Solving Ordinary Differential Equations II:\n"
3931  << "Stiff and Differential-Algebraic Problems,\n"
3932  << "2nd Revised Edition\n"
3933  << "E. Hairer and G. Wanner\n"
3934  << "Table 5.9, pg 76\n"
3935  << "c = [ 0 1 ]'\n"
3936  << "A = [ 1/2 0 ]\n"
3937  << " [ 1/2 0 ]\n"
3938  << "b = [ 1/2 1/2 ]'";
3939  return Description.str();
3940  }
3941 
3942  virtual bool getICConsistencyCheckDefault() const { return false; }
3943 
3944  Teuchos::RCP<const Teuchos::ParameterList>
3946  {
3947  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3948  this->getValidParametersBasicDIRK(pl);
3949  pl->set<bool>("Initial Condition Consistency Check",
3951  return pl;
3952  }
3953 
3954 protected:
3955 
3957  {
3958  typedef Teuchos::ScalarTraits<Scalar> ST;
3959  using Teuchos::as;
3960  int NumStages = 2;
3961  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3962  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
3963  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
3964  const Scalar zero = ST::zero();
3965  const Scalar one = ST::one();
3966 
3967  // Fill A:
3968  A(0,0) = as<Scalar>( one/(2*one) );
3969  A(0,1) = zero;
3970  A(1,0) = as<Scalar>( one/(2*one) );
3971  A(1,1) = zero;
3972 
3973  // Fill b:
3974  b(0) = as<Scalar>( one/(2*one) );
3975  b(1) = as<Scalar>( one/(2*one) );
3976 
3977  // Fill c:
3978  c(0) = zero;
3979  c(1) = one;
3980  int order = 2;
3981 
3982  auto emptyBStar = Teuchos::SerialDenseVector<int,Scalar>();
3983  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3984  this->getStepperType(),A,b,c,order,order,order,emptyBStar,false));
3985  }
3986 
3987 };
3988 
3989 
3990 // ----------------------------------------------------------------------------
3991 /** \brief SDIRK 5 Stage 4th order
3992  *
3993  * The tableau (order = 4) is
3994  * \f[
3995  * \begin{array}{c|c}
3996  * c & A \\ \hline
3997  * & b^T
3998  * \end{array}
3999  * \;\;\;\;\mbox{ where }\;\;\;\;
4000  * \begin{array}{c|ccccc}
4001  * 1/4 & 1/4 & & & & \\
4002  * 3/4 & 1/2 & 1/4 & & & \\
4003  * 11/20 & 17/50 & -1/25 & 1/4 & & \\
4004  * 1/2 & 371/1360 & -137/2720 & 15/544 & 1/4 & \\
4005  * 1 & 25/24 & -49/48 & 125/16 & -85/12 & 1/4 \\ \hline
4006  * & 25/24 & -49/48 & 125/16 & -85/12 & 1/4 \end{array}
4007  * \f]
4008  * and is L-stable.
4009  *
4010  * Reference: Solving Ordinary Differential Equations II:
4011  * Stiff and Differential-Algebraic Problems,
4012  * 2nd Revised Edition, E. Hairer and G. Wanner, pg100.
4013  */
4014 template<class Scalar>
4016  virtual public StepperDIRK<Scalar>
4017 {
4018 public:
4019  /** \brief Default constructor.
4020  *
4021  * Requires subsequent setModel() and initialize()
4022  * calls before calling takestep().
4023  */
4025  {
4026  this->setStepperType("SDIRK 5 Stage 4th order");
4027  this->setupTableau();
4028  this->setupDefault();
4029  }
4030 
4031 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
4033  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4034  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
4035  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4036  bool useFSAL,
4037  std::string ICConsistency,
4038  bool ICConsistencyCheck,
4039  bool useEmbedded,
4040  bool zeroInitialGuess)
4041  {
4042  this->setStepperType("SDIRK 5 Stage 4th order");
4043  this->setupTableau();
4044  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
4045  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
4046  }
4047 #endif
4049  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4050  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4051  bool useFSAL,
4052  std::string ICConsistency,
4053  bool ICConsistencyCheck,
4054  bool useEmbedded,
4055  bool zeroInitialGuess,
4056  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4057  {
4058  this->setStepperType("SDIRK 5 Stage 4th order");
4059  this->setupTableau();
4060  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4061  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4062  }
4063 
4064  std::string getDescription() const
4065  {
4066  std::ostringstream Description;
4067  Description << this->getStepperType() << "\n"
4068  << "L-stable\n"
4069  << "Solving Ordinary Differential Equations II:\n"
4070  << "Stiff and Differential-Algebraic Problems,\n"
4071  << "2nd Revised Edition\n"
4072  << "E. Hairer and G. Wanner\n"
4073  << "pg100 \n"
4074  << "c = [ 1/4 3/4 11/20 1/2 1 ]'\n"
4075  << "A = [ 1/4 ]\n"
4076  << " [ 1/2 1/4 ]\n"
4077  << " [ 17/50 -1/25 1/4 ]\n"
4078  << " [ 371/1360 -137/2720 15/544 1/4 ]\n"
4079  << " [ 25/24 -49/48 125/16 -85/12 1/4 ]\n"
4080  << "b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'";
4081  // << "b = [ 59/48 -17/96 225/32 -85/12 0 ]'";
4082  return Description.str();
4083  }
4084 
4085  virtual bool getICConsistencyCheckDefault() const { return false; }
4086 
4087  Teuchos::RCP<const Teuchos::ParameterList>
4089  {
4090  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
4091  this->getValidParametersBasicDIRK(pl);
4092  pl->set<bool>("Initial Condition Consistency Check",
4094  return pl;
4095  }
4096 
4097 protected:
4098 
4100  {
4101  typedef Teuchos::ScalarTraits<Scalar> ST;
4102  using Teuchos::as;
4103  int NumStages = 5;
4104  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4105  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
4106  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
4107  const Scalar zero = ST::zero();
4108  const Scalar one = ST::one();
4109  const Scalar onequarter = as<Scalar>( one/(4*one) );
4110 
4111  // Fill A:
4112  A(0,0) = onequarter;
4113  A(0,1) = zero;
4114  A(0,2) = zero;
4115  A(0,3) = zero;
4116  A(0,4) = zero;
4117 
4118  A(1,0) = as<Scalar>( one / (2*one) );
4119  A(1,1) = onequarter;
4120  A(1,2) = zero;
4121  A(1,3) = zero;
4122  A(1,4) = zero;
4123 
4124  A(2,0) = as<Scalar>( 17*one/(50*one) );
4125  A(2,1) = as<Scalar>( -one/(25*one) );
4126  A(2,2) = onequarter;
4127  A(2,3) = zero;
4128  A(2,4) = zero;
4129 
4130  A(3,0) = as<Scalar>( 371*one/(1360*one) );
4131  A(3,1) = as<Scalar>( -137*one/(2720*one) );
4132  A(3,2) = as<Scalar>( 15*one/(544*one) );
4133  A(3,3) = onequarter;
4134  A(3,4) = zero;
4135 
4136  A(4,0) = as<Scalar>( 25*one/(24*one) );
4137  A(4,1) = as<Scalar>( -49*one/(48*one) );
4138  A(4,2) = as<Scalar>( 125*one/(16*one) );
4139  A(4,3) = as<Scalar>( -85*one/(12*one) );
4140  A(4,4) = onequarter;
4141 
4142  // Fill b:
4143  b(0) = as<Scalar>( 25*one/(24*one) );
4144  b(1) = as<Scalar>( -49*one/(48*one) );
4145  b(2) = as<Scalar>( 125*one/(16*one) );
4146  b(3) = as<Scalar>( -85*one/(12*one) );
4147  b(4) = onequarter;
4148 
4149  /*
4150  // Alternate version
4151  b(0) = as<Scalar>( 59*one/(48*one) );
4152  b(1) = as<Scalar>( -17*one/(96*one) );
4153  b(2) = as<Scalar>( 225*one/(32*one) );
4154  b(3) = as<Scalar>( -85*one/(12*one) );
4155  b(4) = zero;
4156  */
4157 
4158  // Fill c:
4159  c(0) = onequarter;
4160  c(1) = as<Scalar>( 3*one/(4*one) );
4161  c(2) = as<Scalar>( 11*one/(20*one) );
4162  c(3) = as<Scalar>( one/(2*one) );
4163  c(4) = one;
4164 
4165  int order = 4;
4166 
4167  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4168  this->getStepperType(),A,b,c,order,order,order));
4169  }
4170 };
4171 
4172 
4173 // ----------------------------------------------------------------------------
4174 /** \brief SDIRK 3 Stage 4th order
4175  *
4176  * The tableau (order = 4) is
4177  * \f[
4178  * \begin{array}{c|c}
4179  * c & A \\ \hline
4180  * & b^T
4181  * \end{array}
4182  * \;\;\;\;\mbox{ where }\;\;\;\;
4183  * \begin{array}{c|ccc}
4184  * \gamma & \gamma & & \\
4185  * 1/2 & 1/2-\gamma & \gamma & \\
4186  * 1-\gamma & 2\gamma & 1-4\gamma & \gamma \\ \hline
4187  * & \delta & 1-2\delta & \delta \end{array}
4188  * \f]
4189  * where \f$\gamma = (1/\sqrt{3})\cos(\pi/18)+1/2\f$ and
4190  * \f$\delta = 1/(6(2\gamma-1)^2)\f$, and is A-stable.
4191  *
4192  * Reference: Solving Ordinary Differential Equations II:
4193  * Stiff and Differential-Algebraic Problems,
4194  * 2nd Revised Edition, E. Hairer and G. Wanner, p. 100.
4195  */
4196 template<class Scalar>
4198  virtual public StepperDIRK<Scalar>
4199 {
4200 public:
4201  /** \brief Default constructor.
4202  *
4203  * Requires subsequent setModel() and initialize()
4204  * calls before calling takestep().
4205  */
4207  {
4208  this->setStepperType("SDIRK 3 Stage 4th order");
4209  this->setupTableau();
4210  this->setupDefault();
4211  }
4212 
4213 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
4215  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4216  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
4217  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4218  bool useFSAL,
4219  std::string ICConsistency,
4220  bool ICConsistencyCheck,
4221  bool useEmbedded,
4222  bool zeroInitialGuess)
4223  {
4224  this->setStepperType("SDIRK 3 Stage 4th order");
4225  this->setupTableau();
4226  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
4227  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
4228  }
4229 #endif
4231  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4232  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4233  bool useFSAL,
4234  std::string ICConsistency,
4235  bool ICConsistencyCheck,
4236  bool useEmbedded,
4237  bool zeroInitialGuess,
4238  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4239  {
4240  this->setStepperType("SDIRK 3 Stage 4th order");
4241  this->setupTableau();
4242  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4243  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4244  }
4245 
4246  std::string getDescription() const
4247  {
4248  std::ostringstream Description;
4249  Description << this->getStepperType() << "\n"
4250  << "A-stable\n"
4251  << "Solving Ordinary Differential Equations II:\n"
4252  << "Stiff and Differential-Algebraic Problems,\n"
4253  << "2nd Revised Edition\n"
4254  << "E. Hairer and G. Wanner\n"
4255  << "p. 100 \n"
4256  << "gamma = (1/sqrt(3))*cos(pi/18)+1/2\n"
4257  << "delta = 1/(6*(2*gamma-1)^2)\n"
4258  << "c = [ gamma 1/2 1-gamma ]'\n"
4259  << "A = [ gamma ]\n"
4260  << " [ 1/2-gamma gamma ]\n"
4261  << " [ 2*gamma 1-4*gamma gamma ]\n"
4262  << "b = [ delta 1-2*delta delta ]'";
4263  return Description.str();
4264  }
4265 
4266  virtual bool getICConsistencyCheckDefault() const { return false; }
4267 
4268  Teuchos::RCP<const Teuchos::ParameterList>
4270  {
4271  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
4272  this->getValidParametersBasicDIRK(pl);
4273  pl->set<bool>("Initial Condition Consistency Check",
4275  return pl;
4276  }
4277 
4278 protected:
4279 
4281  {
4282  typedef Teuchos::ScalarTraits<Scalar> ST;
4283  using Teuchos::as;
4284  int NumStages = 3;
4285  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4286  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
4287  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
4288  const Scalar zero = ST::zero();
4289  const Scalar one = ST::one();
4290  const Scalar pi = as<Scalar>(4*one)*std::atan(one);
4291  const Scalar gamma = as<Scalar>( one/ST::squareroot(3*one)*std::cos(pi/(18*one))+one/(2*one) );
4292  const Scalar delta = as<Scalar>( one/(6*one*std::pow(2*gamma-one,2*one)) );
4293 
4294  // Fill A:
4295  A(0,0) = gamma;
4296  A(0,1) = zero;
4297  A(0,2) = zero;
4298 
4299  A(1,0) = as<Scalar>( one/(2*one) - gamma );
4300  A(1,1) = gamma;
4301  A(1,2) = zero;
4302 
4303  A(2,0) = as<Scalar>( 2*gamma );
4304  A(2,1) = as<Scalar>( one - 4*gamma );
4305  A(2,2) = gamma;
4306 
4307  // Fill b:
4308  b(0) = delta;
4309  b(1) = as<Scalar>( one-2*delta );
4310  b(2) = delta;
4311 
4312  // Fill c:
4313  c(0) = gamma;
4314  c(1) = as<Scalar>( one/(2*one) );
4315  c(2) = as<Scalar>( one - gamma );
4316 
4317  int order = 4;
4318 
4319  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4320  this->getStepperType(),A,b,c,order,order,order));
4321  }
4322 };
4323 
4324 
4325 // ----------------------------------------------------------------------------
4326 /** \brief SDIRK 5 Stage 5th order
4327  *
4328  * The tableau (order = 5) is
4329  * \f[
4330  * \begin{array}{c|c}
4331  * c & A \\ \hline
4332  * & b^T
4333  * \end{array}
4334  * \;\;\;\;\mbox{ where }\;\;\;\;
4335  * \begin{array}{c|ccccc}
4336  * (6-\sqrt{6})/10 & (6-\sqrt{6})/10 & 0 & 0 & 0 & 0 \\
4337  * (6+9\sqrt{6})/35 & (-6+5\sqrt{6})/14 & (6-\sqrt{6})/10 & 0 & 0 & 0 \\
4338  * 1 & (888+607\sqrt{6})/2850 & (126-161\sqrt{6})/1425 & (6-\sqrt{6})/10 & 0 & 0 \\
4339  * (4-\sqrt{6})/10 & (3153-3082\sqrt{6})/14250 & (3213+1148\sqrt{6})/28500 & (-267+88\sqrt{6})/500 & (6-\sqrt{6})/10 & 0 \\
4340  * (4+\sqrt{6})/10 & (-32583+14638\sqrt{6})/71250 & (-17199+364\sqrt{6})/142500 & (1329-544\sqrt{6})/2500 & (-96+131\sqrt{6})/625 & (6-\sqrt{6})/10 \\ \hline
4341  * & 0 & 0 & 1/9 & (16-\sqrt{6})/36 & (16+\sqrt{6})/36
4342  * \end{array}
4343  * \f]
4344  *
4345  * Reference: Solving Ordinary Differential Equations II:
4346  * Stiff and Differential-Algebraic Problems,
4347  * 2nd Revised Edition, E. Hairer and G. Wanner, pg101.
4348  */
4349 template<class Scalar>
4351  virtual public StepperDIRK<Scalar>
4352 {
4353 public:
4354  /** \brief Default constructor.
4355  *
4356  * Requires subsequent setModel() and initialize()
4357  * calls before calling takestep().
4358  */
4360  {
4361  this->setStepperType("SDIRK 5 Stage 5th order");
4362  this->setupTableau();
4363  this->setupDefault();
4364  }
4365 
4366 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
4368  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4369  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
4370  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4371  bool useFSAL,
4372  std::string ICConsistency,
4373  bool ICConsistencyCheck,
4374  bool useEmbedded,
4375  bool zeroInitialGuess)
4376  {
4377  this->setStepperType("SDIRK 5 Stage 5th order");
4378  this->setupTableau();
4379  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
4380  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
4381  }
4382 #endif
4384  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4385  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4386  bool useFSAL,
4387  std::string ICConsistency,
4388  bool ICConsistencyCheck,
4389  bool useEmbedded,
4390  bool zeroInitialGuess,
4391  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4392  {
4393  this->setStepperType("SDIRK 5 Stage 5th order");
4394  this->setupTableau();
4395  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4396  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4397  }
4398 
4399  std::string getDescription() const
4400  {
4401  std::ostringstream Description;
4402  Description << this->getStepperType() << "\n"
4403  << "Solving Ordinary Differential Equations II:\n"
4404  << "Stiff and Differential-Algebraic Problems,\n"
4405  << "2nd Revised Edition\n"
4406  << "E. Hairer and G. Wanner\n"
4407  << "pg101 \n"
4408  << "c = [ (6-sqrt(6))/10 ]\n"
4409  << " [ (6+9*sqrt(6))/35 ]\n"
4410  << " [ 1 ]\n"
4411  << " [ (4-sqrt(6))/10 ]\n"
4412  << " [ (4+sqrt(6))/10 ]\n"
4413  << "A = [ A1 A2 A3 A4 A5 ]\n"
4414  << " A1 = [ (6-sqrt(6))/10 ]\n"
4415  << " [ (-6+5*sqrt(6))/14 ]\n"
4416  << " [ (888+607*sqrt(6))/2850 ]\n"
4417  << " [ (3153-3082*sqrt(6))/14250 ]\n"
4418  << " [ (-32583+14638*sqrt(6))/71250 ]\n"
4419  << " A2 = [ 0 ]\n"
4420  << " [ (6-sqrt(6))/10 ]\n"
4421  << " [ (126-161*sqrt(6))/1425 ]\n"
4422  << " [ (3213+1148*sqrt(6))/28500 ]\n"
4423  << " [ (-17199+364*sqrt(6))/142500 ]\n"
4424  << " A3 = [ 0 ]\n"
4425  << " [ 0 ]\n"
4426  << " [ (6-sqrt(6))/10 ]\n"
4427  << " [ (-267+88*sqrt(6))/500 ]\n"
4428  << " [ (1329-544*sqrt(6))/2500 ]\n"
4429  << " A4 = [ 0 ]\n"
4430  << " [ 0 ]\n"
4431  << " [ 0 ]\n"
4432  << " [ (6-sqrt(6))/10 ]\n"
4433  << " [ (-96+131*sqrt(6))/625 ]\n"
4434  << " A5 = [ 0 ]\n"
4435  << " [ 0 ]\n"
4436  << " [ 0 ]\n"
4437  << " [ 0 ]\n"
4438  << " [ (6-sqrt(6))/10 ]\n"
4439  << "b = [ 0 ]\n"
4440  << " [ 0 ]\n"
4441  << " [ 1/9 ]\n"
4442  << " [ (16-sqrt(6))/36 ]\n"
4443  << " [ (16+sqrt(6))/36 ]'";
4444  return Description.str();
4445  }
4446 
4447  virtual bool getICConsistencyCheckDefault() const { return false; }
4448 
4449  Teuchos::RCP<const Teuchos::ParameterList>
4451  {
4452  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
4453  this->getValidParametersBasicDIRK(pl);
4454  pl->set<bool>("Initial Condition Consistency Check",
4456  return pl;
4457  }
4458 
4459 protected:
4460 
4462  {
4463  typedef Teuchos::ScalarTraits<Scalar> ST;
4464  using Teuchos::as;
4465  int NumStages = 5;
4466  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4467  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
4468  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
4469  const Scalar zero = ST::zero();
4470  const Scalar one = ST::one();
4471  const Scalar sqrt6 = ST::squareroot(as<Scalar>(6*one));
4472  const Scalar gamma = as<Scalar>( (6*one - sqrt6) / (10*one) ); // diagonal
4473 
4474  // Fill A:
4475  A(0,0) = gamma;
4476  A(0,1) = zero;
4477  A(0,2) = zero;
4478  A(0,3) = zero;
4479  A(0,4) = zero;
4480 
4481  A(1,0) = as<Scalar>( (-6*one+5*one*sqrt6)/(14*one) );
4482  A(1,1) = gamma;
4483  A(1,2) = zero;
4484  A(1,3) = zero;
4485  A(1,4) = zero;
4486 
4487  A(2,0) = as<Scalar>( (888*one+607*one*sqrt6)/(2850*one) );
4488  A(2,1) = as<Scalar>( (126*one-161*one*sqrt6)/(1425*one) );
4489  A(2,2) = gamma;
4490  A(2,3) = zero;
4491  A(2,4) = zero;
4492 
4493  A(3,0) = as<Scalar>( (3153*one-3082*one*sqrt6)/(14250*one) );
4494  A(3,1) = as<Scalar>( (3213*one+1148*one*sqrt6)/(28500*one) );
4495  A(3,2) = as<Scalar>( (-267*one+88*one*sqrt6)/(500*one) );
4496  A(3,3) = gamma;
4497  A(3,4) = zero;
4498 
4499  A(4,0) = as<Scalar>( (-32583*one+14638*one*sqrt6)/(71250*one) );
4500  A(4,1) = as<Scalar>( (-17199*one+364*one*sqrt6)/(142500*one) );
4501  A(4,2) = as<Scalar>( (1329*one-544*one*sqrt6)/(2500*one) );
4502  A(4,3) = as<Scalar>( (-96*one+131*sqrt6)/(625*one) );
4503  A(4,4) = gamma;
4504 
4505  // Fill b:
4506  b(0) = zero;
4507  b(1) = zero;
4508  b(2) = as<Scalar>( one/(9*one) );
4509  b(3) = as<Scalar>( (16*one-sqrt6)/(36*one) );
4510  b(4) = as<Scalar>( (16*one+sqrt6)/(36*one) );
4511 
4512  // Fill c:
4513  c(0) = gamma;
4514  c(1) = as<Scalar>( (6*one+9*one*sqrt6)/(35*one) );
4515  c(2) = one;
4516  c(3) = as<Scalar>( (4*one-sqrt6)/(10*one) );
4517  c(4) = as<Scalar>( (4*one+sqrt6)/(10*one) );
4518 
4519  int order = 5;
4520 
4521  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4522  this->getStepperType(),A,b,c,order,order,order));
4523  }
4524 };
4525 
4526 
4527 // ----------------------------------------------------------------------------
4528 /** \brief SDIRK 2(1) pair
4529  *
4530  * The tableau (order=2(1)) is
4531  * \f[
4532  * \begin{array}{c|c}
4533  * c & A \\ \hline
4534  * & b^T \\
4535  * & b^{*T}
4536  * \end{array}
4537  * \;\;\;\;\mbox{ where }\;\;\;\;
4538  * \begin{array}{c|cccc} 0 & 0 & \\
4539  * 1 & -1 & 1 \\ \hline
4540  * & 1/2 & 1/2 \\
4541  * & 1 & 0 \end{array}
4542  * \f]
4543  */
4544 template<class Scalar>
4546  virtual public StepperDIRK<Scalar>
4547 {
4548 public:
4549  /** \brief Default constructor.
4550  *
4551  * Requires subsequent setModel() and initialize()
4552  * calls before calling takestep().
4553  */
4555  {
4556  this->setStepperType("SDIRK 2(1) Pair");
4557  this->setupTableau();
4558  this->setupDefault();
4559  }
4560 
4561 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
4563  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4564  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
4565  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4566  bool useFSAL,
4567  std::string ICConsistency,
4568  bool ICConsistencyCheck,
4569  bool useEmbedded,
4570  bool zeroInitialGuess)
4571  {
4572  this->setStepperType("SDIRK 2(1) Pair");
4573  this->setupTableau();
4574  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
4575  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
4576  }
4577 #endif
4579  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4580  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4581  bool useFSAL,
4582  std::string ICConsistency,
4583  bool ICConsistencyCheck,
4584  bool useEmbedded,
4585  bool zeroInitialGuess,
4586  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4587  {
4588  this->setStepperType("SDIRK 2(1) Pair");
4589  this->setupTableau();
4590  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4591  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4592  }
4593 
4594  std::string getDescription() const
4595  {
4596  std::ostringstream Description;
4597  Description << this->getStepperType() << "\n"
4598  << "c = [ 1 0 ]'\n"
4599  << "A = [ 1 ]\n"
4600  << " [ -1 1 ]\n"
4601  << "b = [ 1/2 1/2 ]'\n"
4602  << "bstar = [ 1 0 ]'";
4603  return Description.str();
4604  }
4605 
4606  virtual bool getICConsistencyCheckDefault() const { return false; }
4607 
4608  Teuchos::RCP<const Teuchos::ParameterList>
4610  {
4611  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
4612  this->getValidParametersBasicDIRK(pl);
4613  pl->set<bool>("Initial Condition Consistency Check",
4615  return pl;
4616  }
4617 
4618 protected:
4619 
4621  {
4622  typedef Teuchos::ScalarTraits<Scalar> ST;
4623  using Teuchos::as;
4624  int NumStages = 2;
4625  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4626  Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
4627  Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
4628  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
4629 
4630  const Scalar one = ST::one();
4631  const Scalar zero = ST::zero();
4632 
4633  // Fill A:
4634  A(0,0) = one; A(0,1) = zero;
4635  A(1,0) = -one; A(1,1) = one;
4636 
4637  // Fill b:
4638  b(0) = as<Scalar>(one/(2*one));
4639  b(1) = as<Scalar>(one/(2*one));
4640 
4641  // Fill c:
4642  c(0) = one;
4643  c(1) = zero;
4644 
4645  // Fill bstar
4646  bstar(0) = one;
4647  bstar(1) = zero;
4648  int order = 2;
4649 
4650  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4651  this->getStepperType(),A,b,c,order,order,order,bstar));
4652  }
4653 };
4654 
4655 
4656 // ----------------------------------------------------------------------------
4657 /** \brief General Implicit Runge-Kutta Butcher Tableau
4658  *
4659  * The format of the Butcher Tableau parameter list is
4660  \verbatim
4661  <Parameter name="A" type="string" value="# # # ;
4662  # # # ;
4663  # # #">
4664  <Parameter name="b" type="string" value="# # #">
4665  <Parameter name="c" type="string" value="# # #">
4666  \endverbatim
4667  * Note the number of stages is implicit in the number of entries.
4668  * The number of stages must be consistent.
4669  *
4670  * Default tableau is "SDIRK 2 Stage 2nd order":
4671  * \f[
4672  * \begin{array}{c|c}
4673  * c & A \\ \hline
4674  * & b^T
4675  * \end{array}
4676  * \;\;\;\;\mbox{ where }\;\;\;\;
4677  * \begin{array}{c|cc} \gamma & \gamma & \\
4678  * 1 & 1-\gamma & \gamma \\ \hline
4679  * & 1-\gamma & \gamma \end{array}
4680  * \f]
4681  * where \f$\gamma = (2\pm \sqrt{2})/2\f$. This will produce an
4682  * L-stable 2nd order method.
4683  *
4684  * Reference: U. M. Ascher and L. R. Petzold,
4685  * Computer Methods for ODEs and DAEs, p. 106.
4686  */
4687 template<class Scalar>
4689  virtual public StepperDIRK<Scalar>
4690 {
4691 public:
4692  /** \brief Default constructor.
4693  *
4694  * Requires subsequent setModel() and initialize()
4695  * calls before calling takestep().
4696  */
4698  {
4699  this->setStepperType("General DIRK");
4700  this->setupTableau();
4701  this->setupDefault();
4702  }
4703 
4704 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
4706  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4707  const Teuchos::RCP<StepperRKObserverComposite<Scalar> >& obs,
4708  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4709  bool useFSAL,
4710  std::string ICConsistency,
4711  bool ICConsistencyCheck,
4712  bool useEmbedded,
4713  bool zeroInitialGuess,
4714  const Teuchos::SerialDenseMatrix<int,Scalar>& A,
4715  const Teuchos::SerialDenseVector<int,Scalar>& b,
4716  const Teuchos::SerialDenseVector<int,Scalar>& c,
4717  const int order,
4718  const int orderMin,
4719  const int orderMax,
4720  const Teuchos::SerialDenseVector<int,Scalar>& bstar)
4721  {
4722  this->setStepperType("General DIRK");
4723  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
4724 
4725  TEUCHOS_TEST_FOR_EXCEPTION(
4726  this->tableau_->isImplicit() != true, std::logic_error,
4727  "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
4728 
4729  this->setup(appModel, obs, solver, useFSAL, ICConsistency,
4730  ICConsistencyCheck, useEmbedded, zeroInitialGuess);
4731  }
4732 #endif
4734  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4735  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4736  bool useFSAL,
4737  std::string ICConsistency,
4738  bool ICConsistencyCheck,
4739  bool useEmbedded,
4740  bool zeroInitialGuess,
4741  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
4742  const Teuchos::SerialDenseMatrix<int,Scalar>& A,
4743  const Teuchos::SerialDenseVector<int,Scalar>& b,
4744  const Teuchos::SerialDenseVector<int,Scalar>& c,
4745  const int order,
4746  const int orderMin,
4747  const int orderMax,
4748  const Teuchos::SerialDenseVector<int,Scalar>& bstar)
4749  {
4750  this->setStepperType("General DIRK");
4751  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
4752 
4753  TEUCHOS_TEST_FOR_EXCEPTION(
4754  this->tableau_->isImplicit() != true, std::logic_error,
4755  "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
4756 
4757  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4758  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4759  }
4760 
4761  std::string getDescription() const
4762  {
4763  std::stringstream Description;
4764  Description << this->getStepperType() << "\n"
4765  << "The format of the Butcher Tableau parameter list is\n"
4766  << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
4767  << " # # # ;\n"
4768  << " # # #\"/>\n"
4769  << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
4770  << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
4771  << "Note the number of stages is implicit in the number of entries.\n"
4772  << "The number of stages must be consistent.\n"
4773  << "\n"
4774  << "Default tableau is 'SDIRK 2 Stage 2nd order':\n"
4775  << " Computer Methods for ODEs and DAEs\n"
4776  << " U. M. Ascher and L. R. Petzold\n"
4777  << " p. 106\n"
4778  << " gamma = (2-sqrt(2))/2\n"
4779  << " c = [ gamma 1 ]'\n"
4780  << " A = [ gamma 0 ]\n"
4781  << " [ 1-gamma gamma ]\n"
4782  << " b = [ 1-gamma gamma ]'";
4783  return Description.str();
4784  }
4785 
4786  virtual bool getICConsistencyCheckDefault() const { return false; }
4787 
4789  {
4790  if (this->tableau_ == Teuchos::null) {
4791  // Set tableau to the default if null, otherwise keep current tableau.
4792  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
4793  auto t = stepper->getTableau();
4794  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4795  this->getStepperType(),
4796  t->A(),t->b(),t->c(),
4797  t->order(),t->orderMin(),t->orderMax(),
4798  t->bstar()));
4799  this->isInitialized_ = false;
4800  }
4801  }
4802 
4803  void setTableau(const Teuchos::SerialDenseMatrix<int,Scalar>& A,
4804  const Teuchos::SerialDenseVector<int,Scalar>& b,
4805  const Teuchos::SerialDenseVector<int,Scalar>& c,
4806  const int order,
4807  const int orderMin,
4808  const int orderMax,
4809  const Teuchos::SerialDenseVector<int,Scalar>&
4810  bstar = Teuchos::SerialDenseVector<int,Scalar>())
4811  {
4812  this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4813  this->getStepperType(),A,b,c,order,orderMin,orderMax,bstar));
4814  this->isInitialized_ = false;
4815  }
4816 
4817  Teuchos::RCP<const Teuchos::ParameterList>
4819  {
4820  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
4821  this->getValidParametersBasicDIRK(pl);
4822  pl->set<bool>("Initial Condition Consistency Check",
4824 
4825  // Tableau ParameterList
4826  Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
4827  tableauPL->set<std::string>("A",
4828  "0.2928932188134524 0.0; 0.7071067811865476 0.2928932188134524");
4829  tableauPL->set<std::string>("b",
4830  "0.7071067811865476 0.2928932188134524");
4831  tableauPL->set<std::string>("c", "0.2928932188134524 1.0");
4832  tableauPL->set<int>("order", 2);
4833  tableauPL->set<std::string>("bstar", "");
4834  pl->set("Tableau", *tableauPL);
4835 
4836  return pl;
4837  }
4838 };
4839 
4840 
4841 } // namespace Tempus
4842 
4843 
4844 #endif // Tempus_StepperRKButcherTableau_hpp
StepperERK_3Stage3rdOrderTVD(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_Merson45(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
General Implicit Runge-Kutta Butcher Tableau.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperEDIRK_TrapezoidalRule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperERK_3Stage3rdOrderHeun(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
RK Implicit 2 Stage 2nd order Lobatto IIIB.
virtual std::string getDefaultICConsistency() const
std::string getStepperType() const
Explicit Runge-Kutta time stepper.
virtual void setupDefault()
Default setup for constructor.
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
StepperSDIRK_SSPDIRK33(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperDIRK_BackwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_SSPERK54(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperEDIRK_2StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, Scalar theta=Scalar(0.5))
Backward Euler Runge-Kutta Butcher Tableau.
StepperSDIRK_3Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< RKButcherTableau< Scalar > > tableau_
StepperSDIRK_ImplicitMidpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
General Explicit Runge-Kutta Butcher Tableau.
StepperDIRK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar)
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
virtual void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &wrapperModel, const Teuchos::RCP< StepperRKObserver< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Setup for constructor.
StepperSDIRK_SSPDIRK23(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperSDIRK_3Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Strong Stability Preserving Explicit RK Butcher Tableau.
RK Explicit 4 Stage 3rd order by Runge.
StepperERK_5Stage3rdOrderKandG(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
void getValidParametersBasicDIRK(Teuchos::RCP< Teuchos::ParameterList > pl) const
StepperEDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_Trapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
virtual bool getICConsistencyCheckDefault() const
StepperDIRK_BackwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperDIRK_2Stage2ndOrderLobattoIIIB(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
RK Trapezoidal Rule (A.K.A. RK Crank-Nicolson)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
bool isInitialized_
True if stepper&#39;s member data is initialized.
StepperSDIRK_SSPDIRK33(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperSDIRK_ImplicitMidpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperERK_Ralston(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
virtual void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
Setup for constructor.
StepperERK_4Stage3rdOrderRunge(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperSDIRK_SSPDIRK32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperERK_ForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
Explicit RK 3/8th Rule Butcher Tableau.
StepperSDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, std::string gammaType="3rd Order A-stable", Scalar gamma=Scalar(0.7886751345948128))
StepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Diagonally Implicit Runge-Kutta (DIRK) time stepper.
StepperERK_4Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperSDIRK_21Pair(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperERK_4Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperEDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperERK_SSPERK54(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperERK_BogackiShampine32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperDIRK_1Stage1stOrderRadauIA(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Application Action for StepperRKBase.
StepperSDIRK_3Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperEDIRK_2StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, Scalar theta=Scalar(0.5))
StepperERK_3_8Rule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
virtual void setupDefault()
Default setup for constructor.
Explicit RK Bogacki-Shampine Butcher Tableau.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperSDIRK_5Stage5thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperSDIRK_21Pair(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar)
StepperERK_Trapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperDIRK_1Stage1stOrderRadauIA(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
StepperERK_4Stage3rdOrderRunge(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperSDIRK_SSPDIRK22(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
void getValidParametersBasicERK(Teuchos::RCP< Teuchos::ParameterList > pl) const
StepperERK_3Stage3rdOrderHeun(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
void setTableau(const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar=Teuchos::SerialDenseVector< int, Scalar >())
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperERK_3Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperERK_ForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperSDIRK_5Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Forward Euler Runge-Kutta Butcher Tableau.
StepperDIRK_1StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, Scalar theta=Scalar(0.5))
StepperERK_BogackiShampine32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_3Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
virtual std::string getDescription() const
Explicit RK Merson Butcher Tableau.
StepperERK_Merson45(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
Runge-Kutta 4th order Butcher Tableau.
StepperSDIRK_SSPDIRK22(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperSDIRK_3Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperEDIRK_TrapezoidalRule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void setTableau(const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar=Teuchos::SerialDenseVector< int, Scalar >())
StepperERK_Ralston(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperSDIRK_5Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperERK_5Stage3rdOrderKandG(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
StepperSDIRK_SSPDIRK23(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperSDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, std::string gammaType="3rd Order A-stable", Scalar gamma=Scalar(0.7886751345948128))
StepperSDIRK_2Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, Scalar gamma=Scalar(0.2928932188134524))
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperSDIRK_SSPDIRK32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperERK_3_8Rule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperDIRK_2Stage2ndOrderLobattoIIIB(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperSDIRK_5Stage5thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess)
StepperERK_3Stage3rdOrderTVD(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded)
void setStepperType(std::string s)
RK Explicit 3 Stage 3rd order by Heun.
StepperDIRK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar)
StepperSDIRK_2Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, Scalar gamma=Scalar(0.2928932188134524))
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperDIRK_1StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< StepperRKObserverComposite< Scalar > > &obs, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, Scalar theta=Scalar(0.5))
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.