Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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_config.hpp"
18 #include "Tempus_StepperExplicitRK.hpp"
19 #include "Tempus_StepperDIRK.hpp"
21 
22 
23 namespace Tempus {
24 
25 
26 // ----------------------------------------------------------------------------
40 template<class Scalar>
42  virtual public StepperExplicitRK<Scalar>
43 {
44 public:
51  {
52  this->setStepperName("RK Forward Euler");
53  this->setStepperType("RK Forward Euler");
54  this->setupTableau();
55  this->setupDefault();
56  this->setUseFSAL( true);
57  this->setICConsistency( "Consistent");
58  this->setICConsistencyCheck( false);
59  }
60 
62  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
63  bool useFSAL,
64  std::string ICConsistency,
65  bool ICConsistencyCheck,
66  bool useEmbedded,
67  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
68  {
69  this->setStepperName("RK Forward Euler");
70  this->setStepperType("RK Forward Euler");
71  this->setupTableau();
72  this->setup(appModel, useFSAL, ICConsistency,
73  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
74  }
75 
76  std::string getDescription() const
77  {
78  std::ostringstream Description;
79  Description << this->getStepperType() << "\n"
80  << "c = [ 0 ]'\n"
81  << "A = [ 0 ]\n"
82  << "b = [ 1 ]'";
83  return Description.str();
84  }
85 
86  void setUseFSAL(bool a) { this->useFSAL_ = a; this->isInitialized_ = false; }
87 
88 protected:
89 
90  void setupTableau()
91  {
96  A(0,0) = ST::zero();
97  b(0) = ST::one();
98  c(0) = ST::zero();
99  int order = 1;
100 
102  this->getStepperType(),A,b,c,order,order,order));
103  this->tableau_->setTVD(true);
104  this->tableau_->setTVDCoeff(1.0);
105  }
106 };
107 
108 
110 // ------------------------------------------------------------------------
111 template<class Scalar>
114  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
116 {
117  auto stepper = Teuchos::rcp(new StepperERK_ForwardEuler<Scalar>());
118 
119  // Test for aliases.
120  if (pl != Teuchos::null) {
121  auto stepperType =
122  pl->get<std::string>("Stepper Type", stepper->getStepperType());
123 
125  stepperType != stepper->getStepperType() &&
126  stepperType != "RK1", std::logic_error,
127  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
128  " does not match type for this Stepper (='" + stepper->getStepperType() +
129  "')\n or one of its aliases ('RK1').\n");
130 
131  // Reset default StepperType.
132  pl->set<std::string>("Stepper Type", stepper->getStepperType());
133  }
134 
135  stepper->setStepperRKValues(pl);
136 
137  if (model != Teuchos::null) {
138  stepper->setModel(model);
139  stepper->initialize();
140  }
141 
142  return stepper;
143 }
144 
145 
146 // ----------------------------------------------------------------------------
163 template<class Scalar>
165  virtual public StepperExplicitRK<Scalar>
166 {
167 public:
174  {
175  this->setStepperName("RK Explicit 4 Stage");
176  this->setStepperType("RK Explicit 4 Stage");
177  this->setupTableau();
178  this->setupDefault();
179  this->setUseFSAL( false);
180  this->setICConsistency( "None");
181  this->setICConsistencyCheck( false);
182  }
183 
185  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
186  bool useFSAL,
187  std::string ICConsistency,
188  bool ICConsistencyCheck,
189  bool useEmbedded,
190  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
191  {
192  this->setStepperName("RK Explicit 4 Stage");
193  this->setStepperType("RK Explicit 4 Stage");
194  this->setupTableau();
195  this->setup(appModel, useFSAL, ICConsistency,
196  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
197  }
198 
199  std::string getDescription() const
200  {
201  std::ostringstream Description;
202  Description << this->getStepperType() << "\n"
203  << "\"The\" Runge-Kutta Method (explicit):\n"
204  << "Solving Ordinary Differential Equations I:\n"
205  << "Nonstiff Problems, 2nd Revised Edition\n"
206  << "E. Hairer, S.P. Norsett, G. Wanner\n"
207  << "Table 1.2, pg 138\n"
208  << "c = [ 0 1/2 1/2 1 ]'\n"
209  << "A = [ 0 ] \n"
210  << " [ 1/2 0 ]\n"
211  << " [ 0 1/2 0 ]\n"
212  << " [ 0 0 1 0 ]\n"
213  << "b = [ 1/6 1/3 1/3 1/6 ]'";
214  return Description.str();
215  }
216 
218  {
220  const Scalar one = ST::one();
221  const Scalar zero = ST::zero();
222  const Scalar onehalf = one/(2*one);
223  const Scalar onesixth = one/(6*one);
224  const Scalar onethird = one/(3*one);
225 
226  int NumStages = 4;
227  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
230 
231  // Fill A:
232  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
233  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
234  A(2,0) = zero; A(2,1) = onehalf; A(2,2) = zero; A(2,3) = zero;
235  A(3,0) = zero; A(3,1) = zero; A(3,2) = one; A(3,3) = zero;
236 
237  // Fill b:
238  b(0) = onesixth; b(1) = onethird; b(2) = onethird; b(3) = onesixth;
239 
240  // fill c:
241  c(0) = zero; c(1) = onehalf; c(2) = onehalf; c(3) = one;
242 
243  int order = 4;
244 
246  this->getStepperType(),A,b,c,order,order,order));
247  }
248 };
249 
250 
252 // ------------------------------------------------------------------------
253 template<class Scalar>
256  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
258 {
259  auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
260  stepper->setStepperRKValues(pl);
261 
262  if (model != Teuchos::null) {
263  stepper->setModel(model);
264  stepper->initialize();
265  }
266 
267  return stepper;
268 }
269 
270 
271 // ----------------------------------------------------------------------------
293 template<class Scalar>
295  virtual public StepperExplicitRK<Scalar>
296 {
297 public:
304  {
305  this->setStepperName("Bogacki-Shampine 3(2) Pair");
306  this->setStepperType("Bogacki-Shampine 3(2) Pair");
307  this->setupTableau();
308  this->setupDefault();
309  this->setUseFSAL( true);
310  this->setICConsistency( "Consistent");
311  this->setICConsistencyCheck( false);
312  }
313 
315  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
316  bool useFSAL,
317  std::string ICConsistency,
318  bool ICConsistencyCheck,
319  bool useEmbedded,
320  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
321  {
322  this->setStepperName("Bogacki-Shampine 3(2) Pair");
323  this->setStepperType("Bogacki-Shampine 3(2) Pair");
324  this->setupTableau();
325  this->setup(appModel, useFSAL, ICConsistency,
326  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
327  }
328 
329  std::string getDescription() const
330  {
331  std::ostringstream Description;
332  Description << this->getStepperType() << "\n"
333  << "P. Bogacki and L.F. Shampine.\n"
334  << "A 3(2) pair of Runge–Kutta formulas.\n"
335  << "Applied Mathematics Letters, 2(4):321 – 325, 1989.\n"
336  << "c = [ 0 1/2 3/4 1 ]'\n"
337  << "A = [ 0 ]\n"
338  << " [ 1/2 0 ]\n"
339  << " [ 0 3/4 0 ]\n"
340  << " [ 2/9 1/3 4/9 0 ]\n"
341  << "b = [ 2/9 1/3 4/9 0 ]'\n"
342  << "bstar = [ 7/24 1/4 1/3 1/8 ]'";
343  return Description.str();
344  }
345 
346  void setUseFSAL(bool a) { this->useFSAL_ = a; this->isInitialized_ = false; }
347 
348 protected:
349 
351  {
353  using Teuchos::as;
354  int NumStages = 4;
355  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
359 
360  const Scalar one = ST::one();
361  const Scalar zero = ST::zero();
362  const Scalar onehalf = one/(2*one);
363  const Scalar onethird = one/(3*one);
364  const Scalar threefourths = (3*one)/(4*one);
365  const Scalar twoninths = (2*one)/(9*one);
366  const Scalar fourninths = (4*one)/(9*one);
367 
368  // Fill A:
369  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
370  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
371  A(2,0) = zero; A(2,1) =threefourths; A(2,2) = zero; A(2,3) = zero;
372  A(3,0) =twoninths; A(3,1) = onethird; A(3,2) =fourninths; A(3,3) = zero;
373 
374  // Fill b:
375  b(0) = A(3,0); b(1) = A(3,1); b(2) = A(3,2); b(3) = A(3,3);
376 
377  // Fill c:
378  c(0) = zero; c(1) = onehalf; c(2) = threefourths; c(3) = one;
379 
380  // Fill bstar
381  bstar(0) = as<Scalar>(7*one/(24*one));
382  bstar(1) = as<Scalar>(1*one/(4*one));
383  bstar(2) = as<Scalar>(1*one/(3*one));
384  bstar(3) = as<Scalar>(1*one/(8*one));
385  int order = 3;
386 
388  this->getStepperType(),A,b,c,order,order,order,bstar));
389  }
390 };
391 
392 
394 // ------------------------------------------------------------------------
395 template<class Scalar>
398  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
400 {
402  stepper->setStepperRKValues(pl);
403 
404  if (model != Teuchos::null) {
405  stepper->setModel(model);
406  stepper->initialize();
407  }
408 
409  return stepper;
410 }
411 
412 
413 // ----------------------------------------------------------------------------
438 template<class Scalar>
440  virtual public StepperExplicitRK<Scalar>
441 {
442 public:
449  {
450  this->setStepperName("Merson 4(5) Pair");
451  this->setStepperType("Merson 4(5) Pair");
452  this->setupTableau();
453  this->setupDefault();
454  this->setUseFSAL( false);
455  this->setICConsistency( "None");
456  this->setICConsistencyCheck( false);
457  }
458 
460  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
461  bool useFSAL,
462  std::string ICConsistency,
463  bool ICConsistencyCheck,
464  bool useEmbedded,
465  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
466  {
467  this->setStepperName("Merson 4(5) Pair");
468  this->setStepperType("Merson 4(5) Pair");
469  this->setupTableau();
470  this->setup(appModel, useFSAL, ICConsistency,
471  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
472  }
473 
474  std::string getDescription() const
475  {
476  std::ostringstream Description;
477  Description << this->getStepperType() << "\n"
478  << "Solving Ordinary Differential Equations I:\n"
479  << "Nonstiff Problems, 2nd Revised Edition\n"
480  << "E. Hairer, S.P. Norsett, G. Wanner\n"
481  << "Table 4.1, pg 167\n"
482  << "c = [ 0 1/3 1/3 1/2 1 ]'\n"
483  << "A = [ 0 ]\n"
484  << " [ 1/3 0 ]\n"
485  << " [ 1/6 1/6 0 ]\n"
486  << " [ 1/8 0 3/8 0 ]\n"
487  << " [ 1/2 0 -3/2 2 0 ]\n"
488  << "b = [ 1/6 0 0 2/3 1/6 ]'\n"
489  << "bstar = [ 1/10 0 3/10 2/5 1/5 ]'";
490  return Description.str();
491  }
492 
493 
494 protected:
495 
497  {
499  using Teuchos::as;
500  int NumStages = 5;
501  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages, true);
502  Teuchos::SerialDenseVector<int,Scalar> b(NumStages, true);
503  Teuchos::SerialDenseVector<int,Scalar> c(NumStages, true);
504  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages, true);
505 
506  const Scalar one = ST::one();
507  const Scalar zero = ST::zero();
508 
509  // Fill A:
510  A(1,0) = as<Scalar>(one/(3*one));;
511 
512  A(2,0) = as<Scalar>(one/(6*one));;
513  A(2,1) = as<Scalar>(one/(6*one));;
514 
515  A(3,0) = as<Scalar>(one/(8*one));;
516  A(3,2) = as<Scalar>(3*one/(8*one));;
517 
518  A(4,0) = as<Scalar>(one/(2*one));;
519  A(4,2) = as<Scalar>(-3*one/(2*one));;
520  A(4,3) = 2*one;
521 
522  // Fill b:
523  b(0) = as<Scalar>(one/(6*one));
524  b(3) = as<Scalar>(2*one/(3*one));
525  b(4) = as<Scalar>(one/(6*one));
526 
527  // Fill c:
528  c(0) = zero;
529  c(1) = as<Scalar>(1*one/(3*one));
530  c(2) = as<Scalar>(1*one/(3*one));
531  c(3) = as<Scalar>(1*one/(2*one));
532  c(4) = one;
533 
534  // Fill bstar
535  bstar(0) = as<Scalar>(1*one/(10*one));
536  bstar(2) = as<Scalar>(3*one/(10*one));
537  bstar(3) = as<Scalar>(2*one/(5*one));
538  bstar(4) = as<Scalar>(1*one/(5*one));
539  int order = 4;
540 
542  this->getStepperType(),A,b,c,order,order,order,bstar));
543  }
544 };
545 
546 
548 // ------------------------------------------------------------------------
549 template<class Scalar>
552  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
554 {
555  auto stepper = Teuchos::rcp(new StepperERK_Merson45<Scalar>());
556  stepper->setStepperRKValues(pl);
557 
558  if (model != Teuchos::null) {
559  stepper->setModel(model);
560  stepper->initialize();
561  }
562 
563  return stepper;
564 }
565 
566 
567 // ----------------------------------------------------------------------------
588 template<class Scalar>
590  virtual public StepperExplicitRK<Scalar>
591 {
592 public:
593 
595  {
596  this->setStepperName("RK Explicit 3/8 Rule");
597  this->setStepperType("RK Explicit 3/8 Rule");
598  this->setupTableau();
599  this->setupDefault();
600  this->setUseFSAL( false);
601  this->setICConsistency( "None");
602  this->setICConsistencyCheck( false);
603  }
604 
606  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
607  bool useFSAL,
608  std::string ICConsistency,
609  bool ICConsistencyCheck,
610  bool useEmbedded,
611  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
612  {
613  this->setStepperName("RK Explicit 3/8 Rule");
614  this->setStepperType("RK Explicit 3/8 Rule");
615  this->setupTableau();
616  this->setup(appModel, useFSAL, ICConsistency,
617  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
618  }
619 
620  std::string getDescription() const
621  {
622  std::ostringstream Description;
623  Description << this->getStepperType() << "\n"
624  << "Solving Ordinary Differential Equations I:\n"
625  << "Nonstiff Problems, 2nd Revised Edition\n"
626  << "E. Hairer, S.P. Norsett, G. Wanner\n"
627  << "Table 1.2, pg 138\n"
628  << "c = [ 0 1/3 2/3 1 ]'\n"
629  << "A = [ 0 ]\n"
630  << " [ 1/3 0 ]\n"
631  << " [-1/3 1 0 ]\n"
632  << " [ 1 -1 1 0 ]\n"
633  << "b = [ 1/8 3/8 3/8 1/8 ]'";
634  return Description.str();
635  }
636 
637 
638 protected:
639 
641  {
643  using Teuchos::as;
644  int NumStages = 4;
645  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
648 
649  const Scalar one = ST::one();
650  const Scalar zero = ST::zero();
651  const Scalar onethird = as<Scalar>(one/(3*one));
652  const Scalar twothirds = as<Scalar>(2*one/(3*one));
653  const Scalar oneeighth = as<Scalar>(one/(8*one));
654  const Scalar threeeighths = as<Scalar>(3*one/(8*one));
655 
656  // Fill A:
657  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
658  A(1,0) = onethird; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
659  A(2,0) = -onethird; A(2,1) = one; A(2,2) = zero; A(2,3) = zero;
660  A(3,0) = one; A(3,1) = -one; A(3,2) = one; A(3,3) = zero;
661 
662  // Fill b:
663  b(0) =oneeighth; b(1) =threeeighths; b(2) =threeeighths; b(3) =oneeighth;
664 
665  // Fill c:
666  c(0) = zero; c(1) = onethird; c(2) = twothirds; c(3) = one;
667 
668  int order = 4;
669 
671  this->getStepperType(),A,b,c,order,order,order));
672  }
673 };
674 
675 
677 // ------------------------------------------------------------------------
678 template<class Scalar>
681  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
683 {
684  auto stepper = Teuchos::rcp(new StepperERK_3_8Rule<Scalar>());
685  stepper->setStepperRKValues(pl);
686 
687  if (model != Teuchos::null) {
688  stepper->setModel(model);
689  stepper->initialize();
690  }
691 
692  return stepper;
693 }
694 
695 
696 // ----------------------------------------------------------------------------
717 template<class Scalar>
719  virtual public StepperExplicitRK<Scalar>
720 {
721 public:
728  {
729  this->setStepperName("RK Explicit 4 Stage 3rd order by Runge");
730  this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
731  this->setupTableau();
732  this->setupDefault();
733  this->setUseFSAL( false);
734  this->setICConsistency( "None");
735  this->setICConsistencyCheck( false);
736  }
737 
739  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
740  bool useFSAL,
741  std::string ICConsistency,
742  bool ICConsistencyCheck,
743  bool useEmbedded,
744  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
745  {
746  this->setStepperName("RK Explicit 4 Stage 3rd order by Runge");
747  this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
748  this->setupTableau();
749  this->setup(appModel, useFSAL, ICConsistency,
750  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
751  }
752 
753  std::string getDescription() const
754  {
755  std::ostringstream Description;
756  Description << this->getStepperType() << "\n"
757  << "Solving Ordinary Differential Equations I:\n"
758  << "Nonstiff Problems, 2nd Revised Edition\n"
759  << "E. Hairer, S.P. Norsett, G. Wanner\n"
760  << "Table 1.1, pg 135\n"
761  << "c = [ 0 1/2 1 1 ]'\n"
762  << "A = [ 0 ]\n"
763  << " [ 1/2 0 ]\n"
764  << " [ 0 1 0 ]\n"
765  << " [ 0 0 1 0 ]\n"
766  << "b = [ 1/6 2/3 0 1/6 ]'";
767  return Description.str();
768  }
769 protected:
770 
772  {
774  int NumStages = 4;
775  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
778 
779  const Scalar one = ST::one();
780  const Scalar onehalf = one/(2*one);
781  const Scalar onesixth = one/(6*one);
782  const Scalar twothirds = 2*one/(3*one);
783  const Scalar zero = ST::zero();
784 
785  // Fill A:
786  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero;
787  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero;
788  A(2,0) = zero; A(2,1) = one; A(2,2) = zero; A(2,3) = zero;
789  A(3,0) = zero; A(3,1) = zero; A(3,2) = one; A(3,3) = zero;
790 
791  // Fill b:
792  b(0) = onesixth; b(1) = twothirds; b(2) = zero; b(3) = onesixth;
793 
794  // Fill c:
795  c(0) = zero; c(1) = onehalf; c(2) = one; c(3) = one;
796 
797  int order = 3;
798 
800  this->getStepperType(),A,b,c,order,order,order));
801  }
802 };
803 
804 
806 // ------------------------------------------------------------------------
807 template<class Scalar>
810  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
812 {
814  stepper->setStepperRKValues(pl);
815 
816  if (model != Teuchos::null) {
817  stepper->setModel(model);
818  stepper->initialize();
819  }
820 
821  return stepper;
822 }
823 
824 
825 // ----------------------------------------------------------------------------
845 template<class Scalar>
847  virtual public StepperExplicitRK<Scalar>
848 {
849 public:
856  {
857  this->setStepperName("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
858  this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
859  this->setupTableau();
860  this->setupDefault();
861  this->setUseFSAL( false);
862  this->setICConsistency( "None");
863  this->setICConsistencyCheck( false);
864  }
865 
867  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
868  bool useFSAL,
869  std::string ICConsistency,
870  bool ICConsistencyCheck,
871  bool useEmbedded,
872  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
873  {
874  this->setStepperName("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
875  this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
876  this->setupTableau();
877  this->setup(appModel, useFSAL, ICConsistency,
878  ICConsistencyCheck, useEmbedded,stepperRKAppAction);
879  }
880 
881  std::string getDescription() const
882  {
883  std::ostringstream Description;
884  Description << this->getStepperType() << "\n"
885  << "Kinnmark & Gray 5 stage, 3rd order scheme \n"
886  << "Modified by P. Ullrich. From the prim_advance_mod.F90 \n"
887  << "routine in the HOMME atmosphere model code.\n"
888  << "c = [ 0 1/5 1/5 1/3 2/3 ]'\n"
889  << "A = [ 0 ]\n"
890  << " [ 1/5 0 ]\n"
891  << " [ 0 1/5 0 ]\n"
892  << " [ 0 0 1/3 0 ]\n"
893  << " [ 0 0 0 2/3 0 ]\n"
894  << "b = [ 1/4 0 0 0 3/4 ]'";
895  return Description.str();
896  }
897 
898 protected:
899 
901  {
903  int NumStages = 5;
904  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
907 
908  const Scalar one = ST::one();
909  const Scalar onefifth = one/(5*one);
910  const Scalar onefourth = one/(4*one);
911  const Scalar onethird = one/(3*one);
912  const Scalar twothirds = 2*one/(3*one);
913  const Scalar threefourths = 3*one/(4*one);
914  const Scalar zero = ST::zero();
915 
916  // Fill A:
917  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero; A(0,3) = zero; A(0,4) = zero;
918  A(1,0) = onefifth; A(1,1) = zero; A(1,2) = zero; A(1,3) = zero; A(1,4) = zero;
919  A(2,0) = zero; A(2,1) = onefifth; A(2,2) = zero; A(2,3) = zero; A(2,4) = zero;
920  A(3,0) = zero; A(3,1) = zero; A(3,2) = onethird; A(3,3) = zero; A(3,4) = zero;
921  A(4,0) = zero; A(4,1) = zero; A(4,2) = zero; A(4,3) = twothirds; A(4,4) = zero;
922 
923  // Fill b:
924  b(0) =onefourth; b(1) =zero; b(2) =zero; b(3) =zero; b(4) =threefourths;
925 
926  // Fill c:
927  c(0) =zero; c(1) =onefifth; c(2) =onefifth; c(3) =onethird; c(4) =twothirds;
928 
929  int order = 3;
930 
932  this->getStepperType(),A,b,c,order,order,order));
933  }
934 };
935 
936 
938 // ------------------------------------------------------------------------
939 template<class Scalar>
942  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
944 {
946  stepper->setStepperRKValues(pl);
947 
948  if (model != Teuchos::null) {
949  stepper->setModel(model);
950  stepper->initialize();
951  }
952 
953  return stepper;
954 }
955 
956 
957 // ----------------------------------------------------------------------------
973 template<class Scalar>
975  virtual public StepperExplicitRK<Scalar>
976 {
977 public:
984  {
985  this->setStepperName("RK Explicit 3 Stage 3rd order");
986  this->setStepperType("RK Explicit 3 Stage 3rd order");
987  this->setupTableau();
988  this->setupDefault();
989  this->setUseFSAL( false);
990  this->setICConsistency( "None");
991  this->setICConsistencyCheck( false);
992  }
993 
995  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
996  bool useFSAL,
997  std::string ICConsistency,
998  bool ICConsistencyCheck,
999  bool useEmbedded,
1000  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1001  {
1002  this->setStepperName("RK Explicit 3 Stage 3rd order");
1003  this->setStepperType("RK Explicit 3 Stage 3rd order");
1004  this->setupTableau();
1005  this->setup(appModel, useFSAL, ICConsistency,
1006  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1007  }
1008 
1009  std::string getDescription() const
1010  {
1011  std::ostringstream Description;
1012  Description << this->getStepperType() << "\n"
1013  << "c = [ 0 1/2 1 ]'\n"
1014  << "A = [ 0 ]\n"
1015  << " [ 1/2 0 ]\n"
1016  << " [ -1 2 0 ]\n"
1017  << "b = [ 1/6 4/6 1/6 ]'";
1018  return Description.str();
1019  }
1020 
1021 protected:
1022 
1024  {
1025  typedef Teuchos::ScalarTraits<Scalar> ST;
1026  const Scalar one = ST::one();
1027  const Scalar two = Teuchos::as<Scalar>(2*one);
1028  const Scalar zero = ST::zero();
1029  const Scalar onehalf = one/(2*one);
1030  const Scalar onesixth = one/(6*one);
1031  const Scalar foursixth = 4*one/(6*one);
1032 
1033  int NumStages = 3;
1034  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1037 
1038  // Fill A:
1039  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
1040  A(1,0) = onehalf; A(1,1) = zero; A(1,2) = zero;
1041  A(2,0) = -one; A(2,1) = two; A(2,2) = zero;
1042 
1043  // Fill b:
1044  b(0) = onesixth; b(1) = foursixth; b(2) = onesixth;
1045 
1046  // fill c:
1047  c(0) = zero; c(1) = onehalf; c(2) = one;
1048 
1049  int order = 3;
1050 
1052  this->getStepperType(),A,b,c,order,order,order));
1053  }
1054 };
1055 
1056 
1058 // ------------------------------------------------------------------------
1059 template<class Scalar>
1062  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1064 {
1065  auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrder<Scalar>());
1066  stepper->setStepperRKValues(pl);
1067 
1068  if (model != Teuchos::null) {
1069  stepper->setModel(model);
1070  stepper->initialize();
1071  }
1072 
1073  return stepper;
1074 }
1075 
1076 
1077 // ----------------------------------------------------------------------------
1104 template<class Scalar>
1106  virtual public StepperExplicitRK<Scalar>
1107 {
1108 public:
1115  {
1116  this->setStepperName("RK Explicit 3 Stage 3rd order TVD");
1117  this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1118  this->setupTableau();
1119  this->setupDefault();
1120  this->setUseFSAL( false);
1121  this->setICConsistency( "None");
1122  this->setICConsistencyCheck( false);
1123  }
1124 
1126  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1127  bool useFSAL,
1128  std::string ICConsistency,
1129  bool ICConsistencyCheck,
1130  bool useEmbedded,
1131  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1132  {
1133  this->setStepperName("RK Explicit 3 Stage 3rd order TVD");
1134  this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1135  this->setupTableau();
1136  this->setup(appModel, useFSAL, ICConsistency,
1137  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1138  }
1139 
1140  std::string getDescription() const
1141  {
1142  std::ostringstream Description;
1143  Description << this->getStepperType() << "\n"
1144  << "This Stepper is known as 'RK Explicit 3 Stage 3rd order TVD' or 'SSPERK33'.\n"
1145  << "Sigal Gottlieb and Chi-Wang Shu\n"
1146  << "`Total Variation Diminishing Runge-Kutta Schemes'\n"
1147  << "Mathematics of Computation\n"
1148  << "Volume 67, Number 221, January 1998, pp. 73-85\n"
1149  << "c = [ 0 1 1/2 ]'\n"
1150  << "A = [ 0 ]\n"
1151  << " [ 1 0 ]\n"
1152  << " [ 1/4 1/4 0 ]\n"
1153  << "b = [ 1/6 1/6 4/6 ]'\n"
1154  << "This is also written in the following set of updates.\n"
1155  << "u1 = u^n + dt L(u^n)\n"
1156  << "u2 = 3 u^n/4 + u1/4 + dt L(u1)/4\n"
1157  << "u^(n+1) = u^n/3 + 2 u2/2 + 2 dt L(u2)/3";
1158  return Description.str();
1159  }
1160 
1161 protected:
1162 
1164  {
1165  typedef Teuchos::ScalarTraits<Scalar> ST;
1166  using Teuchos::as;
1167  const Scalar one = ST::one();
1168  const Scalar zero = ST::zero();
1169  const Scalar onehalf = one/(2*one);
1170  const Scalar onefourth = one/(4*one);
1171  const Scalar onesixth = one/(6*one);
1172  const Scalar foursixth = 4*one/(6*one);
1173 
1174  int NumStages = 3;
1175  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1178  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1179 
1180  // Fill A:
1181  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
1182  A(1,0) = one; A(1,1) = zero; A(1,2) = zero;
1183  A(2,0) = onefourth; A(2,1) = onefourth; A(2,2) = zero;
1184 
1185  // Fill b:
1186  b(0) = onesixth; b(1) = onesixth; b(2) = foursixth;
1187 
1188  // fill c:
1189  c(0) = zero; c(1) = one; c(2) = onehalf;
1190 
1191  // Fill bstar:
1192  bstar(0) = as<Scalar>(0.291485418878409);
1193  bstar(1) = as<Scalar>(0.291485418878409);
1194  bstar(2) = as<Scalar>(0.417029162243181);
1195 
1196  int order = 3;
1197 
1199  this->getStepperType(),A,b,c,order,order,order,bstar));
1200  this->tableau_->setTVD(true);
1201  this->tableau_->setTVDCoeff(1.0);
1202  }
1203 };
1204 
1205 
1207 // ------------------------------------------------------------------------
1208 template<class Scalar>
1211  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1213 {
1214  auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrderTVD<Scalar>());
1215 
1216  // Test for aliases.
1217  if (pl != Teuchos::null) {
1218  auto stepperType =
1219  pl->get<std::string>("Stepper Type", stepper->getStepperType());
1220 
1222  stepperType != stepper->getStepperType() &&
1223  stepperType != "SSPERK33" && stepperType != "SSPRK3", std::logic_error,
1224  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
1225  " does not match type for this Stepper (='" + stepper->getStepperType() +
1226  "')\n or one of its aliases ('SSPERK33' or 'SSPRK3').\n");
1227 
1228  // Reset default StepperType.
1229  pl->set<std::string>("Stepper Type", stepper->getStepperType());
1230  }
1231 
1232  stepper->setStepperRKValues(pl);
1233 
1234  if (model != Teuchos::null) {
1235  stepper->setModel(model);
1236  stepper->initialize();
1237  }
1238 
1239  return stepper;
1240 }
1241 
1242 
1243 // ----------------------------------------------------------------------------
1263 template<class Scalar>
1265  virtual public StepperExplicitRK<Scalar>
1266 {
1267 public:
1274  {
1275  this->setStepperName("RK Explicit 3 Stage 3rd order by Heun");
1276  this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1277  this->setupTableau();
1278  this->setupDefault();
1279  this->setUseFSAL( false);
1280  this->setICConsistency( "None");
1281  this->setICConsistencyCheck( false);
1282  }
1283 
1285  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1286  bool useFSAL,
1287  std::string ICConsistency,
1288  bool ICConsistencyCheck,
1289  bool useEmbedded,
1290  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1291  {
1292  this->setStepperName("RK Explicit 3 Stage 3rd order by Heun");
1293  this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1294  this->setupTableau();
1295  this->setup(appModel, useFSAL, ICConsistency,
1296  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1297  }
1298 
1299  std::string getDescription() const
1300  {
1301  std::ostringstream Description;
1302  Description << this->getStepperType() << "\n"
1303  << "Solving Ordinary Differential Equations I:\n"
1304  << "Nonstiff Problems, 2nd Revised Edition\n"
1305  << "E. Hairer, S.P. Norsett, G. Wanner\n"
1306  << "Table 1.1, pg 135\n"
1307  << "c = [ 0 1/3 2/3 ]'\n"
1308  << "A = [ 0 ] \n"
1309  << " [ 1/3 0 ]\n"
1310  << " [ 0 2/3 0 ]\n"
1311  << "b = [ 1/4 0 3/4 ]'";
1312  return Description.str();
1313  }
1314 
1315 protected:
1316 
1318  {
1319  typedef Teuchos::ScalarTraits<Scalar> ST;
1320  const Scalar one = ST::one();
1321  const Scalar zero = ST::zero();
1322  const Scalar onethird = one/(3*one);
1323  const Scalar twothirds = 2*one/(3*one);
1324  const Scalar onefourth = one/(4*one);
1325  const Scalar threefourths = 3*one/(4*one);
1326 
1327  int NumStages = 3;
1328  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1331 
1332  // Fill A:
1333  A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
1334  A(1,0) = onethird; A(1,1) = zero; A(1,2) = zero;
1335  A(2,0) = zero; A(2,1) = twothirds; A(2,2) = zero;
1336 
1337  // Fill b:
1338  b(0) = onefourth; b(1) = zero; b(2) = threefourths;
1339 
1340  // fill c:
1341  c(0) = zero; c(1) = onethird; c(2) = twothirds;
1342 
1343  int order = 3;
1344 
1346  this->getStepperType(),A,b,c,order,order,order));
1347  }
1348 };
1349 
1350 
1352 // ------------------------------------------------------------------------
1353 template<class Scalar>
1356  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1358 {
1360  stepper->setStepperRKValues(pl);
1361 
1362  if (model != Teuchos::null) {
1363  stepper->setModel(model);
1364  stepper->initialize();
1365  }
1366 
1367  return stepper;
1368 }
1369 
1370 
1371 // ----------------------------------------------------------------------------
1390 template<class Scalar>
1392  virtual public StepperExplicitRK<Scalar>
1393 {
1394 public:
1401  {
1402  this->setStepperName("RK Explicit Midpoint");
1403  this->setStepperType("RK Explicit Midpoint");
1404  this->setupTableau();
1405  this->setupDefault();
1406  this->setUseFSAL( false);
1407  this->setICConsistency( "None");
1408  this->setICConsistencyCheck( false);
1409  }
1410 
1412  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1413  bool useFSAL,
1414  std::string ICConsistency,
1415  bool ICConsistencyCheck,
1416  bool useEmbedded,
1417  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1418  {
1419  this->setStepperName("RK Explicit Midpoint");
1420  this->setStepperType("RK Explicit Midpoint");
1421  this->setupTableau();
1422  this->setup(appModel, useFSAL, ICConsistency,
1423  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1424  }
1425 
1426  std::string getDescription() const
1427  {
1428  std::ostringstream Description;
1429  Description << this->getStepperType() << "\n"
1430  << "Solving Ordinary Differential Equations I:\n"
1431  << "Nonstiff Problems, 2nd Revised Edition\n"
1432  << "E. Hairer, S.P. Norsett, G. Wanner\n"
1433  << "Table 1.1, pg 135\n"
1434  << "c = [ 0 1/2 ]'\n"
1435  << "A = [ 0 ]\n"
1436  << " [ 1/2 0 ]\n"
1437  << "b = [ 0 1 ]'";
1438  return Description.str();
1439  }
1440 
1441 protected:
1442 
1444  {
1445  typedef Teuchos::ScalarTraits<Scalar> ST;
1446  const Scalar one = ST::one();
1447  const Scalar zero = ST::zero();
1448  const Scalar onehalf = one/(2*one);
1449 
1450  int NumStages = 2;
1451  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1454 
1455  // Fill A:
1456  A(0,0) = zero; A(0,1) = zero;
1457  A(1,0) = onehalf; A(1,1) = zero;
1458 
1459  // Fill b:
1460  b(0) = zero; b(1) = one;
1461 
1462  // fill c:
1463  c(0) = zero; c(1) = onehalf;
1464 
1465  int order = 2;
1466 
1468  this->getStepperType(),A,b,c,order,order,order));
1469  }
1470 };
1471 
1472 
1474 // ------------------------------------------------------------------------
1475 template<class Scalar>
1478  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1480 {
1481  auto stepper = Teuchos::rcp(new StepperERK_Midpoint<Scalar>());
1482  stepper->setStepperRKValues(pl);
1483 
1484  if (model != Teuchos::null) {
1485  stepper->setModel(model);
1486  stepper->initialize();
1487  }
1488 
1489  return stepper;
1490 }
1491 
1492 
1493 // ----------------------------------------------------------------------------
1508 template<class Scalar>
1510  virtual public StepperExplicitRK<Scalar>
1511 {
1512 public:
1519  {
1520  this->setStepperName("RK Explicit Ralston");
1521  this->setStepperType("RK Explicit Ralston");
1522  this->setupTableau();
1523  this->setupDefault();
1524  this->setUseFSAL( false);
1525  this->setICConsistency( "None");
1526  this->setICConsistencyCheck( false);
1527  }
1528 
1530  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1531  bool useFSAL,
1532  std::string ICConsistency,
1533  bool ICConsistencyCheck,
1534  bool useEmbedded,
1535  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1536  {
1537  this->setStepperName("RK Explicit Ralston");
1538  this->setStepperType("RK Explicit Ralston");
1539  this->setupTableau();
1540  this->setup(appModel, useFSAL, ICConsistency,
1541  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1542  }
1543 
1544  std::string getDescription() const
1545  {
1546  std::ostringstream Description;
1547  Description << this->getStepperType() << "\n"
1548  << "This Stepper is known as 'RK Explicit Ralston' or 'RK2'.\n"
1549  << "c = [ 0 2/3 ]'\n"
1550  << "A = [ 0 ]\n"
1551  << " [ 2/3 0 ]\n"
1552  << "b = [ 1/4 3/4 ]'";
1553  return Description.str();
1554  }
1555 
1556 protected:
1557 
1559  {
1560  typedef Teuchos::ScalarTraits<Scalar> ST;
1561  const Scalar one = ST::one();
1562  const Scalar zero = ST::zero();
1563 
1564  const int NumStages = 2;
1565  const int order = 2;
1566  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1569 
1570  // Fill A:
1571  A(0,0) = zero; A(0,1) = zero; A(1,1) = zero;
1572  A(1,0) = (2*one)/(3*one);
1573 
1574  // Fill b:
1575  b(0) = (1*one)/(4*one);
1576  b(1) = (3*one)/(4*one);
1577 
1578  // fill c:
1579  c(0) = zero;
1580  c(1) = (2*one)/(3*one);
1581 
1582 
1584  this->getStepperType(),A,b,c,order,order,order));
1585  this->tableau_->setTVD(true);
1586  this->tableau_->setTVDCoeff(0.5);
1587  }
1588 };
1589 
1590 
1592 // ------------------------------------------------------------------------
1593 template<class Scalar>
1596  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1598 {
1599  auto stepper = Teuchos::rcp(new StepperERK_Ralston<Scalar>());
1600 
1601  // Test for aliases.
1602  if (pl != Teuchos::null) {
1603  auto stepperType =
1604  pl->get<std::string>("Stepper Type", stepper->getStepperType());
1605 
1607  stepperType != stepper->getStepperType() &&
1608  stepperType != "RK2", std::logic_error,
1609  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
1610  " does not match type for this Stepper (='" + stepper->getStepperType() +
1611  "')\n or one of its aliases ('RK2').\n");
1612 
1613  // Reset default StepperType.
1614  pl->set<std::string>("Stepper Type", stepper->getStepperType());
1615  }
1616 
1617  stepper->setStepperRKValues(pl);
1618 
1619  if (model != Teuchos::null) {
1620  stepper->setModel(model);
1621  stepper->initialize();
1622  }
1623 
1624  return stepper;
1625 }
1626 
1627 
1628 // ----------------------------------------------------------------------------
1644 template<class Scalar>
1646  virtual public StepperExplicitRK<Scalar>
1647 {
1648 public:
1655  {
1656  this->setStepperName("RK Explicit Trapezoidal");
1657  this->setStepperType("RK Explicit Trapezoidal");
1658  this->setupTableau();
1659  this->setupDefault();
1660  this->setUseFSAL( false);
1661  this->setICConsistency( "None");
1662  this->setICConsistencyCheck( false);
1663  }
1664 
1666  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1667  bool useFSAL,
1668  std::string ICConsistency,
1669  bool ICConsistencyCheck,
1670  bool useEmbedded,
1671  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1672  {
1673  this->setStepperName("RK Explicit Trapezoidal");
1674  this->setStepperType("RK Explicit Trapezoidal");
1675  this->setupTableau();
1676  this->setup(appModel, useFSAL, ICConsistency,
1677  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1678  }
1679 
1680  std::string getDescription() const
1681  {
1682  std::ostringstream Description;
1683  Description << this->getStepperType() << "\n"
1684  << "This Stepper is known as 'RK Explicit Trapezoidal' or 'Heuns Method' or 'SSPERK22'.\n"
1685  << "c = [ 0 1 ]'\n"
1686  << "A = [ 0 ]\n"
1687  << " [ 1 0 ]\n"
1688  << "b = [ 1/2 1/2 ]\n"
1689  << "bstart = [ 3/4 1/4 ]'";
1690  return Description.str();
1691  }
1692 
1693 protected:
1694 
1696  {
1697  typedef Teuchos::ScalarTraits<Scalar> ST;
1698  using Teuchos::as;
1699  const Scalar one = ST::one();
1700  const Scalar zero = ST::zero();
1701  const Scalar onehalf = one/(2*one);
1702 
1703  int NumStages = 2;
1704  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1707  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1708 
1709  // Fill A:
1710  A(0,0) = zero; A(0,1) = zero;
1711  A(1,0) = one; A(1,1) = zero;
1712 
1713  // Fill b:
1714  b(0) = onehalf; b(1) = onehalf;
1715 
1716  // fill c:
1717  c(0) = zero; c(1) = one;
1718 
1719  // Fill bstar
1720  bstar(0) = as<Scalar>(3*one/(4*one));
1721  bstar(1) = as<Scalar>(1*one/(4*one));
1722 
1723  int order = 2;
1724 
1726  this->getStepperType(),A,b,c,order,order,order,bstar));
1727  this->tableau_->setTVD(true);
1728  this->tableau_->setTVDCoeff(1.0);
1729  }
1730 };
1731 
1732 
1734 // ------------------------------------------------------------------------
1735 template<class Scalar>
1738  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1740 {
1741  auto stepper = Teuchos::rcp(new StepperERK_Trapezoidal<Scalar>());
1742 
1743  // Test for aliases.
1744  if (pl != Teuchos::null) {
1745  auto stepperType =
1746  pl->get<std::string>("Stepper Type", stepper->getStepperType());
1747 
1749  stepperType != stepper->getStepperType() &&
1750  stepperType != "Heuns Method" && stepperType != "SSPERK22" &&
1751  stepperType != "SSPRK2", std::logic_error,
1752  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
1753  " does not match type for this Stepper (='" + stepper->getStepperType() +
1754  "')\n or one of its aliases ('Heuns Method' or 'SSPERK22' or 'SSPRK2').\n");
1755 
1756  // Reset default StepperType.
1757  pl->set<std::string>("Stepper Type", stepper->getStepperType());
1758  }
1759 
1760  stepper->setStepperRKValues(pl);
1761 
1762  if (model != Teuchos::null) {
1763  stepper->setModel(model);
1764  stepper->initialize();
1765  }
1766 
1767  return stepper;
1768 }
1769 
1770 
1771 // ----------------------------------------------------------------------------
1789 template<class Scalar>
1791  virtual public StepperExplicitRK<Scalar>
1792 {
1793  public:
1795  {
1796  this->setStepperName("SSPERK54");
1797  this->setStepperType("SSPERK54");
1798  this->setupTableau();
1799  this->setupDefault();
1800  this->setUseFSAL( false);
1801  this->setICConsistency( "None");
1802  this->setICConsistencyCheck( false);
1803  }
1804 
1806  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1807  bool useFSAL,
1808  std::string ICConsistency,
1809  bool ICConsistencyCheck,
1810  bool useEmbedded,
1811  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1812  {
1813  this->setStepperName("SSPERK54");
1814  this->setStepperType("SSPERK54");
1815  this->setupTableau();
1816  this->setup(appModel, useFSAL, ICConsistency,
1817  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1818  }
1819 
1820  std::string getDescription() const
1821  {
1822  std::ostringstream Description;
1823  Description << this->getStepperType() << "\n"
1824  << "Strong Stability Preserving Explicit RK (stage=5, order=4)\n"
1825  << std::endl;
1826  return Description.str();
1827  }
1828 
1829 protected:
1830 
1832  {
1833 
1834  typedef Teuchos::ScalarTraits<Scalar> ST;
1835  using Teuchos::as;
1836  const int NumStages = 5;
1837  const int order = 4;
1838  const Scalar sspcoef = 1.5082;
1839  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
1842  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
1843  const Scalar zero = ST::zero();
1844 
1845  // Fill A:
1846  A(0,0) = A(0,1) = A(0,2) = A(0,3) = A(0,4) = zero;
1847 
1848  A(1,0) = as<Scalar>(0.391752226571889);
1849  A(1,1) = A(1,2) = A(1,3) = A(0,4) = zero;
1850 
1851  A(2,0) = as<Scalar>(0.217669096261169);
1852  A(2,1) = as<Scalar>(0.368410593050372);
1853  A(2,2) = A(2,3) = A(2,4) = zero;
1854 
1855  A(3,0) = as<Scalar>(0.082692086657811);
1856  A(3,1) = as<Scalar>(0.139958502191896);
1857  A(3,2) = as<Scalar>(0.251891774271693);
1858  A(3,3) = A(2,4) = zero;
1859 
1860  A(4,0) = as<Scalar>(0.067966283637115);
1861  A(4,1) = as<Scalar>(0.115034698504632);
1862  A(4,2) = as<Scalar>(0.207034898597385);
1863  A(4,3) = as<Scalar>(0.544974750228520);
1864  A(4,4) = zero;
1865 
1866  // Fill b:
1867  b(0) = as<Scalar>(0.146811876084786);
1868  b(1) = as<Scalar>(0.248482909444976);
1869  b(2) = as<Scalar>(0.104258830331980);
1870  b(3) = as<Scalar>(0.274438900901350);
1871  b(4) = as<Scalar>(0.226007483236908);
1872 
1873  // fill c:
1874  c(0) = zero;
1875  c(1) = A(1,0);
1876  c(2) = A(2,0) + A(2,1);
1877  c(3) = A(3,0) + A(3,1) + A(3,2);
1878  c(4) = A(4,0) + A(4,1) + A(4,2) + A(4,3);
1879 
1880  // Fill bstar:
1881  bstar(0) = as<Scalar>(0.130649104813131);
1882  bstar(1) = as<Scalar>(0.317716031201302);
1883  bstar(2) = as<Scalar>(0.000000869337261);
1884  bstar(3) = as<Scalar>(0.304581512634772);
1885  bstar(4) = as<Scalar>(0.247052482013534);
1886 
1888  this->getStepperType(),A,b,c,order,order,order,bstar));
1889  this->tableau_->setTVD(true);
1890  this->tableau_->setTVDCoeff(sspcoef);
1891  }
1892 };
1893 
1894 
1896 // ------------------------------------------------------------------------
1897 template<class Scalar>
1900  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1902 {
1903  auto stepper = Teuchos::rcp(new StepperERK_SSPERK54<Scalar>());
1904  stepper->setStepperRKValues(pl);
1905 
1906  if (model != Teuchos::null) {
1907  stepper->setModel(model);
1908  stepper->initialize();
1909  }
1910 
1911  return stepper;
1912 }
1913 
1914 
1915 // ----------------------------------------------------------------------------
1943 template<class Scalar>
1945  virtual public StepperExplicitRK<Scalar>
1946 {
1947 public:
1949  {
1950  this->setStepperName("General ERK");
1951  this->setStepperType("General ERK");
1952  this->setupTableau();
1953  this->setupDefault();
1954  this->setUseFSAL( false);
1955  this->setICConsistency( "None");
1956  this->setICConsistencyCheck( false);
1957  }
1958 
1960  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1961  bool useFSAL,
1962  std::string ICConsistency,
1963  bool ICConsistencyCheck,
1964  bool useEmbedded,
1968  const int order,
1969  const int orderMin,
1970  const int orderMax,
1972  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction=Teuchos::null)
1973  {
1974  this->setStepperName("General ERK");
1975  this->setStepperType("General ERK");
1976  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
1977 
1979  this->tableau_->isImplicit() == true, std::logic_error,
1980  "Error - General ERK received an implicit Butcher Tableau!\n");
1981 
1982  this->setup(appModel, useFSAL, ICConsistency,
1983  ICConsistencyCheck, useEmbedded, stepperRKAppAction);
1984  }
1985 
1986  virtual std::string getDescription() const
1987  {
1988  std::stringstream Description;
1989  Description << this->getStepperType() << "\n"
1990  << "The format of the Butcher Tableau parameter list is\n"
1991  << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
1992  << " # # # ;\n"
1993  << " # # #\"/>\n"
1994  << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
1995  << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
1996  << "Note the number of stages is implicit in the number of entries.\n"
1997  << "The number of stages must be consistent.\n"
1998  << "\n"
1999  << "Default tableau is RK4 (order=4):\n"
2000  << "c = [ 0 1/2 1/2 1 ]'\n"
2001  << "A = [ 0 ]\n"
2002  << " [ 1/2 0 ]\n"
2003  << " [ 0 1/2 0 ]\n"
2004  << " [ 0 0 1 0 ]\n"
2005  << "b = [ 1/6 1/3 1/3 1/6 ]'";
2006  return Description.str();
2007  }
2008 
2010  {
2011  if (this->tableau_ == Teuchos::null) {
2012  // Set tableau to the default if null, otherwise keep current tableau.
2013  auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
2014  auto t = stepper->getTableau();
2016  this->getStepperType(),
2017  t->A(),t->b(),t->c(),
2018  t->order(),t->orderMin(),t->orderMax(),
2019  t->bstar()));
2020  }
2021  }
2022 
2026  const int order,
2027  const int orderMin,
2028  const int orderMax,
2031  {
2033  this->getStepperType(),A,b,c,order,orderMin,orderMax,bstar));
2034  this->isInitialized_ = false;
2035  }
2036 
2037  virtual std::string getDefaultICConsistency() const { return "Consistent"; }
2038 
2041  {
2042  auto pl = this->getValidParametersBasicERK();
2043 
2044  // Tableau ParameterList
2048  Teuchos::SerialDenseVector<int,Scalar> bstar = this->tableau_->bstar();
2049 
2050  Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
2051 
2052  std::ostringstream Astream;
2053  Astream.precision(15);
2054  for(int i = 0; i < A.numRows(); i++) {
2055  for(int j = 0; j < A.numCols()-1; j++) {
2056  Astream << A(i,j) << " ";
2057  }
2058  Astream << A(i,A.numCols()-1);
2059  if ( i != A.numRows()-1 ) Astream << "; ";
2060  }
2061  tableauPL->set<std::string>("A", Astream.str());
2062 
2063  std::ostringstream bstream;
2064  bstream.precision(15);
2065  for(int i = 0; i < b.length()-1; i++) {
2066  bstream << b(i) << " ";
2067  }
2068  bstream << b(b.length()-1);
2069  tableauPL->set<std::string>("b", bstream.str());
2070 
2071  std::ostringstream cstream;
2072  cstream.precision(15);
2073  for(int i = 0; i < c.length()-1; i++) {
2074  cstream << c(i) << " ";
2075  }
2076  cstream << c(c.length()-1);
2077  tableauPL->set<std::string>("c", cstream.str());
2078 
2079  tableauPL->set<int>("order", this->tableau_->order());
2080 
2081  if ( bstar.length() == 0 ) {
2082  tableauPL->set("bstar", "");
2083  } else {
2084  std::ostringstream bstarstream;
2085  bstarstream.precision(15);
2086  for(int i = 0; i < bstar.length()-1; i++) {
2087  bstarstream << bstar(i) << " ";
2088  }
2089  bstarstream << bstar(bstar.length()-1);
2090  tableauPL->set<std::string>("bstar", bstarstream.str());
2091  }
2092 
2093  pl->set("Tableau", *tableauPL);
2094 
2095  return pl;
2096  }
2097 };
2098 
2099 
2101 // ------------------------------------------------------------------------
2102 template<class Scalar>
2105  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2107 {
2108  auto stepper = Teuchos::rcp(new StepperERK_General<Scalar>());
2109  stepper->setStepperRKValues(pl);
2110 
2111  if (pl != Teuchos::null) {
2112  if (pl->isParameter("Tableau")) {
2113  auto t = stepper->createTableau(pl);
2114  stepper->setTableau( t->A(),t->b(),t->c(),
2115  t->order(),t->orderMin(),t->orderMax(),
2116  t->bstar() );
2117  }
2118  }
2120  stepper->getTableau()->isImplicit() == true, std::logic_error,
2121  "Error - General ERK received an implicit Butcher Tableau!\n");
2122 
2123  if (model != Teuchos::null) {
2124  stepper->setModel(model);
2125  stepper->initialize();
2126  }
2127 
2128  return stepper;
2129 }
2130 
2131 
2132 // ----------------------------------------------------------------------------
2146 template<class Scalar>
2148  virtual public StepperDIRK<Scalar>
2149 {
2150 public:
2157  {
2158  this->setStepperName("RK Backward Euler");
2159  this->setStepperType("RK Backward Euler");
2160  this->setupTableau();
2161  this->setupDefault();
2162  this->setUseFSAL( false);
2163  this->setICConsistency( "None");
2164  this->setICConsistencyCheck( false);
2165  }
2166 
2168  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2170  bool useFSAL,
2171  std::string ICConsistency,
2172  bool ICConsistencyCheck,
2173  bool useEmbedded,
2174  bool zeroInitialGuess,
2175  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2176  {
2177  this->setStepperName("RK Backward Euler");
2178  this->setStepperType("RK Backward Euler");
2179  this->setupTableau();
2180  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2181  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2182  }
2183 
2184  std::string getDescription() const
2185  {
2186  std::ostringstream Description;
2187  Description << this->getStepperType() << "\n"
2188  << "c = [ 1 ]'\n"
2189  << "A = [ 1 ]\n"
2190  << "b = [ 1 ]'";
2191  return Description.str();
2192  }
2193 
2194 protected:
2195 
2197  {
2198  typedef Teuchos::ScalarTraits<Scalar> ST;
2199  const Scalar sspcoef = std::numeric_limits<Scalar>::max();
2200  int NumStages = 1;
2201  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2204 
2205  // Fill A:
2206  A(0,0) = ST::one();
2207 
2208  // Fill b:
2209  b(0) = ST::one();
2210 
2211  // Fill c:
2212  c(0) = ST::one();
2213 
2214  int order = 1;
2215 
2217  this->getStepperType(),A,b,c,order,order,order));
2218  this->tableau_->setTVD(true);
2219  this->tableau_->setTVDCoeff(sspcoef);
2220  }
2221 };
2222 
2223 
2225 // ------------------------------------------------------------------------
2226 template<class Scalar>
2229  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2231 {
2232  auto stepper = Teuchos::rcp(new StepperDIRK_BackwardEuler<Scalar>());
2233  stepper->setStepperDIRKValues(pl);
2234 
2235  if (model != Teuchos::null) {
2236  stepper->setModel(model);
2237  stepper->initialize();
2238  }
2239 
2240  return stepper;
2241 }
2242 
2243 
2244 // ----------------------------------------------------------------------------
2267 template<class Scalar>
2269  virtual public StepperDIRK<Scalar>
2270 {
2271 public:
2278  {
2279  typedef Teuchos::ScalarTraits<Scalar> ST;
2280  const Scalar one = ST::one();
2281  gammaDefault_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
2282 
2283  this->setStepperName("SDIRK 2 Stage 2nd order");
2284  this->setStepperType("SDIRK 2 Stage 2nd order");
2285  this->setGamma(gammaDefault_);
2286  this->setupTableau();
2287  this->setupDefault();
2288  this->setUseFSAL( false);
2289  this->setICConsistency( "None");
2290  this->setICConsistencyCheck( false);
2291  }
2292 
2294  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2296  bool useFSAL,
2297  std::string ICConsistency,
2298  bool ICConsistencyCheck,
2299  bool useEmbedded,
2300  bool zeroInitialGuess,
2301  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2302  Scalar gamma = Scalar(0.2928932188134524))
2303  {
2304  typedef Teuchos::ScalarTraits<Scalar> ST;
2305  const Scalar one = ST::one();
2306  gammaDefault_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
2307 
2308  this->setStepperName("SDIRK 2 Stage 2nd order");
2309  this->setStepperType("SDIRK 2 Stage 2nd order");
2310  this->setGamma(gamma);
2311  this->setupTableau();
2312  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2313  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2314  }
2315 
2316  void setGamma(Scalar gamma)
2317  {
2318  gamma_ = gamma;
2319  this->isInitialized_ = false;
2320  this->setupTableau();
2321  }
2322 
2323  Scalar getGamma() const { return gamma_; }
2324 
2325  std::string getDescription() const
2326  {
2327  std::ostringstream Description;
2328  Description << this->getStepperType() << "\n"
2329  << "Computer Methods for ODEs and DAEs\n"
2330  << "U. M. Ascher and L. R. Petzold\n"
2331  << "p. 106\n"
2332  << "gamma = (2+-sqrt(2))/2\n"
2333  << "c = [ gamma 1 ]'\n"
2334  << "A = [ gamma 0 ]\n"
2335  << " [ 1-gamma gamma ]\n"
2336  << "b = [ 1-gamma gamma ]'";
2337  return Description.str();
2338  }
2339 
2342  {
2343  auto pl = this->getValidParametersBasicDIRK();
2344  pl->template set<double>("gamma", this->getGamma(),
2345  "The default value is gamma = (2-sqrt(2))/2. "
2346  "This will produce an L-stable 2nd order method with the stage "
2347  "times within the timestep. Other values of gamma will still "
2348  "produce an L-stable scheme, but will only be 1st order accurate.");
2349 
2350  return pl;
2351  }
2352 
2353 protected:
2354 
2356  {
2357  typedef Teuchos::ScalarTraits<Scalar> ST;
2358  int NumStages = 2;
2359  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2362 
2363  const Scalar one = ST::one();
2364  const Scalar zero = ST::zero();
2365 
2366  // Fill A:
2367  A(0,0) = gamma_; A(0,1) = zero;
2368  A(1,0) = Teuchos::as<Scalar>( one - gamma_ ); A(1,1) = gamma_;
2369 
2370  // Fill b:
2371  b(0) = Teuchos::as<Scalar>( one - gamma_ ); b(1) = gamma_;
2372 
2373  // Fill c:
2374  c(0) = gamma_; c(1) = one;
2375 
2376  int order = 1;
2377  if ( std::abs((gamma_-gammaDefault_)/gamma_) < 1.0e-08 ) order = 2;
2378 
2380  this->getStepperType(),A,b,c,order,order,order));
2381  }
2382 
2383  private:
2385  Scalar gamma_;
2386 };
2387 
2388 
2390 // ------------------------------------------------------------------------
2391 template<class Scalar>
2394  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2396 {
2397  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
2398  stepper->setStepperDIRKValues(pl);
2399 
2400  if (pl != Teuchos::null)
2401  stepper->setGamma(pl->get<double>("gamma", 0.2928932188134524));
2402 
2403  if (model != Teuchos::null) {
2404  stepper->setModel(model);
2405  stepper->initialize();
2406  }
2407 
2408  return stepper;
2409 }
2410 
2411 
2412 // ----------------------------------------------------------------------------
2439 template<class Scalar>
2441  virtual public StepperDIRK<Scalar>
2442 {
2443 public:
2450  {
2451  this->setStepperName("SDIRK 3 Stage 2nd order");
2452  this->setStepperType("SDIRK 3 Stage 2nd order");
2453  this->setupTableau();
2454  this->setupDefault();
2455  this->setUseFSAL( false);
2456  this->setICConsistency( "None");
2457  this->setICConsistencyCheck( false);
2458  }
2459 
2461  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2463  bool useFSAL,
2464  std::string ICConsistency,
2465  bool ICConsistencyCheck,
2466  bool useEmbedded,
2467  bool zeroInitialGuess,
2468  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2469  {
2470 
2471  this->setStepperName("SDIRK 3 Stage 2nd order");
2472  this->setStepperType("SDIRK 3 Stage 2nd order");
2473  this->setupTableau();
2474  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2475  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2476  }
2477 
2478  std::string getDescription() const
2479  {
2480  std::ostringstream Description;
2481  Description << this->getStepperType() << "\n"
2482  << "Implicit-explicit Runge-Kutta schemes and applications to\n"
2483  << "hyperbolic systems with relaxation\n"
2484  << "L Pareschi, G Russo\n"
2485  << "Journal of Scientific computing, 2005 - Springer\n"
2486  << "Table 5\n"
2487  << "gamma = 1/(2+sqrt(2))\n"
2488  << "c = [ gamma (1-gamma) 1/2 ]'\n"
2489  << "A = [ gamma 0 0 ]\n"
2490  << " [ 1-2gamma gamma 0 ]\n"
2491  << " [ 1/2-gamma 0 gamma ]\n"
2492  << "b = [ 1/6 1/6 2/3 ]'";
2493  return Description.str();
2494  }
2495 
2496 protected:
2497 
2499  {
2500  typedef Teuchos::ScalarTraits<Scalar> ST;
2501  using Teuchos::as;
2502  const int NumStages = 3;
2503  const int order = 2;
2504  const Scalar sspcoef = 1.0529;
2505  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2508  const Scalar one = ST::one();
2509  const Scalar zero = ST::zero();
2510  const Scalar gamma = as<Scalar>(one - ( one / ST::squareroot(2*one) ) );
2511 
2512  // Fill A:
2513  A(0,0) = A(1,1) = A(2,2) = gamma;
2514  A(0,1) = A(0,2) = A(1,2) = A(2,1) = zero;
2515  A(1,0) = as<Scalar>(one - 2*gamma);
2516  A(2,0) = as<Scalar>( ( one/ (2.*one)) - gamma );
2517 
2518  // Fill b:
2519  b(0) = b(1) = ( one / (6*one) );
2520  b(2) = (2*one)/(3*one);
2521 
2522  // Fill c:
2523  c(0) = gamma;
2524  c(1) = one - gamma;
2525  c(2) = one / (2*one);
2526 
2528  this->getStepperType(),A,b,c,order,order,order));
2529  this->tableau_->setTVD(true);
2530  this->tableau_->setTVDCoeff(sspcoef);
2531  }
2532 
2533 };
2534 
2535 
2537 // ------------------------------------------------------------------------
2538 template<class Scalar>
2541  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2543 {
2544  auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage2ndOrder<Scalar>());
2545  stepper->setStepperDIRKValues(pl);
2546 
2547  if (model != Teuchos::null) {
2548  stepper->setModel(model);
2549  stepper->initialize();
2550  }
2551 
2552  return stepper;
2553 }
2554 
2555 
2556 // ----------------------------------------------------------------------------
2583 template<class Scalar>
2585  virtual public StepperDIRK<Scalar>
2586 {
2587 public:
2594  {
2595  typedef Teuchos::ScalarTraits<Scalar> ST;
2596  using Teuchos::as;
2597  const Scalar one = ST::one();
2598  gammaDefault_ = as<Scalar>((3*one+ST::squareroot(3*one))/(6*one));
2599  gammaTypeDefault_ = "3rd Order A-stable";
2600 
2601  this->setStepperName("SDIRK 2 Stage 3rd order");
2602  this->setStepperType("SDIRK 2 Stage 3rd order");
2603  this->setGammaType(gammaTypeDefault_);
2604  this->setGamma(gammaDefault_);
2605  this->setupTableau();
2606  this->setupDefault();
2607  this->setUseFSAL( false);
2608  this->setICConsistency( "None");
2609  this->setICConsistencyCheck( false);
2610  }
2611 
2613  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2615  bool useFSAL,
2616  std::string ICConsistency,
2617  bool ICConsistencyCheck,
2618  bool useEmbedded,
2619  bool zeroInitialGuess,
2620  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2621  std::string gammaType = "3rd Order A-stable",
2622  Scalar gamma = Scalar(0.7886751345948128))
2623  {
2624  typedef Teuchos::ScalarTraits<Scalar> ST;
2625  using Teuchos::as;
2626  const Scalar one = ST::one();
2627  gammaDefault_ = as<Scalar>((3*one+ST::squareroot(3*one))/(6*one));
2628  gammaTypeDefault_ = "3rd Order A-stable";
2629 
2630  this->setStepperName("SDIRK 2 Stage 3rd order");
2631  this->setStepperType("SDIRK 2 Stage 3rd order");
2632  this->setGammaType(gammaType);
2633  this->setGamma(gamma);
2634  this->setupTableau();
2635  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2636  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2637  }
2638 
2639  void setGammaType(std::string gammaType)
2640  {
2642  !(gammaType == "3rd Order A-stable" ||
2643  gammaType == "2nd Order L-stable" ||
2644  gammaType == "gamma"), std::logic_error,
2645  "gammaType needs to be '3rd Order A-stable', '2nd Order L-stable' "
2646  "or 'gamma'.");
2647 
2648  gammaType_ = gammaType;
2649  this->isInitialized_ = false;
2650  this->setupTableau();
2651  }
2652 
2653  std::string getGammaType() const { return gammaType_; }
2654 
2655  void setGamma(Scalar gamma)
2656  {
2657  if ( gammaType_ == "gamma" ) {
2658  gamma_ = gamma;
2659  this->setupTableau();
2660  }
2661  this->isInitialized_ = false;
2662  }
2663 
2664  Scalar getGamma() const { return gamma_; }
2665 
2666  std::string getDescription() const
2667  {
2668  std::ostringstream Description;
2669  Description << this->getStepperType() << "\n"
2670  << "Solving Ordinary Differential Equations I:\n"
2671  << "Nonstiff Problems, 2nd Revised Edition\n"
2672  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2673  << "Table 7.2, pg 207\n"
2674  << "gamma = (3+sqrt(3))/6 -> 3rd order and A-stable\n"
2675  << "gamma = (2-sqrt(2))/2 -> 2nd order and L-stable\n"
2676  << "c = [ gamma 1-gamma ]'\n"
2677  << "A = [ gamma 0 ]\n"
2678  << " [ 1-2*gamma gamma ]\n"
2679  << "b = [ 1/2 1/2 ]'";
2680  return Description.str();
2681  }
2682 
2685  {
2686  auto pl = this->getValidParametersBasicDIRK();
2687 
2688  pl->template set<std::string>("Gamma Type", this->getGammaType(),
2689  "Valid values are '3rd Order A-stable' ((3+sqrt(3))/6.), "
2690  "'2nd Order L-stable' ((2-sqrt(2))/2) and 'gamma' (user defined). "
2691  "The default value is '3rd Order A-stable'.");
2692  pl->template set<double>("gamma", this->getGamma(),
2693  "Equal to (3+sqrt(3))/6 if 'Gamma Type' = '3rd Order A-stable', or "
2694  "(2-sqrt(2))/2 if 'Gamma Type' = '2nd Order L-stable', or "
2695  "user-defined gamma value if 'Gamma Type = 'gamma'. "
2696  "The default value is gamma = (3+sqrt(3))/6, which matches "
2697  "the default 'Gamma Type' = '3rd Order A-stable'.");
2698 
2699  return pl;
2700  }
2701 
2702 protected:
2703 
2705  {
2706  typedef Teuchos::ScalarTraits<Scalar> ST;
2707  using Teuchos::as;
2708  int NumStages = 2;
2709  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2712  const Scalar one = ST::one();
2713  const Scalar zero = ST::zero();
2714 
2715  int order = 0;
2716  if (gammaType_ == "3rd Order A-stable") {
2717  order = 3;
2719  } else if (gammaType_ == "2nd Order L-stable") {
2720  order = 2;
2721  gamma_ = as<Scalar>( (2*one - ST::squareroot(2*one))/(2*one) );
2722  } else if (gammaType_ == "gamma") {
2723  order = 2;
2724  }
2725 
2726  // Fill A:
2727  A(0,0) = gamma_; A(0,1) = zero;
2728  A(1,0) = as<Scalar>(one - 2*gamma_); A(1,1) = gamma_;
2729 
2730  // Fill b:
2731  b(0) = as<Scalar>( one/(2*one) ); b(1) = as<Scalar>( one/(2*one) );
2732 
2733  // Fill c:
2734  c(0) = gamma_; c(1) = as<Scalar>( one - gamma_ );
2735 
2737  this->getStepperType(),A,b,c,order,2,3));
2738  }
2739 
2740  private:
2741  std::string gammaTypeDefault_;
2742  std::string gammaType_;
2744  Scalar gamma_;
2745 };
2746 
2747 
2749 // ------------------------------------------------------------------------
2750 template<class Scalar>
2753  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2755 {
2756  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage3rdOrder<Scalar>());
2757  stepper->setStepperDIRKValues(pl);
2758 
2759  if (pl != Teuchos::null) {
2760  stepper->setGammaType(
2761  pl->get<std::string>("Gamma Type", "3rd Order A-stable"));
2762  stepper->setGamma(pl->get<double>("gamma", 0.7886751345948128));
2763  }
2764 
2765  if (model != Teuchos::null) {
2766  stepper->setModel(model);
2767  stepper->initialize();
2768  }
2769 
2770  return stepper;
2771 }
2772 
2773 
2774 // ----------------------------------------------------------------------------
2793 template<class Scalar>
2795  virtual public StepperDIRK<Scalar>
2796 {
2797 public:
2804  {
2805  this->setStepperName("EDIRK 2 Stage 3rd order");
2806  this->setStepperType("EDIRK 2 Stage 3rd order");
2807  this->setupTableau();
2808  this->setupDefault();
2809  this->setUseFSAL( false);
2810  this->setICConsistency( "None");
2811  this->setICConsistencyCheck( false);
2812  }
2813 
2815  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2817  bool useFSAL,
2818  std::string ICConsistency,
2819  bool ICConsistencyCheck,
2820  bool useEmbedded,
2821  bool zeroInitialGuess,
2822  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2823  {
2824  this->setStepperName("EDIRK 2 Stage 3rd order");
2825  this->setStepperType("EDIRK 2 Stage 3rd order");
2826  this->setupTableau();
2827  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2828  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2829  }
2830 
2831  std::string getDescription() const
2832  {
2833  std::ostringstream Description;
2834  Description << this->getStepperType() << "\n"
2835  << "Hammer & Hollingsworth method\n"
2836  << "Solving Ordinary Differential Equations I:\n"
2837  << "Nonstiff Problems, 2nd Revised Edition\n"
2838  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2839  << "Table 7.1, pg 205\n"
2840  << "c = [ 0 2/3 ]'\n"
2841  << "A = [ 0 0 ]\n"
2842  << " [ 1/3 1/3 ]\n"
2843  << "b = [ 1/4 3/4 ]'";
2844  return Description.str();
2845  }
2846 
2847 protected:
2848 
2850  {
2851  typedef Teuchos::ScalarTraits<Scalar> ST;
2852  using Teuchos::as;
2853  int NumStages = 2;
2854  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
2857  const Scalar one = ST::one();
2858  const Scalar zero = ST::zero();
2859 
2860  // Fill A:
2861  A(0,0) = zero; A(0,1) = zero;
2862  A(1,0) = as<Scalar>( one/(3*one) ); A(1,1) = as<Scalar>( one/(3*one) );
2863 
2864  // Fill b:
2865  b(0) = as<Scalar>( one/(4*one) ); b(1) = as<Scalar>( 3*one/(4*one) );
2866 
2867  // Fill c:
2868  c(0) = zero; c(1) = as<Scalar>( 2*one/(3*one) );
2869  int order = 3;
2870 
2872  this->getStepperType(),A,b,c,order,order,order));
2873  this->tableau_->setTVD(true);
2874  this->tableau_->setTVDCoeff(1.5);
2875  }
2876 };
2877 
2878 
2880 template<class Scalar>
2883  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2885 {
2886  auto stepper = Teuchos::rcp(new StepperEDIRK_2Stage3rdOrder<Scalar>());
2887  stepper->setStepperDIRKValues(pl);
2888 
2889  if (model != Teuchos::null) {
2890  stepper->setModel(model);
2891  stepper->initialize();
2892  }
2893 
2894  return stepper;
2895 }
2896 
2897 
2898 // ----------------------------------------------------------------------------
2924 template<class Scalar>
2926  virtual public StepperDIRK<Scalar>
2927 {
2928 public:
2935  {
2936  typedef Teuchos::ScalarTraits<Scalar> ST;
2937  thetaDefault_ = ST::one()/(2*ST::one());
2938 
2939  this->setStepperName("DIRK 1 Stage Theta Method");
2940  this->setStepperType("DIRK 1 Stage Theta Method");
2941  this->setTheta(thetaDefault_);
2942  this->setupTableau();
2943  this->setupDefault();
2944  this->setUseFSAL( false);
2945  this->setICConsistency( "None");
2946  this->setICConsistencyCheck( false);
2947  }
2948 
2950  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2952  bool useFSAL,
2953  std::string ICConsistency,
2954  bool ICConsistencyCheck,
2955  bool useEmbedded,
2956  bool zeroInitialGuess,
2957  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2958  Scalar theta = Scalar(0.5))
2959  {
2960  typedef Teuchos::ScalarTraits<Scalar> ST;
2961  thetaDefault_ = ST::one()/(2*ST::one());
2962 
2963  this->setStepperName("DIRK 1 Stage Theta Method");
2964  this->setStepperType("DIRK 1 Stage Theta Method");
2965  this->setTheta(theta);
2966  this->setupTableau();
2967  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2968  useEmbedded, zeroInitialGuess, stepperRKAppAction);
2969  }
2970 
2971  void setTheta(Scalar theta)
2972  {
2974  theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
2975  "'theta' can not be zero, as it makes this stepper explicit. \n"
2976  "Try using the 'RK Forward Euler' stepper.\n");
2977  theta_ = theta;
2978  this->setupTableau();
2979  this->isInitialized_ = false;
2980  }
2981 
2982  Scalar getTheta() const { return theta_; }
2983 
2984  std::string getDescription() const
2985  {
2986  std::ostringstream Description;
2987  Description << this->getStepperType() << "\n"
2988  << "Non-standard finite-difference methods\n"
2989  << "in dynamical systems, P. Kama,\n"
2990  << "Dissertation, University of Pretoria, pg. 49.\n"
2991  << "Comment: Generalized Implicit Midpoint Method\n"
2992  << "c = [ theta ]'\n"
2993  << "A = [ theta ]\n"
2994  << "b = [ 1 ]'";
2995  return Description.str();
2996  }
2997 
3000  {
3001  auto pl = this->getValidParametersBasicDIRK();
3002 
3003  pl->template set<double>("theta", getTheta(),
3004  "Valid values are 0 <= theta <= 1, where theta = 0 "
3005  "implies Forward Euler, theta = 1/2 implies implicit midpoint "
3006  "method (default), and theta = 1 implies Backward Euler. "
3007  "For theta != 1/2, this method is first-order accurate, "
3008  "and with theta = 1/2, it is second-order accurate. "
3009  "This method is A-stable, but becomes L-stable with theta=1.");
3010 
3011  return pl;
3012  }
3013 
3014 protected:
3015 
3017  {
3018  typedef Teuchos::ScalarTraits<Scalar> ST;
3019  int NumStages = 1;
3020  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3023  A(0,0) = theta_;
3024  b(0) = ST::one();
3025  c(0) = theta_;
3026 
3027  int order = 1;
3028  if ( std::abs((theta_-thetaDefault_)/theta_) < 1.0e-08 ) order = 2;
3029 
3031  this->getStepperType(),A,b,c,order,1,2));
3032  this->tableau_->setTVD(true);
3033  this->tableau_->setTVDCoeff(2.0);
3034  }
3035 
3036  private:
3038  Scalar theta_;
3039 };
3040 
3041 
3043 // ------------------------------------------------------------------------
3044 template<class Scalar>
3047  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3049 {
3050  auto stepper = Teuchos::rcp(new StepperDIRK_1StageTheta<Scalar>());
3051  stepper->setStepperDIRKValues(pl);
3052 
3053  if (pl != Teuchos::null) {
3054  stepper->setTheta(pl->get<double>("theta", 0.5));
3055  }
3056 
3057  if (model != Teuchos::null) {
3058  stepper->setModel(model);
3059  stepper->initialize();
3060  }
3061 
3062  return stepper;
3063 }
3064 
3065 
3066 // ----------------------------------------------------------------------------
3091 template<class Scalar>
3093  virtual public StepperDIRK<Scalar>
3094 {
3095 public:
3102  {
3103  typedef Teuchos::ScalarTraits<Scalar> ST;
3104  thetaDefault_ = ST::one()/(2*ST::one());
3105 
3106  this->setStepperName("EDIRK 2 Stage Theta Method");
3107  this->setStepperType("EDIRK 2 Stage Theta Method");
3108  this->setTheta(thetaDefault_);
3109  this->setupTableau();
3110  this->setupDefault();
3111  this->setUseFSAL( true);
3112  this->setICConsistency( "Consistent");
3113  this->setICConsistencyCheck( false);
3114  }
3115 
3117  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3119  bool useFSAL,
3120  std::string ICConsistency,
3121  bool ICConsistencyCheck,
3122  bool useEmbedded,
3123  bool zeroInitialGuess,
3124  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
3125  Scalar theta = Scalar(0.5))
3126  {
3127  typedef Teuchos::ScalarTraits<Scalar> ST;
3128  thetaDefault_ = ST::one()/(2*ST::one());
3129 
3130  this->setStepperName("EDIRK 2 Stage Theta Method");
3131  this->setStepperType("EDIRK 2 Stage Theta Method");
3132  this->setTheta(theta);
3133  this->setupTableau();
3134  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3135  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3136  }
3137 
3138  void setTheta(Scalar theta)
3139  {
3141  theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
3142  "'theta' can not be zero, as it makes this stepper explicit. \n"
3143  "Try using the 'RK Forward Euler' stepper.\n");
3144  theta_ = theta;
3145  this->isInitialized_ = false;
3146  this->setupTableau();
3147  }
3148 
3149  Scalar getTheta() const { return theta_; }
3150 
3151  std::string getDescription() const
3152  {
3153  std::ostringstream Description;
3154  Description << this->getStepperType() << "\n"
3155  << "Computer Methods for ODEs and DAEs\n"
3156  << "U. M. Ascher and L. R. Petzold\n"
3157  << "p. 113\n"
3158  << "c = [ 0 1 ]'\n"
3159  << "A = [ 0 0 ]\n"
3160  << " [ 1-theta theta ]\n"
3161  << "b = [ 1-theta theta ]'";
3162  return Description.str();
3163  }
3164 
3167  {
3168  auto pl = this->getValidParametersBasicDIRK();
3169 
3170  pl->template set<double>("theta", getTheta(),
3171  "Valid values are 0 < theta <= 1, where theta = 0 "
3172  "implies Forward Euler, theta = 1/2 implies trapezoidal "
3173  "method (default), and theta = 1 implies Backward Euler. "
3174  "For theta != 1/2, this method is first-order accurate, "
3175  "and with theta = 1/2, it is second-order accurate. "
3176  "This method is A-stable, but becomes L-stable with theta=1.");
3177 
3178  return pl;
3179  }
3180 
3181  void setUseFSAL(bool a) { this->useFSAL_ = a; this->isInitialized_ = false; }
3182 
3183 protected:
3184 
3186  {
3187  typedef Teuchos::ScalarTraits<Scalar> ST;
3188  const Scalar one = ST::one();
3189  const Scalar zero = ST::zero();
3190 
3191  int NumStages = 2;
3192  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3195 
3196  // Fill A:
3197  A(0,0) = zero; A(0,1) = zero;
3198  A(1,0) = Teuchos::as<Scalar>( one - theta_ ); A(1,1) = theta_;
3199 
3200  // Fill b:
3201  b(0) = Teuchos::as<Scalar>( one - theta_ );
3202  b(1) = theta_;
3203 
3204  // Fill c:
3205  c(0) = zero;
3206  c(1) = one;
3207 
3208  int order = 1;
3209  if ( std::abs((theta_-thetaDefault_)/theta_) < 1.0e-08 ) order = 2;
3210 
3212  this->getStepperType(),A,b,c,order,1,2));
3213  this->tableau_->setTVD(true);
3214  this->tableau_->setTVDCoeff(2.0);
3215  }
3216 
3217  private:
3219  Scalar theta_;
3220 };
3221 
3222 
3224 // ------------------------------------------------------------------------
3225 template<class Scalar>
3228  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3230 {
3231  auto stepper = Teuchos::rcp(new StepperEDIRK_2StageTheta<Scalar>());
3232  stepper->setStepperDIRKValues(pl);
3233 
3234  if (pl != Teuchos::null) {
3235  stepper->setTheta(pl->get<double>("theta", 0.5));
3236  }
3237 
3238  if (model != Teuchos::null) {
3239  stepper->setModel(model);
3240  stepper->initialize();
3241  }
3242 
3243  return stepper;
3244 }
3245 
3246 
3247 // ----------------------------------------------------------------------------
3266 template<class Scalar>
3268  virtual public StepperDIRK<Scalar>
3269 {
3270 public:
3277  {
3278  this->setStepperName("RK Trapezoidal Rule");
3279  this->setStepperType("RK Trapezoidal Rule");
3280  this->setupTableau();
3281  this->setupDefault();
3282  this->setUseFSAL( true);
3283  this->setICConsistency( "Consistent");
3284  this->setICConsistencyCheck( false);
3285  }
3286 
3288  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3290  bool useFSAL,
3291  std::string ICConsistency,
3292  bool ICConsistencyCheck,
3293  bool useEmbedded,
3294  bool zeroInitialGuess,
3295  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3296  {
3297  this->setStepperName("RK Trapezoidal Rule");
3298  this->setStepperType("RK Trapezoidal Rule");
3299  this->setupTableau();
3300  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3301  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3302  }
3303 
3304  std::string getDescription() const
3305  {
3306  std::ostringstream Description;
3307  Description << this->getStepperType() << "\n"
3308  << "Also known as Crank-Nicolson Method.\n"
3309  << "c = [ 0 1 ]'\n"
3310  << "A = [ 0 0 ]\n"
3311  << " [ 1/2 1/2 ]\n"
3312  << "b = [ 1/2 1/2 ]'";
3313  return Description.str();
3314  }
3315 
3316  void setUseFSAL(bool a) { this->useFSAL_ = a; this->isInitialized_ = false; }
3317 
3318 protected:
3319 
3321  {
3322  typedef Teuchos::ScalarTraits<Scalar> ST;
3323  const Scalar one = ST::one();
3324  const Scalar zero = ST::zero();
3325  const Scalar onehalf = ST::one()/(2*ST::one());
3326 
3327  int NumStages = 2;
3328  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3331 
3332  // Fill A:
3333  A(0,0) = zero; A(0,1) = zero;
3334  A(1,0) = onehalf; A(1,1) = onehalf;
3335 
3336  // Fill b:
3337  b(0) = onehalf;
3338  b(1) = onehalf;
3339 
3340  // Fill c:
3341  c(0) = zero;
3342  c(1) = one;
3343 
3344  int order = 2;
3345 
3347  this->getStepperType(),A,b,c,order,order,order));
3348  this->tableau_->setTVD(true);
3349  this->tableau_->setTVDCoeff(2.0);
3350  }
3351 };
3352 
3353 
3355 // ------------------------------------------------------------------------
3356 template<class Scalar>
3359  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3361 {
3362  auto stepper = Teuchos::rcp(new StepperEDIRK_TrapezoidalRule<Scalar>());
3363 
3364  // Test for aliases.
3365  if (pl != Teuchos::null) {
3366  auto stepperType =
3367  pl->get<std::string>("Stepper Type", stepper->getStepperType());
3368 
3370  stepperType != stepper->getStepperType() &&
3371  stepperType != "RK Crank-Nicolson", std::logic_error,
3372  " ParameterList 'Stepper Type' (='" + stepperType +"')\n"
3373  " does not match type for this Stepper (='" + stepper->getStepperType() +
3374  "')\n or one of its aliases ('RK Crank-Nicolson').\n");
3375 
3376  // Reset default StepperType.
3377  pl->set<std::string>("Stepper Type", stepper->getStepperType());
3378  }
3379 
3380  stepper->setStepperDIRKValues(pl);
3381 
3382  if (model != Teuchos::null) {
3383  stepper->setModel(model);
3384  stepper->initialize();
3385  }
3386 
3387  return stepper;
3388 }
3389 
3390 
3391 // ----------------------------------------------------------------------------
3416 template<class Scalar>
3418  virtual public StepperDIRK<Scalar>
3419 {
3420 public:
3427  {
3428  this->setStepperName("RK Implicit Midpoint");
3429  this->setStepperType("RK Implicit Midpoint");
3430  this->setupTableau();
3431  this->setupDefault();
3432  this->setUseFSAL( false);
3433  this->setICConsistency( "None");
3434  this->setICConsistencyCheck( false);
3435  }
3436 
3438  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3440  bool useFSAL,
3441  std::string ICConsistency,
3442  bool ICConsistencyCheck,
3443  bool useEmbedded,
3444  bool zeroInitialGuess,
3445  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3446  {
3447  this->setStepperName("RK Implicit Midpoint");
3448  this->setStepperType("RK Implicit Midpoint");
3449  this->setupTableau();
3450  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3451  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3452  }
3453 
3454  std::string getDescription() const
3455  {
3456  std::ostringstream Description;
3457  Description << this->getStepperType() << "\n"
3458  << "A-stable\n"
3459  << "Solving Ordinary Differential Equations II:\n"
3460  << "Stiff and Differential-Algebraic Problems,\n"
3461  << "2nd Revised Edition\n"
3462  << "E. Hairer and G. Wanner\n"
3463  << "Table 5.2, pg 72\n"
3464  << "Solving Ordinary Differential Equations I:\n"
3465  << "Nonstiff Problems, 2nd Revised Edition\n"
3466  << "E. Hairer, S. P. Norsett, and G. Wanner\n"
3467  << "Table 7.1, pg 205\n"
3468  << "c = [ 1/2 ]'\n"
3469  << "A = [ 1/2 ]\n"
3470  << "b = [ 1 ]'";
3471  return Description.str();
3472  }
3473 
3474 protected:
3475 
3477  {
3478  typedef Teuchos::ScalarTraits<Scalar> ST;
3479  int NumStages = 1;
3480  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3483  const Scalar onehalf = ST::one()/(2*ST::one());
3484  const Scalar one = ST::one();
3485 
3486  // Fill A:
3487  A(0,0) = onehalf;
3488 
3489  // Fill b:
3490  b(0) = one;
3491 
3492  // Fill c:
3493  c(0) = onehalf;
3494 
3495  int order = 2;
3496 
3498  this->getStepperType(),A,b,c,order,order,order));
3499  this->tableau_->setTVD(true);
3500  this->tableau_->setTVDCoeff(2.0);
3501  }
3502 };
3503 
3504 
3506 // ------------------------------------------------------------------------
3507 template<class Scalar>
3510  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3512 {
3514  stepper->setStepperDIRKValues(pl);
3515 
3516  if (model != Teuchos::null) {
3517  stepper->setModel(model);
3518  stepper->initialize();
3519  }
3520 
3521  return stepper;
3522 }
3523 
3524 
3525 // ----------------------------------------------------------------------------
3544 template<class Scalar>
3546  virtual public StepperDIRK<Scalar>
3547 {
3548  public:
3550  {
3551  this->setStepperName("SSPDIRK22");
3552  this->setStepperType("SSPDIRK22");
3553  this->setupTableau();
3554  this->setupDefault();
3555  this->setUseFSAL( false);
3556  this->setICConsistency( "None");
3557  this->setICConsistencyCheck( false);
3558  }
3559 
3561  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3563  bool useFSAL,
3564  std::string ICConsistency,
3565  bool ICConsistencyCheck,
3566  bool useEmbedded,
3567  bool zeroInitialGuess,
3568  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3569  {
3570  this->setStepperName("SSPDIRK22");
3571  this->setStepperType("SSPDIRK22");
3572  this->setupTableau();
3573  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3574  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3575  }
3576 
3577  std::string getDescription() const
3578  {
3579  std::ostringstream Description;
3580  Description << this->getStepperType() << "\n"
3581  << "Strong Stability Preserving Diagonally-Implicit RK (stage=2, order=2)\n"
3582  << "SSP-Coef = 4\n"
3583  << "c = [ 1/4 3/4 ]'\n"
3584  << "A = [ 1/4 ]\n"
3585  << " [ 1/2 1/4 ]\n"
3586  << "b = [ 1/2 1/2 ]\n" << std::endl;
3587  return Description.str();
3588  }
3589 
3590 protected:
3591 
3593  {
3594  typedef Teuchos::ScalarTraits<Scalar> ST;
3595  using Teuchos::as;
3596  const int NumStages = 2;
3597  const int order = 2;
3598  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3601 
3602  const Scalar one = ST::one();
3603  const Scalar zero = ST::zero();
3604  const Scalar onehalf = one/(2*one);
3605  const Scalar onefourth = one/(4*one);
3606 
3607  // Fill A:
3608  A(0,0) = A(1,1) = onefourth;
3609  A(0,1) = zero;
3610  A(1,0) = onehalf;
3611 
3612  // Fill b:
3613  b(0) = b(1) = onehalf;
3614 
3615  // Fill c:
3616  c(0) = A(0,0);
3617  c(1) = A(1,0) + A(1,1);
3618 
3620  this->getStepperType(),A,b,c,order,order,order));
3621  this->tableau_->setTVD(true);
3622  this->tableau_->setTVDCoeff(4.0);
3623  }
3624 };
3625 
3626 
3628 // ------------------------------------------------------------------------
3629 template<class Scalar>
3632  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3634 {
3635  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK22<Scalar>());
3636  stepper->setStepperDIRKValues(pl);
3637 
3638  if (model != Teuchos::null) {
3639  stepper->setModel(model);
3640  stepper->initialize();
3641  }
3642 
3643  return stepper;
3644 }
3645 
3646 
3647 // ----------------------------------------------------------------------------
3667 template<class Scalar>
3669  virtual public StepperDIRK<Scalar>
3670 {
3671  public:
3673  {
3674  this->setStepperName("SSPDIRK32");
3675  this->setStepperType("SSPDIRK32");
3676  this->setupTableau();
3677  this->setupDefault();
3678  this->setUseFSAL( false);
3679  this->setICConsistency( "None");
3680  this->setICConsistencyCheck( false);
3681  }
3682 
3684  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3686  bool useFSAL,
3687  std::string ICConsistency,
3688  bool ICConsistencyCheck,
3689  bool useEmbedded,
3690  bool zeroInitialGuess,
3691  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3692  {
3693  this->setStepperName("SSPDIRK32");
3694  this->setStepperType("SSPDIRK32");
3695  this->setupTableau();
3696  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3697  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3698  }
3699 
3700  std::string getDescription() const
3701  {
3702  std::ostringstream Description;
3703  Description << this->getStepperType() << "\n"
3704  << "Strong Stability Preserving Diagonally-Implicit RK (stage=3, order=2)\n"
3705  << "SSP-Coef = 6\n"
3706  << "c = [ 1/6 1/2 5/6 ]'\n"
3707  << "A = [ 1/6 ]\n"
3708  << " [ 1/3 1/6 ]\n"
3709  << " [ 1/3 1/3 1/6 ]\n"
3710  << "b = [ 1/3 1/3 1/3 ]\n" << std::endl;
3711  return Description.str();
3712  }
3713 
3714 protected:
3715 
3717  {
3718 
3719  typedef Teuchos::ScalarTraits<Scalar> ST;
3720  using Teuchos::as;
3721  const int NumStages = 3;
3722  const int order = 2;
3723  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3726 
3727  const Scalar one = ST::one();
3728  const Scalar zero = ST::zero();
3729  const Scalar onethird = one/(3*one);
3730  const Scalar onesixth = one/(6*one);
3731 
3732  // Fill A:
3733  A(0,0) = A(1,1) = A(2,2) = onesixth;
3734  A(1,0) = A(2,0) = A(2,1) = onethird;
3735  A(0,1) = A(0,2) = A(1,2) = zero;
3736 
3737  // Fill b:
3738  b(0) = b(1) = b(2) = onethird;
3739 
3740  // Fill c:
3741  c(0) = A(0,0);
3742  c(1) = A(1,0) + A(1,1);
3743  c(2) = A(2,0) + A(2,1) + A(2,2);
3744 
3746  this->getStepperType(),A,b,c,order,order,order));
3747  this->tableau_->setTVD(true);
3748  this->tableau_->setTVDCoeff(6.0);
3749  }
3750 };
3751 
3752 
3754 // ------------------------------------------------------------------------
3755 template<class Scalar>
3758  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3760 {
3761  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK32<Scalar>());
3762  stepper->setStepperDIRKValues(pl);
3763 
3764  if (model != Teuchos::null) {
3765  stepper->setModel(model);
3766  stepper->initialize();
3767  }
3768 
3769  return stepper;
3770 }
3771 
3772 
3773 // ----------------------------------------------------------------------------
3792 template<class Scalar>
3794  virtual public StepperDIRK<Scalar>
3795 {
3796  public:
3798  {
3799  this->setStepperName("SSPDIRK23");
3800  this->setStepperType("SSPDIRK23");
3801  this->setupTableau();
3802  this->setupDefault();
3803  this->setUseFSAL( false);
3804  this->setICConsistency( "None");
3805  this->setICConsistencyCheck( false);
3806  }
3807 
3809  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3811  bool useFSAL,
3812  std::string ICConsistency,
3813  bool ICConsistencyCheck,
3814  bool useEmbedded,
3815  bool zeroInitialGuess,
3816  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3817  {
3818  this->setStepperName("SSPDIRK23");
3819  this->setStepperType("SSPDIRK23");
3820  this->setupTableau();
3821  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3822  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3823  }
3824 
3825  std::string getDescription() const
3826  {
3827  std::ostringstream Description;
3828  Description << this->getStepperType() << "\n"
3829  << "Strong Stability Preserving Diagonally-Implicit RK (stage=2, order=3)\n"
3830  << "SSP-Coef = 1 + sqrt( 3 )\n"
3831  << "c = [ 1/(3 + sqrt( 3 )) (1/6)(3 + sqrt( 3 )) ] '\n"
3832  << "A = [ 1/(3 + sqrt( 3 )) ] \n"
3833  << " [ 1/sqrt( 3 ) 1/(3 + sqrt( 3 )) ] \n"
3834  << "b = [ 1/2 1/2 ] \n" << std::endl;
3835  return Description.str();
3836  }
3837 
3838 protected:
3839 
3841  {
3842 
3843  typedef Teuchos::ScalarTraits<Scalar> ST;
3844  using Teuchos::as;
3845  const int NumStages = 2;
3846  const int order = 3;
3847  const Scalar sspcoef = 2.7321;
3848  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3851 
3852  const Scalar one = ST::one();
3853  const Scalar zero = ST::zero();
3854  const Scalar onehalf = one/(2*one);
3855  const Scalar rootthree = ST::squareroot(3*one);
3856 
3857  // Fill A:
3858  A(0,0) = A(1,1) = one/(3*one + rootthree);
3859  A(1,0) = one/rootthree;
3860  A(0,1) = zero;
3861 
3862  // Fill b:
3863  b(0) = b(1) = onehalf;
3864 
3865  // Fill c:
3866  c(0) = A(0,0);
3867  c(1) = A(1,0) + A(1,1);
3868 
3870  this->getStepperType(),A,b,c,order,order,order));
3871  this->tableau_->setTVD(true);
3872  this->tableau_->setTVDCoeff(sspcoef);
3873  }
3874 };
3875 
3876 
3878 // ------------------------------------------------------------------------
3879 template<class Scalar>
3882  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3884 {
3885  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK23<Scalar>());
3886  stepper->setStepperDIRKValues(pl);
3887 
3888  if (model != Teuchos::null) {
3889  stepper->setModel(model);
3890  stepper->initialize();
3891  }
3892 
3893  return stepper;
3894 }
3895 
3896 
3897 // ----------------------------------------------------------------------------
3917 template<class Scalar>
3919  virtual public StepperDIRK<Scalar>
3920 {
3921  public:
3923  {
3924  this->setStepperName("SSPDIRK33");
3925  this->setStepperType("SSPDIRK33");
3926  this->setupTableau();
3927  this->setupDefault();
3928  this->setUseFSAL( false);
3929  this->setICConsistency( "None");
3930  this->setICConsistencyCheck( false);
3931  }
3932 
3934  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3936  bool useFSAL,
3937  std::string ICConsistency,
3938  bool ICConsistencyCheck,
3939  bool useEmbedded,
3940  bool zeroInitialGuess,
3941  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3942  {
3943  this->setStepperName("SSPDIRK33");
3944  this->setStepperType("SSPDIRK33");
3945  this->setupTableau();
3946  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3947  useEmbedded, zeroInitialGuess, stepperRKAppAction);
3948  }
3949 
3950  std::string getDescription() const
3951  {
3952  std::ostringstream Description;
3953  Description << this->getStepperType() << "\n"
3954  << "Strong Stability Preserving Diagonally-Implicit RK (stage=3, order=3)\n"
3955  << "SSP-Coef = 2 + 2 sqrt(2)\n"
3956  << "c = [ 1/( 4 + 2 sqrt(2) 1/2 (1/4)(2 + sqrt(2) ] '\n"
3957  << "A = [ 1/( 4 + 2 sqrt(2) ] \n"
3958  << " [ 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) ] \n"
3959  << " [ 1/(2 sqrt(2) 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) ] \n"
3960  << "b = [ 1/3 1/3 1/3 ] \n"
3961  << std::endl;
3962  return Description.str();
3963  }
3964 
3965 protected:
3966 
3968  {
3969 
3970  typedef Teuchos::ScalarTraits<Scalar> ST;
3971  using Teuchos::as;
3972  const int NumStages = 3;
3973  const int order = 3;
3974  const Scalar sspcoef= 4.8284;
3975  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
3978 
3979  const Scalar one = ST::one();
3980  const Scalar zero = ST::zero();
3981  const Scalar onethird = one/(3*one);
3982  const Scalar rootwo = ST::squareroot(2*one);
3983 
3984  // Fill A:
3985  A(0,0) = A(1,1) = A(2,2) = one / (4*one + 2*rootwo);
3986  A(1,0) = A(2,0) = A(2,1) = one / (2*rootwo);
3987  A(0,1) = A(0,2) = A(1,2) = zero;
3988 
3989  // Fill b:
3990  b(0) = b(1) = b(2) = onethird;
3991 
3992  // Fill c:
3993  c(0) = A(0,0);
3994  c(1) = A(1,0) + A(1,1);
3995  c(2) = A(2,0) + A(2,1) + A(2,2);
3996 
3998  this->getStepperType(),A,b,c,order,order,order));
3999  this->tableau_->setTVD(true);
4000  this->tableau_->setTVDCoeff(sspcoef);
4001  }
4002 };
4003 
4004 
4006 // ------------------------------------------------------------------------
4007 template<class Scalar>
4010  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4012 {
4013  auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK33<Scalar>());
4014  stepper->setStepperDIRKValues(pl);
4015 
4016  if (model != Teuchos::null) {
4017  stepper->setModel(model);
4018  stepper->initialize();
4019  }
4020 
4021  return stepper;
4022 }
4023 
4024 
4025 // ----------------------------------------------------------------------------
4044 template<class Scalar>
4046  virtual public StepperDIRK<Scalar>
4047 {
4048 public:
4055  {
4056  this->setStepperName("RK Implicit 1 Stage 1st order Radau IA");
4057  this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
4058  this->setupTableau();
4059  this->setupDefault();
4060  this->setUseFSAL( false);
4061  this->setICConsistency( "None");
4062  this->setICConsistencyCheck( false);
4063  }
4064 
4066  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4068  bool useFSAL,
4069  std::string ICConsistency,
4070  bool ICConsistencyCheck,
4071  bool useEmbedded,
4072  bool zeroInitialGuess,
4073  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4074  {
4075  this->setStepperName("RK Implicit 1 Stage 1st order Radau IA");
4076  this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
4077  this->setupTableau();
4078  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4079  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4080  }
4081 
4082  std::string getDescription() const
4083  {
4084  std::ostringstream Description;
4085  Description << this->getStepperType() << "\n"
4086  << "A-stable\n"
4087  << "Solving Ordinary Differential Equations II:\n"
4088  << "Stiff and Differential-Algebraic Problems,\n"
4089  << "2nd Revised Edition\n"
4090  << "E. Hairer and G. Wanner\n"
4091  << "Table 5.3, pg 73\n"
4092  << "c = [ 0 ]'\n"
4093  << "A = [ 1 ]\n"
4094  << "b = [ 1 ]'";
4095  return Description.str();
4096  }
4097 
4098 protected:
4099 
4101  {
4102  typedef Teuchos::ScalarTraits<Scalar> ST;
4103  int NumStages = 1;
4104  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4107  const Scalar one = ST::one();
4108  const Scalar zero = ST::zero();
4109  A(0,0) = one;
4110  b(0) = one;
4111  c(0) = zero;
4112  int order = 1;
4113 
4114  auto emptyBStar = Teuchos::SerialDenseVector<int,Scalar>();
4116  this->getStepperType(),A,b,c,order,order,order,emptyBStar,false));
4117  }
4118 };
4119 
4120 
4122 // ------------------------------------------------------------------------
4123 template<class Scalar>
4126  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4128 {
4130  stepper->setStepperDIRKValues(pl);
4131 
4132  if (model != Teuchos::null) {
4133  stepper->setModel(model);
4134  stepper->initialize();
4135  }
4136 
4137  return stepper;
4138 }
4139 
4140 
4141 // ----------------------------------------------------------------------------
4162 template<class Scalar>
4164  virtual public StepperDIRK<Scalar>
4165 {
4166 public:
4173  {
4174  this->setStepperName("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4175  this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4176  this->setupTableau();
4177  this->setupDefault();
4178  this->setUseFSAL( false);
4179  this->setICConsistency( "None");
4180  this->setICConsistencyCheck( false);
4181  }
4182 
4184  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4186  bool useFSAL,
4187  std::string ICConsistency,
4188  bool ICConsistencyCheck,
4189  bool useEmbedded,
4190  bool zeroInitialGuess,
4191  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4192  {
4193  this->setStepperName("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4194  this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4195  this->setupTableau();
4196  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4197  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4198  }
4199 
4200  std::string getDescription() const
4201  {
4202  std::ostringstream Description;
4203  Description << this->getStepperType() << "\n"
4204  << "A-stable\n"
4205  << "Solving Ordinary Differential Equations II:\n"
4206  << "Stiff and Differential-Algebraic Problems,\n"
4207  << "2nd Revised Edition\n"
4208  << "E. Hairer and G. Wanner\n"
4209  << "Table 5.9, pg 76\n"
4210  << "c = [ 0 1 ]'\n"
4211  << "A = [ 1/2 0 ]\n"
4212  << " [ 1/2 0 ]\n"
4213  << "b = [ 1/2 1/2 ]'";
4214  return Description.str();
4215  }
4216 
4217 protected:
4218 
4220  {
4221  typedef Teuchos::ScalarTraits<Scalar> ST;
4222  using Teuchos::as;
4223  int NumStages = 2;
4224  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4227  const Scalar zero = ST::zero();
4228  const Scalar one = ST::one();
4229 
4230  // Fill A:
4231  A(0,0) = as<Scalar>( one/(2*one) );
4232  A(0,1) = zero;
4233  A(1,0) = as<Scalar>( one/(2*one) );
4234  A(1,1) = zero;
4235 
4236  // Fill b:
4237  b(0) = as<Scalar>( one/(2*one) );
4238  b(1) = as<Scalar>( one/(2*one) );
4239 
4240  // Fill c:
4241  c(0) = zero;
4242  c(1) = one;
4243  int order = 2;
4244 
4245  auto emptyBStar = Teuchos::SerialDenseVector<int,Scalar>();
4247  this->getStepperType(),A,b,c,order,order,order,emptyBStar,false));
4248  this->tableau_->setTVD(true);
4249  this->tableau_->setTVDCoeff(2.0);
4250  //TODO: fix this
4251  }
4252 
4253 };
4254 
4255 
4257 // ------------------------------------------------------------------------
4258 template<class Scalar>
4261  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4263 {
4265  stepper->setStepperDIRKValues(pl);
4266 
4267  if (model != Teuchos::null) {
4268  stepper->setModel(model);
4269  stepper->initialize();
4270  }
4271 
4272  return stepper;
4273 }
4274 
4275 
4276 // ----------------------------------------------------------------------------
4300 template<class Scalar>
4302  virtual public StepperDIRK<Scalar>
4303 {
4304 public:
4311  {
4312  this->setStepperName("SDIRK 5 Stage 4th order");
4313  this->setStepperType("SDIRK 5 Stage 4th order");
4314  this->setupTableau();
4315  this->setupDefault();
4316  this->setUseFSAL( false);
4317  this->setICConsistency( "None");
4318  this->setICConsistencyCheck( false);
4319  }
4320 
4322  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4324  bool useFSAL,
4325  std::string ICConsistency,
4326  bool ICConsistencyCheck,
4327  bool useEmbedded,
4328  bool zeroInitialGuess,
4329  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4330  {
4331  this->setStepperName("SDIRK 5 Stage 4th order");
4332  this->setStepperType("SDIRK 5 Stage 4th order");
4333  this->setupTableau();
4334  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4335  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4336  }
4337 
4338  std::string getDescription() const
4339  {
4340  std::ostringstream Description;
4341  Description << this->getStepperType() << "\n"
4342  << "L-stable\n"
4343  << "Solving Ordinary Differential Equations II:\n"
4344  << "Stiff and Differential-Algebraic Problems,\n"
4345  << "2nd Revised Edition\n"
4346  << "E. Hairer and G. Wanner\n"
4347  << "pg100 \n"
4348  << "c = [ 1/4 3/4 11/20 1/2 1 ]'\n"
4349  << "A = [ 1/4 ]\n"
4350  << " [ 1/2 1/4 ]\n"
4351  << " [ 17/50 -1/25 1/4 ]\n"
4352  << " [ 371/1360 -137/2720 15/544 1/4 ]\n"
4353  << " [ 25/24 -49/48 125/16 -85/12 1/4 ]\n"
4354  << "b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'";
4355  // << "b = [ 59/48 -17/96 225/32 -85/12 0 ]'";
4356  return Description.str();
4357  }
4358 
4359 protected:
4360 
4362  {
4363  typedef Teuchos::ScalarTraits<Scalar> ST;
4364  using Teuchos::as;
4365  int NumStages = 5;
4366  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4369  const Scalar zero = ST::zero();
4370  const Scalar one = ST::one();
4371  const Scalar onequarter = as<Scalar>( one/(4*one) );
4372 
4373  // Fill A:
4374  A(0,0) = onequarter;
4375  A(0,1) = zero;
4376  A(0,2) = zero;
4377  A(0,3) = zero;
4378  A(0,4) = zero;
4379 
4380  A(1,0) = as<Scalar>( one / (2*one) );
4381  A(1,1) = onequarter;
4382  A(1,2) = zero;
4383  A(1,3) = zero;
4384  A(1,4) = zero;
4385 
4386  A(2,0) = as<Scalar>( 17*one/(50*one) );
4387  A(2,1) = as<Scalar>( -one/(25*one) );
4388  A(2,2) = onequarter;
4389  A(2,3) = zero;
4390  A(2,4) = zero;
4391 
4392  A(3,0) = as<Scalar>( 371*one/(1360*one) );
4393  A(3,1) = as<Scalar>( -137*one/(2720*one) );
4394  A(3,2) = as<Scalar>( 15*one/(544*one) );
4395  A(3,3) = onequarter;
4396  A(3,4) = zero;
4397 
4398  A(4,0) = as<Scalar>( 25*one/(24*one) );
4399  A(4,1) = as<Scalar>( -49*one/(48*one) );
4400  A(4,2) = as<Scalar>( 125*one/(16*one) );
4401  A(4,3) = as<Scalar>( -85*one/(12*one) );
4402  A(4,4) = onequarter;
4403 
4404  // Fill b:
4405  b(0) = as<Scalar>( 25*one/(24*one) );
4406  b(1) = as<Scalar>( -49*one/(48*one) );
4407  b(2) = as<Scalar>( 125*one/(16*one) );
4408  b(3) = as<Scalar>( -85*one/(12*one) );
4409  b(4) = onequarter;
4410 
4411  /*
4412  // Alternate version
4413  b(0) = as<Scalar>( 59*one/(48*one) );
4414  b(1) = as<Scalar>( -17*one/(96*one) );
4415  b(2) = as<Scalar>( 225*one/(32*one) );
4416  b(3) = as<Scalar>( -85*one/(12*one) );
4417  b(4) = zero;
4418  */
4419 
4420  // Fill c:
4421  c(0) = onequarter;
4422  c(1) = as<Scalar>( 3*one/(4*one) );
4423  c(2) = as<Scalar>( 11*one/(20*one) );
4424  c(3) = as<Scalar>( one/(2*one) );
4425  c(4) = one;
4426 
4427  int order = 4;
4428 
4430  this->getStepperType(),A,b,c,order,order,order));
4431  }
4432 };
4433 
4434 
4436 // ------------------------------------------------------------------------
4437 template<class Scalar>
4440  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4442 {
4443  auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage4thOrder<Scalar>());
4444  stepper->setStepperDIRKValues(pl);
4445 
4446  if (model != Teuchos::null) {
4447  stepper->setModel(model);
4448  stepper->initialize();
4449  }
4450 
4451  return stepper;
4452 }
4453 
4454 
4455 // ----------------------------------------------------------------------------
4478 template<class Scalar>
4480  virtual public StepperDIRK<Scalar>
4481 {
4482 public:
4489  {
4490  this->setStepperName("SDIRK 3 Stage 4th order");
4491  this->setStepperType("SDIRK 3 Stage 4th order");
4492  this->setupTableau();
4493  this->setupDefault();
4494  this->setUseFSAL( false);
4495  this->setICConsistency( "None");
4496  this->setICConsistencyCheck( false);
4497  }
4498 
4500  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4502  bool useFSAL,
4503  std::string ICConsistency,
4504  bool ICConsistencyCheck,
4505  bool useEmbedded,
4506  bool zeroInitialGuess,
4507  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4508  {
4509  this->setStepperName("SDIRK 3 Stage 4th order");
4510  this->setStepperType("SDIRK 3 Stage 4th order");
4511  this->setupTableau();
4512  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4513  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4514  }
4515 
4516  std::string getDescription() const
4517  {
4518  std::ostringstream Description;
4519  Description << this->getStepperType() << "\n"
4520  << "A-stable\n"
4521  << "Solving Ordinary Differential Equations II:\n"
4522  << "Stiff and Differential-Algebraic Problems,\n"
4523  << "2nd Revised Edition\n"
4524  << "E. Hairer and G. Wanner\n"
4525  << "p. 100 \n"
4526  << "gamma = (1/sqrt(3))*cos(pi/18)+1/2\n"
4527  << "delta = 1/(6*(2*gamma-1)^2)\n"
4528  << "c = [ gamma 1/2 1-gamma ]'\n"
4529  << "A = [ gamma ]\n"
4530  << " [ 1/2-gamma gamma ]\n"
4531  << " [ 2*gamma 1-4*gamma gamma ]\n"
4532  << "b = [ delta 1-2*delta delta ]'";
4533  return Description.str();
4534  }
4535 
4536 protected:
4537 
4539  {
4540  typedef Teuchos::ScalarTraits<Scalar> ST;
4541  using Teuchos::as;
4542  int NumStages = 3;
4543  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4546  const Scalar zero = ST::zero();
4547  const Scalar one = ST::one();
4548  const Scalar pi = as<Scalar>(4*one)*std::atan(one);
4549  const Scalar gamma = as<Scalar>( one/ST::squareroot(3*one)*std::cos(pi/(18*one))+one/(2*one) );
4550  const Scalar delta = as<Scalar>( one/(6*one*std::pow(2*gamma-one,2*one)) );
4551 
4552  // Fill A:
4553  A(0,0) = gamma;
4554  A(0,1) = zero;
4555  A(0,2) = zero;
4556 
4557  A(1,0) = as<Scalar>( one/(2*one) - gamma );
4558  A(1,1) = gamma;
4559  A(1,2) = zero;
4560 
4561  A(2,0) = as<Scalar>( 2*gamma );
4562  A(2,1) = as<Scalar>( one - 4*gamma );
4563  A(2,2) = gamma;
4564 
4565  // Fill b:
4566  b(0) = delta;
4567  b(1) = as<Scalar>( one-2*delta );
4568  b(2) = delta;
4569 
4570  // Fill c:
4571  c(0) = gamma;
4572  c(1) = as<Scalar>( one/(2*one) );
4573  c(2) = as<Scalar>( one - gamma );
4574 
4575  int order = 4;
4576 
4578  this->getStepperType(),A,b,c,order,order,order));
4579  }
4580 };
4581 
4582 
4584 // ------------------------------------------------------------------------
4585 template<class Scalar>
4588  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4590 {
4591  auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage4thOrder<Scalar>());
4592  stepper->setStepperDIRKValues(pl);
4593 
4594  if (model != Teuchos::null) {
4595  stepper->setModel(model);
4596  stepper->initialize();
4597  }
4598 
4599  return stepper;
4600 }
4601 
4602 
4603 // ----------------------------------------------------------------------------
4627 template<class Scalar>
4629  virtual public StepperDIRK<Scalar>
4630 {
4631 public:
4638  {
4639  this->setStepperName("SDIRK 5 Stage 5th order");
4640  this->setStepperType("SDIRK 5 Stage 5th order");
4641  this->setupTableau();
4642  this->setupDefault();
4643  this->setUseFSAL( false);
4644  this->setICConsistency( "None");
4645  this->setICConsistencyCheck( false);
4646  }
4647 
4649  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4651  bool useFSAL,
4652  std::string ICConsistency,
4653  bool ICConsistencyCheck,
4654  bool useEmbedded,
4655  bool zeroInitialGuess,
4656  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4657  {
4658  this->setStepperName("SDIRK 5 Stage 5th order");
4659  this->setStepperType("SDIRK 5 Stage 5th order");
4660  this->setupTableau();
4661  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4662  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4663  }
4664 
4665  std::string getDescription() const
4666  {
4667  std::ostringstream Description;
4668  Description << this->getStepperType() << "\n"
4669  << "Solving Ordinary Differential Equations II:\n"
4670  << "Stiff and Differential-Algebraic Problems,\n"
4671  << "2nd Revised Edition\n"
4672  << "E. Hairer and G. Wanner\n"
4673  << "pg101 \n"
4674  << "c = [ (6-sqrt(6))/10 ]\n"
4675  << " [ (6+9*sqrt(6))/35 ]\n"
4676  << " [ 1 ]\n"
4677  << " [ (4-sqrt(6))/10 ]\n"
4678  << " [ (4+sqrt(6))/10 ]\n"
4679  << "A = [ A1 A2 A3 A4 A5 ]\n"
4680  << " A1 = [ (6-sqrt(6))/10 ]\n"
4681  << " [ (-6+5*sqrt(6))/14 ]\n"
4682  << " [ (888+607*sqrt(6))/2850 ]\n"
4683  << " [ (3153-3082*sqrt(6))/14250 ]\n"
4684  << " [ (-32583+14638*sqrt(6))/71250 ]\n"
4685  << " A2 = [ 0 ]\n"
4686  << " [ (6-sqrt(6))/10 ]\n"
4687  << " [ (126-161*sqrt(6))/1425 ]\n"
4688  << " [ (3213+1148*sqrt(6))/28500 ]\n"
4689  << " [ (-17199+364*sqrt(6))/142500 ]\n"
4690  << " A3 = [ 0 ]\n"
4691  << " [ 0 ]\n"
4692  << " [ (6-sqrt(6))/10 ]\n"
4693  << " [ (-267+88*sqrt(6))/500 ]\n"
4694  << " [ (1329-544*sqrt(6))/2500 ]\n"
4695  << " A4 = [ 0 ]\n"
4696  << " [ 0 ]\n"
4697  << " [ 0 ]\n"
4698  << " [ (6-sqrt(6))/10 ]\n"
4699  << " [ (-96+131*sqrt(6))/625 ]\n"
4700  << " A5 = [ 0 ]\n"
4701  << " [ 0 ]\n"
4702  << " [ 0 ]\n"
4703  << " [ 0 ]\n"
4704  << " [ (6-sqrt(6))/10 ]\n"
4705  << "b = [ 0 ]\n"
4706  << " [ 0 ]\n"
4707  << " [ 1/9 ]\n"
4708  << " [ (16-sqrt(6))/36 ]\n"
4709  << " [ (16+sqrt(6))/36 ]'";
4710  return Description.str();
4711  }
4712 
4713 protected:
4714 
4716  {
4717  typedef Teuchos::ScalarTraits<Scalar> ST;
4718  using Teuchos::as;
4719  int NumStages = 5;
4720  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4723  const Scalar zero = ST::zero();
4724  const Scalar one = ST::one();
4725  const Scalar sqrt6 = ST::squareroot(as<Scalar>(6*one));
4726  const Scalar gamma = as<Scalar>( (6*one - sqrt6) / (10*one) ); // diagonal
4727 
4728  // Fill A:
4729  A(0,0) = gamma;
4730  A(0,1) = zero;
4731  A(0,2) = zero;
4732  A(0,3) = zero;
4733  A(0,4) = zero;
4734 
4735  A(1,0) = as<Scalar>( (-6*one+5*one*sqrt6)/(14*one) );
4736  A(1,1) = gamma;
4737  A(1,2) = zero;
4738  A(1,3) = zero;
4739  A(1,4) = zero;
4740 
4741  A(2,0) = as<Scalar>( (888*one+607*one*sqrt6)/(2850*one) );
4742  A(2,1) = as<Scalar>( (126*one-161*one*sqrt6)/(1425*one) );
4743  A(2,2) = gamma;
4744  A(2,3) = zero;
4745  A(2,4) = zero;
4746 
4747  A(3,0) = as<Scalar>( (3153*one-3082*one*sqrt6)/(14250*one) );
4748  A(3,1) = as<Scalar>( (3213*one+1148*one*sqrt6)/(28500*one) );
4749  A(3,2) = as<Scalar>( (-267*one+88*one*sqrt6)/(500*one) );
4750  A(3,3) = gamma;
4751  A(3,4) = zero;
4752 
4753  A(4,0) = as<Scalar>( (-32583*one+14638*one*sqrt6)/(71250*one) );
4754  A(4,1) = as<Scalar>( (-17199*one+364*one*sqrt6)/(142500*one) );
4755  A(4,2) = as<Scalar>( (1329*one-544*one*sqrt6)/(2500*one) );
4756  A(4,3) = as<Scalar>( (-96*one+131*sqrt6)/(625*one) );
4757  A(4,4) = gamma;
4758 
4759  // Fill b:
4760  b(0) = zero;
4761  b(1) = zero;
4762  b(2) = as<Scalar>( one/(9*one) );
4763  b(3) = as<Scalar>( (16*one-sqrt6)/(36*one) );
4764  b(4) = as<Scalar>( (16*one+sqrt6)/(36*one) );
4765 
4766  // Fill c:
4767  c(0) = gamma;
4768  c(1) = as<Scalar>( (6*one+9*one*sqrt6)/(35*one) );
4769  c(2) = one;
4770  c(3) = as<Scalar>( (4*one-sqrt6)/(10*one) );
4771  c(4) = as<Scalar>( (4*one+sqrt6)/(10*one) );
4772 
4773  int order = 5;
4774 
4776  this->getStepperType(),A,b,c,order,order,order));
4777  }
4778 };
4779 
4780 
4782 // ------------------------------------------------------------------------
4783 template<class Scalar>
4786  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4788 {
4789  auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage5thOrder<Scalar>());
4790  stepper->setStepperDIRKValues(pl);
4791 
4792  if (model != Teuchos::null) {
4793  stepper->setModel(model);
4794  stepper->initialize();
4795  }
4796 
4797  return stepper;
4798 }
4799 
4800 
4801 // ----------------------------------------------------------------------------
4818 template<class Scalar>
4820  virtual public StepperDIRK<Scalar>
4821 {
4822 public:
4829  {
4830  this->setStepperName("SDIRK 2(1) Pair");
4831  this->setStepperType("SDIRK 2(1) Pair");
4832  this->setupTableau();
4833  this->setupDefault();
4834  this->setUseFSAL( false);
4835  this->setICConsistency( "None");
4836  this->setICConsistencyCheck( false);
4837  }
4838 
4840  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4842  bool useFSAL,
4843  std::string ICConsistency,
4844  bool ICConsistencyCheck,
4845  bool useEmbedded,
4846  bool zeroInitialGuess,
4847  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4848  {
4849  this->setStepperName("SDIRK 2(1) Pair");
4850  this->setStepperType("SDIRK 2(1) Pair");
4851  this->setupTableau();
4852  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4853  useEmbedded, zeroInitialGuess, stepperRKAppAction);
4854  }
4855 
4856  std::string getDescription() const
4857  {
4858  std::ostringstream Description;
4859  Description << this->getStepperType() << "\n"
4860  << "c = [ 1 0 ]'\n"
4861  << "A = [ 1 ]\n"
4862  << " [ -1 1 ]\n"
4863  << "b = [ 1/2 1/2 ]'\n"
4864  << "bstar = [ 1 0 ]'";
4865  return Description.str();
4866  }
4867 
4868 protected:
4869 
4871  {
4872  typedef Teuchos::ScalarTraits<Scalar> ST;
4873  using Teuchos::as;
4874  int NumStages = 2;
4875  Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
4878  Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);
4879 
4880  const Scalar one = ST::one();
4881  const Scalar zero = ST::zero();
4882 
4883  // Fill A:
4884  A(0,0) = one; A(0,1) = zero;
4885  A(1,0) = -one; A(1,1) = one;
4886 
4887  // Fill b:
4888  b(0) = as<Scalar>(one/(2*one));
4889  b(1) = as<Scalar>(one/(2*one));
4890 
4891  // Fill c:
4892  c(0) = one;
4893  c(1) = zero;
4894 
4895  // Fill bstar
4896  bstar(0) = one;
4897  bstar(1) = zero;
4898  int order = 2;
4899 
4901  this->getStepperType(),A,b,c,order,order,order,bstar));
4902  }
4903 };
4904 
4905 
4907 // ------------------------------------------------------------------------
4908 template<class Scalar>
4911  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4913 {
4914  auto stepper = Teuchos::rcp(new StepperSDIRK_21Pair<Scalar>());
4915  stepper->setStepperDIRKValues(pl);
4916 
4917  if (model != Teuchos::null) {
4918  stepper->setModel(model);
4919  stepper->initialize();
4920  }
4921 
4922  return stepper;
4923 }
4924 
4925 
4926 // ----------------------------------------------------------------------------
4957 template<class Scalar>
4959  virtual public StepperDIRK<Scalar>
4960 {
4961 public:
4968  {
4969  this->setStepperName("General DIRK");
4970  this->setStepperType("General DIRK");
4971  this->setupTableau();
4972  this->setupDefault();
4973  this->setUseFSAL( false);
4974  this->setICConsistency( "None");
4975  this->setICConsistencyCheck( false);
4976  }
4977 
4979  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4981  bool useFSAL,
4982  std::string ICConsistency,
4983  bool ICConsistencyCheck,
4984  bool useEmbedded,
4985  bool zeroInitialGuess,
4986  const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
4990  const int order,
4991  const int orderMin,
4992  const int orderMax,
4994  {
4995  this->setStepperName("General DIRK");
4996  this->setStepperType("General DIRK");
4997  this->setTableau(A,b,c,order,orderMin,orderMax,bstar);
4998 
5000  this->tableau_->isImplicit() != true, std::logic_error,
5001  "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
5002 
5003  this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
5004  useEmbedded, zeroInitialGuess, stepperRKAppAction);
5005  }
5006 
5007  std::string getDescription() const
5008  {
5009  std::stringstream Description;
5010  Description << this->getStepperType() << "\n"
5011  << "The format of the Butcher Tableau parameter list is\n"
5012  << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
5013  << " # # # ;\n"
5014  << " # # #\"/>\n"
5015  << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
5016  << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
5017  << "Note the number of stages is implicit in the number of entries.\n"
5018  << "The number of stages must be consistent.\n"
5019  << "\n"
5020  << "Default tableau is 'SDIRK 2 Stage 2nd order':\n"
5021  << " Computer Methods for ODEs and DAEs\n"
5022  << " U. M. Ascher and L. R. Petzold\n"
5023  << " p. 106\n"
5024  << " gamma = (2-sqrt(2))/2\n"
5025  << " c = [ gamma 1 ]'\n"
5026  << " A = [ gamma 0 ]\n"
5027  << " [ 1-gamma gamma ]\n"
5028  << " b = [ 1-gamma gamma ]'";
5029  return Description.str();
5030  }
5031 
5033  {
5034  if (this->tableau_ == Teuchos::null) {
5035  // Set tableau to the default if null, otherwise keep current tableau.
5036  auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
5037  auto t = stepper->getTableau();
5039  this->getStepperType(),
5040  t->A(),t->b(),t->c(),
5041  t->order(),t->orderMin(),t->orderMax(),
5042  t->bstar()));
5043  this->isInitialized_ = false;
5044  }
5045  }
5046 
5050  const int order,
5051  const int orderMin,
5052  const int orderMax,
5055  {
5057  this->getStepperType(),A,b,c,order,orderMin,orderMax,bstar));
5058  this->isInitialized_ = false;
5059  }
5060 
5063  {
5064  auto pl = this->getValidParametersBasicDIRK();
5065 
5066  // Tableau ParameterList
5070  Teuchos::SerialDenseVector<int,Scalar> bstar = this->tableau_->bstar();
5071 
5072  Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
5073 
5074  std::ostringstream Astream;
5075  Astream.precision(15);
5076  for(int i = 0; i < A.numRows(); i++) {
5077  for(int j = 0; j < A.numCols()-1; j++) {
5078  Astream << A(i,j) << " ";
5079  }
5080  Astream << A(i,A.numCols()-1);
5081  if ( i != A.numRows()-1 ) Astream << "; ";
5082  }
5083  tableauPL->set<std::string>("A", Astream.str());
5084 
5085  std::ostringstream bstream;
5086  bstream.precision(15);
5087  for(int i = 0; i < b.length()-1; i++) {
5088  bstream << b(i) << " ";
5089  }
5090  bstream << b(b.length()-1);
5091  tableauPL->set<std::string>("b", bstream.str());
5092 
5093  std::ostringstream cstream;
5094  cstream.precision(15);
5095  for(int i = 0; i < c.length()-1; i++) {
5096  cstream << c(i) << " ";
5097  }
5098  cstream << c(c.length()-1);
5099  tableauPL->set<std::string>("c", cstream.str());
5100 
5101  tableauPL->set<int>("order", this->tableau_->order());
5102 
5103  if ( bstar.length() == 0 ) {
5104  tableauPL->set("bstar", "");
5105  } else {
5106  std::ostringstream bstarstream;
5107  bstarstream.precision(15);
5108  for(int i = 0; i < bstar.length()-1; i++) {
5109  bstarstream << bstar(i) << " ";
5110  }
5111  bstarstream << bstar(bstar.length()-1);
5112  tableauPL->set<std::string>("bstar", bstarstream.str());
5113  }
5114 
5115  pl->set("Tableau", *tableauPL);
5116 
5117  return pl;
5118  }
5119 };
5120 
5121 
5123 // ------------------------------------------------------------------------
5124 template<class Scalar>
5127  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
5129 {
5130  auto stepper = Teuchos::rcp(new StepperDIRK_General<Scalar>());
5131  stepper->setStepperDIRKValues(pl);
5132 
5133  if (pl != Teuchos::null) {
5134  if (pl->isParameter("Tableau")) {
5135  auto t = stepper->createTableau(pl);
5136  stepper->setTableau( t->A(),t->b(),t->c(),
5137  t->order(),t->orderMin(),t->orderMax(),
5138  t->bstar() );
5139  }
5140  }
5142  stepper->getTableau()->isDIRK() != true, std::logic_error,
5143  "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
5144 
5145  if (model != Teuchos::null) {
5146  stepper->setModel(model);
5147  stepper->initialize();
5148  }
5149 
5150  return stepper;
5151 }
5152 
5153 
5154 } // namespace Tempus
5155 
5156 
5157 #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)
Teuchos::RCP< StepperEDIRK_TrapezoidalRule< Scalar > > createStepperEDIRK_TrapezoidalRule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
General Implicit Runge-Kutta Butcher Tableau.
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)
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
Get the stepper type. The stepper type is used as an identifier for the stepper, and can only be set ...
Teuchos::RCP< StepperSDIRK_SSPDIRK33< Scalar > > createStepperSDIRK_SSPDIRK33(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Explicit Runge-Kutta time stepper.
virtual void setupDefault()
Default setup for constructor.
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicDIRK() const
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)
Teuchos::RCP< StepperEDIRK_2Stage3rdOrder< Scalar > > createStepperEDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
Teuchos::RCP< StepperSDIRK_5Stage4thOrder< Scalar > > createStepperSDIRK_5Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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< RKButcherTableau< Scalar > > tableau_
T & get(const std::string &name, T def_value)
Teuchos::RCP< StepperERK_SSPERK54< Scalar > > createStepperERK_SSPERK54(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Teuchos::RCP< StepperERK_3Stage3rdOrderHeun< Scalar > > createStepperERK_3Stage3rdOrderHeun(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
Teuchos::RCP< StepperERK_Merson45< Scalar > > createStepperERK_Merson45(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperEDIRK_2StageTheta< Scalar > > createStepperEDIRK_2StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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)
void setStepperName(std::string s)
Set the stepper name.
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)
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)
Teuchos::RCP< StepperERK_3_8Rule< Scalar > > createStepperERK_3_8Rule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperERK_BogackiShampine32< Scalar > > createStepperERK_BogackiShampine32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperSDIRK_5Stage5thOrder< Scalar > > createStepperSDIRK_5Stage5thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperERK_3Stage3rdOrder< Scalar > > createStepperERK_3Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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< StepperDIRK_2Stage2ndOrderLobattoIIIB< Scalar > > createStepperDIRK_2Stage2ndOrderLobattoIIIB(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperERK_ForwardEuler< Scalar > > createStepperERK_ForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< StepperSDIRK_21Pair< Scalar > > createStepperSDIRK_21Pair(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
bool isInitialized_
True if stepper&#39;s member data is initialized.
Teuchos::RCP< StepperSDIRK_SSPDIRK23< Scalar > > createStepperSDIRK_SSPDIRK23(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
Teuchos::RCP< StepperERK_3Stage3rdOrderTVD< Scalar > > createStepperERK_3Stage3rdOrderTVD(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperSDIRK_3Stage4thOrder< Scalar > > createStepperSDIRK_3Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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))
bool isParameter(const std::string &name) const
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, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Application Action for StepperRKBase.
Teuchos::RCP< StepperDIRK_1Stage1stOrderRadauIA< Scalar > > createStepperDIRK_1Stage1stOrderRadauIA(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
bool useFSAL_
Use First-Same-As-Last (FSAL) principle.
virtual void setupDefault()
Default setup for constructor.
Explicit RK Bogacki-Shampine Butcher Tableau.
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)
void setICConsistencyCheck(bool c)
Teuchos::RCP< StepperSDIRK_3Stage2ndOrder< Scalar > > createStepperSDIRK_3Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperERK_5Stage3rdOrderKandG< Scalar > > createStepperERK_5Stage3rdOrderKandG(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
OrdinalType length() 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)
Teuchos::RCP< StepperDIRK_BackwardEuler< Scalar > > createStepperDIRK_BackwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< StepperSDIRK_2Stage3rdOrder< Scalar > > createStepperSDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicERK() const
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 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< StepperERK_Midpoint< Scalar > > createStepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
OrdinalType numCols() const
Teuchos::RCP< StepperSDIRK_SSPDIRK22< Scalar > > createStepperSDIRK_SSPDIRK22(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
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)
Teuchos::RCP< StepperERK_Trapezoidal< Scalar > > createStepperERK_Trapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
Teuchos::RCP< StepperSDIRK_ImplicitMidpoint< Scalar > > createStepperSDIRK_ImplicitMidpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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)
Teuchos::RCP< StepperERK_General< Scalar > > createStepperERK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
virtual std::string getDescription() const
TypeTo as(const TypeFrom &t)
Teuchos::RCP< StepperSDIRK_2Stage2ndOrder< Scalar > > createStepperSDIRK_2Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Explicit RK Merson Butcher Tableau.
Runge-Kutta 4th order Butcher Tableau.
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)
virtual void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &wrapperModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Setup for constructor.
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< StepperERK_Ralston< Scalar > > createStepperERK_Ralston(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
virtual void setUseFSAL(bool a)
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
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)
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)
void setStepperType(std::string s)
Set the stepper type.
RK Explicit 3 Stage 3rd order by Heun.
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=Teuchos::null)
Teuchos::RCP< StepperERK_4Stage4thOrder< Scalar > > createStepperERK_4Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
OrdinalType numRows() const
virtual void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Setup for constructor.
Teuchos::RCP< StepperSDIRK_SSPDIRK32< Scalar > > createStepperSDIRK_SSPDIRK32(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperDIRK_1StageTheta< Scalar > > createStepperDIRK_1StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
void setICConsistency(std::string s)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
Teuchos::RCP< StepperERK_4Stage3rdOrderRunge< Scalar > > createStepperERK_4Stage3rdOrderRunge(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< StepperDIRK_General< Scalar > > createStepperDIRK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.