Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Tempus_StepperRKButcherTableau.hpp
Go to the documentation of this file.
1//@HEADER
2// *****************************************************************************
3// Tempus: Time Integration and Sensitivity Analysis Package
4//
5// Copyright 2017 NTESS and the Tempus contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8//@HEADER
9
10#ifndef Tempus_StepperRKButcherTableau_hpp
11#define Tempus_StepperRKButcherTableau_hpp
12
13// disable clang warnings
14#ifdef __clang__
15#pragma clang system_header
16#endif
17
18#include "Tempus_config.hpp"
19#include "Tempus_StepperExplicitRK.hpp"
20#include "Tempus_StepperDIRK.hpp"
22
23namespace Tempus {
24
25// ----------------------------------------------------------------------------
41template <class Scalar>
42class StepperERK_ForwardEuler : virtual public StepperExplicitRK<Scalar> {
43 public:
50 {
51 this->setStepperName("RK Forward Euler");
52 this->setStepperType("RK Forward Euler");
53 this->setupTableau();
54 this->setupDefault();
55 this->setUseFSAL(true);
56 this->setICConsistency("Consistent");
57 this->setICConsistencyCheck(false);
58 }
59
61 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
62 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
63 bool useEmbedded,
64 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
65 {
66 this->setStepperName("RK Forward Euler");
67 this->setStepperType("RK Forward Euler");
68 this->setupTableau();
69 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
70 useEmbedded, stepperRKAppAction);
71 }
72
73 std::string getDescription() const
74 {
75 std::ostringstream Description;
76 Description << this->getStepperType() << "\n"
77 << "c = [ 0 ]'\n"
78 << "A = [ 0 ]\n"
79 << "b = [ 1 ]'";
80 return Description.str();
81 }
82
83 void setUseFSAL(bool a)
84 {
85 this->useFSAL_ = a;
86 this->isInitialized_ = false;
87 }
88
89 protected:
91 {
92 typedef Teuchos::ScalarTraits<Scalar> ST;
93 Teuchos::SerialDenseMatrix<int, Scalar> A(1, 1);
94 Teuchos::SerialDenseVector<int, Scalar> b(1);
95 Teuchos::SerialDenseVector<int, Scalar> c(1);
96 A(0, 0) = ST::zero();
97 b(0) = ST::one();
98 c(0) = ST::zero();
99 int order = 1;
100
101 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
102 this->getStepperType(), A, b, c, order, order, order));
103 this->tableau_->setTVD(true);
104 this->tableau_->setTVDCoeff(1.0);
105 }
106};
107
109// ------------------------------------------------------------------------
110template <class Scalar>
111Teuchos::RCP<StepperERK_ForwardEuler<Scalar> > createStepperERK_ForwardEuler(
112 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
113 Teuchos::RCP<Teuchos::ParameterList> pl)
114{
115 auto stepper = Teuchos::rcp(new StepperERK_ForwardEuler<Scalar>());
116
117 // Test for aliases.
118 if (pl != Teuchos::null) {
119 auto stepperType =
120 pl->get<std::string>("Stepper Type", stepper->getStepperType());
121
122 TEUCHOS_TEST_FOR_EXCEPTION(
123 stepperType != stepper->getStepperType() && stepperType != "RK1",
124 std::logic_error,
125 " ParameterList 'Stepper Type' (='"
126 << stepperType << "')\n"
127 << " does not match type for this Stepper (='"
128 << 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// ----------------------------------------------------------------------------
164template <class Scalar>
165class StepperERK_4Stage4thOrder : virtual public StepperExplicitRK<Scalar> {
166 public:
173 {
174 this->setStepperName("RK Explicit 4 Stage");
175 this->setStepperType("RK Explicit 4 Stage");
176 this->setupTableau();
177 this->setupDefault();
178 this->setUseFSAL(false);
179 this->setICConsistency("None");
180 this->setICConsistencyCheck(false);
181 }
182
184 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
185 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
186 bool useEmbedded,
187 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
188 {
189 this->setStepperName("RK Explicit 4 Stage");
190 this->setStepperType("RK Explicit 4 Stage");
191 this->setupTableau();
192 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
193 useEmbedded, stepperRKAppAction);
194 }
195
196 std::string getDescription() const
197 {
198 std::ostringstream Description;
199 Description << this->getStepperType() << "\n"
200 << "\"The\" Runge-Kutta Method (explicit):\n"
201 << "Solving Ordinary Differential Equations I:\n"
202 << "Nonstiff Problems, 2nd Revised Edition\n"
203 << "E. Hairer, S.P. Norsett, G. Wanner\n"
204 << "Table 1.2, pg 138\n"
205 << "c = [ 0 1/2 1/2 1 ]'\n"
206 << "A = [ 0 ] \n"
207 << " [ 1/2 0 ]\n"
208 << " [ 0 1/2 0 ]\n"
209 << " [ 0 0 1 0 ]\n"
210 << "b = [ 1/6 1/3 1/3 1/6 ]'";
211 return Description.str();
212 }
213
215 {
216 typedef Teuchos::ScalarTraits<Scalar> ST;
217 const Scalar one = ST::one();
218 const Scalar zero = ST::zero();
219 const Scalar onehalf = one / (2 * one);
220 const Scalar onesixth = one / (6 * one);
221 const Scalar onethird = one / (3 * one);
222
223 int NumStages = 4;
224 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
225 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
226 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
227
228 // Fill A:
229 A(0, 0) = zero;
230 A(0, 1) = zero;
231 A(0, 2) = zero;
232 A(0, 3) = zero;
233 A(1, 0) = onehalf;
234 A(1, 1) = zero;
235 A(1, 2) = zero;
236 A(1, 3) = zero;
237 A(2, 0) = zero;
238 A(2, 1) = onehalf;
239 A(2, 2) = zero;
240 A(2, 3) = zero;
241 A(3, 0) = zero;
242 A(3, 1) = zero;
243 A(3, 2) = one;
244 A(3, 3) = zero;
245
246 // Fill b:
247 b(0) = onesixth;
248 b(1) = onethird;
249 b(2) = onethird;
250 b(3) = onesixth;
251
252 // fill c:
253 c(0) = zero;
254 c(1) = onehalf;
255 c(2) = onehalf;
256 c(3) = one;
257
258 int order = 4;
259
260 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
261 this->getStepperType(), A, b, c, order, order, order));
262 }
263};
264
266// ------------------------------------------------------------------------
267template <class Scalar>
268Teuchos::RCP<StepperERK_4Stage4thOrder<Scalar> >
270 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
271 Teuchos::RCP<Teuchos::ParameterList> pl)
272{
273 auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
274 stepper->setStepperRKValues(pl);
275
276 if (model != Teuchos::null) {
277 stepper->setModel(model);
278 stepper->initialize();
279 }
280
281 return stepper;
282}
283
284// ----------------------------------------------------------------------------
308template <class Scalar>
309class StepperERK_BogackiShampine32 : virtual public StepperExplicitRK<Scalar> {
310 public:
317 {
318 this->setStepperName("Bogacki-Shampine 3(2) Pair");
319 this->setStepperType("Bogacki-Shampine 3(2) Pair");
320 this->setupTableau();
321 this->setupDefault();
322 this->setUseFSAL(true);
323 this->setICConsistency("Consistent");
324 this->setICConsistencyCheck(false);
325 }
326
328 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
329 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
330 bool useEmbedded,
331 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
332 {
333 this->setStepperName("Bogacki-Shampine 3(2) Pair");
334 this->setStepperType("Bogacki-Shampine 3(2) Pair");
335 this->setupTableau();
336 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
337 useEmbedded, stepperRKAppAction);
338 }
339
340 std::string getDescription() const
341 {
342 std::ostringstream Description;
343 Description << this->getStepperType() << "\n"
344 << "P. Bogacki and L.F. Shampine.\n"
345 << "A 3(2) pair of Runge–Kutta formulas.\n"
346 << "Applied Mathematics Letters, 2(4):321 – 325, 1989.\n"
347 << "c = [ 0 1/2 3/4 1 ]'\n"
348 << "A = [ 0 ]\n"
349 << " [ 1/2 0 ]\n"
350 << " [ 0 3/4 0 ]\n"
351 << " [ 2/9 1/3 4/9 0 ]\n"
352 << "b = [ 2/9 1/3 4/9 0 ]'\n"
353 << "bstar = [ 7/24 1/4 1/3 1/8 ]'";
354 return Description.str();
355 }
356
357 void setUseFSAL(bool a)
358 {
359 this->useFSAL_ = a;
360 this->isInitialized_ = false;
361 }
362
363 protected:
365 {
366 typedef Teuchos::ScalarTraits<Scalar> ST;
367 using Teuchos::as;
368 int NumStages = 4;
369 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
370 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
371 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
372 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages);
373
374 const Scalar one = ST::one();
375 const Scalar zero = ST::zero();
376 const Scalar onehalf = one / (2 * one);
377 const Scalar onethird = one / (3 * one);
378 const Scalar threefourths = (3 * one) / (4 * one);
379 const Scalar twoninths = (2 * one) / (9 * one);
380 const Scalar fourninths = (4 * one) / (9 * one);
381
382 // Fill A:
383 A(0, 0) = zero;
384 A(0, 1) = zero;
385 A(0, 2) = zero;
386 A(0, 3) = zero;
387 A(1, 0) = onehalf;
388 A(1, 1) = zero;
389 A(1, 2) = zero;
390 A(1, 3) = zero;
391 A(2, 0) = zero;
392 A(2, 1) = threefourths;
393 A(2, 2) = zero;
394 A(2, 3) = zero;
395 A(3, 0) = twoninths;
396 A(3, 1) = onethird;
397 A(3, 2) = fourninths;
398 A(3, 3) = zero;
399
400 // Fill b:
401 b(0) = A(3, 0);
402 b(1) = A(3, 1);
403 b(2) = A(3, 2);
404 b(3) = A(3, 3);
405
406 // Fill c:
407 c(0) = zero;
408 c(1) = onehalf;
409 c(2) = threefourths;
410 c(3) = one;
411
412 // Fill bstar
413 bstar(0) = as<Scalar>(7 * one / (24 * one));
414 bstar(1) = as<Scalar>(1 * one / (4 * one));
415 bstar(2) = as<Scalar>(1 * one / (3 * one));
416 bstar(3) = as<Scalar>(1 * one / (8 * one));
417 int order = 3;
418
419 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
420 this->getStepperType(), A, b, c, order, order, order, bstar));
421 }
422};
423
425// ------------------------------------------------------------------------
426template <class Scalar>
427Teuchos::RCP<StepperERK_BogackiShampine32<Scalar> >
429 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
430 Teuchos::RCP<Teuchos::ParameterList> pl)
431{
432 auto stepper = Teuchos::rcp(new StepperERK_BogackiShampine32<Scalar>());
433 stepper->setStepperRKValues(pl);
434
435 if (model != Teuchos::null) {
436 stepper->setModel(model);
437 stepper->initialize();
438 }
439
440 return stepper;
441}
442
443// ----------------------------------------------------------------------------
469template <class Scalar>
470class StepperERK_Merson45 : virtual public StepperExplicitRK<Scalar> {
471 public:
478 {
479 this->setStepperName("Merson 4(5) Pair");
480 this->setStepperType("Merson 4(5) Pair");
481 this->setupTableau();
482 this->setupDefault();
483 this->setUseFSAL(false);
484 this->setICConsistency("None");
485 this->setICConsistencyCheck(false);
486 }
487
489 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
490 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
491 bool useEmbedded,
492 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
493 {
494 this->setStepperName("Merson 4(5) Pair");
495 this->setStepperType("Merson 4(5) Pair");
496 this->setupTableau();
497 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
498 useEmbedded, stepperRKAppAction);
499 }
500
501 std::string getDescription() const
502 {
503 std::ostringstream Description;
504 Description << this->getStepperType() << "\n"
505 << "Solving Ordinary Differential Equations I:\n"
506 << "Nonstiff Problems, 2nd Revised Edition\n"
507 << "E. Hairer, S.P. Norsett, G. Wanner\n"
508 << "Table 4.1, pg 167\n"
509 << "c = [ 0 1/3 1/3 1/2 1 ]'\n"
510 << "A = [ 0 ]\n"
511 << " [ 1/3 0 ]\n"
512 << " [ 1/6 1/6 0 ]\n"
513 << " [ 1/8 0 3/8 0 ]\n"
514 << " [ 1/2 0 -3/2 2 0 ]\n"
515 << "b = [ 1/6 0 0 2/3 1/6 ]'\n"
516 << "bstar = [ 1/10 0 3/10 2/5 1/5 ]'";
517 return Description.str();
518 }
519
520 protected:
522 {
523 typedef Teuchos::ScalarTraits<Scalar> ST;
524 using Teuchos::as;
525 int NumStages = 5;
526 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages, true);
527 Teuchos::SerialDenseVector<int, Scalar> b(NumStages, true);
528 Teuchos::SerialDenseVector<int, Scalar> c(NumStages, true);
529 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages, true);
530
531 const Scalar one = ST::one();
532 const Scalar zero = ST::zero();
533
534 // Fill A:
535 A(1, 0) = as<Scalar>(one / (3 * one));
536
537 A(2, 0) = as<Scalar>(one / (6 * one));
538 A(2, 1) = as<Scalar>(one / (6 * one));
539
540 A(3, 0) = as<Scalar>(one / (8 * one));
541 A(3, 2) = as<Scalar>(3 * one / (8 * one));
542
543 A(4, 0) = as<Scalar>(one / (2 * one));
544 A(4, 2) = as<Scalar>(-3 * one / (2 * one));
545 A(4, 3) = 2 * one;
546
547 // Fill b:
548 b(0) = as<Scalar>(one / (6 * one));
549 b(3) = as<Scalar>(2 * one / (3 * one));
550 b(4) = as<Scalar>(one / (6 * one));
551
552 // Fill c:
553 c(0) = zero;
554 c(1) = as<Scalar>(1 * one / (3 * one));
555 c(2) = as<Scalar>(1 * one / (3 * one));
556 c(3) = as<Scalar>(1 * one / (2 * one));
557 c(4) = one;
558
559 // Fill bstar
560 bstar(0) = as<Scalar>(1 * one / (10 * one));
561 bstar(2) = as<Scalar>(3 * one / (10 * one));
562 bstar(3) = as<Scalar>(2 * one / (5 * one));
563 bstar(4) = as<Scalar>(1 * one / (5 * one));
564 int order = 4;
565
566 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
567 this->getStepperType(), A, b, c, order, order, order, bstar));
568 }
569};
570
572// ------------------------------------------------------------------------
573template <class Scalar>
574Teuchos::RCP<StepperERK_Merson45<Scalar> > createStepperERK_Merson45(
575 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
576 Teuchos::RCP<Teuchos::ParameterList> pl)
577{
578 auto stepper = Teuchos::rcp(new StepperERK_Merson45<Scalar>());
579 stepper->setStepperRKValues(pl);
580
581 if (model != Teuchos::null) {
582 stepper->setModel(model);
583 stepper->initialize();
584 }
585
586 return stepper;
587}
588
589// ----------------------------------------------------------------------------
612template <class Scalar>
613class StepperERK_3_8Rule : virtual public StepperExplicitRK<Scalar> {
614 public:
616 {
617 this->setStepperName("RK Explicit 3/8 Rule");
618 this->setStepperType("RK Explicit 3/8 Rule");
619 this->setupTableau();
620 this->setupDefault();
621 this->setUseFSAL(false);
622 this->setICConsistency("None");
623 this->setICConsistencyCheck(false);
624 }
625
627 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
628 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
629 bool useEmbedded,
630 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
631 {
632 this->setStepperName("RK Explicit 3/8 Rule");
633 this->setStepperType("RK Explicit 3/8 Rule");
634 this->setupTableau();
635 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
636 useEmbedded, stepperRKAppAction);
637 }
638
639 std::string getDescription() const
640 {
641 std::ostringstream Description;
642 Description << this->getStepperType() << "\n"
643 << "Solving Ordinary Differential Equations I:\n"
644 << "Nonstiff Problems, 2nd Revised Edition\n"
645 << "E. Hairer, S.P. Norsett, G. Wanner\n"
646 << "Table 1.2, pg 138\n"
647 << "c = [ 0 1/3 2/3 1 ]'\n"
648 << "A = [ 0 ]\n"
649 << " [ 1/3 0 ]\n"
650 << " [-1/3 1 0 ]\n"
651 << " [ 1 -1 1 0 ]\n"
652 << "b = [ 1/8 3/8 3/8 1/8 ]'";
653 return Description.str();
654 }
655
656 protected:
658 {
659 typedef Teuchos::ScalarTraits<Scalar> ST;
660 using Teuchos::as;
661 int NumStages = 4;
662 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
663 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
664 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
665
666 const Scalar one = ST::one();
667 const Scalar zero = ST::zero();
668 const Scalar onethird = as<Scalar>(one / (3 * one));
669 const Scalar twothirds = as<Scalar>(2 * one / (3 * one));
670 const Scalar oneeighth = as<Scalar>(one / (8 * one));
671 const Scalar threeeighths = as<Scalar>(3 * one / (8 * one));
672
673 // Fill A:
674 A(0, 0) = zero;
675 A(0, 1) = zero;
676 A(0, 2) = zero;
677 A(0, 3) = zero;
678 A(1, 0) = onethird;
679 A(1, 1) = zero;
680 A(1, 2) = zero;
681 A(1, 3) = zero;
682 A(2, 0) = -onethird;
683 A(2, 1) = one;
684 A(2, 2) = zero;
685 A(2, 3) = zero;
686 A(3, 0) = one;
687 A(3, 1) = -one;
688 A(3, 2) = one;
689 A(3, 3) = zero;
690
691 // Fill b:
692 b(0) = oneeighth;
693 b(1) = threeeighths;
694 b(2) = threeeighths;
695 b(3) = oneeighth;
696
697 // Fill c:
698 c(0) = zero;
699 c(1) = onethird;
700 c(2) = twothirds;
701 c(3) = one;
702
703 int order = 4;
704
705 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
706 this->getStepperType(), A, b, c, order, order, order));
707 }
708};
709
711// ------------------------------------------------------------------------
712template <class Scalar>
713Teuchos::RCP<StepperERK_3_8Rule<Scalar> > createStepperERK_3_8Rule(
714 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
715 Teuchos::RCP<Teuchos::ParameterList> pl)
716{
717 auto stepper = Teuchos::rcp(new StepperERK_3_8Rule<Scalar>());
718 stepper->setStepperRKValues(pl);
719
720 if (model != Teuchos::null) {
721 stepper->setModel(model);
722 stepper->initialize();
723 }
724
725 return stepper;
726}
727
728// ----------------------------------------------------------------------------
751template <class Scalar>
753 : virtual public StepperExplicitRK<Scalar> {
754 public:
761 {
762 this->setStepperName("RK Explicit 4 Stage 3rd order by Runge");
763 this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
764 this->setupTableau();
765 this->setupDefault();
766 this->setUseFSAL(false);
767 this->setICConsistency("None");
768 this->setICConsistencyCheck(false);
769 }
770
772 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
773 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
774 bool useEmbedded,
775 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
776 {
777 this->setStepperName("RK Explicit 4 Stage 3rd order by Runge");
778 this->setStepperType("RK Explicit 4 Stage 3rd order by Runge");
779 this->setupTableau();
780 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
781 useEmbedded, stepperRKAppAction);
782 }
783
784 std::string getDescription() const
785 {
786 std::ostringstream Description;
787 Description << this->getStepperType() << "\n"
788 << "Solving Ordinary Differential Equations I:\n"
789 << "Nonstiff Problems, 2nd Revised Edition\n"
790 << "E. Hairer, S.P. Norsett, G. Wanner\n"
791 << "Table 1.1, pg 135\n"
792 << "c = [ 0 1/2 1 1 ]'\n"
793 << "A = [ 0 ]\n"
794 << " [ 1/2 0 ]\n"
795 << " [ 0 1 0 ]\n"
796 << " [ 0 0 1 0 ]\n"
797 << "b = [ 1/6 2/3 0 1/6 ]'";
798 return Description.str();
799 }
800
801 protected:
803 {
804 typedef Teuchos::ScalarTraits<Scalar> ST;
805 int NumStages = 4;
806 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
807 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
808 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
809
810 const Scalar one = ST::one();
811 const Scalar onehalf = one / (2 * one);
812 const Scalar onesixth = one / (6 * one);
813 const Scalar twothirds = 2 * one / (3 * one);
814 const Scalar zero = ST::zero();
815
816 // Fill A:
817 A(0, 0) = zero;
818 A(0, 1) = zero;
819 A(0, 2) = zero;
820 A(0, 3) = zero;
821 A(1, 0) = onehalf;
822 A(1, 1) = zero;
823 A(1, 2) = zero;
824 A(1, 3) = zero;
825 A(2, 0) = zero;
826 A(2, 1) = one;
827 A(2, 2) = zero;
828 A(2, 3) = zero;
829 A(3, 0) = zero;
830 A(3, 1) = zero;
831 A(3, 2) = one;
832 A(3, 3) = zero;
833
834 // Fill b:
835 b(0) = onesixth;
836 b(1) = twothirds;
837 b(2) = zero;
838 b(3) = onesixth;
839
840 // Fill c:
841 c(0) = zero;
842 c(1) = onehalf;
843 c(2) = one;
844 c(3) = one;
845
846 int order = 3;
847
848 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
849 this->getStepperType(), A, b, c, order, order, order));
850 }
851};
852
854// ------------------------------------------------------------------------
855template <class Scalar>
856Teuchos::RCP<StepperERK_4Stage3rdOrderRunge<Scalar> >
858 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
859 Teuchos::RCP<Teuchos::ParameterList> pl)
860{
861 auto stepper = Teuchos::rcp(new StepperERK_4Stage3rdOrderRunge<Scalar>());
862 stepper->setStepperRKValues(pl);
863
864 if (model != Teuchos::null) {
865 stepper->setModel(model);
866 stepper->initialize();
867 }
868
869 return stepper;
870}
871
872// ----------------------------------------------------------------------------
894template <class Scalar>
896 : virtual public StepperExplicitRK<Scalar> {
897 public:
904 {
905 this->setStepperName("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
906 this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
907 this->setupTableau();
908 this->setupDefault();
909 this->setUseFSAL(false);
910 this->setICConsistency("None");
911 this->setICConsistencyCheck(false);
912 }
913
915 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
916 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
917 bool useEmbedded,
918 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
919 {
920 this->setStepperName("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
921 this->setStepperType("RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
922 this->setupTableau();
923 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
924 useEmbedded, stepperRKAppAction);
925 }
926
927 std::string getDescription() const
928 {
929 std::ostringstream Description;
930 Description << this->getStepperType() << "\n"
931 << "Kinnmark & Gray 5 stage, 3rd order scheme \n"
932 << "Modified by P. Ullrich. From the prim_advance_mod.F90 \n"
933 << "routine in the HOMME atmosphere model code.\n"
934 << "c = [ 0 1/5 1/5 1/3 2/3 ]'\n"
935 << "A = [ 0 ]\n"
936 << " [ 1/5 0 ]\n"
937 << " [ 0 1/5 0 ]\n"
938 << " [ 0 0 1/3 0 ]\n"
939 << " [ 0 0 0 2/3 0 ]\n"
940 << "b = [ 1/4 0 0 0 3/4 ]'";
941 return Description.str();
942 }
943
944 protected:
946 {
947 typedef Teuchos::ScalarTraits<Scalar> ST;
948 int NumStages = 5;
949 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
950 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
951 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
952
953 const Scalar one = ST::one();
954 const Scalar onefifth = one / (5 * one);
955 const Scalar onefourth = one / (4 * one);
956 const Scalar onethird = one / (3 * one);
957 const Scalar twothirds = 2 * one / (3 * one);
958 const Scalar threefourths = 3 * one / (4 * one);
959 const Scalar zero = ST::zero();
960
961 // Fill A:
962 A(0, 0) = zero;
963 A(0, 1) = zero;
964 A(0, 2) = zero;
965 A(0, 3) = zero;
966 A(0, 4) = zero;
967 A(1, 0) = onefifth;
968 A(1, 1) = zero;
969 A(1, 2) = zero;
970 A(1, 3) = zero;
971 A(1, 4) = zero;
972 A(2, 0) = zero;
973 A(2, 1) = onefifth;
974 A(2, 2) = zero;
975 A(2, 3) = zero;
976 A(2, 4) = zero;
977 A(3, 0) = zero;
978 A(3, 1) = zero;
979 A(3, 2) = onethird;
980 A(3, 3) = zero;
981 A(3, 4) = zero;
982 A(4, 0) = zero;
983 A(4, 1) = zero;
984 A(4, 2) = zero;
985 A(4, 3) = twothirds;
986 A(4, 4) = zero;
987
988 // Fill b:
989 b(0) = onefourth;
990 b(1) = zero;
991 b(2) = zero;
992 b(3) = zero;
993 b(4) = threefourths;
994
995 // Fill c:
996 c(0) = zero;
997 c(1) = onefifth;
998 c(2) = onefifth;
999 c(3) = onethird;
1000 c(4) = twothirds;
1001
1002 int order = 3;
1003
1004 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1005 this->getStepperType(), A, b, c, order, order, order));
1006 }
1007};
1008
1010// ------------------------------------------------------------------------
1011template <class Scalar>
1012Teuchos::RCP<StepperERK_5Stage3rdOrderKandG<Scalar> >
1014 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1015 Teuchos::RCP<Teuchos::ParameterList> pl)
1016{
1017 auto stepper = Teuchos::rcp(new StepperERK_5Stage3rdOrderKandG<Scalar>());
1018 stepper->setStepperRKValues(pl);
1019
1020 if (model != Teuchos::null) {
1021 stepper->setModel(model);
1022 stepper->initialize();
1023 }
1024
1025 return stepper;
1026}
1027
1028// ----------------------------------------------------------------------------
1046template <class Scalar>
1047class StepperERK_3Stage3rdOrder : virtual public StepperExplicitRK<Scalar> {
1048 public:
1055 {
1056 this->setStepperName("RK Explicit 3 Stage 3rd order");
1057 this->setStepperType("RK Explicit 3 Stage 3rd order");
1058 this->setupTableau();
1059 this->setupDefault();
1060 this->setUseFSAL(false);
1061 this->setICConsistency("None");
1062 this->setICConsistencyCheck(false);
1063 }
1064
1066 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1067 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1068 bool useEmbedded,
1069 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1070 {
1071 this->setStepperName("RK Explicit 3 Stage 3rd order");
1072 this->setStepperType("RK Explicit 3 Stage 3rd order");
1073 this->setupTableau();
1074 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1075 useEmbedded, stepperRKAppAction);
1076 }
1077
1078 std::string getDescription() const
1079 {
1080 std::ostringstream Description;
1081 Description << this->getStepperType() << "\n"
1082 << "c = [ 0 1/2 1 ]'\n"
1083 << "A = [ 0 ]\n"
1084 << " [ 1/2 0 ]\n"
1085 << " [ -1 2 0 ]\n"
1086 << "b = [ 1/6 4/6 1/6 ]'";
1087 return Description.str();
1088 }
1089
1090 protected:
1092 {
1093 typedef Teuchos::ScalarTraits<Scalar> ST;
1094 const Scalar one = ST::one();
1095 const Scalar two = Teuchos::as<Scalar>(2 * one);
1096 const Scalar zero = ST::zero();
1097 const Scalar onehalf = one / (2 * one);
1098 const Scalar onesixth = one / (6 * one);
1099 const Scalar foursixth = 4 * one / (6 * one);
1100
1101 int NumStages = 3;
1102 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1103 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1104 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1105
1106 // Fill A:
1107 A(0, 0) = zero;
1108 A(0, 1) = zero;
1109 A(0, 2) = zero;
1110 A(1, 0) = onehalf;
1111 A(1, 1) = zero;
1112 A(1, 2) = zero;
1113 A(2, 0) = -one;
1114 A(2, 1) = two;
1115 A(2, 2) = zero;
1116
1117 // Fill b:
1118 b(0) = onesixth;
1119 b(1) = foursixth;
1120 b(2) = onesixth;
1121
1122 // fill c:
1123 c(0) = zero;
1124 c(1) = onehalf;
1125 c(2) = one;
1126
1127 int order = 3;
1128
1129 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1130 this->getStepperType(), A, b, c, order, order, order));
1131 }
1132};
1133
1135// ------------------------------------------------------------------------
1136template <class Scalar>
1137Teuchos::RCP<StepperERK_3Stage3rdOrder<Scalar> >
1139 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1140 Teuchos::RCP<Teuchos::ParameterList> pl)
1141{
1142 auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrder<Scalar>());
1143 stepper->setStepperRKValues(pl);
1144
1145 if (model != Teuchos::null) {
1146 stepper->setModel(model);
1147 stepper->initialize();
1148 }
1149
1150 return stepper;
1151}
1152
1153// ----------------------------------------------------------------------------
1182template <class Scalar>
1183class StepperERK_3Stage3rdOrderTVD : virtual public StepperExplicitRK<Scalar> {
1184 public:
1191 {
1192 this->setStepperName("RK Explicit 3 Stage 3rd order TVD");
1193 this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1194 this->setupTableau();
1195 this->setupDefault();
1196 this->setUseFSAL(false);
1197 this->setICConsistency("None");
1198 this->setICConsistencyCheck(false);
1199 }
1200
1202 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1203 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1204 bool useEmbedded,
1205 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1206 {
1207 this->setStepperName("RK Explicit 3 Stage 3rd order TVD");
1208 this->setStepperType("RK Explicit 3 Stage 3rd order TVD");
1209 this->setupTableau();
1210 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1211 useEmbedded, stepperRKAppAction);
1212 }
1213
1214 std::string getDescription() const
1215 {
1216 std::ostringstream Description;
1217 Description << this->getStepperType() << "\n"
1218 << "This Stepper is known as 'RK Explicit 3 Stage 3rd order "
1219 "TVD' or 'SSPERK33'.\n"
1220 << "Sigal Gottlieb and Chi-Wang Shu\n"
1221 << "`Total Variation Diminishing Runge-Kutta Schemes'\n"
1222 << "Mathematics of Computation\n"
1223 << "Volume 67, Number 221, January 1998, pp. 73-85\n"
1224 << "c = [ 0 1 1/2 ]'\n"
1225 << "A = [ 0 ]\n"
1226 << " [ 1 0 ]\n"
1227 << " [ 1/4 1/4 0 ]\n"
1228 << "b = [ 1/6 1/6 4/6 ]'\n"
1229 << "This is also written in the following set of updates.\n"
1230 << "u1 = u^n + dt L(u^n)\n"
1231 << "u2 = 3 u^n/4 + u1/4 + dt L(u1)/4\n"
1232 << "u^(n+1) = u^n/3 + 2 u2/2 + 2 dt L(u2)/3";
1233 return Description.str();
1234 }
1235
1236 protected:
1238 {
1239 typedef Teuchos::ScalarTraits<Scalar> ST;
1240 using Teuchos::as;
1241 const Scalar one = ST::one();
1242 const Scalar zero = ST::zero();
1243 const Scalar onehalf = one / (2 * one);
1244 const Scalar onefourth = one / (4 * one);
1245 const Scalar onesixth = one / (6 * one);
1246 const Scalar foursixth = 4 * one / (6 * one);
1247
1248 int NumStages = 3;
1249 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1250 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1251 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1252 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages);
1253
1254 // Fill A:
1255 A(0, 0) = zero;
1256 A(0, 1) = zero;
1257 A(0, 2) = zero;
1258 A(1, 0) = one;
1259 A(1, 1) = zero;
1260 A(1, 2) = zero;
1261 A(2, 0) = onefourth;
1262 A(2, 1) = onefourth;
1263 A(2, 2) = zero;
1264
1265 // Fill b:
1266 b(0) = onesixth;
1267 b(1) = onesixth;
1268 b(2) = foursixth;
1269
1270 // fill c:
1271 c(0) = zero;
1272 c(1) = one;
1273 c(2) = onehalf;
1274
1275 // Fill bstar:
1276 bstar(0) = as<Scalar>(0.291485418878409);
1277 bstar(1) = as<Scalar>(0.291485418878409);
1278 bstar(2) = as<Scalar>(0.417029162243181);
1279
1280 int order = 3;
1281
1282 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1283 this->getStepperType(), A, b, c, order, order, order, bstar));
1284 this->tableau_->setTVD(true);
1285 this->tableau_->setTVDCoeff(1.0);
1286 }
1287};
1288
1290// ------------------------------------------------------------------------
1291template <class Scalar>
1292Teuchos::RCP<StepperERK_3Stage3rdOrderTVD<Scalar> >
1294 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1295 Teuchos::RCP<Teuchos::ParameterList> pl)
1296{
1297 auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrderTVD<Scalar>());
1298
1299 // Test for aliases.
1300 if (pl != Teuchos::null) {
1301 auto stepperType =
1302 pl->get<std::string>("Stepper Type", stepper->getStepperType());
1303
1304 TEUCHOS_TEST_FOR_EXCEPTION(
1305 stepperType != stepper->getStepperType() && stepperType != "SSPERK33" &&
1306 stepperType != "SSPRK3",
1307 std::logic_error,
1308 " ParameterList 'Stepper Type' (='"
1309 << stepperType
1310 << "')\n does not match type for this Stepper (='"
1311 << stepper->getStepperType()
1312 << "')\n or one of its aliases ('SSPERK33' or 'SSPRK3').\n");
1313
1314 // Reset default StepperType.
1315 pl->set<std::string>("Stepper Type", stepper->getStepperType());
1316 }
1317
1318 stepper->setStepperRKValues(pl);
1319
1320 if (model != Teuchos::null) {
1321 stepper->setModel(model);
1322 stepper->initialize();
1323 }
1324
1325 return stepper;
1326}
1327
1328// ----------------------------------------------------------------------------
1350template <class Scalar>
1351class StepperERK_3Stage3rdOrderHeun : virtual public StepperExplicitRK<Scalar> {
1352 public:
1359 {
1360 this->setStepperName("RK Explicit 3 Stage 3rd order by Heun");
1361 this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1362 this->setupTableau();
1363 this->setupDefault();
1364 this->setUseFSAL(false);
1365 this->setICConsistency("None");
1366 this->setICConsistencyCheck(false);
1367 }
1368
1370 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1371 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1372 bool useEmbedded,
1373 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1374 {
1375 this->setStepperName("RK Explicit 3 Stage 3rd order by Heun");
1376 this->setStepperType("RK Explicit 3 Stage 3rd order by Heun");
1377 this->setupTableau();
1378 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1379 useEmbedded, stepperRKAppAction);
1380 }
1381
1382 std::string getDescription() const
1383 {
1384 std::ostringstream Description;
1385 Description << this->getStepperType() << "\n"
1386 << "Solving Ordinary Differential Equations I:\n"
1387 << "Nonstiff Problems, 2nd Revised Edition\n"
1388 << "E. Hairer, S.P. Norsett, G. Wanner\n"
1389 << "Table 1.1, pg 135\n"
1390 << "c = [ 0 1/3 2/3 ]'\n"
1391 << "A = [ 0 ] \n"
1392 << " [ 1/3 0 ]\n"
1393 << " [ 0 2/3 0 ]\n"
1394 << "b = [ 1/4 0 3/4 ]'";
1395 return Description.str();
1396 }
1397
1398 protected:
1400 {
1401 typedef Teuchos::ScalarTraits<Scalar> ST;
1402 const Scalar one = ST::one();
1403 const Scalar zero = ST::zero();
1404 const Scalar onethird = one / (3 * one);
1405 const Scalar twothirds = 2 * one / (3 * one);
1406 const Scalar onefourth = one / (4 * one);
1407 const Scalar threefourths = 3 * one / (4 * one);
1408
1409 int NumStages = 3;
1410 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1411 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1412 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1413
1414 // Fill A:
1415 A(0, 0) = zero;
1416 A(0, 1) = zero;
1417 A(0, 2) = zero;
1418 A(1, 0) = onethird;
1419 A(1, 1) = zero;
1420 A(1, 2) = zero;
1421 A(2, 0) = zero;
1422 A(2, 1) = twothirds;
1423 A(2, 2) = zero;
1424
1425 // Fill b:
1426 b(0) = onefourth;
1427 b(1) = zero;
1428 b(2) = threefourths;
1429
1430 // fill c:
1431 c(0) = zero;
1432 c(1) = onethird;
1433 c(2) = twothirds;
1434
1435 int order = 3;
1436
1437 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1438 this->getStepperType(), A, b, c, order, order, order));
1439 }
1440};
1441
1443// ------------------------------------------------------------------------
1444template <class Scalar>
1445Teuchos::RCP<StepperERK_3Stage3rdOrderHeun<Scalar> >
1447 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1448 Teuchos::RCP<Teuchos::ParameterList> pl)
1449{
1450 auto stepper = Teuchos::rcp(new StepperERK_3Stage3rdOrderHeun<Scalar>());
1451 stepper->setStepperRKValues(pl);
1452
1453 if (model != Teuchos::null) {
1454 stepper->setModel(model);
1455 stepper->initialize();
1456 }
1457
1458 return stepper;
1459}
1460
1461// ----------------------------------------------------------------------------
1482template <class Scalar>
1483class StepperERK_Midpoint : virtual public StepperExplicitRK<Scalar> {
1484 public:
1491 {
1492 this->setStepperName("RK Explicit Midpoint");
1493 this->setStepperType("RK Explicit Midpoint");
1494 this->setupTableau();
1495 this->setupDefault();
1496 this->setUseFSAL(false);
1497 this->setICConsistency("None");
1498 this->setICConsistencyCheck(false);
1499 }
1500
1502 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1503 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1504 bool useEmbedded,
1505 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1506 {
1507 this->setStepperName("RK Explicit Midpoint");
1508 this->setStepperType("RK Explicit Midpoint");
1509 this->setupTableau();
1510 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1511 useEmbedded, stepperRKAppAction);
1512 }
1513
1514 std::string getDescription() const
1515 {
1516 std::ostringstream Description;
1517 Description << this->getStepperType() << "\n"
1518 << "Solving Ordinary Differential Equations I:\n"
1519 << "Nonstiff Problems, 2nd Revised Edition\n"
1520 << "E. Hairer, S.P. Norsett, G. Wanner\n"
1521 << "Table 1.1, pg 135\n"
1522 << "c = [ 0 1/2 ]'\n"
1523 << "A = [ 0 ]\n"
1524 << " [ 1/2 0 ]\n"
1525 << "b = [ 0 1 ]'";
1526 return Description.str();
1527 }
1528
1529 protected:
1531 {
1532 typedef Teuchos::ScalarTraits<Scalar> ST;
1533 const Scalar one = ST::one();
1534 const Scalar zero = ST::zero();
1535 const Scalar onehalf = one / (2 * one);
1536
1537 int NumStages = 2;
1538 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1539 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1540 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1541
1542 // Fill A:
1543 A(0, 0) = zero;
1544 A(0, 1) = zero;
1545 A(1, 0) = onehalf;
1546 A(1, 1) = zero;
1547
1548 // Fill b:
1549 b(0) = zero;
1550 b(1) = one;
1551
1552 // fill c:
1553 c(0) = zero;
1554 c(1) = onehalf;
1555
1556 int order = 2;
1557
1558 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1559 this->getStepperType(), A, b, c, order, order, order));
1560 }
1561};
1562
1564// ------------------------------------------------------------------------
1565template <class Scalar>
1566Teuchos::RCP<StepperERK_Midpoint<Scalar> > createStepperERK_Midpoint(
1567 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1568 Teuchos::RCP<Teuchos::ParameterList> pl)
1569{
1570 auto stepper = Teuchos::rcp(new StepperERK_Midpoint<Scalar>());
1571 stepper->setStepperRKValues(pl);
1572
1573 if (model != Teuchos::null) {
1574 stepper->setModel(model);
1575 stepper->initialize();
1576 }
1577
1578 return stepper;
1579}
1580
1581// ----------------------------------------------------------------------------
1598template <class Scalar>
1599class StepperERK_Ralston : virtual public StepperExplicitRK<Scalar> {
1600 public:
1607 {
1608 this->setStepperName("RK Explicit Ralston");
1609 this->setStepperType("RK Explicit Ralston");
1610 this->setupTableau();
1611 this->setupDefault();
1612 this->setUseFSAL(false);
1613 this->setICConsistency("None");
1614 this->setICConsistencyCheck(false);
1615 }
1616
1618 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1619 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1620 bool useEmbedded,
1621 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1622 {
1623 this->setStepperName("RK Explicit Ralston");
1624 this->setStepperType("RK Explicit Ralston");
1625 this->setupTableau();
1626 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1627 useEmbedded, stepperRKAppAction);
1628 }
1629
1630 std::string getDescription() const
1631 {
1632 std::ostringstream Description;
1633 Description << this->getStepperType() << "\n"
1634 << "This Stepper is known as 'RK Explicit Ralston' or 'RK2'.\n"
1635 << "c = [ 0 2/3 ]'\n"
1636 << "A = [ 0 ]\n"
1637 << " [ 2/3 0 ]\n"
1638 << "b = [ 1/4 3/4 ]'";
1639 return Description.str();
1640 }
1641
1642 protected:
1644 {
1645 typedef Teuchos::ScalarTraits<Scalar> ST;
1646 const Scalar one = ST::one();
1647 const Scalar zero = ST::zero();
1648
1649 const int NumStages = 2;
1650 const int order = 2;
1651 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1652 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1653 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1654
1655 // Fill A:
1656 A(0, 0) = zero;
1657 A(0, 1) = zero;
1658 A(1, 1) = zero;
1659 A(1, 0) = (2 * one) / (3 * one);
1660
1661 // Fill b:
1662 b(0) = (1 * one) / (4 * one);
1663 b(1) = (3 * one) / (4 * one);
1664
1665 // fill c:
1666 c(0) = zero;
1667 c(1) = (2 * one) / (3 * one);
1668
1669 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1670 this->getStepperType(), A, b, c, order, order, order));
1671 this->tableau_->setTVD(true);
1672 this->tableau_->setTVDCoeff(0.5);
1673 }
1674};
1675
1677// ------------------------------------------------------------------------
1678template <class Scalar>
1679Teuchos::RCP<StepperERK_Ralston<Scalar> > createStepperERK_Ralston(
1680 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1681 Teuchos::RCP<Teuchos::ParameterList> pl)
1682{
1683 auto stepper = Teuchos::rcp(new StepperERK_Ralston<Scalar>());
1684
1685 // Test for aliases.
1686 if (pl != Teuchos::null) {
1687 auto stepperType =
1688 pl->get<std::string>("Stepper Type", stepper->getStepperType());
1689
1690 TEUCHOS_TEST_FOR_EXCEPTION(
1691 stepperType != stepper->getStepperType() && stepperType != "RK2",
1692 std::logic_error,
1693 " ParameterList 'Stepper Type' (='"
1694 << stepperType
1695 << "')\n does not match type for this Stepper (='"
1696 << stepper->getStepperType()
1697 << "')\n or one of its aliases ('RK2').\n");
1698
1699 // Reset default StepperType.
1700 pl->set<std::string>("Stepper Type", stepper->getStepperType());
1701 }
1702
1703 stepper->setStepperRKValues(pl);
1704
1705 if (model != Teuchos::null) {
1706 stepper->setModel(model);
1707 stepper->initialize();
1708 }
1709
1710 return stepper;
1711}
1712
1713// ----------------------------------------------------------------------------
1731template <class Scalar>
1732class StepperERK_Trapezoidal : virtual public StepperExplicitRK<Scalar> {
1733 public:
1740 {
1741 this->setStepperName("RK Explicit Trapezoidal");
1742 this->setStepperType("RK Explicit Trapezoidal");
1743 this->setupTableau();
1744 this->setupDefault();
1745 this->setUseFSAL(false);
1746 this->setICConsistency("None");
1747 this->setICConsistencyCheck(false);
1748 }
1749
1751 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1752 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1753 bool useEmbedded,
1754 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1755 {
1756 this->setStepperName("RK Explicit Trapezoidal");
1757 this->setStepperType("RK Explicit Trapezoidal");
1758 this->setupTableau();
1759 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1760 useEmbedded, stepperRKAppAction);
1761 }
1762
1763 std::string getDescription() const
1764 {
1765 std::ostringstream Description;
1766 Description << this->getStepperType() << "\n"
1767 << "This Stepper is known as 'RK Explicit Trapezoidal' or "
1768 "'Heuns Method' or 'SSPERK22'.\n"
1769 << "c = [ 0 1 ]'\n"
1770 << "A = [ 0 ]\n"
1771 << " [ 1 0 ]\n"
1772 << "b = [ 1/2 1/2 ]\n"
1773 << "bstart = [ 3/4 1/4 ]'";
1774 return Description.str();
1775 }
1776
1777 protected:
1779 {
1780 typedef Teuchos::ScalarTraits<Scalar> ST;
1781 using Teuchos::as;
1782 const Scalar one = ST::one();
1783 const Scalar zero = ST::zero();
1784 const Scalar onehalf = one / (2 * one);
1785
1786 int NumStages = 2;
1787 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1788 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1789 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1790 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages);
1791
1792 // Fill A:
1793 A(0, 0) = zero;
1794 A(0, 1) = zero;
1795 A(1, 0) = one;
1796 A(1, 1) = zero;
1797
1798 // Fill b:
1799 b(0) = onehalf;
1800 b(1) = onehalf;
1801
1802 // fill c:
1803 c(0) = zero;
1804 c(1) = one;
1805
1806 // Fill bstar
1807 bstar(0) = as<Scalar>(3 * one / (4 * one));
1808 bstar(1) = as<Scalar>(1 * one / (4 * one));
1809
1810 int order = 2;
1811
1812 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1813 this->getStepperType(), A, b, c, order, order, order, bstar));
1814 this->tableau_->setTVD(true);
1815 this->tableau_->setTVDCoeff(1.0);
1816 }
1817};
1818
1820// ------------------------------------------------------------------------
1821template <class Scalar>
1822Teuchos::RCP<StepperERK_Trapezoidal<Scalar> > createStepperERK_Trapezoidal(
1823 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1824 Teuchos::RCP<Teuchos::ParameterList> pl)
1825{
1826 auto stepper = Teuchos::rcp(new StepperERK_Trapezoidal<Scalar>());
1827
1828 // Test for aliases.
1829 if (pl != Teuchos::null) {
1830 auto stepperType =
1831 pl->get<std::string>("Stepper Type", stepper->getStepperType());
1832
1833 TEUCHOS_TEST_FOR_EXCEPTION(
1834 stepperType != stepper->getStepperType() &&
1835 stepperType != "Heuns Method" && stepperType != "SSPERK22" &&
1836 stepperType != "SSPRK2",
1837 std::logic_error,
1838 " ParameterList 'Stepper Type' (='"
1839 << stepperType
1840 << "')\n does not match type for this Stepper (='"
1841 << stepper->getStepperType()
1842 << "')\n or one of its aliases ('Heuns Method' or 'SSPERK22' or "
1843 << "'SSPRK2').\n");
1844
1845 // Reset default StepperType.
1846 pl->set<std::string>("Stepper Type", stepper->getStepperType());
1847 }
1848
1849 stepper->setStepperRKValues(pl);
1850
1851 if (model != Teuchos::null) {
1852 stepper->setModel(model);
1853 stepper->initialize();
1854 }
1855
1856 return stepper;
1857}
1858
1859// ----------------------------------------------------------------------------
1876template <class Scalar>
1877class StepperERK_SSPERK54 : virtual public StepperExplicitRK<Scalar> {
1878 public:
1880 {
1881 this->setStepperName("SSPERK54");
1882 this->setStepperType("SSPERK54");
1883 this->setupTableau();
1884 this->setupDefault();
1885 this->setUseFSAL(false);
1886 this->setICConsistency("None");
1887 this->setICConsistencyCheck(false);
1888 }
1889
1891 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
1892 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
1893 bool useEmbedded,
1894 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
1895 {
1896 this->setStepperName("SSPERK54");
1897 this->setStepperType("SSPERK54");
1898 this->setupTableau();
1899 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1900 useEmbedded, stepperRKAppAction);
1901 }
1902
1903 std::string getDescription() const
1904 {
1905 std::ostringstream Description;
1906 Description
1907 << this->getStepperType() << "\n"
1908 << "Strong Stability Preserving Explicit RK (stage=5, order=4)\n"
1909 << std::endl;
1910 return Description.str();
1911 }
1912
1913 protected:
1915 {
1916 typedef Teuchos::ScalarTraits<Scalar> ST;
1917 using Teuchos::as;
1918 const int NumStages = 5;
1919 const int order = 4;
1920 const Scalar sspcoef = 1.5082;
1921 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1922 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1923 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1924 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages);
1925 const Scalar zero = ST::zero();
1926
1927 // Fill A:
1928 A(0, 0) = A(0, 1) = A(0, 2) = A(0, 3) = A(0, 4) = zero;
1929
1930 A(1, 0) = as<Scalar>(0.391752226571889);
1931 A(1, 1) = A(1, 2) = A(1, 3) = A(1, 4) = zero;
1932
1933 A(2, 0) = as<Scalar>(0.217669096261169);
1934 A(2, 1) = as<Scalar>(0.368410593050372);
1935 A(2, 2) = A(2, 3) = A(2, 4) = zero;
1936
1937 A(3, 0) = as<Scalar>(0.082692086657811);
1938 A(3, 1) = as<Scalar>(0.139958502191896);
1939 A(3, 2) = as<Scalar>(0.251891774271693);
1940 A(3, 3) = A(3, 4) = zero;
1941
1942 A(4, 0) = as<Scalar>(0.067966283637115);
1943 A(4, 1) = as<Scalar>(0.115034698504632);
1944 A(4, 2) = as<Scalar>(0.207034898597385);
1945 A(4, 3) = as<Scalar>(0.544974750228520);
1946 A(4, 4) = zero;
1947
1948 // Fill b:
1949 b(0) = as<Scalar>(0.146811876084786);
1950 b(1) = as<Scalar>(0.248482909444976);
1951 b(2) = as<Scalar>(0.104258830331980);
1952 b(3) = as<Scalar>(0.274438900901350);
1953 b(4) = as<Scalar>(0.226007483236908);
1954
1955 // fill c:
1956 c(0) = zero;
1957 c(1) = A(1, 0);
1958 c(2) = A(2, 0) + A(2, 1);
1959 c(3) = A(3, 0) + A(3, 1) + A(3, 2);
1960 c(4) = A(4, 0) + A(4, 1) + A(4, 2) + A(4, 3);
1961
1962 // Fill bstar:
1963 bstar(0) = as<Scalar>(0.130649104813131);
1964 bstar(1) = as<Scalar>(0.317716031201302);
1965 bstar(2) = as<Scalar>(0.000000869337261);
1966 bstar(3) = as<Scalar>(0.304581512634772);
1967 bstar(4) = as<Scalar>(0.247052482013534);
1968
1969 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
1970 this->getStepperType(), A, b, c, order, order, order, bstar));
1971 this->tableau_->setTVD(true);
1972 this->tableau_->setTVDCoeff(sspcoef);
1973 }
1974};
1975
1977// ------------------------------------------------------------------------
1978template <class Scalar>
1979Teuchos::RCP<StepperERK_SSPERK54<Scalar> > createStepperERK_SSPERK54(
1980 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
1981 Teuchos::RCP<Teuchos::ParameterList> pl)
1982{
1983 auto stepper = Teuchos::rcp(new StepperERK_SSPERK54<Scalar>());
1984 stepper->setStepperRKValues(pl);
1985
1986 if (model != Teuchos::null) {
1987 stepper->setModel(model);
1988 stepper->initialize();
1989 }
1990
1991 return stepper;
1992}
1993
1994// ----------------------------------------------------------------------------
2024template <class Scalar>
2025class StepperERK_General : virtual public StepperExplicitRK<Scalar> {
2026 public:
2028 {
2029 this->setStepperName("General ERK");
2030 this->setStepperType("General ERK");
2031 this->setupTableau();
2032 this->setupDefault();
2033 this->setUseFSAL(false);
2034 this->setICConsistency("None");
2035 this->setICConsistencyCheck(false);
2036 }
2037
2039 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2040 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2041 bool useEmbedded, const Teuchos::SerialDenseMatrix<int, Scalar>& A,
2042 const Teuchos::SerialDenseVector<int, Scalar>& b,
2043 const Teuchos::SerialDenseVector<int, Scalar>& c, const int order,
2044 const int orderMin, const int orderMax,
2045 const Teuchos::SerialDenseVector<int, Scalar>& bstar,
2046 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction =
2047 Teuchos::null)
2048 {
2049 this->setStepperName("General ERK");
2050 this->setStepperType("General ERK");
2051 this->setTableau(A, b, c, order, orderMin, orderMax, bstar);
2052
2053 TEUCHOS_TEST_FOR_EXCEPTION(
2054 this->tableau_->isImplicit() == true, std::logic_error,
2055 "Error - General ERK received an implicit Butcher Tableau!\n");
2056
2057 this->setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
2058 useEmbedded, stepperRKAppAction);
2059 }
2060
2061 virtual std::string getDescription() const
2062 {
2063 std::stringstream Description;
2064 Description
2065 << this->getStepperType() << "\n"
2066 << "The format of the Butcher Tableau parameter list is\n"
2067 << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
2068 << " # # # ;\n"
2069 << " # # #\"/>\n"
2070 << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
2071 << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
2072 << "Note the number of stages is implicit in the number of entries.\n"
2073 << "The number of stages must be consistent.\n"
2074 << "\n"
2075 << "Default tableau is RK4 (order=4):\n"
2076 << "c = [ 0 1/2 1/2 1 ]'\n"
2077 << "A = [ 0 ]\n"
2078 << " [ 1/2 0 ]\n"
2079 << " [ 0 1/2 0 ]\n"
2080 << " [ 0 0 1 0 ]\n"
2081 << "b = [ 1/6 1/3 1/3 1/6 ]'";
2082 return Description.str();
2083 }
2084
2086 {
2087 if (this->tableau_ == Teuchos::null) {
2088 // Set tableau to the default if null, otherwise keep current tableau.
2089 auto stepper = Teuchos::rcp(new StepperERK_4Stage4thOrder<Scalar>());
2090 auto t = stepper->getTableau();
2091 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2092 this->getStepperType(), t->A(), t->b(), t->c(), t->order(),
2093 t->orderMin(), t->orderMax(), t->bstar()));
2094 }
2095 }
2096
2097 void setTableau(const Teuchos::SerialDenseMatrix<int, Scalar>& A,
2098 const Teuchos::SerialDenseVector<int, Scalar>& b,
2099 const Teuchos::SerialDenseVector<int, Scalar>& c,
2100 const int order, const int orderMin, const int orderMax,
2101 const Teuchos::SerialDenseVector<int, Scalar>& bstar =
2102 Teuchos::SerialDenseVector<int, Scalar>())
2103 {
2104 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2105 this->getStepperType(), A, b, c, order, orderMin, orderMax, bstar));
2106 this->isInitialized_ = false;
2107 }
2108
2109 virtual std::string getDefaultICConsistency() const { return "Consistent"; }
2110
2111 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
2112 {
2113 auto pl = this->getValidParametersBasicERK();
2114
2115 // Tableau ParameterList
2116 Teuchos::SerialDenseMatrix<int, Scalar> A = this->tableau_->A();
2117 Teuchos::SerialDenseVector<int, Scalar> b = this->tableau_->b();
2118 Teuchos::SerialDenseVector<int, Scalar> c = this->tableau_->c();
2119 Teuchos::SerialDenseVector<int, Scalar> bstar = this->tableau_->bstar();
2120
2121 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
2122
2123 std::ostringstream Astream;
2124 Astream.precision(15);
2125 for (int i = 0; i < A.numRows(); i++) {
2126 for (int j = 0; j < A.numCols() - 1; j++) {
2127 Astream << A(i, j) << " ";
2128 }
2129 Astream << A(i, A.numCols() - 1);
2130 if (i != A.numRows() - 1) Astream << "; ";
2131 }
2132 tableauPL->set<std::string>("A", Astream.str());
2133
2134 std::ostringstream bstream;
2135 bstream.precision(15);
2136 for (int i = 0; i < b.length() - 1; i++) {
2137 bstream << b(i) << " ";
2138 }
2139 bstream << b(b.length() - 1);
2140 tableauPL->set<std::string>("b", bstream.str());
2141
2142 std::ostringstream cstream;
2143 cstream.precision(15);
2144 for (int i = 0; i < c.length() - 1; i++) {
2145 cstream << c(i) << " ";
2146 }
2147 cstream << c(c.length() - 1);
2148 tableauPL->set<std::string>("c", cstream.str());
2149
2150 tableauPL->set<int>("order", this->tableau_->order());
2151
2152 if (bstar.length() == 0) {
2153 tableauPL->set("bstar", "");
2154 }
2155 else {
2156 std::ostringstream bstarstream;
2157 bstarstream.precision(15);
2158 for (int i = 0; i < bstar.length() - 1; i++) {
2159 bstarstream << bstar(i) << " ";
2160 }
2161 bstarstream << bstar(bstar.length() - 1);
2162 tableauPL->set<std::string>("bstar", bstarstream.str());
2163 }
2164
2165 pl->set("Tableau", *tableauPL);
2166
2167 return pl;
2168 }
2169};
2170
2172// ------------------------------------------------------------------------
2173template <class Scalar>
2174Teuchos::RCP<StepperERK_General<Scalar> > createStepperERK_General(
2175 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2176 Teuchos::RCP<Teuchos::ParameterList> pl)
2177{
2178 auto stepper = Teuchos::rcp(new StepperERK_General<Scalar>());
2179 stepper->setStepperRKValues(pl);
2180
2181 if (pl != Teuchos::null) {
2182 if (pl->isParameter("Tableau")) {
2183 auto t = stepper->createTableau(pl);
2184 stepper->setTableau(t->A(), t->b(), t->c(), t->order(), t->orderMin(),
2185 t->orderMax(), t->bstar());
2186 }
2187 }
2188 TEUCHOS_TEST_FOR_EXCEPTION(
2189 stepper->getTableau()->isImplicit() == true, std::logic_error,
2190 "Error - General ERK received an implicit Butcher Tableau!\n");
2191
2192 if (model != Teuchos::null) {
2193 stepper->setModel(model);
2194 stepper->initialize();
2195 }
2196
2197 return stepper;
2198}
2199
2200// ----------------------------------------------------------------------------
2216template <class Scalar>
2217class StepperDIRK_BackwardEuler : virtual public StepperDIRK<Scalar> {
2218 public:
2225 {
2226 this->setStepperName("RK Backward Euler");
2227 this->setStepperType("RK Backward Euler");
2228 this->setupTableau();
2229 this->setupDefault();
2230 this->setUseFSAL(false);
2231 this->setICConsistency("None");
2232 this->setICConsistencyCheck(false);
2233 }
2234
2236 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2237 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2238 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2239 bool useEmbedded, bool zeroInitialGuess,
2240 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2241 {
2242 this->setStepperName("RK Backward Euler");
2243 this->setStepperType("RK Backward Euler");
2244 this->setupTableau();
2245 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2246 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2247 }
2248
2249 std::string getDescription() const
2250 {
2251 std::ostringstream Description;
2252 Description << this->getStepperType() << "\n"
2253 << "c = [ 1 ]'\n"
2254 << "A = [ 1 ]\n"
2255 << "b = [ 1 ]'";
2256 return Description.str();
2257 }
2258
2259 protected:
2261 {
2262 typedef Teuchos::ScalarTraits<Scalar> ST;
2263 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
2264 int NumStages = 1;
2265 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2266 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2267 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2268
2269 // Fill A:
2270 A(0, 0) = ST::one();
2271
2272 // Fill b:
2273 b(0) = ST::one();
2274
2275 // Fill c:
2276 c(0) = ST::one();
2277
2278 int order = 1;
2279
2280 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2281 this->getStepperType(), A, b, c, order, order, order));
2282 this->tableau_->setTVD(true);
2283 this->tableau_->setTVDCoeff(sspcoef);
2284 }
2285};
2286
2288// ------------------------------------------------------------------------
2289template <class Scalar>
2290Teuchos::RCP<StepperDIRK_BackwardEuler<Scalar> >
2292 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2293 Teuchos::RCP<Teuchos::ParameterList> pl)
2294{
2295 auto stepper = Teuchos::rcp(new StepperDIRK_BackwardEuler<Scalar>());
2296 stepper->setStepperDIRKValues(pl);
2297
2298 if (model != Teuchos::null) {
2299 stepper->setModel(model);
2300 stepper->initialize();
2301 }
2302
2303 return stepper;
2304}
2305
2306// ----------------------------------------------------------------------------
2331template <class Scalar>
2332class StepperSDIRK_2Stage2ndOrder : virtual public StepperDIRK<Scalar> {
2333 public:
2340 {
2341 typedef Teuchos::ScalarTraits<Scalar> ST;
2342 const Scalar one = ST::one();
2344 Teuchos::as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2345
2346 this->setStepperName("SDIRK 2 Stage 2nd order");
2347 this->setStepperType("SDIRK 2 Stage 2nd order");
2348 this->setGamma(gammaDefault_);
2349 this->setupTableau();
2350 this->setupDefault();
2351 this->setUseFSAL(false);
2352 this->setICConsistency("None");
2353 this->setICConsistencyCheck(false);
2354 }
2355
2357 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2358 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2359 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2360 bool useEmbedded, bool zeroInitialGuess,
2361 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2362 Scalar gamma = Scalar(0.2928932188134524))
2363 {
2364 typedef Teuchos::ScalarTraits<Scalar> ST;
2365 const Scalar one = ST::one();
2367 Teuchos::as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2368
2369 this->setStepperName("SDIRK 2 Stage 2nd order");
2370 this->setStepperType("SDIRK 2 Stage 2nd order");
2371 this->setGamma(gamma);
2372 this->setupTableau();
2373 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2374 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2375 }
2376
2377 void setGamma(Scalar gamma)
2378 {
2379 gamma_ = gamma;
2380 this->isInitialized_ = false;
2381 this->setupTableau();
2382 }
2383
2384 Scalar getGamma() const { return gamma_; }
2385
2386 std::string getDescription() const
2387 {
2388 std::ostringstream Description;
2389 Description << this->getStepperType() << "\n"
2390 << "Computer Methods for ODEs and DAEs\n"
2391 << "U. M. Ascher and L. R. Petzold\n"
2392 << "p. 106\n"
2393 << "gamma = (2+-sqrt(2))/2\n"
2394 << "c = [ gamma 1 ]'\n"
2395 << "A = [ gamma 0 ]\n"
2396 << " [ 1-gamma gamma ]\n"
2397 << "b = [ 1-gamma gamma ]'";
2398 return Description.str();
2399 }
2400
2401 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
2402 {
2403 auto pl = this->getValidParametersBasicDIRK();
2404 pl->template set<double>(
2405 "gamma", this->getGamma(),
2406 "The default value is gamma = (2-sqrt(2))/2. "
2407 "This will produce an L-stable 2nd order method with the stage "
2408 "times within the timestep. Other values of gamma will still "
2409 "produce an L-stable scheme, but will only be 1st order accurate.");
2410
2411 return pl;
2412 }
2413
2414 protected:
2416 {
2417 typedef Teuchos::ScalarTraits<Scalar> ST;
2418 int NumStages = 2;
2419 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2420 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2421 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2422
2423 const Scalar one = ST::one();
2424 const Scalar zero = ST::zero();
2425
2426 // Fill A:
2427 A(0, 0) = gamma_;
2428 A(0, 1) = zero;
2429 A(1, 0) = Teuchos::as<Scalar>(one - gamma_);
2430 A(1, 1) = gamma_;
2431
2432 // Fill b:
2433 b(0) = Teuchos::as<Scalar>(one - gamma_);
2434 b(1) = gamma_;
2435
2436 // Fill c:
2437 c(0) = gamma_;
2438 c(1) = one;
2439
2440 int order = 1;
2441 if (std::abs((gamma_ - gammaDefault_) / gamma_) < 1.0e-08) order = 2;
2442 if (std::abs((gamma_ -
2443 Teuchos::as<Scalar>((2 * one + ST::squareroot(2 * one)) / (2 * one))) /
2444 gamma_) < 1.0e-08) order = 2;
2445
2446 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2447 this->getStepperType(), A, b, c, order, order, order));
2448 }
2449
2450 private:
2452 Scalar gamma_;
2453};
2454
2456// ------------------------------------------------------------------------
2457template <class Scalar>
2458Teuchos::RCP<StepperSDIRK_2Stage2ndOrder<Scalar> >
2460 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2461 Teuchos::RCP<Teuchos::ParameterList> pl)
2462{
2463 auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
2464 stepper->setStepperDIRKValues(pl);
2465
2466 if (pl != Teuchos::null)
2467 stepper->setGamma(pl->get<double>("gamma", 0.2928932188134524));
2468
2469 if (model != Teuchos::null) {
2470 stepper->setModel(model);
2471 stepper->initialize();
2472 }
2473
2474 return stepper;
2475}
2476
2477// ----------------------------------------------------------------------------
2505template <class Scalar>
2506class StepperSDIRK_3Stage2ndOrder : virtual public StepperDIRK<Scalar> {
2507 public:
2514 {
2515 this->setStepperName("SDIRK 3 Stage 2nd order");
2516 this->setStepperType("SDIRK 3 Stage 2nd order");
2517 this->setupTableau();
2518 this->setupDefault();
2519 this->setUseFSAL(false);
2520 this->setICConsistency("None");
2521 this->setICConsistencyCheck(false);
2522 }
2523
2525 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2526 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2527 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2528 bool useEmbedded, bool zeroInitialGuess,
2529 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2530 {
2531 this->setStepperName("SDIRK 3 Stage 2nd order");
2532 this->setStepperType("SDIRK 3 Stage 2nd order");
2533 this->setupTableau();
2534 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2535 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2536 }
2537
2538 std::string getDescription() const
2539 {
2540 std::ostringstream Description;
2541 Description << this->getStepperType() << "\n"
2542 << "Implicit-explicit Runge-Kutta schemes and applications to\n"
2543 << "hyperbolic systems with relaxation\n"
2544 << "L Pareschi, G Russo\n"
2545 << "Journal of Scientific computing, 2005 - Springer\n"
2546 << "Table 5\n"
2547 << "gamma = 1/(2+sqrt(2))\n"
2548 << "c = [ gamma (1-gamma) 1/2 ]'\n"
2549 << "A = [ gamma 0 0 ]\n"
2550 << " [ 1-2gamma gamma 0 ]\n"
2551 << " [ 1/2-gamma 0 gamma ]\n"
2552 << "b = [ 1/6 1/6 2/3 ]'";
2553 return Description.str();
2554 }
2555
2556 protected:
2558 {
2559 typedef Teuchos::ScalarTraits<Scalar> ST;
2560 using Teuchos::as;
2561 const int NumStages = 3;
2562 const int order = 2;
2563 const Scalar sspcoef = 1.0529;
2564 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2565 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2566 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2567 const Scalar one = ST::one();
2568 const Scalar zero = ST::zero();
2569 const Scalar gamma = as<Scalar>(one - (one / ST::squareroot(2 * one)));
2570
2571 // Fill A:
2572 A(0, 0) = A(1, 1) = A(2, 2) = gamma;
2573 A(0, 1) = A(0, 2) = A(1, 2) = A(2, 1) = zero;
2574 A(1, 0) = as<Scalar>(one - 2 * gamma);
2575 A(2, 0) = as<Scalar>((one / (2. * one)) - gamma);
2576
2577 // Fill b:
2578 b(0) = b(1) = (one / (6 * one));
2579 b(2) = (2 * one) / (3 * one);
2580
2581 // Fill c:
2582 c(0) = gamma;
2583 c(1) = one - gamma;
2584 c(2) = one / (2 * one);
2585
2586 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2587 this->getStepperType(), A, b, c, order, order, order));
2588 this->tableau_->setTVD(true);
2589 this->tableau_->setTVDCoeff(sspcoef);
2590 }
2591};
2592
2594// ------------------------------------------------------------------------
2595template <class Scalar>
2596Teuchos::RCP<StepperSDIRK_3Stage2ndOrder<Scalar> >
2598 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2599 Teuchos::RCP<Teuchos::ParameterList> pl)
2600{
2601 auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage2ndOrder<Scalar>());
2602 stepper->setStepperDIRKValues(pl);
2603
2604 if (model != Teuchos::null) {
2605 stepper->setModel(model);
2606 stepper->initialize();
2607 }
2608
2609 return stepper;
2610}
2611
2612// ----------------------------------------------------------------------------
2641template <class Scalar>
2642class StepperSDIRK_2Stage3rdOrder : virtual public StepperDIRK<Scalar> {
2643 public:
2650 {
2651 typedef Teuchos::ScalarTraits<Scalar> ST;
2652 using Teuchos::as;
2653 const Scalar one = ST::one();
2654 gammaDefault_ = as<Scalar>((3 * one + ST::squareroot(3 * one)) / (6 * one));
2655 gammaTypeDefault_ = "3rd Order A-stable";
2656
2657 this->setStepperName("SDIRK 2 Stage 3rd order");
2658 this->setStepperType("SDIRK 2 Stage 3rd order");
2660 this->setGamma(gammaDefault_);
2661 this->setupTableau();
2662 this->setupDefault();
2663 this->setUseFSAL(false);
2664 this->setICConsistency("None");
2665 this->setICConsistencyCheck(false);
2666 }
2667
2669 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2670 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2671 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2672 bool useEmbedded, bool zeroInitialGuess,
2673 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
2674 std::string gammaType = "3rd Order A-stable",
2675 Scalar gamma = Scalar(0.7886751345948128))
2676 {
2677 typedef Teuchos::ScalarTraits<Scalar> ST;
2678 using Teuchos::as;
2679 const Scalar one = ST::one();
2680 gammaDefault_ = as<Scalar>((3 * one + ST::squareroot(3 * one)) / (6 * one));
2681 gammaTypeDefault_ = "3rd Order A-stable";
2682
2683 this->setStepperName("SDIRK 2 Stage 3rd order");
2684 this->setStepperType("SDIRK 2 Stage 3rd order");
2685 this->setGammaType(gammaType);
2686 this->setGamma(gamma);
2687 this->setupTableau();
2688 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2689 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2690 }
2691
2692 void setGammaType(std::string gammaType)
2693 {
2694 TEUCHOS_TEST_FOR_EXCEPTION(
2695 !(gammaType == "3rd Order A-stable" ||
2696 gammaType == "2nd Order L-stable" || gammaType == "gamma"),
2697 std::logic_error,
2698 "gammaType needs to be '3rd Order A-stable', '2nd Order L-stable' "
2699 "or 'gamma'.");
2700
2701 gammaType_ = gammaType;
2702 this->isInitialized_ = false;
2703 this->setupTableau();
2704 }
2705
2706 std::string getGammaType() const { return gammaType_; }
2707
2708 void setGamma(Scalar gamma)
2709 {
2710 if (gammaType_ == "gamma") {
2711 gamma_ = gamma;
2712 this->setupTableau();
2713 }
2714 this->isInitialized_ = false;
2715 }
2716
2717 Scalar getGamma() const { return gamma_; }
2718
2719 std::string getDescription() const
2720 {
2721 std::ostringstream Description;
2722 Description << this->getStepperType() << "\n"
2723 << "Solving Ordinary Differential Equations I:\n"
2724 << "Nonstiff Problems, 2nd Revised Edition\n"
2725 << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2726 << "Table 7.2, pg 207\n"
2727 << "gamma = (3+sqrt(3))/6 -> 3rd order and A-stable\n"
2728 << "gamma = (2-sqrt(2))/2 -> 2nd order and L-stable\n"
2729 << "c = [ gamma 1-gamma ]'\n"
2730 << "A = [ gamma 0 ]\n"
2731 << " [ 1-2*gamma gamma ]\n"
2732 << "b = [ 1/2 1/2 ]'";
2733 return Description.str();
2734 }
2735
2736 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
2737 {
2738 auto pl = this->getValidParametersBasicDIRK();
2739
2740 pl->template set<std::string>(
2741 "Gamma Type", this->getGammaType(),
2742 "Valid values are '3rd Order A-stable' ((3+sqrt(3))/6.), "
2743 "'2nd Order L-stable' ((2-sqrt(2))/2) and 'gamma' (user defined). "
2744 "The default value is '3rd Order A-stable'.");
2745 pl->template set<double>(
2746 "gamma", this->getGamma(),
2747 "Equal to (3+sqrt(3))/6 if 'Gamma Type' = '3rd Order A-stable', or "
2748 "(2-sqrt(2))/2 if 'Gamma Type' = '2nd Order L-stable', or "
2749 "user-defined gamma value if 'Gamma Type = 'gamma'. "
2750 "The default value is gamma = (3+sqrt(3))/6, which matches "
2751 "the default 'Gamma Type' = '3rd Order A-stable'.");
2752
2753 return pl;
2754 }
2755
2756 protected:
2758 {
2759 typedef Teuchos::ScalarTraits<Scalar> ST;
2760 using Teuchos::as;
2761 int NumStages = 2;
2762 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2763 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2764 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2765 const Scalar one = ST::one();
2766 const Scalar zero = ST::zero();
2767
2768 int order = 0;
2769 if (gammaType_ == "3rd Order A-stable") {
2770 order = 3;
2772 }
2773 else if (gammaType_ == "2nd Order L-stable") {
2774 order = 2;
2775 gamma_ = as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2776 }
2777 else if (gammaType_ == "gamma") {
2778 order = 2;
2779 }
2780
2781 // Fill A:
2782 A(0, 0) = gamma_;
2783 A(0, 1) = zero;
2784 A(1, 0) = as<Scalar>(one - 2 * gamma_);
2785 A(1, 1) = gamma_;
2786
2787 // Fill b:
2788 b(0) = as<Scalar>(one / (2 * one));
2789 b(1) = as<Scalar>(one / (2 * one));
2790
2791 // Fill c:
2792 c(0) = gamma_;
2793 c(1) = as<Scalar>(one - gamma_);
2794
2795 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2796 this->getStepperType(), A, b, c, order, 2, 3));
2797 }
2798
2799 private:
2801 std::string gammaType_;
2803 Scalar gamma_;
2804};
2805
2807// ------------------------------------------------------------------------
2808template <class Scalar>
2809Teuchos::RCP<StepperSDIRK_2Stage3rdOrder<Scalar> >
2811 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2812 Teuchos::RCP<Teuchos::ParameterList> pl)
2813{
2814 auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage3rdOrder<Scalar>());
2815 stepper->setStepperDIRKValues(pl);
2816
2817 if (pl != Teuchos::null) {
2818 stepper->setGammaType(
2819 pl->get<std::string>("Gamma Type", "3rd Order A-stable"));
2820 stepper->setGamma(pl->get<double>("gamma", 0.7886751345948128));
2821 }
2822
2823 if (model != Teuchos::null) {
2824 stepper->setModel(model);
2825 stepper->initialize();
2826 }
2827
2828 return stepper;
2829}
2830
2831// ----------------------------------------------------------------------------
2852template <class Scalar>
2853class StepperEDIRK_2Stage3rdOrder : virtual public StepperDIRK<Scalar> {
2854 public:
2861 {
2862 this->setStepperName("EDIRK 2 Stage 3rd order");
2863 this->setStepperType("EDIRK 2 Stage 3rd order");
2864 this->setupTableau();
2865 this->setupDefault();
2866 this->setUseFSAL(false);
2867 this->setICConsistency("None");
2868 this->setICConsistencyCheck(false);
2869 }
2870
2872 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
2873 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2874 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
2875 bool useEmbedded, bool zeroInitialGuess,
2876 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
2877 {
2878 this->setStepperName("EDIRK 2 Stage 3rd order");
2879 this->setStepperType("EDIRK 2 Stage 3rd order");
2880 this->setupTableau();
2881 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2882 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2883 }
2884
2885 std::string getDescription() const
2886 {
2887 std::ostringstream Description;
2888 Description << this->getStepperType() << "\n"
2889 << "Hammer & Hollingsworth method\n"
2890 << "Solving Ordinary Differential Equations I:\n"
2891 << "Nonstiff Problems, 2nd Revised Edition\n"
2892 << "E. Hairer, S. P. Norsett, and G. Wanner\n"
2893 << "Table 7.1, pg 205\n"
2894 << "c = [ 0 2/3 ]'\n"
2895 << "A = [ 0 0 ]\n"
2896 << " [ 1/3 1/3 ]\n"
2897 << "b = [ 1/4 3/4 ]'";
2898 return Description.str();
2899 }
2900
2901 protected:
2903 {
2904 typedef Teuchos::ScalarTraits<Scalar> ST;
2905 using Teuchos::as;
2906 int NumStages = 2;
2907 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2908 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2909 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2910 const Scalar one = ST::one();
2911 const Scalar zero = ST::zero();
2912
2913 // Fill A:
2914 A(0, 0) = zero;
2915 A(0, 1) = zero;
2916 A(1, 0) = as<Scalar>(one / (3 * one));
2917 A(1, 1) = as<Scalar>(one / (3 * one));
2918
2919 // Fill b:
2920 b(0) = as<Scalar>(one / (4 * one));
2921 b(1) = as<Scalar>(3 * one / (4 * one));
2922
2923 // Fill c:
2924 c(0) = zero;
2925 c(1) = as<Scalar>(2 * one / (3 * one));
2926 int order = 3;
2927
2928 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
2929 this->getStepperType(), A, b, c, order, order, order));
2930 this->tableau_->setTVD(true);
2931 this->tableau_->setTVDCoeff(1.5);
2932 }
2933};
2934
2936template <class Scalar>
2937Teuchos::RCP<StepperEDIRK_2Stage3rdOrder<Scalar> >
2939 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
2940 Teuchos::RCP<Teuchos::ParameterList> pl)
2941{
2942 auto stepper = Teuchos::rcp(new StepperEDIRK_2Stage3rdOrder<Scalar>());
2943 stepper->setStepperDIRKValues(pl);
2944
2945 if (model != Teuchos::null) {
2946 stepper->setModel(model);
2947 stepper->initialize();
2948 }
2949
2950 return stepper;
2951}
2952
2953// ----------------------------------------------------------------------------
2981template <class Scalar>
2982class StepperDIRK_1StageTheta : virtual public StepperDIRK<Scalar> {
2983 public:
2990 {
2991 typedef Teuchos::ScalarTraits<Scalar> ST;
2992 thetaDefault_ = ST::one() / (2 * ST::one());
2993
2994 this->setStepperName("DIRK 1 Stage Theta Method");
2995 this->setStepperType("DIRK 1 Stage Theta Method");
2996 this->setTheta(thetaDefault_);
2997 this->setupTableau();
2998 this->setupDefault();
2999 this->setUseFSAL(false);
3000 this->setICConsistency("None");
3001 this->setICConsistencyCheck(false);
3002 }
3003
3005 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3006 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3007 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3008 bool useEmbedded, bool zeroInitialGuess,
3009 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
3010 Scalar theta = Scalar(0.5))
3011 {
3012 typedef Teuchos::ScalarTraits<Scalar> ST;
3013 thetaDefault_ = ST::one() / (2 * ST::one());
3014
3015 this->setStepperName("DIRK 1 Stage Theta Method");
3016 this->setStepperType("DIRK 1 Stage Theta Method");
3017 this->setTheta(theta);
3018 this->setupTableau();
3019 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3020 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3021 }
3022
3023 void setTheta(Scalar theta)
3024 {
3025 TEUCHOS_TEST_FOR_EXCEPTION(
3026 theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
3027 "'theta' can not be zero, as it makes this stepper explicit. \n"
3028 "Try using the 'RK Forward Euler' stepper.\n");
3029 theta_ = theta;
3030 this->setupTableau();
3031 this->isInitialized_ = false;
3032 }
3033
3034 Scalar getTheta() const { return theta_; }
3035
3036 std::string getDescription() const
3037 {
3038 std::ostringstream Description;
3039 Description << this->getStepperType() << "\n"
3040 << "Non-standard finite-difference methods\n"
3041 << "in dynamical systems, P. Kama,\n"
3042 << "Dissertation, University of Pretoria, pg. 49.\n"
3043 << "Comment: Generalized Implicit Midpoint Method\n"
3044 << "c = [ theta ]'\n"
3045 << "A = [ theta ]\n"
3046 << "b = [ 1 ]'";
3047 return Description.str();
3048 }
3049
3050 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
3051 {
3052 auto pl = this->getValidParametersBasicDIRK();
3053
3054 pl->template set<double>(
3055 "theta", getTheta(),
3056 "Valid values are 0 <= theta <= 1, where theta = 0 "
3057 "implies Forward Euler, theta = 1/2 implies implicit midpoint "
3058 "method (default), and theta = 1 implies Backward Euler. "
3059 "For theta != 1/2, this method is first-order accurate, "
3060 "and with theta = 1/2, it is second-order accurate. "
3061 "This method is A-stable, but becomes L-stable with theta=1.");
3062
3063 return pl;
3064 }
3065
3066 protected:
3068 {
3069 typedef Teuchos::ScalarTraits<Scalar> ST;
3070 int NumStages = 1;
3071 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3072 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3073 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3074 A(0, 0) = theta_;
3075 b(0) = ST::one();
3076 c(0) = theta_;
3077
3078 int order = 1;
3079 if (std::abs((theta_ - thetaDefault_) / theta_) < 1.0e-08) order = 2;
3080
3081 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3082 this->getStepperType(), A, b, c, order, 1, 2));
3083 this->tableau_->setTVD(true);
3084 this->tableau_->setTVDCoeff(2.0);
3085 }
3086
3087 private:
3089 Scalar theta_;
3090};
3091
3093// ------------------------------------------------------------------------
3094template <class Scalar>
3095Teuchos::RCP<StepperDIRK_1StageTheta<Scalar> > createStepperDIRK_1StageTheta(
3096 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3097 Teuchos::RCP<Teuchos::ParameterList> pl)
3098{
3099 auto stepper = Teuchos::rcp(new StepperDIRK_1StageTheta<Scalar>());
3100 stepper->setStepperDIRKValues(pl);
3101
3102 if (pl != Teuchos::null) {
3103 stepper->setTheta(pl->get<double>("theta", 0.5));
3104 }
3105
3106 if (model != Teuchos::null) {
3107 stepper->setModel(model);
3108 stepper->initialize();
3109 }
3110
3111 return stepper;
3112}
3113
3114// ----------------------------------------------------------------------------
3141template <class Scalar>
3142class StepperEDIRK_2StageTheta : virtual public StepperDIRK<Scalar> {
3143 public:
3150 {
3151 typedef Teuchos::ScalarTraits<Scalar> ST;
3152 thetaDefault_ = ST::one() / (2 * ST::one());
3153
3154 this->setStepperName("EDIRK 2 Stage Theta Method");
3155 this->setStepperType("EDIRK 2 Stage Theta Method");
3156 this->setTheta(thetaDefault_);
3157 this->setupTableau();
3158 this->setupDefault();
3159 this->setUseFSAL(true);
3160 this->setICConsistency("Consistent");
3161 this->setICConsistencyCheck(false);
3162 }
3163
3165 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3166 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3167 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3168 bool useEmbedded, bool zeroInitialGuess,
3169 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
3170 Scalar theta = Scalar(0.5))
3171 {
3172 typedef Teuchos::ScalarTraits<Scalar> ST;
3173 thetaDefault_ = ST::one() / (2 * ST::one());
3174
3175 this->setStepperName("EDIRK 2 Stage Theta Method");
3176 this->setStepperType("EDIRK 2 Stage Theta Method");
3177 this->setTheta(theta);
3178 this->setupTableau();
3179 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3180 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3181 }
3182
3183 void setTheta(Scalar theta)
3184 {
3185 TEUCHOS_TEST_FOR_EXCEPTION(
3186 theta == Teuchos::ScalarTraits<Scalar>::zero(), std::logic_error,
3187 "'theta' can not be zero, as it makes this stepper explicit. \n"
3188 "Try using the 'RK Forward Euler' stepper.\n");
3189 theta_ = theta;
3190 this->isInitialized_ = false;
3191 this->setupTableau();
3192 }
3193
3194 Scalar getTheta() const { return theta_; }
3195
3196 std::string getDescription() const
3197 {
3198 std::ostringstream Description;
3199 Description << this->getStepperType() << "\n"
3200 << "Computer Methods for ODEs and DAEs\n"
3201 << "U. M. Ascher and L. R. Petzold\n"
3202 << "p. 113\n"
3203 << "c = [ 0 1 ]'\n"
3204 << "A = [ 0 0 ]\n"
3205 << " [ 1-theta theta ]\n"
3206 << "b = [ 1-theta theta ]'";
3207 return Description.str();
3208 }
3209
3210 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
3211 {
3212 auto pl = this->getValidParametersBasicDIRK();
3213
3214 pl->template set<double>(
3215 "theta", getTheta(),
3216 "Valid values are 0 < theta <= 1, where theta = 0 "
3217 "implies Forward Euler, theta = 1/2 implies trapezoidal "
3218 "method (default), and theta = 1 implies Backward Euler. "
3219 "For theta != 1/2, this method is first-order accurate, "
3220 "and with theta = 1/2, it is second-order accurate. "
3221 "This method is A-stable, but becomes L-stable with theta=1.");
3222
3223 return pl;
3224 }
3225
3226 void setUseFSAL(bool a)
3227 {
3228 this->useFSAL_ = a;
3229 this->isInitialized_ = false;
3230 }
3231
3232 protected:
3234 {
3235 typedef Teuchos::ScalarTraits<Scalar> ST;
3236 const Scalar one = ST::one();
3237 const Scalar zero = ST::zero();
3238
3239 int NumStages = 2;
3240 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3241 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3242 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3243
3244 // Fill A:
3245 A(0, 0) = zero;
3246 A(0, 1) = zero;
3247 A(1, 0) = Teuchos::as<Scalar>(one - theta_);
3248 A(1, 1) = theta_;
3249
3250 // Fill b:
3251 b(0) = Teuchos::as<Scalar>(one - theta_);
3252 b(1) = theta_;
3253
3254 // Fill c:
3255 c(0) = zero;
3256 c(1) = one;
3257
3258 int order = 1;
3259 if (std::abs((theta_ - thetaDefault_) / theta_) < 1.0e-08) order = 2;
3260
3261 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3262 this->getStepperType(), A, b, c, order, 1, 2));
3263 this->tableau_->setTVD(true);
3264 this->tableau_->setTVDCoeff(2.0);
3265 }
3266
3267 private:
3269 Scalar theta_;
3270};
3271
3273// ------------------------------------------------------------------------
3274template <class Scalar>
3275Teuchos::RCP<StepperEDIRK_2StageTheta<Scalar> > createStepperEDIRK_2StageTheta(
3276 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3277 Teuchos::RCP<Teuchos::ParameterList> pl)
3278{
3279 auto stepper = Teuchos::rcp(new StepperEDIRK_2StageTheta<Scalar>());
3280 stepper->setStepperDIRKValues(pl);
3281
3282 if (pl != Teuchos::null) {
3283 stepper->setTheta(pl->get<double>("theta", 0.5));
3284 }
3285
3286 if (model != Teuchos::null) {
3287 stepper->setModel(model);
3288 stepper->initialize();
3289 }
3290
3291 return stepper;
3292}
3293
3294// ----------------------------------------------------------------------------
3315template <class Scalar>
3316class StepperEDIRK_TrapezoidalRule : virtual public StepperDIRK<Scalar> {
3317 public:
3324 {
3325 this->setStepperName("RK Trapezoidal Rule");
3326 this->setStepperType("RK Trapezoidal Rule");
3327 this->setupTableau();
3328 this->setupDefault();
3329 this->setUseFSAL(true);
3330 this->setICConsistency("Consistent");
3331 this->setICConsistencyCheck(false);
3332 }
3333
3335 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3336 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3337 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3338 bool useEmbedded, bool zeroInitialGuess,
3339 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3340 {
3341 this->setStepperName("RK Trapezoidal Rule");
3342 this->setStepperType("RK Trapezoidal Rule");
3343 this->setupTableau();
3344 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3345 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3346 }
3347
3348 std::string getDescription() const
3349 {
3350 std::ostringstream Description;
3351 Description << this->getStepperType() << "\n"
3352 << "Also known as Crank-Nicolson Method.\n"
3353 << "c = [ 0 1 ]'\n"
3354 << "A = [ 0 0 ]\n"
3355 << " [ 1/2 1/2 ]\n"
3356 << "b = [ 1/2 1/2 ]'";
3357 return Description.str();
3358 }
3359
3360 void setUseFSAL(bool a)
3361 {
3362 this->useFSAL_ = a;
3363 this->isInitialized_ = false;
3364 }
3365
3366 protected:
3368 {
3369 typedef Teuchos::ScalarTraits<Scalar> ST;
3370 const Scalar one = ST::one();
3371 const Scalar zero = ST::zero();
3372 const Scalar onehalf = ST::one() / (2 * ST::one());
3373
3374 int NumStages = 2;
3375 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3376 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3377 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3378
3379 // Fill A:
3380 A(0, 0) = zero;
3381 A(0, 1) = zero;
3382 A(1, 0) = onehalf;
3383 A(1, 1) = onehalf;
3384
3385 // Fill b:
3386 b(0) = onehalf;
3387 b(1) = onehalf;
3388
3389 // Fill c:
3390 c(0) = zero;
3391 c(1) = one;
3392
3393 int order = 2;
3394
3395 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3396 this->getStepperType(), A, b, c, order, order, order));
3397 this->tableau_->setTVD(true);
3398 this->tableau_->setTVDCoeff(2.0);
3399 }
3400};
3401
3403// ------------------------------------------------------------------------
3404template <class Scalar>
3405Teuchos::RCP<StepperEDIRK_TrapezoidalRule<Scalar> >
3407 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3408 Teuchos::RCP<Teuchos::ParameterList> pl)
3409{
3410 auto stepper = Teuchos::rcp(new StepperEDIRK_TrapezoidalRule<Scalar>());
3411
3412 // Test for aliases.
3413 if (pl != Teuchos::null) {
3414 auto stepperType =
3415 pl->get<std::string>("Stepper Type", stepper->getStepperType());
3416
3417 TEUCHOS_TEST_FOR_EXCEPTION(
3418 stepperType != stepper->getStepperType() &&
3419 stepperType != "RK Crank-Nicolson",
3420 std::logic_error,
3421 " ParameterList 'Stepper Type' (='" + stepperType
3422 << "')\n does not match type for this Stepper (='"
3423 << stepper->getStepperType()
3424 << "')\n or one of its aliases ('RK Crank-Nicolson').\n");
3425
3426 // Reset default StepperType.
3427 pl->set<std::string>("Stepper Type", stepper->getStepperType());
3428 }
3429
3430 stepper->setStepperDIRKValues(pl);
3431
3432 if (model != Teuchos::null) {
3433 stepper->setModel(model);
3434 stepper->initialize();
3435 }
3436
3437 return stepper;
3438}
3439
3440// ----------------------------------------------------------------------------
3467template <class Scalar>
3468class StepperSDIRK_ImplicitMidpoint : virtual public StepperDIRK<Scalar> {
3469 public:
3476 {
3477 this->setStepperName("RK Implicit Midpoint");
3478 this->setStepperType("RK Implicit Midpoint");
3479 this->setupTableau();
3480 this->setupDefault();
3481 this->setUseFSAL(false);
3482 this->setICConsistency("None");
3483 this->setICConsistencyCheck(false);
3484 }
3485
3487 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3488 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3489 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3490 bool useEmbedded, bool zeroInitialGuess,
3491 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3492 {
3493 this->setStepperName("RK Implicit Midpoint");
3494 this->setStepperType("RK Implicit Midpoint");
3495 this->setupTableau();
3496 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3497 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3498 }
3499
3500 std::string getDescription() const
3501 {
3502 std::ostringstream Description;
3503 Description << this->getStepperType() << "\n"
3504 << "A-stable\n"
3505 << "Solving Ordinary Differential Equations II:\n"
3506 << "Stiff and Differential-Algebraic Problems,\n"
3507 << "2nd Revised Edition\n"
3508 << "E. Hairer and G. Wanner\n"
3509 << "Table 5.2, pg 72\n"
3510 << "Solving Ordinary Differential Equations I:\n"
3511 << "Nonstiff Problems, 2nd Revised Edition\n"
3512 << "E. Hairer, S. P. Norsett, and G. Wanner\n"
3513 << "Table 7.1, pg 205\n"
3514 << "c = [ 1/2 ]'\n"
3515 << "A = [ 1/2 ]\n"
3516 << "b = [ 1 ]'";
3517 return Description.str();
3518 }
3519
3520 protected:
3522 {
3523 typedef Teuchos::ScalarTraits<Scalar> ST;
3524 int NumStages = 1;
3525 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3526 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3527 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3528 const Scalar onehalf = ST::one() / (2 * ST::one());
3529 const Scalar one = ST::one();
3530
3531 // Fill A:
3532 A(0, 0) = onehalf;
3533
3534 // Fill b:
3535 b(0) = one;
3536
3537 // Fill c:
3538 c(0) = onehalf;
3539
3540 int order = 2;
3541
3542 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3543 this->getStepperType(), A, b, c, order, order, order));
3544 this->tableau_->setTVD(true);
3545 this->tableau_->setTVDCoeff(2.0);
3546 }
3547};
3548
3550// ------------------------------------------------------------------------
3551template <class Scalar>
3552Teuchos::RCP<StepperSDIRK_ImplicitMidpoint<Scalar> >
3554 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3555 Teuchos::RCP<Teuchos::ParameterList> pl)
3556{
3557 auto stepper = Teuchos::rcp(new StepperSDIRK_ImplicitMidpoint<Scalar>());
3558 stepper->setStepperDIRKValues(pl);
3559
3560 if (model != Teuchos::null) {
3561 stepper->setModel(model);
3562 stepper->initialize();
3563 }
3564
3565 return stepper;
3566}
3567
3568// ----------------------------------------------------------------------------
3589template <class Scalar>
3590class StepperSDIRK_SSPDIRK22 : virtual public StepperDIRK<Scalar> {
3591 public:
3593 {
3594 this->setStepperName("SSPDIRK22");
3595 this->setStepperType("SSPDIRK22");
3596 this->setupTableau();
3597 this->setupDefault();
3598 this->setUseFSAL(false);
3599 this->setICConsistency("None");
3600 this->setICConsistencyCheck(false);
3601 }
3602
3604 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3605 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3606 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3607 bool useEmbedded, bool zeroInitialGuess,
3608 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3609 {
3610 this->setStepperName("SSPDIRK22");
3611 this->setStepperType("SSPDIRK22");
3612 this->setupTableau();
3613 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3614 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3615 }
3616
3617 std::string getDescription() const
3618 {
3619 std::ostringstream Description;
3620 Description << this->getStepperType() << "\n"
3621 << "Strong Stability Preserving Diagonally-Implicit RK "
3622 "(stage=2, order=2)\n"
3623 << "SSP-Coef = 4\n"
3624 << "c = [ 1/4 3/4 ]'\n"
3625 << "A = [ 1/4 ]\n"
3626 << " [ 1/2 1/4 ]\n"
3627 << "b = [ 1/2 1/2 ]\n"
3628 << std::endl;
3629 return Description.str();
3630 }
3631
3632 protected:
3634 {
3635 typedef Teuchos::ScalarTraits<Scalar> ST;
3636 using Teuchos::as;
3637 const int NumStages = 2;
3638 const int order = 2;
3639 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3640 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3641 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3642
3643 const Scalar one = ST::one();
3644 const Scalar zero = ST::zero();
3645 const Scalar onehalf = one / (2 * one);
3646 const Scalar onefourth = one / (4 * one);
3647
3648 // Fill A:
3649 A(0, 0) = A(1, 1) = onefourth;
3650 A(0, 1) = zero;
3651 A(1, 0) = onehalf;
3652
3653 // Fill b:
3654 b(0) = b(1) = onehalf;
3655
3656 // Fill c:
3657 c(0) = A(0, 0);
3658 c(1) = A(1, 0) + A(1, 1);
3659
3660 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3661 this->getStepperType(), A, b, c, order, order, order));
3662 this->tableau_->setTVD(true);
3663 this->tableau_->setTVDCoeff(4.0);
3664 }
3665};
3666
3668// ------------------------------------------------------------------------
3669template <class Scalar>
3670Teuchos::RCP<StepperSDIRK_SSPDIRK22<Scalar> > createStepperSDIRK_SSPDIRK22(
3671 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3672 Teuchos::RCP<Teuchos::ParameterList> pl)
3673{
3674 auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK22<Scalar>());
3675 stepper->setStepperDIRKValues(pl);
3676
3677 if (model != Teuchos::null) {
3678 stepper->setModel(model);
3679 stepper->initialize();
3680 }
3681
3682 return stepper;
3683}
3684
3685// ----------------------------------------------------------------------------
3707template <class Scalar>
3708class StepperSDIRK_SSPDIRK32 : virtual public StepperDIRK<Scalar> {
3709 public:
3711 {
3712 this->setStepperName("SSPDIRK32");
3713 this->setStepperType("SSPDIRK32");
3714 this->setupTableau();
3715 this->setupDefault();
3716 this->setUseFSAL(false);
3717 this->setICConsistency("None");
3718 this->setICConsistencyCheck(false);
3719 }
3720
3722 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3723 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3724 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3725 bool useEmbedded, bool zeroInitialGuess,
3726 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3727 {
3728 this->setStepperName("SSPDIRK32");
3729 this->setStepperType("SSPDIRK32");
3730 this->setupTableau();
3731 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3732 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3733 }
3734
3735 std::string getDescription() const
3736 {
3737 std::ostringstream Description;
3738 Description << this->getStepperType() << "\n"
3739 << "Strong Stability Preserving Diagonally-Implicit RK "
3740 "(stage=3, order=2)\n"
3741 << "SSP-Coef = 6\n"
3742 << "c = [ 1/6 1/2 5/6 ]'\n"
3743 << "A = [ 1/6 ]\n"
3744 << " [ 1/3 1/6 ]\n"
3745 << " [ 1/3 1/3 1/6 ]\n"
3746 << "b = [ 1/3 1/3 1/3 ]\n"
3747 << std::endl;
3748 return Description.str();
3749 }
3750
3751 protected:
3753 {
3754 typedef Teuchos::ScalarTraits<Scalar> ST;
3755 using Teuchos::as;
3756 const int NumStages = 3;
3757 const int order = 2;
3758 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3759 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3760 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3761
3762 const Scalar one = ST::one();
3763 const Scalar zero = ST::zero();
3764 const Scalar onethird = one / (3 * one);
3765 const Scalar onesixth = one / (6 * one);
3766
3767 // Fill A:
3768 A(0, 0) = A(1, 1) = A(2, 2) = onesixth;
3769 A(1, 0) = A(2, 0) = A(2, 1) = onethird;
3770 A(0, 1) = A(0, 2) = A(1, 2) = zero;
3771
3772 // Fill b:
3773 b(0) = b(1) = b(2) = onethird;
3774
3775 // Fill c:
3776 c(0) = A(0, 0);
3777 c(1) = A(1, 0) + A(1, 1);
3778 c(2) = A(2, 0) + A(2, 1) + A(2, 2);
3779
3780 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3781 this->getStepperType(), A, b, c, order, order, order));
3782 this->tableau_->setTVD(true);
3783 this->tableau_->setTVDCoeff(6.0);
3784 }
3785};
3786
3788// ------------------------------------------------------------------------
3789template <class Scalar>
3790Teuchos::RCP<StepperSDIRK_SSPDIRK32<Scalar> > createStepperSDIRK_SSPDIRK32(
3791 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3792 Teuchos::RCP<Teuchos::ParameterList> pl)
3793{
3794 auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK32<Scalar>());
3795 stepper->setStepperDIRKValues(pl);
3796
3797 if (model != Teuchos::null) {
3798 stepper->setModel(model);
3799 stepper->initialize();
3800 }
3801
3802 return stepper;
3803}
3804
3805// ----------------------------------------------------------------------------
3824template <class Scalar>
3825class StepperSDIRK_SSPDIRK23 : virtual public StepperDIRK<Scalar> {
3826 public:
3828 {
3829 this->setStepperName("SSPDIRK23");
3830 this->setStepperType("SSPDIRK23");
3831 this->setupTableau();
3832 this->setupDefault();
3833 this->setUseFSAL(false);
3834 this->setICConsistency("None");
3835 this->setICConsistencyCheck(false);
3836 }
3837
3839 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3840 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3841 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3842 bool useEmbedded, bool zeroInitialGuess,
3843 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3844 {
3845 this->setStepperName("SSPDIRK23");
3846 this->setStepperType("SSPDIRK23");
3847 this->setupTableau();
3848 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3849 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3850 }
3851
3852 std::string getDescription() const
3853 {
3854 std::ostringstream Description;
3855 Description << this->getStepperType() << "\n"
3856 << "Strong Stability Preserving Diagonally-Implicit RK "
3857 "(stage=2, order=3)\n"
3858 << "SSP-Coef = 1 + sqrt( 3 )\n"
3859 << "c = [ 1/(3 + sqrt( 3 )) (1/6)(3 + sqrt( 3 )) ] '\n"
3860 << "A = [ 1/(3 + sqrt( 3 )) ] \n"
3861 << " [ 1/sqrt( 3 ) 1/(3 + sqrt( 3 )) ] \n"
3862 << "b = [ 1/2 1/2 ] \n"
3863 << std::endl;
3864 return Description.str();
3865 }
3866
3867 protected:
3869 {
3870 typedef Teuchos::ScalarTraits<Scalar> ST;
3871 using Teuchos::as;
3872 const int NumStages = 2;
3873 const int order = 3;
3874 const Scalar sspcoef = 2.7321;
3875 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3876 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3877 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3878
3879 const Scalar one = ST::one();
3880 const Scalar zero = ST::zero();
3881 const Scalar onehalf = one / (2 * one);
3882 const Scalar rootthree = ST::squareroot(3 * one);
3883
3884 // Fill A:
3885 A(0, 0) = A(1, 1) = one / (3 * one + rootthree);
3886 A(1, 0) = one / rootthree;
3887 A(0, 1) = zero;
3888
3889 // Fill b:
3890 b(0) = b(1) = onehalf;
3891
3892 // Fill c:
3893 c(0) = A(0, 0);
3894 c(1) = A(1, 0) + A(1, 1);
3895
3896 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
3897 this->getStepperType(), A, b, c, order, order, order));
3898 this->tableau_->setTVD(true);
3899 this->tableau_->setTVDCoeff(sspcoef);
3900 }
3901};
3902
3904// ------------------------------------------------------------------------
3905template <class Scalar>
3906Teuchos::RCP<StepperSDIRK_SSPDIRK23<Scalar> > createStepperSDIRK_SSPDIRK23(
3907 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
3908 Teuchos::RCP<Teuchos::ParameterList> pl)
3909{
3910 auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK23<Scalar>());
3911 stepper->setStepperDIRKValues(pl);
3912
3913 if (model != Teuchos::null) {
3914 stepper->setModel(model);
3915 stepper->initialize();
3916 }
3917
3918 return stepper;
3919}
3920
3921// ----------------------------------------------------------------------------
3943template <class Scalar>
3944class StepperSDIRK_SSPDIRK33 : virtual public StepperDIRK<Scalar> {
3945 public:
3947 {
3948 this->setStepperName("SSPDIRK33");
3949 this->setStepperType("SSPDIRK33");
3950 this->setupTableau();
3951 this->setupDefault();
3952 this->setUseFSAL(false);
3953 this->setICConsistency("None");
3954 this->setICConsistencyCheck(false);
3955 }
3956
3958 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
3959 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3960 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
3961 bool useEmbedded, bool zeroInitialGuess,
3962 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
3963 {
3964 this->setStepperName("SSPDIRK33");
3965 this->setStepperType("SSPDIRK33");
3966 this->setupTableau();
3967 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3968 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3969 }
3970
3971 std::string getDescription() const
3972 {
3973 std::ostringstream Description;
3974 Description << this->getStepperType() << "\n"
3975 << "Strong Stability Preserving Diagonally-Implicit RK "
3976 "(stage=3, order=3)\n"
3977 << "SSP-Coef = 2 + 2 sqrt(2)\n"
3978 << "c = [ 1/( 4 + 2 sqrt(2) 1/2 (1/4)(2 + "
3979 "sqrt(2) ] '\n"
3980 << "A = [ 1/( 4 + 2 sqrt(2) "
3981 " ] \n"
3982 << " [ 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) "
3983 " ] \n"
3984 << " [ 1/(2 sqrt(2) 1/(2 sqrt(2) 1/( 4 + 2 "
3985 "sqrt(2) ] \n"
3986 << "b = [ 1/3 1/3 1/3 "
3987 " ] \n"
3988 << std::endl;
3989 return Description.str();
3990 }
3991
3992 protected:
3994 {
3995 typedef Teuchos::ScalarTraits<Scalar> ST;
3996 using Teuchos::as;
3997 const int NumStages = 3;
3998 const int order = 3;
3999 const Scalar sspcoef = 4.8284;
4000 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4001 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4002 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4003
4004 const Scalar one = ST::one();
4005 const Scalar zero = ST::zero();
4006 const Scalar onethird = one / (3 * one);
4007 const Scalar rootwo = ST::squareroot(2 * one);
4008
4009 // Fill A:
4010 A(0, 0) = A(1, 1) = A(2, 2) = one / (4 * one + 2 * rootwo);
4011 A(1, 0) = A(2, 0) = A(2, 1) = one / (2 * rootwo);
4012 A(0, 1) = A(0, 2) = A(1, 2) = zero;
4013
4014 // Fill b:
4015 b(0) = b(1) = b(2) = onethird;
4016
4017 // Fill c:
4018 c(0) = A(0, 0);
4019 c(1) = A(1, 0) + A(1, 1);
4020 c(2) = A(2, 0) + A(2, 1) + A(2, 2);
4021
4022 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4023 this->getStepperType(), A, b, c, order, order, order));
4024 this->tableau_->setTVD(true);
4025 this->tableau_->setTVDCoeff(sspcoef);
4026 }
4027};
4028
4030// ------------------------------------------------------------------------
4031template <class Scalar>
4032Teuchos::RCP<StepperSDIRK_SSPDIRK33<Scalar> > createStepperSDIRK_SSPDIRK33(
4033 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4034 Teuchos::RCP<Teuchos::ParameterList> pl)
4035{
4036 auto stepper = Teuchos::rcp(new StepperSDIRK_SSPDIRK33<Scalar>());
4037 stepper->setStepperDIRKValues(pl);
4038
4039 if (model != Teuchos::null) {
4040 stepper->setModel(model);
4041 stepper->initialize();
4042 }
4043
4044 return stepper;
4045}
4046
4047// ----------------------------------------------------------------------------
4068template <class Scalar>
4069class StepperDIRK_1Stage1stOrderRadauIA : virtual public StepperDIRK<Scalar> {
4070 public:
4077 {
4078 this->setStepperName("RK Implicit 1 Stage 1st order Radau IA");
4079 this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
4080 this->setupTableau();
4081 this->setupDefault();
4082 this->setUseFSAL(false);
4083 this->setICConsistency("None");
4084 this->setICConsistencyCheck(false);
4085 }
4086
4088 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4089 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4090 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4091 bool useEmbedded, bool zeroInitialGuess,
4092 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4093 {
4094 this->setStepperName("RK Implicit 1 Stage 1st order Radau IA");
4095 this->setStepperType("RK Implicit 1 Stage 1st order Radau IA");
4096 this->setupTableau();
4097 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4098 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4099 }
4100
4101 std::string getDescription() const
4102 {
4103 std::ostringstream Description;
4104 Description << this->getStepperType() << "\n"
4105 << "A-stable\n"
4106 << "Solving Ordinary Differential Equations II:\n"
4107 << "Stiff and Differential-Algebraic Problems,\n"
4108 << "2nd Revised Edition\n"
4109 << "E. Hairer and G. Wanner\n"
4110 << "Table 5.3, pg 73\n"
4111 << "c = [ 0 ]'\n"
4112 << "A = [ 1 ]\n"
4113 << "b = [ 1 ]'";
4114 return Description.str();
4115 }
4116
4117 protected:
4119 {
4120 typedef Teuchos::ScalarTraits<Scalar> ST;
4121 int NumStages = 1;
4122 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4123 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4124 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4125 const Scalar one = ST::one();
4126 const Scalar zero = ST::zero();
4127 A(0, 0) = one;
4128 b(0) = one;
4129 c(0) = zero;
4130 int order = 1;
4131
4132 auto emptyBStar = Teuchos::SerialDenseVector<int, Scalar>();
4133 this->tableau_ = Teuchos::rcp(
4134 new RKButcherTableau<Scalar>(this->getStepperType(), A, b, c, order,
4135 order, order, emptyBStar, false));
4136 }
4137};
4138
4140// ------------------------------------------------------------------------
4141template <class Scalar>
4142Teuchos::RCP<StepperDIRK_1Stage1stOrderRadauIA<Scalar> >
4144 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4145 Teuchos::RCP<Teuchos::ParameterList> pl)
4146{
4147 auto stepper = Teuchos::rcp(new StepperDIRK_1Stage1stOrderRadauIA<Scalar>());
4148 stepper->setStepperDIRKValues(pl);
4149
4150 if (model != Teuchos::null) {
4151 stepper->setModel(model);
4152 stepper->initialize();
4153 }
4154
4155 return stepper;
4156}
4157
4158// ----------------------------------------------------------------------------
4181template <class Scalar>
4183 : virtual public StepperDIRK<Scalar> {
4184 public:
4191 {
4192 this->setStepperName("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4193 this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4194 this->setupTableau();
4195 this->setupDefault();
4196 this->setUseFSAL(false);
4197 this->setICConsistency("None");
4198 this->setICConsistencyCheck(false);
4199 }
4200
4202 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4203 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4204 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4205 bool useEmbedded, bool zeroInitialGuess,
4206 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4207 {
4208 this->setStepperName("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4209 this->setStepperType("RK Implicit 2 Stage 2nd order Lobatto IIIB");
4210 this->setupTableau();
4211 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4212 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4213 }
4214
4215 std::string getDescription() const
4216 {
4217 std::ostringstream Description;
4218 Description << this->getStepperType() << "\n"
4219 << "A-stable\n"
4220 << "Solving Ordinary Differential Equations II:\n"
4221 << "Stiff and Differential-Algebraic Problems,\n"
4222 << "2nd Revised Edition\n"
4223 << "E. Hairer and G. Wanner\n"
4224 << "Table 5.9, pg 76\n"
4225 << "c = [ 0 1 ]'\n"
4226 << "A = [ 1/2 0 ]\n"
4227 << " [ 1/2 0 ]\n"
4228 << "b = [ 1/2 1/2 ]'";
4229 return Description.str();
4230 }
4231
4232 protected:
4234 {
4235 typedef Teuchos::ScalarTraits<Scalar> ST;
4236 using Teuchos::as;
4237 int NumStages = 2;
4238 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4239 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4240 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4241 const Scalar zero = ST::zero();
4242 const Scalar one = ST::one();
4243
4244 // Fill A:
4245 A(0, 0) = as<Scalar>(one / (2 * one));
4246 A(0, 1) = zero;
4247 A(1, 0) = as<Scalar>(one / (2 * one));
4248 A(1, 1) = zero;
4249
4250 // Fill b:
4251 b(0) = as<Scalar>(one / (2 * one));
4252 b(1) = as<Scalar>(one / (2 * one));
4253
4254 // Fill c:
4255 c(0) = zero;
4256 c(1) = one;
4257 int order = 2;
4258
4259 auto emptyBStar = Teuchos::SerialDenseVector<int, Scalar>();
4260 this->tableau_ = Teuchos::rcp(
4261 new RKButcherTableau<Scalar>(this->getStepperType(), A, b, c, order,
4262 order, order, emptyBStar, false));
4263 this->tableau_->setTVD(true);
4264 this->tableau_->setTVDCoeff(2.0);
4265 }
4266};
4267
4269// ------------------------------------------------------------------------
4270template <class Scalar>
4271Teuchos::RCP<StepperDIRK_2Stage2ndOrderLobattoIIIB<Scalar> >
4273 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4274 Teuchos::RCP<Teuchos::ParameterList> pl)
4275{
4276 auto stepper =
4278 stepper->setStepperDIRKValues(pl);
4279
4280 if (model != Teuchos::null) {
4281 stepper->setModel(model);
4282 stepper->initialize();
4283 }
4284
4285 return stepper;
4286}
4287
4288// ----------------------------------------------------------------------------
4314template <class Scalar>
4315class StepperSDIRK_5Stage4thOrder : virtual public StepperDIRK<Scalar> {
4316 public:
4323 {
4324 this->setStepperName("SDIRK 5 Stage 4th order");
4325 this->setStepperType("SDIRK 5 Stage 4th order");
4326 this->setupTableau();
4327 this->setupDefault();
4328 this->setUseFSAL(false);
4329 this->setICConsistency("None");
4330 this->setICConsistencyCheck(false);
4331 }
4332
4334 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4335 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4336 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4337 bool useEmbedded, bool zeroInitialGuess,
4338 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4339 {
4340 this->setStepperName("SDIRK 5 Stage 4th order");
4341 this->setStepperType("SDIRK 5 Stage 4th order");
4342 this->setupTableau();
4343 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4344 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4345 }
4346
4347 std::string getDescription() const
4348 {
4349 std::ostringstream Description;
4350 Description << this->getStepperType() << "\n"
4351 << "L-stable\n"
4352 << "Solving Ordinary Differential Equations II:\n"
4353 << "Stiff and Differential-Algebraic Problems,\n"
4354 << "2nd Revised Edition\n"
4355 << "E. Hairer and G. Wanner\n"
4356 << "pg100 \n"
4357 << "c = [ 1/4 3/4 11/20 1/2 1 ]'\n"
4358 << "A = [ 1/4 ]\n"
4359 << " [ 1/2 1/4 ]\n"
4360 << " [ 17/50 -1/25 1/4 ]\n"
4361 << " [ 371/1360 -137/2720 15/544 1/4 ]\n"
4362 << " [ 25/24 -49/48 125/16 -85/12 1/4 ]\n"
4363 << "b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'";
4364 // << "b = [ 59/48 -17/96 225/32 -85/12 0 ]'";
4365 return Description.str();
4366 }
4367
4368 protected:
4370 {
4371 typedef Teuchos::ScalarTraits<Scalar> ST;
4372 using Teuchos::as;
4373 int NumStages = 5;
4374 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4375 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4376 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4377 const Scalar zero = ST::zero();
4378 const Scalar one = ST::one();
4379 const Scalar onequarter = as<Scalar>(one / (4 * one));
4380
4381 // Fill A:
4382 A(0, 0) = onequarter;
4383 A(0, 1) = zero;
4384 A(0, 2) = zero;
4385 A(0, 3) = zero;
4386 A(0, 4) = zero;
4387
4388 A(1, 0) = as<Scalar>(one / (2 * one));
4389 A(1, 1) = onequarter;
4390 A(1, 2) = zero;
4391 A(1, 3) = zero;
4392 A(1, 4) = zero;
4393
4394 A(2, 0) = as<Scalar>(17 * one / (50 * one));
4395 A(2, 1) = as<Scalar>(-one / (25 * one));
4396 A(2, 2) = onequarter;
4397 A(2, 3) = zero;
4398 A(2, 4) = zero;
4399
4400 A(3, 0) = as<Scalar>(371 * one / (1360 * one));
4401 A(3, 1) = as<Scalar>(-137 * one / (2720 * one));
4402 A(3, 2) = as<Scalar>(15 * one / (544 * one));
4403 A(3, 3) = onequarter;
4404 A(3, 4) = zero;
4405
4406 A(4, 0) = as<Scalar>(25 * one / (24 * one));
4407 A(4, 1) = as<Scalar>(-49 * one / (48 * one));
4408 A(4, 2) = as<Scalar>(125 * one / (16 * one));
4409 A(4, 3) = as<Scalar>(-85 * one / (12 * one));
4410 A(4, 4) = onequarter;
4411
4412 // Fill b:
4413 b(0) = as<Scalar>(25 * one / (24 * one));
4414 b(1) = as<Scalar>(-49 * one / (48 * one));
4415 b(2) = as<Scalar>(125 * one / (16 * one));
4416 b(3) = as<Scalar>(-85 * one / (12 * one));
4417 b(4) = onequarter;
4418
4419 /*
4420 // Alternate version
4421 b(0) = as<Scalar>( 59*one/(48*one) );
4422 b(1) = as<Scalar>( -17*one/(96*one) );
4423 b(2) = as<Scalar>( 225*one/(32*one) );
4424 b(3) = as<Scalar>( -85*one/(12*one) );
4425 b(4) = zero;
4426 */
4427
4428 // Fill c:
4429 c(0) = onequarter;
4430 c(1) = as<Scalar>(3 * one / (4 * one));
4431 c(2) = as<Scalar>(11 * one / (20 * one));
4432 c(3) = as<Scalar>(one / (2 * one));
4433 c(4) = one;
4434
4435 int order = 4;
4436
4437 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4438 this->getStepperType(), A, b, c, order, order, order));
4439 }
4440};
4441
4443// ------------------------------------------------------------------------
4444template <class Scalar>
4445Teuchos::RCP<StepperSDIRK_5Stage4thOrder<Scalar> >
4447 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4448 Teuchos::RCP<Teuchos::ParameterList> pl)
4449{
4450 auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage4thOrder<Scalar>());
4451 stepper->setStepperDIRKValues(pl);
4452
4453 if (model != Teuchos::null) {
4454 stepper->setModel(model);
4455 stepper->initialize();
4456 }
4457
4458 return stepper;
4459}
4460
4461// ----------------------------------------------------------------------------
4486template <class Scalar>
4487class StepperSDIRK_3Stage4thOrder : virtual public StepperDIRK<Scalar> {
4488 public:
4495 {
4496 this->setStepperName("SDIRK 3 Stage 4th order");
4497 this->setStepperType("SDIRK 3 Stage 4th order");
4498 this->setupTableau();
4499 this->setupDefault();
4500 this->setUseFSAL(false);
4501 this->setICConsistency("None");
4502 this->setICConsistencyCheck(false);
4503 }
4504
4506 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4507 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4508 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4509 bool useEmbedded, bool zeroInitialGuess,
4510 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4511 {
4512 this->setStepperName("SDIRK 3 Stage 4th order");
4513 this->setStepperType("SDIRK 3 Stage 4th order");
4514 this->setupTableau();
4515 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4516 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4517 }
4518
4519 std::string getDescription() const
4520 {
4521 std::ostringstream Description;
4522 Description << this->getStepperType() << "\n"
4523 << "A-stable\n"
4524 << "Solving Ordinary Differential Equations II:\n"
4525 << "Stiff and Differential-Algebraic Problems,\n"
4526 << "2nd Revised Edition\n"
4527 << "E. Hairer and G. Wanner\n"
4528 << "p. 100 \n"
4529 << "gamma = (1/sqrt(3))*cos(pi/18)+1/2\n"
4530 << "delta = 1/(6*(2*gamma-1)^2)\n"
4531 << "c = [ gamma 1/2 1-gamma ]'\n"
4532 << "A = [ gamma ]\n"
4533 << " [ 1/2-gamma gamma ]\n"
4534 << " [ 2*gamma 1-4*gamma gamma ]\n"
4535 << "b = [ delta 1-2*delta delta ]'";
4536 return Description.str();
4537 }
4538
4539 protected:
4541 {
4542 typedef Teuchos::ScalarTraits<Scalar> ST;
4543 using Teuchos::as;
4544 int NumStages = 3;
4545 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4546 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4547 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4548 const Scalar zero = ST::zero();
4549 const Scalar one = ST::one();
4550 const Scalar pi = as<Scalar>(4 * one) * std::atan(one);
4551 const Scalar gamma =
4552 as<Scalar>(one / ST::squareroot(3 * one) * std::cos(pi / (18 * one)) +
4553 one / (2 * one));
4554 const Scalar delta =
4555 as<Scalar>(one / (6 * one * std::pow(2 * gamma - one, 2 * one)));
4556
4557 // Fill A:
4558 A(0, 0) = gamma;
4559 A(0, 1) = zero;
4560 A(0, 2) = zero;
4561
4562 A(1, 0) = as<Scalar>(one / (2 * one) - gamma);
4563 A(1, 1) = gamma;
4564 A(1, 2) = zero;
4565
4566 A(2, 0) = as<Scalar>(2 * gamma);
4567 A(2, 1) = as<Scalar>(one - 4 * gamma);
4568 A(2, 2) = gamma;
4569
4570 // Fill b:
4571 b(0) = delta;
4572 b(1) = as<Scalar>(one - 2 * delta);
4573 b(2) = delta;
4574
4575 // Fill c:
4576 c(0) = gamma;
4577 c(1) = as<Scalar>(one / (2 * one));
4578 c(2) = as<Scalar>(one - gamma);
4579
4580 int order = 4;
4581
4582 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4583 this->getStepperType(), A, b, c, order, order, order));
4584 }
4585};
4586
4588// ------------------------------------------------------------------------
4589template <class Scalar>
4590Teuchos::RCP<StepperSDIRK_3Stage4thOrder<Scalar> >
4592 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4593 Teuchos::RCP<Teuchos::ParameterList> pl)
4594{
4595 auto stepper = Teuchos::rcp(new StepperSDIRK_3Stage4thOrder<Scalar>());
4596 stepper->setStepperDIRKValues(pl);
4597
4598 if (model != Teuchos::null) {
4599 stepper->setModel(model);
4600 stepper->initialize();
4601 }
4602
4603 return stepper;
4604}
4605
4606// ----------------------------------------------------------------------------
4635template <class Scalar>
4636class StepperSDIRK_5Stage5thOrder : virtual public StepperDIRK<Scalar> {
4637 public:
4644 {
4645 this->setStepperName("SDIRK 5 Stage 5th order");
4646 this->setStepperType("SDIRK 5 Stage 5th order");
4647 this->setupTableau();
4648 this->setupDefault();
4649 this->setUseFSAL(false);
4650 this->setICConsistency("None");
4651 this->setICConsistencyCheck(false);
4652 }
4653
4655 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4656 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4657 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4658 bool useEmbedded, bool zeroInitialGuess,
4659 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4660 {
4661 this->setStepperName("SDIRK 5 Stage 5th order");
4662 this->setStepperType("SDIRK 5 Stage 5th order");
4663 this->setupTableau();
4664 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4665 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4666 }
4667
4668 std::string getDescription() const
4669 {
4670 std::ostringstream Description;
4671 Description << this->getStepperType() << "\n"
4672 << "Solving Ordinary Differential Equations II:\n"
4673 << "Stiff and Differential-Algebraic Problems,\n"
4674 << "2nd Revised Edition\n"
4675 << "E. Hairer and G. Wanner\n"
4676 << "pg101 \n"
4677 << "c = [ (6-sqrt(6))/10 ]\n"
4678 << " [ (6+9*sqrt(6))/35 ]\n"
4679 << " [ 1 ]\n"
4680 << " [ (4-sqrt(6))/10 ]\n"
4681 << " [ (4+sqrt(6))/10 ]\n"
4682 << "A = [ A1 A2 A3 A4 A5 ]\n"
4683 << " A1 = [ (6-sqrt(6))/10 ]\n"
4684 << " [ (-6+5*sqrt(6))/14 ]\n"
4685 << " [ (888+607*sqrt(6))/2850 ]\n"
4686 << " [ (3153-3082*sqrt(6))/14250 ]\n"
4687 << " [ (-32583+14638*sqrt(6))/71250 ]\n"
4688 << " A2 = [ 0 ]\n"
4689 << " [ (6-sqrt(6))/10 ]\n"
4690 << " [ (126-161*sqrt(6))/1425 ]\n"
4691 << " [ (3213+1148*sqrt(6))/28500 ]\n"
4692 << " [ (-17199+364*sqrt(6))/142500 ]\n"
4693 << " A3 = [ 0 ]\n"
4694 << " [ 0 ]\n"
4695 << " [ (6-sqrt(6))/10 ]\n"
4696 << " [ (-267+88*sqrt(6))/500 ]\n"
4697 << " [ (1329-544*sqrt(6))/2500 ]\n"
4698 << " A4 = [ 0 ]\n"
4699 << " [ 0 ]\n"
4700 << " [ 0 ]\n"
4701 << " [ (6-sqrt(6))/10 ]\n"
4702 << " [ (-96+131*sqrt(6))/625 ]\n"
4703 << " A5 = [ 0 ]\n"
4704 << " [ 0 ]\n"
4705 << " [ 0 ]\n"
4706 << " [ 0 ]\n"
4707 << " [ (6-sqrt(6))/10 ]\n"
4708 << "b = [ 0 ]\n"
4709 << " [ 0 ]\n"
4710 << " [ 1/9 ]\n"
4711 << " [ (16-sqrt(6))/36 ]\n"
4712 << " [ (16+sqrt(6))/36 ]'";
4713 return Description.str();
4714 }
4715
4716 protected:
4718 {
4719 typedef Teuchos::ScalarTraits<Scalar> ST;
4720 using Teuchos::as;
4721 int NumStages = 5;
4722 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4723 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4724 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4725 const Scalar zero = ST::zero();
4726 const Scalar one = ST::one();
4727 const Scalar sqrt6 = ST::squareroot(as<Scalar>(6 * one));
4728 const Scalar gamma =
4729 as<Scalar>((6 * one - sqrt6) / (10 * one)); // diagonal
4730
4731 // Fill A:
4732 A(0, 0) = gamma;
4733 A(0, 1) = zero;
4734 A(0, 2) = zero;
4735 A(0, 3) = zero;
4736 A(0, 4) = zero;
4737
4738 A(1, 0) = as<Scalar>((-6 * one + 5 * one * sqrt6) / (14 * one));
4739 A(1, 1) = gamma;
4740 A(1, 2) = zero;
4741 A(1, 3) = zero;
4742 A(1, 4) = zero;
4743
4744 A(2, 0) = as<Scalar>((888 * one + 607 * one * sqrt6) / (2850 * one));
4745 A(2, 1) = as<Scalar>((126 * one - 161 * one * sqrt6) / (1425 * one));
4746 A(2, 2) = gamma;
4747 A(2, 3) = zero;
4748 A(2, 4) = zero;
4749
4750 A(3, 0) = as<Scalar>((3153 * one - 3082 * one * sqrt6) / (14250 * one));
4751 A(3, 1) = as<Scalar>((3213 * one + 1148 * one * sqrt6) / (28500 * one));
4752 A(3, 2) = as<Scalar>((-267 * one + 88 * one * sqrt6) / (500 * one));
4753 A(3, 3) = gamma;
4754 A(3, 4) = zero;
4755
4756 A(4, 0) = as<Scalar>((-32583 * one + 14638 * one * sqrt6) / (71250 * one));
4757 A(4, 1) = as<Scalar>((-17199 * one + 364 * one * sqrt6) / (142500 * one));
4758 A(4, 2) = as<Scalar>((1329 * one - 544 * one * sqrt6) / (2500 * one));
4759 A(4, 3) = as<Scalar>((-96 * one + 131 * sqrt6) / (625 * one));
4760 A(4, 4) = gamma;
4761
4762 // Fill b:
4763 b(0) = zero;
4764 b(1) = zero;
4765 b(2) = as<Scalar>(one / (9 * one));
4766 b(3) = as<Scalar>((16 * one - sqrt6) / (36 * one));
4767 b(4) = as<Scalar>((16 * one + sqrt6) / (36 * one));
4768
4769 // Fill c:
4770 c(0) = gamma;
4771 c(1) = as<Scalar>((6 * one + 9 * one * sqrt6) / (35 * one));
4772 c(2) = one;
4773 c(3) = as<Scalar>((4 * one - sqrt6) / (10 * one));
4774 c(4) = as<Scalar>((4 * one + sqrt6) / (10 * one));
4775
4776 int order = 5;
4777
4778 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4779 this->getStepperType(), A, b, c, order, order, order));
4780 }
4781};
4782
4784// ------------------------------------------------------------------------
4785template <class Scalar>
4786Teuchos::RCP<StepperSDIRK_5Stage5thOrder<Scalar> >
4788 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4789 Teuchos::RCP<Teuchos::ParameterList> pl)
4790{
4791 auto stepper = Teuchos::rcp(new StepperSDIRK_5Stage5thOrder<Scalar>());
4792 stepper->setStepperDIRKValues(pl);
4793
4794 if (model != Teuchos::null) {
4795 stepper->setModel(model);
4796 stepper->initialize();
4797 }
4798
4799 return stepper;
4800}
4801
4802// ----------------------------------------------------------------------------
4821template <class Scalar>
4822class StepperSDIRK_21Pair : virtual public StepperDIRK<Scalar> {
4823 public:
4830 {
4831 this->setStepperName("SDIRK 2(1) Pair");
4832 this->setStepperType("SDIRK 2(1) Pair");
4833 this->setupTableau();
4834 this->setupDefault();
4835 this->setUseFSAL(false);
4836 this->setICConsistency("None");
4837 this->setICConsistencyCheck(false);
4838 }
4839
4841 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4842 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4843 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4844 bool useEmbedded, bool zeroInitialGuess,
4845 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction)
4846 {
4847 this->setStepperName("SDIRK 2(1) Pair");
4848 this->setStepperType("SDIRK 2(1) Pair");
4849 this->setupTableau();
4850 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4851 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4852 }
4853
4854 std::string getDescription() const
4855 {
4856 std::ostringstream Description;
4857 Description << this->getStepperType() << "\n"
4858 << "c = [ 1 0 ]'\n"
4859 << "A = [ 1 ]\n"
4860 << " [ -1 1 ]\n"
4861 << "b = [ 1/2 1/2 ]'\n"
4862 << "bstar = [ 1 0 ]'";
4863 return Description.str();
4864 }
4865
4866 protected:
4868 {
4869 typedef Teuchos::ScalarTraits<Scalar> ST;
4870 using Teuchos::as;
4871 int NumStages = 2;
4872 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
4873 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
4874 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
4875 Teuchos::SerialDenseVector<int, Scalar> bstar(NumStages);
4876
4877 const Scalar one = ST::one();
4878 const Scalar zero = ST::zero();
4879
4880 // Fill A:
4881 A(0, 0) = one;
4882 A(0, 1) = zero;
4883 A(1, 0) = -one;
4884 A(1, 1) = one;
4885
4886 // Fill b:
4887 b(0) = as<Scalar>(one / (2 * one));
4888 b(1) = as<Scalar>(one / (2 * one));
4889
4890 // Fill c:
4891 c(0) = one;
4892 c(1) = zero;
4893
4894 // Fill bstar
4895 bstar(0) = one;
4896 bstar(1) = zero;
4897 int order = 2;
4898
4899 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
4900 this->getStepperType(), A, b, c, order, order, order, bstar));
4901 }
4902};
4903
4905// ------------------------------------------------------------------------
4906template <class Scalar>
4907Teuchos::RCP<StepperSDIRK_21Pair<Scalar> > createStepperSDIRK_21Pair(
4908 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
4909 Teuchos::RCP<Teuchos::ParameterList> pl)
4910{
4911 auto stepper = Teuchos::rcp(new StepperSDIRK_21Pair<Scalar>());
4912 stepper->setStepperDIRKValues(pl);
4913
4914 if (model != Teuchos::null) {
4915 stepper->setModel(model);
4916 stepper->initialize();
4917 }
4918
4919 return stepper;
4920}
4921
4922// ----------------------------------------------------------------------------
4955template <class Scalar>
4956class StepperDIRK_General : virtual public StepperDIRK<Scalar> {
4957 public:
4964 {
4965 this->setStepperName("General DIRK");
4966 this->setStepperType("General DIRK");
4967 this->setupTableau();
4968 this->setupDefault();
4969 this->setUseFSAL(false);
4970 this->setICConsistency("None");
4971 this->setICConsistencyCheck(false);
4972 }
4973
4975 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
4976 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4977 bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
4978 bool useEmbedded, bool zeroInitialGuess,
4979 const Teuchos::RCP<StepperRKAppAction<Scalar> >& stepperRKAppAction,
4980 const Teuchos::SerialDenseMatrix<int, Scalar>& A,
4981 const Teuchos::SerialDenseVector<int, Scalar>& b,
4982 const Teuchos::SerialDenseVector<int, Scalar>& c, const int order,
4983 const int orderMin, const int orderMax,
4984 const Teuchos::SerialDenseVector<int, Scalar>& bstar)
4985 {
4986 this->setStepperName("General DIRK");
4987 this->setStepperType("General DIRK");
4988 this->setTableau(A, b, c, order, orderMin, orderMax, bstar);
4989
4990 TEUCHOS_TEST_FOR_EXCEPTION(
4991 this->tableau_->isImplicit() != true, std::logic_error,
4992 "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
4993
4994 this->setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4995 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4996 }
4997
4998 std::string getDescription() const
4999 {
5000 std::stringstream Description;
5001 Description
5002 << this->getStepperType() << "\n"
5003 << "The format of the Butcher Tableau parameter list is\n"
5004 << " <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
5005 << " # # # ;\n"
5006 << " # # #\"/>\n"
5007 << " <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
5008 << " <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
5009 << "Note the number of stages is implicit in the number of entries.\n"
5010 << "The number of stages must be consistent.\n"
5011 << "\n"
5012 << "Default tableau is 'SDIRK 2 Stage 2nd order':\n"
5013 << " Computer Methods for ODEs and DAEs\n"
5014 << " U. M. Ascher and L. R. Petzold\n"
5015 << " p. 106\n"
5016 << " gamma = (2-sqrt(2))/2\n"
5017 << " c = [ gamma 1 ]'\n"
5018 << " A = [ gamma 0 ]\n"
5019 << " [ 1-gamma gamma ]\n"
5020 << " b = [ 1-gamma gamma ]'";
5021 return Description.str();
5022 }
5023
5025 {
5026 if (this->tableau_ == Teuchos::null) {
5027 // Set tableau to the default if null, otherwise keep current tableau.
5028 auto stepper = Teuchos::rcp(new StepperSDIRK_2Stage2ndOrder<Scalar>());
5029 auto t = stepper->getTableau();
5030 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
5031 this->getStepperType(), t->A(), t->b(), t->c(), t->order(),
5032 t->orderMin(), t->orderMax(), t->bstar()));
5033 this->isInitialized_ = false;
5034 }
5035 }
5036
5037 void setTableau(const Teuchos::SerialDenseMatrix<int, Scalar>& A,
5038 const Teuchos::SerialDenseVector<int, Scalar>& b,
5039 const Teuchos::SerialDenseVector<int, Scalar>& c,
5040 const int order, const int orderMin, const int orderMax,
5041 const Teuchos::SerialDenseVector<int, Scalar>& bstar =
5042 Teuchos::SerialDenseVector<int, Scalar>())
5043 {
5044 this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
5045 this->getStepperType(), A, b, c, order, orderMin, orderMax, bstar));
5046 this->isInitialized_ = false;
5047 }
5048
5049 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const
5050 {
5051 auto pl = this->getValidParametersBasicDIRK();
5052
5053 // Tableau ParameterList
5054 Teuchos::SerialDenseMatrix<int, Scalar> A = this->tableau_->A();
5055 Teuchos::SerialDenseVector<int, Scalar> b = this->tableau_->b();
5056 Teuchos::SerialDenseVector<int, Scalar> c = this->tableau_->c();
5057 Teuchos::SerialDenseVector<int, Scalar> bstar = this->tableau_->bstar();
5058
5059 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
5060
5061 std::ostringstream Astream;
5062 Astream.precision(15);
5063 for (int i = 0; i < A.numRows(); i++) {
5064 for (int j = 0; j < A.numCols() - 1; j++) {
5065 Astream << A(i, j) << " ";
5066 }
5067 Astream << A(i, A.numCols() - 1);
5068 if (i != A.numRows() - 1) Astream << "; ";
5069 }
5070 tableauPL->set<std::string>("A", Astream.str());
5071
5072 std::ostringstream bstream;
5073 bstream.precision(15);
5074 for (int i = 0; i < b.length() - 1; i++) {
5075 bstream << b(i) << " ";
5076 }
5077 bstream << b(b.length() - 1);
5078 tableauPL->set<std::string>("b", bstream.str());
5079
5080 std::ostringstream cstream;
5081 cstream.precision(15);
5082 for (int i = 0; i < c.length() - 1; i++) {
5083 cstream << c(i) << " ";
5084 }
5085 cstream << c(c.length() - 1);
5086 tableauPL->set<std::string>("c", cstream.str());
5087
5088 tableauPL->set<int>("order", this->tableau_->order());
5089
5090 if (bstar.length() == 0) {
5091 tableauPL->set("bstar", "");
5092 }
5093 else {
5094 std::ostringstream bstarstream;
5095 bstarstream.precision(15);
5096 for (int i = 0; i < bstar.length() - 1; i++) {
5097 bstarstream << bstar(i) << " ";
5098 }
5099 bstarstream << bstar(bstar.length() - 1);
5100 tableauPL->set<std::string>("bstar", bstarstream.str());
5101 }
5102
5103 pl->set("Tableau", *tableauPL);
5104
5105 return pl;
5106 }
5107};
5108
5110// ------------------------------------------------------------------------
5111template <class Scalar>
5112Teuchos::RCP<StepperDIRK_General<Scalar> > createStepperDIRK_General(
5113 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
5114 Teuchos::RCP<Teuchos::ParameterList> pl)
5115{
5116 auto stepper = Teuchos::rcp(new StepperDIRK_General<Scalar>());
5117 stepper->setStepperDIRKValues(pl);
5118
5119 if (pl != Teuchos::null) {
5120 if (pl->isParameter("Tableau")) {
5121 auto t = stepper->createTableau(pl);
5122 stepper->setTableau(t->A(), t->b(), t->c(), t->order(), t->orderMin(),
5123 t->orderMax(), t->bstar());
5124 }
5125 }
5126 TEUCHOS_TEST_FOR_EXCEPTION(
5127 stepper->getTableau()->isDIRK() != true, std::logic_error,
5128 "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
5129
5130 if (model != Teuchos::null) {
5131 stepper->setModel(model);
5132 stepper->initialize();
5133 }
5134
5135 return stepper;
5136}
5137
5138} // namespace Tempus
5139
5140#endif // Tempus_StepperRKButcherTableau_hpp
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)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
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))
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)
Backward Euler Runge-Kutta Butcher Tableau.
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)
General Implicit 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)
void setTableau(const Teuchos::SerialDenseMatrix< int, Scalar > &A, const Teuchos::SerialDenseVector< int, Scalar > &b, const Teuchos::SerialDenseVector< int, Scalar > &c, const int order, const int orderMin, const int orderMax, const Teuchos::SerialDenseVector< int, Scalar > &bstar=Teuchos::SerialDenseVector< int, Scalar >())
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Diagonally Implicit Runge-Kutta (DIRK) time stepper.
virtual void setupDefault()
Default setup for constructor.
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicDIRK() const
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.
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)
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))
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
RK Trapezoidal Rule (A.K.A. RK Crank-Nicolson).
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)
Explicit RK 3/8th Rule Butcher Tableau.
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)
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)
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)
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_4Stage3rdOrderRunge(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Runge-Kutta 4th order Butcher Tableau.
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)
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
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)
Explicit RK Bogacki-Shampine Butcher Tableau.
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)
Forward Euler Runge-Kutta Butcher Tableau.
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)
General Explicit Runge-Kutta Butcher Tableau.
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)
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 >())
virtual std::string getDefaultICConsistency() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Explicit RK Merson Butcher Tableau.
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)
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)
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)
Strong Stability Preserving Explicit RK Butcher Tableau.
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)
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)
Explicit Runge-Kutta time stepper.
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.
virtual void setupDefault()
Default setup for constructor.
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicERK() const
bool isInitialized_
True if stepper's member data is initialized.
void setICConsistencyCheck(bool c)
void setStepperName(std::string s)
Set the stepper name.
bool useFSAL_
Use First-Same-As-Last (FSAL) principle.
std::string getStepperType() const
Get the stepper type. The stepper type is used as an identifier for the stepper, and can only be set ...
virtual void setUseFSAL(bool a)
void setStepperType(std::string s)
Set the stepper type.
void setICConsistency(std::string s)
Application Action for StepperRKBase.
Teuchos::RCP< RKButcherTableau< Scalar > > tableau_
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)
StepperSDIRK_2Stage2ndOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction, Scalar gamma=Scalar(0.2928932188134524))
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperSDIRK_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))
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)
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)
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)
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)
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)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
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)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
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)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
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)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
StepperSDIRK_SSPDIRK33(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
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.
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.
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.
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_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_Midpoint< Scalar > > createStepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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< StepperERK_4Stage4thOrder< Scalar > > createStepperERK_4Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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< StepperERK_Trapezoidal< Scalar > > createStepperERK_Trapezoidal(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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.
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.
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< StepperERK_Ralston< Scalar > > createStepperERK_Ralston(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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.
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< StepperDIRK_1StageTheta< Scalar > > createStepperDIRK_1StageTheta(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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_2Stage3rdOrder< Scalar > > createStepperSDIRK_2Stage3rdOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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.
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.
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.
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< StepperSDIRK_ImplicitMidpoint< Scalar > > createStepperSDIRK_ImplicitMidpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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.
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.
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.
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.
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_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_3Stage3rdOrder< Scalar > > createStepperERK_3Stage3rdOrder(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.
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< StepperDIRK_General< Scalar > > createStepperDIRK_General(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
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.