10#ifndef Tempus_StepperRKButcherTableau_hpp
11#define Tempus_StepperRKButcherTableau_hpp
15#pragma clang system_header
18#include "Tempus_config.hpp"
19#include "Tempus_StepperExplicitRK.hpp"
20#include "Tempus_StepperDIRK.hpp"
41template <
class Scalar>
62 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
69 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
70 useEmbedded, stepperRKAppAction);
75 std::ostringstream Description;
80 return Description.str();
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);
110template <
class Scalar>
113 Teuchos::RCP<Teuchos::ParameterList> pl)
118 if (pl != Teuchos::null) {
120 pl->get<std::string>(
"Stepper Type", stepper->getStepperType());
122 TEUCHOS_TEST_FOR_EXCEPTION(
123 stepperType != stepper->getStepperType() && stepperType !=
"RK1",
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");
132 pl->set<std::string>(
"Stepper Type", stepper->getStepperType());
135 stepper->setStepperRKValues(pl);
137 if (model != Teuchos::null) {
138 stepper->setModel(model);
139 stepper->initialize();
164template <
class Scalar>
185 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
192 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
193 useEmbedded, stepperRKAppAction);
198 std::ostringstream Description;
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"
210 <<
"b = [ 1/6 1/3 1/3 1/6 ]'";
211 return Description.str();
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);
224 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
225 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
226 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
267template <
class Scalar>
268Teuchos::RCP<StepperERK_4Stage4thOrder<Scalar> >
271 Teuchos::RCP<Teuchos::ParameterList> pl)
274 stepper->setStepperRKValues(pl);
276 if (model != Teuchos::null) {
277 stepper->setModel(model);
278 stepper->initialize();
308template <
class Scalar>
329 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
336 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
337 useEmbedded, stepperRKAppAction);
342 std::ostringstream Description;
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"
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();
366 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
392 A(2, 1) = threefourths;
397 A(3, 2) = fourninths;
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));
426template <
class Scalar>
427Teuchos::RCP<StepperERK_BogackiShampine32<Scalar> >
430 Teuchos::RCP<Teuchos::ParameterList> pl)
433 stepper->setStepperRKValues(pl);
435 if (model != Teuchos::null) {
436 stepper->setModel(model);
437 stepper->initialize();
469template <
class Scalar>
490 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
497 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
498 useEmbedded, stepperRKAppAction);
503 std::ostringstream Description;
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"
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();
523 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
531 const Scalar one = ST::one();
532 const Scalar zero = ST::zero();
535 A(1, 0) = as<Scalar>(one / (3 * one));
537 A(2, 0) = as<Scalar>(one / (6 * one));
538 A(2, 1) = as<Scalar>(one / (6 * one));
540 A(3, 0) = as<Scalar>(one / (8 * one));
541 A(3, 2) = as<Scalar>(3 * one / (8 * one));
543 A(4, 0) = as<Scalar>(one / (2 * one));
544 A(4, 2) = as<Scalar>(-3 * one / (2 * one));
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));
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));
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));
573template <
class Scalar>
576 Teuchos::RCP<Teuchos::ParameterList> pl)
579 stepper->setStepperRKValues(pl);
581 if (model != Teuchos::null) {
582 stepper->setModel(model);
583 stepper->initialize();
612template <
class Scalar>
628 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
635 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
636 useEmbedded, stepperRKAppAction);
641 std::ostringstream Description;
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"
652 <<
"b = [ 1/8 3/8 3/8 1/8 ]'";
653 return Description.str();
659 typedef Teuchos::ScalarTraits<Scalar> ST;
662 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
663 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
664 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
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));
712template <
class Scalar>
715 Teuchos::RCP<Teuchos::ParameterList> pl)
718 stepper->setStepperRKValues(pl);
720 if (model != Teuchos::null) {
721 stepper->setModel(model);
722 stepper->initialize();
751template <
class Scalar>
773 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
780 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
781 useEmbedded, stepperRKAppAction);
786 std::ostringstream Description;
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"
797 <<
"b = [ 1/6 2/3 0 1/6 ]'";
798 return Description.str();
804 typedef Teuchos::ScalarTraits<Scalar> ST;
806 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
807 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
808 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
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();
855template <
class Scalar>
856Teuchos::RCP<StepperERK_4Stage3rdOrderRunge<Scalar> >
859 Teuchos::RCP<Teuchos::ParameterList> pl)
862 stepper->setStepperRKValues(pl);
864 if (model != Teuchos::null) {
865 stepper->setModel(model);
866 stepper->initialize();
894template <
class Scalar>
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");
916 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
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");
923 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
924 useEmbedded, stepperRKAppAction);
929 std::ostringstream Description;
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"
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();
947 typedef Teuchos::ScalarTraits<Scalar> ST;
949 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
950 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
951 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
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();
1011template <
class Scalar>
1012Teuchos::RCP<StepperERK_5Stage3rdOrderKandG<Scalar> >
1015 Teuchos::RCP<Teuchos::ParameterList> pl)
1018 stepper->setStepperRKValues(pl);
1020 if (model != Teuchos::null) {
1021 stepper->setModel(model);
1022 stepper->initialize();
1046template <
class Scalar>
1067 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1074 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1075 useEmbedded, stepperRKAppAction);
1080 std::ostringstream Description;
1082 <<
"c = [ 0 1/2 1 ]'\n"
1086 <<
"b = [ 1/6 4/6 1/6 ]'";
1087 return Description.str();
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);
1102 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1103 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1104 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1136template <
class Scalar>
1137Teuchos::RCP<StepperERK_3Stage3rdOrder<Scalar> >
1140 Teuchos::RCP<Teuchos::ParameterList> pl)
1143 stepper->setStepperRKValues(pl);
1145 if (model != Teuchos::null) {
1146 stepper->setModel(model);
1147 stepper->initialize();
1182template <
class Scalar>
1203 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1210 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1211 useEmbedded, stepperRKAppAction);
1216 std::ostringstream Description;
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"
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();
1239 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
1261 A(2, 0) = onefourth;
1262 A(2, 1) = onefourth;
1276 bstar(0) = as<Scalar>(0.291485418878409);
1277 bstar(1) = as<Scalar>(0.291485418878409);
1278 bstar(2) = as<Scalar>(0.417029162243181);
1291template <
class Scalar>
1292Teuchos::RCP<StepperERK_3Stage3rdOrderTVD<Scalar> >
1295 Teuchos::RCP<Teuchos::ParameterList> pl)
1300 if (pl != Teuchos::null) {
1302 pl->get<std::string>(
"Stepper Type", stepper->getStepperType());
1304 TEUCHOS_TEST_FOR_EXCEPTION(
1305 stepperType != stepper->getStepperType() && stepperType !=
"SSPERK33" &&
1306 stepperType !=
"SSPRK3",
1308 " ParameterList 'Stepper Type' (='"
1310 <<
"')\n does not match type for this Stepper (='"
1311 << stepper->getStepperType()
1312 <<
"')\n or one of its aliases ('SSPERK33' or 'SSPRK3').\n");
1315 pl->set<std::string>(
"Stepper Type", stepper->getStepperType());
1318 stepper->setStepperRKValues(pl);
1320 if (model != Teuchos::null) {
1321 stepper->setModel(model);
1322 stepper->initialize();
1350template <
class Scalar>
1371 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1378 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1379 useEmbedded, stepperRKAppAction);
1384 std::ostringstream Description;
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"
1394 <<
"b = [ 1/4 0 3/4 ]'";
1395 return Description.str();
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);
1410 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1411 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1412 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1422 A(2, 1) = twothirds;
1428 b(2) = threefourths;
1444template <
class Scalar>
1445Teuchos::RCP<StepperERK_3Stage3rdOrderHeun<Scalar> >
1448 Teuchos::RCP<Teuchos::ParameterList> pl)
1451 stepper->setStepperRKValues(pl);
1453 if (model != Teuchos::null) {
1454 stepper->setModel(model);
1455 stepper->initialize();
1482template <
class Scalar>
1503 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1510 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1511 useEmbedded, stepperRKAppAction);
1516 std::ostringstream Description;
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"
1526 return Description.str();
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);
1538 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
1539 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
1540 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
1565template <
class Scalar>
1568 Teuchos::RCP<Teuchos::ParameterList> pl)
1571 stepper->setStepperRKValues(pl);
1573 if (model != Teuchos::null) {
1574 stepper->setModel(model);
1575 stepper->initialize();
1598template <
class Scalar>
1619 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1626 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1627 useEmbedded, stepperRKAppAction);
1632 std::ostringstream Description;
1634 <<
"This Stepper is known as 'RK Explicit Ralston' or 'RK2'.\n"
1635 <<
"c = [ 0 2/3 ]'\n"
1638 <<
"b = [ 1/4 3/4 ]'";
1639 return Description.str();
1645 typedef Teuchos::ScalarTraits<Scalar> ST;
1646 const Scalar one = ST::one();
1647 const Scalar zero = ST::zero();
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);
1659 A(1, 0) = (2 * one) / (3 * one);
1662 b(0) = (1 * one) / (4 * one);
1663 b(1) = (3 * one) / (4 * one);
1667 c(1) = (2 * one) / (3 * one);
1678template <
class Scalar>
1681 Teuchos::RCP<Teuchos::ParameterList> pl)
1686 if (pl != Teuchos::null) {
1688 pl->get<std::string>(
"Stepper Type", stepper->getStepperType());
1690 TEUCHOS_TEST_FOR_EXCEPTION(
1691 stepperType != stepper->getStepperType() && stepperType !=
"RK2",
1693 " ParameterList 'Stepper Type' (='"
1695 <<
"')\n does not match type for this Stepper (='"
1696 << stepper->getStepperType()
1697 <<
"')\n or one of its aliases ('RK2').\n");
1700 pl->set<std::string>(
"Stepper Type", stepper->getStepperType());
1703 stepper->setStepperRKValues(pl);
1705 if (model != Teuchos::null) {
1706 stepper->setModel(model);
1707 stepper->initialize();
1731template <
class Scalar>
1752 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1759 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1760 useEmbedded, stepperRKAppAction);
1765 std::ostringstream Description;
1767 <<
"This Stepper is known as 'RK Explicit Trapezoidal' or "
1768 "'Heuns Method' or 'SSPERK22'.\n"
1772 <<
"b = [ 1/2 1/2 ]\n"
1773 <<
"bstart = [ 3/4 1/4 ]'";
1774 return Description.str();
1780 typedef Teuchos::ScalarTraits<Scalar> ST;
1782 const Scalar one = ST::one();
1783 const Scalar zero = ST::zero();
1784 const Scalar onehalf = one / (2 * one);
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);
1807 bstar(0) = as<Scalar>(3 * one / (4 * one));
1808 bstar(1) = as<Scalar>(1 * one / (4 * one));
1821template <
class Scalar>
1824 Teuchos::RCP<Teuchos::ParameterList> pl)
1829 if (pl != Teuchos::null) {
1831 pl->get<std::string>(
"Stepper Type", stepper->getStepperType());
1833 TEUCHOS_TEST_FOR_EXCEPTION(
1834 stepperType != stepper->getStepperType() &&
1835 stepperType !=
"Heuns Method" && stepperType !=
"SSPERK22" &&
1836 stepperType !=
"SSPRK2",
1838 " ParameterList 'Stepper Type' (='"
1840 <<
"')\n does not match type for this Stepper (='"
1841 << stepper->getStepperType()
1842 <<
"')\n or one of its aliases ('Heuns Method' or 'SSPERK22' or "
1846 pl->set<std::string>(
"Stepper Type", stepper->getStepperType());
1849 stepper->setStepperRKValues(pl);
1851 if (model != Teuchos::null) {
1852 stepper->setModel(model);
1853 stepper->initialize();
1876template <
class Scalar>
1892 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
1899 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
1900 useEmbedded, stepperRKAppAction);
1905 std::ostringstream Description;
1908 <<
"Strong Stability Preserving Explicit RK (stage=5, order=4)\n"
1910 return Description.str();
1916 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
1928 A(0, 0) = A(0, 1) = A(0, 2) = A(0, 3) = A(0, 4) = zero;
1930 A(1, 0) = as<Scalar>(0.391752226571889);
1931 A(1, 1) = A(1, 2) = A(1, 3) = A(1, 4) = zero;
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;
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;
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);
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);
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);
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);
1972 this->
tableau_->setTVDCoeff(sspcoef);
1978template <
class Scalar>
1981 Teuchos::RCP<Teuchos::ParameterList> pl)
1984 stepper->setStepperRKValues(pl);
1986 if (model != Teuchos::null) {
1987 stepper->setModel(model);
1988 stepper->initialize();
2024template <
class Scalar>
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,
2051 this->
setTableau(A, b, c, order, orderMin, orderMax, bstar);
2053 TEUCHOS_TEST_FOR_EXCEPTION(
2054 this->
tableau_->isImplicit() ==
true, std::logic_error,
2055 "Error - General ERK received an implicit Butcher Tableau!\n");
2057 this->
setup(appModel, useFSAL, ICConsistency, ICConsistencyCheck,
2058 useEmbedded, stepperRKAppAction);
2063 std::stringstream Description;
2066 <<
"The format of the Butcher Tableau parameter list is\n"
2067 <<
" <Parameter name=\"A\" type=\"string\" value=\"# # # ;\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"
2075 <<
"Default tableau is RK4 (order=4):\n"
2076 <<
"c = [ 0 1/2 1/2 1 ]'\n"
2081 <<
"b = [ 1/6 1/3 1/3 1/6 ]'";
2082 return Description.str();
2087 if (this->
tableau_ == Teuchos::null) {
2090 auto t = stepper->getTableau();
2093 t->orderMin(), t->orderMax(), t->bstar()));
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>())
2105 this->
getStepperType(), A, b, c, order, orderMin, orderMax, bstar));
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();
2121 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
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) <<
" ";
2129 Astream << A(i, A.numCols() - 1);
2130 if (i != A.numRows() - 1) Astream <<
"; ";
2132 tableauPL->set<std::string>(
"A", Astream.str());
2134 std::ostringstream bstream;
2135 bstream.precision(15);
2136 for (
int i = 0; i < b.length() - 1; i++) {
2137 bstream << b(i) <<
" ";
2139 bstream << b(b.length() - 1);
2140 tableauPL->set<std::string>(
"b", bstream.str());
2142 std::ostringstream cstream;
2143 cstream.precision(15);
2144 for (
int i = 0; i < c.length() - 1; i++) {
2145 cstream << c(i) <<
" ";
2147 cstream << c(c.length() - 1);
2148 tableauPL->set<std::string>(
"c", cstream.str());
2150 tableauPL->set<
int>(
"order", this->
tableau_->order());
2152 if (bstar.length() == 0) {
2153 tableauPL->set(
"bstar",
"");
2156 std::ostringstream bstarstream;
2157 bstarstream.precision(15);
2158 for (
int i = 0; i < bstar.length() - 1; i++) {
2159 bstarstream << bstar(i) <<
" ";
2161 bstarstream << bstar(bstar.length() - 1);
2162 tableauPL->set<std::string>(
"bstar", bstarstream.str());
2165 pl->set(
"Tableau", *tableauPL);
2173template <
class Scalar>
2176 Teuchos::RCP<Teuchos::ParameterList> pl)
2179 stepper->setStepperRKValues(pl);
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());
2188 TEUCHOS_TEST_FOR_EXCEPTION(
2189 stepper->getTableau()->isImplicit() ==
true, std::logic_error,
2190 "Error - General ERK received an implicit Butcher Tableau!\n");
2192 if (model != Teuchos::null) {
2193 stepper->setModel(model);
2194 stepper->initialize();
2216template <
class Scalar>
2237 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2238 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
2239 bool useEmbedded,
bool zeroInitialGuess,
2245 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2246 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2251 std::ostringstream Description;
2256 return Description.str();
2262 typedef Teuchos::ScalarTraits<Scalar> ST;
2263 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
2265 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2266 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2267 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2270 A(0, 0) = ST::one();
2283 this->
tableau_->setTVDCoeff(sspcoef);
2289template <
class Scalar>
2290Teuchos::RCP<StepperDIRK_BackwardEuler<Scalar> >
2293 Teuchos::RCP<Teuchos::ParameterList> pl)
2296 stepper->setStepperDIRKValues(pl);
2298 if (model != Teuchos::null) {
2299 stepper->setModel(model);
2300 stepper->initialize();
2331template <
class Scalar>
2341 typedef Teuchos::ScalarTraits<Scalar> ST;
2342 const Scalar one = ST::one();
2344 Teuchos::as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2358 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2359 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
2360 bool useEmbedded,
bool zeroInitialGuess,
2362 Scalar gamma = Scalar(0.2928932188134524))
2364 typedef Teuchos::ScalarTraits<Scalar> ST;
2365 const Scalar one = ST::one();
2367 Teuchos::as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2373 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2374 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2388 std::ostringstream Description;
2390 <<
"Computer Methods for ODEs and DAEs\n"
2391 <<
"U. M. Ascher and L. R. Petzold\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();
2404 pl->template set<double>(
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.");
2417 typedef Teuchos::ScalarTraits<Scalar> ST;
2419 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
2420 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
2421 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
2423 const Scalar one = ST::one();
2424 const Scalar zero = ST::zero();
2429 A(1, 0) = Teuchos::as<Scalar>(one -
gamma_);
2433 b(0) = Teuchos::as<Scalar>(one -
gamma_);
2443 Teuchos::as<Scalar>((2 * one + ST::squareroot(2 * one)) / (2 * one))) /
2444 gamma_) < 1.0e-08) order = 2;
2457template <
class Scalar>
2458Teuchos::RCP<StepperSDIRK_2Stage2ndOrder<Scalar> >
2461 Teuchos::RCP<Teuchos::ParameterList> pl)
2464 stepper->setStepperDIRKValues(pl);
2466 if (pl != Teuchos::null)
2467 stepper->setGamma(pl->get<
double>(
"gamma", 0.2928932188134524));
2469 if (model != Teuchos::null) {
2470 stepper->setModel(model);
2471 stepper->initialize();
2505template <
class Scalar>
2526 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2527 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
2528 bool useEmbedded,
bool zeroInitialGuess,
2534 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2535 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2540 std::ostringstream Description;
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"
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();
2559 typedef Teuchos::ScalarTraits<Scalar> ST;
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)));
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);
2578 b(0) = b(1) = (one / (6 * one));
2579 b(2) = (2 * one) / (3 * one);
2584 c(2) = one / (2 * one);
2589 this->
tableau_->setTVDCoeff(sspcoef);
2595template <
class Scalar>
2596Teuchos::RCP<StepperSDIRK_3Stage2ndOrder<Scalar> >
2599 Teuchos::RCP<Teuchos::ParameterList> pl)
2602 stepper->setStepperDIRKValues(pl);
2604 if (model != Teuchos::null) {
2605 stepper->setModel(model);
2606 stepper->initialize();
2641template <
class Scalar>
2651 typedef Teuchos::ScalarTraits<Scalar> ST;
2653 const Scalar one = ST::one();
2654 gammaDefault_ = as<Scalar>((3 * one + ST::squareroot(3 * one)) / (6 * one));
2670 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2671 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
2672 bool useEmbedded,
bool zeroInitialGuess,
2674 std::string gammaType =
"3rd Order A-stable",
2675 Scalar gamma = Scalar(0.7886751345948128))
2677 typedef Teuchos::ScalarTraits<Scalar> ST;
2679 const Scalar one = ST::one();
2680 gammaDefault_ = as<Scalar>((3 * one + ST::squareroot(3 * one)) / (6 * one));
2688 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2689 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2694 TEUCHOS_TEST_FOR_EXCEPTION(
2695 !(gammaType ==
"3rd Order A-stable" ||
2696 gammaType ==
"2nd Order L-stable" || gammaType ==
"gamma"),
2698 "gammaType needs to be '3rd Order A-stable', '2nd Order L-stable' "
2721 std::ostringstream Description;
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();
2740 pl->template set<std::string>(
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>(
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'.");
2759 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
2773 else if (
gammaType_ ==
"2nd Order L-stable") {
2775 gamma_ = as<Scalar>((2 * one - ST::squareroot(2 * one)) / (2 * one));
2784 A(1, 0) = as<Scalar>(one - 2 *
gamma_);
2788 b(0) = as<Scalar>(one / (2 * one));
2789 b(1) = as<Scalar>(one / (2 * one));
2793 c(1) = as<Scalar>(one -
gamma_);
2808template <
class Scalar>
2809Teuchos::RCP<StepperSDIRK_2Stage3rdOrder<Scalar> >
2812 Teuchos::RCP<Teuchos::ParameterList> pl)
2815 stepper->setStepperDIRKValues(pl);
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));
2823 if (model != Teuchos::null) {
2824 stepper->setModel(model);
2825 stepper->initialize();
2852template <
class Scalar>
2873 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
2874 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
2875 bool useEmbedded,
bool zeroInitialGuess,
2881 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
2882 useEmbedded, zeroInitialGuess, stepperRKAppAction);
2887 std::ostringstream Description;
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"
2897 <<
"b = [ 1/4 3/4 ]'";
2898 return Description.str();
2904 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
2916 A(1, 0) = as<Scalar>(one / (3 * one));
2917 A(1, 1) = as<Scalar>(one / (3 * one));
2920 b(0) = as<Scalar>(one / (4 * one));
2921 b(1) = as<Scalar>(3 * one / (4 * one));
2925 c(1) = as<Scalar>(2 * one / (3 * one));
2936template <
class Scalar>
2937Teuchos::RCP<StepperEDIRK_2Stage3rdOrder<Scalar> >
2940 Teuchos::RCP<Teuchos::ParameterList> pl)
2943 stepper->setStepperDIRKValues(pl);
2945 if (model != Teuchos::null) {
2946 stepper->setModel(model);
2947 stepper->initialize();
2981template <
class Scalar>
2991 typedef Teuchos::ScalarTraits<Scalar> ST;
3006 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3007 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3008 bool useEmbedded,
bool zeroInitialGuess,
3010 Scalar theta = Scalar(0.5))
3012 typedef Teuchos::ScalarTraits<Scalar> ST;
3019 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3020 useEmbedded, zeroInitialGuess, stepperRKAppAction);
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");
3038 std::ostringstream Description;
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"
3047 return Description.str();
3054 pl->template set<double>(
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.");
3069 typedef Teuchos::ScalarTraits<Scalar> ST;
3071 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3072 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3073 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3094template <
class Scalar>
3097 Teuchos::RCP<Teuchos::ParameterList> pl)
3100 stepper->setStepperDIRKValues(pl);
3102 if (pl != Teuchos::null) {
3103 stepper->setTheta(pl->get<
double>(
"theta", 0.5));
3106 if (model != Teuchos::null) {
3107 stepper->setModel(model);
3108 stepper->initialize();
3141template <
class Scalar>
3151 typedef Teuchos::ScalarTraits<Scalar> ST;
3166 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3167 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3168 bool useEmbedded,
bool zeroInitialGuess,
3170 Scalar theta = Scalar(0.5))
3172 typedef Teuchos::ScalarTraits<Scalar> ST;
3179 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3180 useEmbedded, zeroInitialGuess, stepperRKAppAction);
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");
3198 std::ostringstream Description;
3200 <<
"Computer Methods for ODEs and DAEs\n"
3201 <<
"U. M. Ascher and L. R. Petzold\n"
3205 <<
" [ 1-theta theta ]\n"
3206 <<
"b = [ 1-theta theta ]'";
3207 return Description.str();
3214 pl->template set<double>(
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.");
3235 typedef Teuchos::ScalarTraits<Scalar> ST;
3236 const Scalar one = ST::one();
3237 const Scalar zero = ST::zero();
3240 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3241 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3242 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3247 A(1, 0) = Teuchos::as<Scalar>(one -
theta_);
3251 b(0) = Teuchos::as<Scalar>(one -
theta_);
3274template <
class Scalar>
3277 Teuchos::RCP<Teuchos::ParameterList> pl)
3280 stepper->setStepperDIRKValues(pl);
3282 if (pl != Teuchos::null) {
3283 stepper->setTheta(pl->get<
double>(
"theta", 0.5));
3286 if (model != Teuchos::null) {
3287 stepper->setModel(model);
3288 stepper->initialize();
3315template <
class Scalar>
3336 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3337 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3338 bool useEmbedded,
bool zeroInitialGuess,
3344 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3345 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3350 std::ostringstream Description;
3352 <<
"Also known as Crank-Nicolson Method.\n"
3356 <<
"b = [ 1/2 1/2 ]'";
3357 return Description.str();
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());
3375 Teuchos::SerialDenseMatrix<int, Scalar> A(NumStages, NumStages);
3376 Teuchos::SerialDenseVector<int, Scalar> b(NumStages);
3377 Teuchos::SerialDenseVector<int, Scalar> c(NumStages);
3404template <
class Scalar>
3405Teuchos::RCP<StepperEDIRK_TrapezoidalRule<Scalar> >
3408 Teuchos::RCP<Teuchos::ParameterList> pl)
3413 if (pl != Teuchos::null) {
3415 pl->get<std::string>(
"Stepper Type", stepper->getStepperType());
3417 TEUCHOS_TEST_FOR_EXCEPTION(
3418 stepperType != stepper->getStepperType() &&
3419 stepperType !=
"RK Crank-Nicolson",
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");
3427 pl->set<std::string>(
"Stepper Type", stepper->getStepperType());
3430 stepper->setStepperDIRKValues(pl);
3432 if (model != Teuchos::null) {
3433 stepper->setModel(model);
3434 stepper->initialize();
3467template <
class Scalar>
3488 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3489 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3490 bool useEmbedded,
bool zeroInitialGuess,
3496 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3497 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3502 std::ostringstream Description;
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"
3517 return Description.str();
3523 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
3551template <
class Scalar>
3552Teuchos::RCP<StepperSDIRK_ImplicitMidpoint<Scalar> >
3555 Teuchos::RCP<Teuchos::ParameterList> pl)
3558 stepper->setStepperDIRKValues(pl);
3560 if (model != Teuchos::null) {
3561 stepper->setModel(model);
3562 stepper->initialize();
3589template <
class Scalar>
3605 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3606 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3607 bool useEmbedded,
bool zeroInitialGuess,
3613 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3614 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3619 std::ostringstream Description;
3621 <<
"Strong Stability Preserving Diagonally-Implicit RK "
3622 "(stage=2, order=2)\n"
3624 <<
"c = [ 1/4 3/4 ]'\n"
3627 <<
"b = [ 1/2 1/2 ]\n"
3629 return Description.str();
3635 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
3649 A(0, 0) = A(1, 1) = onefourth;
3654 b(0) = b(1) = onehalf;
3658 c(1) = A(1, 0) + A(1, 1);
3669template <
class Scalar>
3672 Teuchos::RCP<Teuchos::ParameterList> pl)
3675 stepper->setStepperDIRKValues(pl);
3677 if (model != Teuchos::null) {
3678 stepper->setModel(model);
3679 stepper->initialize();
3707template <
class Scalar>
3723 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3724 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3725 bool useEmbedded,
bool zeroInitialGuess,
3731 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3732 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3737 std::ostringstream Description;
3739 <<
"Strong Stability Preserving Diagonally-Implicit RK "
3740 "(stage=3, order=2)\n"
3742 <<
"c = [ 1/6 1/2 5/6 ]'\n"
3745 <<
" [ 1/3 1/3 1/6 ]\n"
3746 <<
"b = [ 1/3 1/3 1/3 ]\n"
3748 return Description.str();
3754 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
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;
3773 b(0) = b(1) = b(2) = onethird;
3777 c(1) = A(1, 0) + A(1, 1);
3778 c(2) = A(2, 0) + A(2, 1) + A(2, 2);
3789template <
class Scalar>
3792 Teuchos::RCP<Teuchos::ParameterList> pl)
3795 stepper->setStepperDIRKValues(pl);
3797 if (model != Teuchos::null) {
3798 stepper->setModel(model);
3799 stepper->initialize();
3824template <
class Scalar>
3840 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3841 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3842 bool useEmbedded,
bool zeroInitialGuess,
3848 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3849 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3854 std::ostringstream Description;
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"
3864 return Description.str();
3870 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
3885 A(0, 0) = A(1, 1) = one / (3 * one + rootthree);
3886 A(1, 0) = one / rootthree;
3890 b(0) = b(1) = onehalf;
3894 c(1) = A(1, 0) + A(1, 1);
3899 this->
tableau_->setTVDCoeff(sspcoef);
3905template <
class Scalar>
3908 Teuchos::RCP<Teuchos::ParameterList> pl)
3911 stepper->setStepperDIRKValues(pl);
3913 if (model != Teuchos::null) {
3914 stepper->setModel(model);
3915 stepper->initialize();
3943template <
class Scalar>
3959 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
3960 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
3961 bool useEmbedded,
bool zeroInitialGuess,
3967 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
3968 useEmbedded, zeroInitialGuess, stepperRKAppAction);
3973 std::ostringstream Description;
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 + "
3980 <<
"A = [ 1/( 4 + 2 sqrt(2) "
3982 <<
" [ 1/(2 sqrt(2) 1/( 4 + 2 sqrt(2) "
3984 <<
" [ 1/(2 sqrt(2) 1/(2 sqrt(2) 1/( 4 + 2 "
3986 <<
"b = [ 1/3 1/3 1/3 "
3989 return Description.str();
3995 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
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);
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;
4015 b(0) = b(1) = b(2) = onethird;
4019 c(1) = A(1, 0) + A(1, 1);
4020 c(2) = A(2, 0) + A(2, 1) + A(2, 2);
4025 this->
tableau_->setTVDCoeff(sspcoef);
4031template <
class Scalar>
4034 Teuchos::RCP<Teuchos::ParameterList> pl)
4037 stepper->setStepperDIRKValues(pl);
4039 if (model != Teuchos::null) {
4040 stepper->setModel(model);
4041 stepper->initialize();
4068template <
class Scalar>
4089 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4090 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4091 bool useEmbedded,
bool zeroInitialGuess,
4097 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4098 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4103 std::ostringstream Description;
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"
4114 return Description.str();
4120 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
4132 auto emptyBStar = Teuchos::SerialDenseVector<int, Scalar>();
4135 order, order, emptyBStar,
false));
4141template <
class Scalar>
4142Teuchos::RCP<StepperDIRK_1Stage1stOrderRadauIA<Scalar> >
4145 Teuchos::RCP<Teuchos::ParameterList> pl)
4148 stepper->setStepperDIRKValues(pl);
4150 if (model != Teuchos::null) {
4151 stepper->setModel(model);
4152 stepper->initialize();
4181template <
class Scalar>
4192 this->
setStepperName(
"RK Implicit 2 Stage 2nd order Lobatto IIIB");
4193 this->
setStepperType(
"RK Implicit 2 Stage 2nd order Lobatto IIIB");
4203 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4204 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4205 bool useEmbedded,
bool zeroInitialGuess,
4208 this->
setStepperName(
"RK Implicit 2 Stage 2nd order Lobatto IIIB");
4209 this->
setStepperType(
"RK Implicit 2 Stage 2nd order Lobatto IIIB");
4211 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4212 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4217 std::ostringstream Description;
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"
4226 <<
"A = [ 1/2 0 ]\n"
4228 <<
"b = [ 1/2 1/2 ]'";
4229 return Description.str();
4235 typedef Teuchos::ScalarTraits<Scalar> ST;
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();
4245 A(0, 0) = as<Scalar>(one / (2 * one));
4247 A(1, 0) = as<Scalar>(one / (2 * one));
4251 b(0) = as<Scalar>(one / (2 * one));
4252 b(1) = as<Scalar>(one / (2 * one));
4259 auto emptyBStar = Teuchos::SerialDenseVector<int, Scalar>();
4262 order, order, emptyBStar,
false));
4270template <
class Scalar>
4271Teuchos::RCP<StepperDIRK_2Stage2ndOrderLobattoIIIB<Scalar> >
4274 Teuchos::RCP<Teuchos::ParameterList> pl)
4278 stepper->setStepperDIRKValues(pl);
4280 if (model != Teuchos::null) {
4281 stepper->setModel(model);
4282 stepper->initialize();
4314template <
class Scalar>
4335 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4336 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4337 bool useEmbedded,
bool zeroInitialGuess,
4343 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4344 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4349 std::ostringstream Description;
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"
4357 <<
"c = [ 1/4 3/4 11/20 1/2 1 ]'\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 ]'";
4365 return Description.str();
4371 typedef Teuchos::ScalarTraits<Scalar> ST;
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));
4382 A(0, 0) = onequarter;
4388 A(1, 0) = as<Scalar>(one / (2 * one));
4389 A(1, 1) = onequarter;
4394 A(2, 0) = as<Scalar>(17 * one / (50 * one));
4395 A(2, 1) = as<Scalar>(-one / (25 * one));
4396 A(2, 2) = onequarter;
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;
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;
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));
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));
4444template <
class Scalar>
4445Teuchos::RCP<StepperSDIRK_5Stage4thOrder<Scalar> >
4448 Teuchos::RCP<Teuchos::ParameterList> pl)
4451 stepper->setStepperDIRKValues(pl);
4453 if (model != Teuchos::null) {
4454 stepper->setModel(model);
4455 stepper->initialize();
4486template <
class Scalar>
4507 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4508 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4509 bool useEmbedded,
bool zeroInitialGuess,
4515 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4516 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4521 std::ostringstream Description;
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"
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();
4542 typedef Teuchos::ScalarTraits<Scalar> ST;
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)) +
4554 const Scalar delta =
4555 as<Scalar>(one / (6 * one * std::pow(2 * gamma - one, 2 * one)));
4562 A(1, 0) = as<Scalar>(one / (2 * one) - gamma);
4566 A(2, 0) = as<Scalar>(2 * gamma);
4567 A(2, 1) = as<Scalar>(one - 4 * gamma);
4572 b(1) = as<Scalar>(one - 2 * delta);
4577 c(1) = as<Scalar>(one / (2 * one));
4578 c(2) = as<Scalar>(one - gamma);
4589template <
class Scalar>
4590Teuchos::RCP<StepperSDIRK_3Stage4thOrder<Scalar> >
4593 Teuchos::RCP<Teuchos::ParameterList> pl)
4596 stepper->setStepperDIRKValues(pl);
4598 if (model != Teuchos::null) {
4599 stepper->setModel(model);
4600 stepper->initialize();
4635template <
class Scalar>
4656 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4657 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4658 bool useEmbedded,
bool zeroInitialGuess,
4664 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4665 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4670 std::ostringstream Description;
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"
4677 <<
"c = [ (6-sqrt(6))/10 ]\n"
4678 <<
" [ (6+9*sqrt(6))/35 ]\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"
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"
4695 <<
" [ (6-sqrt(6))/10 ]\n"
4696 <<
" [ (-267+88*sqrt(6))/500 ]\n"
4697 <<
" [ (1329-544*sqrt(6))/2500 ]\n"
4701 <<
" [ (6-sqrt(6))/10 ]\n"
4702 <<
" [ (-96+131*sqrt(6))/625 ]\n"
4707 <<
" [ (6-sqrt(6))/10 ]\n"
4711 <<
" [ (16-sqrt(6))/36 ]\n"
4712 <<
" [ (16+sqrt(6))/36 ]'";
4713 return Description.str();
4719 typedef Teuchos::ScalarTraits<Scalar> ST;
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));
4738 A(1, 0) = as<Scalar>((-6 * one + 5 * one * sqrt6) / (14 * one));
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));
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));
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));
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));
4771 c(1) = as<Scalar>((6 * one + 9 * one * sqrt6) / (35 * one));
4773 c(3) = as<Scalar>((4 * one - sqrt6) / (10 * one));
4774 c(4) = as<Scalar>((4 * one + sqrt6) / (10 * one));
4785template <
class Scalar>
4786Teuchos::RCP<StepperSDIRK_5Stage5thOrder<Scalar> >
4789 Teuchos::RCP<Teuchos::ParameterList> pl)
4792 stepper->setStepperDIRKValues(pl);
4794 if (model != Teuchos::null) {
4795 stepper->setModel(model);
4796 stepper->initialize();
4821template <
class Scalar>
4842 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4843 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4844 bool useEmbedded,
bool zeroInitialGuess,
4850 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4851 useEmbedded, zeroInitialGuess, stepperRKAppAction);
4856 std::ostringstream Description;
4861 <<
"b = [ 1/2 1/2 ]'\n"
4862 <<
"bstar = [ 1 0 ]'";
4863 return Description.str();
4869 typedef Teuchos::ScalarTraits<Scalar> ST;
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);
4877 const Scalar one = ST::one();
4878 const Scalar zero = ST::zero();
4887 b(0) = as<Scalar>(one / (2 * one));
4888 b(1) = as<Scalar>(one / (2 * one));
4906template <
class Scalar>
4909 Teuchos::RCP<Teuchos::ParameterList> pl)
4912 stepper->setStepperDIRKValues(pl);
4914 if (model != Teuchos::null) {
4915 stepper->setModel(model);
4916 stepper->initialize();
4955template <
class Scalar>
4976 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
4977 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
4978 bool useEmbedded,
bool zeroInitialGuess,
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)
4988 this->
setTableau(A, b, c, order, orderMin, orderMax, bstar);
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");
4994 this->
setup(appModel, solver, useFSAL, ICConsistency, ICConsistencyCheck,
4995 useEmbedded, zeroInitialGuess, stepperRKAppAction);
5000 std::stringstream Description;
5003 <<
"The format of the Butcher Tableau parameter list is\n"
5004 <<
" <Parameter name=\"A\" type=\"string\" value=\"# # # ;\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"
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"
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();
5026 if (this->
tableau_ == Teuchos::null) {
5029 auto t = stepper->getTableau();
5032 t->orderMin(), t->orderMax(), t->bstar()));
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>())
5045 this->
getStepperType(), A, b, c, order, orderMin, orderMax, bstar));
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();
5059 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
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) <<
" ";
5067 Astream << A(i, A.numCols() - 1);
5068 if (i != A.numRows() - 1) Astream <<
"; ";
5070 tableauPL->set<std::string>(
"A", Astream.str());
5072 std::ostringstream bstream;
5073 bstream.precision(15);
5074 for (
int i = 0; i < b.length() - 1; i++) {
5075 bstream << b(i) <<
" ";
5077 bstream << b(b.length() - 1);
5078 tableauPL->set<std::string>(
"b", bstream.str());
5080 std::ostringstream cstream;
5081 cstream.precision(15);
5082 for (
int i = 0; i < c.length() - 1; i++) {
5083 cstream << c(i) <<
" ";
5085 cstream << c(c.length() - 1);
5086 tableauPL->set<std::string>(
"c", cstream.str());
5088 tableauPL->set<
int>(
"order", this->
tableau_->order());
5090 if (bstar.length() == 0) {
5091 tableauPL->set(
"bstar",
"");
5094 std::ostringstream bstarstream;
5095 bstarstream.precision(15);
5096 for (
int i = 0; i < bstar.length() - 1; i++) {
5097 bstarstream << bstar(i) <<
" ";
5099 bstarstream << bstar(bstar.length() - 1);
5100 tableauPL->set<std::string>(
"bstar", bstarstream.str());
5103 pl->set(
"Tableau", *tableauPL);
5111template <
class Scalar>
5114 Teuchos::RCP<Teuchos::ParameterList> pl)
5117 stepper->setStepperDIRKValues(pl);
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());
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");
5130 if (model != Teuchos::null) {
5131 stepper->setModel(model);
5132 stepper->initialize();
RK Implicit 1 Stage 1st order Radau IA.
StepperDIRK_1Stage1stOrderRadauIA()
Default constructor.
std::string getDescription() const
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)
std::string getDescription() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void setTheta(Scalar theta)
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_1StageTheta()
Default constructor.
RK Implicit 2 Stage 2nd order Lobatto IIIB.
std::string getDescription() const
StepperDIRK_2Stage2ndOrderLobattoIIIB()
Default constructor.
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()
Default constructor.
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)
std::string getDescription() const
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 >())
StepperDIRK_General()
Default constructor.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
std::string getDescription() 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_2Stage3rdOrder()
Default constructor.
std::string getDescription() const
EDIRK 2 Stage Theta Method.
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
std::string getDescription() const
StepperEDIRK_2StageTheta()
Default constructor.
void setTheta(Scalar theta)
RK Trapezoidal Rule (A.K.A. RK Crank-Nicolson).
StepperEDIRK_TrapezoidalRule()
Default constructor.
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)
std::string getDescription() const
Explicit RK 3/8th Rule Butcher Tableau.
std::string getDescription() const
StepperERK_3_8Rule(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
RK Explicit 3 Stage 3rd order by Heun.
std::string getDescription() const
StepperERK_3Stage3rdOrderHeun()
Default constructor.
StepperERK_3Stage3rdOrderHeun(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
RK Explicit 3 Stage 3rd order.
std::string getDescription() const
StepperERK_3Stage3rdOrder()
Default constructor.
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)
RK Explicit 3 Stage 3rd order TVD.
StepperERK_3Stage3rdOrderTVD()
Default constructor.
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)
std::string getDescription() const
RK Explicit 4 Stage 3rd order by Runge.
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)
std::string getDescription() const
StepperERK_4Stage3rdOrderRunge()
Default constructor.
Runge-Kutta 4th order Butcher Tableau.
std::string getDescription() const
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)
StepperERK_4Stage4thOrder()
Default constructor.
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
StepperERK_5Stage3rdOrderKandG()
Default constructor.
std::string getDescription() const
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.
std::string getDescription() const
StepperERK_BogackiShampine32()
Default constructor.
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.
std::string getDescription() const
StepperERK_ForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_ForwardEuler()
Default constructor.
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 getDescription() const
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_Merson45()
Default constructor.
std::string getDescription() const
StepperERK_Midpoint(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperERK_Midpoint()
Default constructor.
std::string getDescription() const
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)
std::string getDescription() const
StepperERK_Ralston()
Default constructor.
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)
std::string getDescription() const
std::string getDescription() const
StepperERK_Trapezoidal()
Default constructor.
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_21Pair()
Default constructor.
std::string getDescription() const
StepperSDIRK_2Stage2ndOrder()
Default constructor.
void setGamma(Scalar gamma)
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))
std::string getDescription() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void setGammaType(std::string gammaType)
std::string getGammaType() const
StepperSDIRK_2Stage3rdOrder()
Default constructor.
std::string getDescription() const
std::string gammaTypeDefault_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void setGamma(Scalar gamma)
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()
Default constructor.
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)
std::string getDescription() const
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)
std::string getDescription() const
StepperSDIRK_3Stage4thOrder()
Default constructor.
StepperSDIRK_5Stage4thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
std::string getDescription() const
StepperSDIRK_5Stage4thOrder()
Default constructor.
std::string getDescription() const
StepperSDIRK_5Stage5thOrder(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
StepperSDIRK_5Stage5thOrder()
Default constructor.
std::string getDescription() const
StepperSDIRK_ImplicitMidpoint()
Default constructor.
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.
std::string getDescription() const
StepperSDIRK_SSPDIRK22(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel, const Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > &solver, bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck, bool useEmbedded, bool zeroInitialGuess, const Teuchos::RCP< StepperRKAppAction< Scalar > > &stepperRKAppAction)
Strong Stability Preserving Diagonally-Implicit RK Butcher Tableau.
std::string getDescription() const
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)
std::string getDescription() const
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)
std::string getDescription() const
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.