9 #ifndef Tempus_RKButcherTableau_hpp
10 #define Tempus_RKButcherTableau_hpp
14 #pragma clang system_header
19 #include "Teuchos_Assert.hpp"
20 #include "Teuchos_as.hpp"
21 #include "Teuchos_Describable.hpp"
22 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
23 #include "Teuchos_VerboseObject.hpp"
24 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
25 #include "Teuchos_SerialDenseMatrix.hpp"
26 #include "Teuchos_SerialDenseVector.hpp"
27 #include "Thyra_MultiVectorStdOps.hpp"
52 template<
class Scalar>
54 virtual public Teuchos::Describable,
55 virtual public Teuchos::ParameterListAcceptorDefaultBase,
56 virtual public Teuchos::VerboseObject<RKButcherTableau<Scalar> >
60 virtual std::size_t
numStages()
const {
return A_.numRows(); }
62 virtual const Teuchos::SerialDenseMatrix<int,Scalar>&
A()
const
65 virtual const Teuchos::SerialDenseVector<int,Scalar>&
b()
const
68 virtual const Teuchos::SerialDenseVector<int,Scalar>&
bstar()
const
71 virtual const Teuchos::SerialDenseVector<int,Scalar>&
c()
const
87 const Teuchos::SerialDenseMatrix<int,Scalar>&
A,
88 const Teuchos::SerialDenseVector<int,Scalar>&
b,
89 const Teuchos::SerialDenseVector<int,Scalar>&
c,
91 const std::string& longDescription,
93 const Teuchos::SerialDenseVector<int,Scalar>&
94 bstar = Teuchos::SerialDenseVector<int,Scalar>())
101 const Teuchos::SerialDenseMatrix<int,Scalar>&
A,
102 const Teuchos::SerialDenseVector<int,Scalar>&
b,
103 const Teuchos::SerialDenseVector<int,Scalar>&
c,
107 const std::string& longDescription,
109 const Teuchos::SerialDenseVector<int,Scalar>&
110 bstar = Teuchos::SerialDenseVector<int,Scalar>())
113 TEUCHOS_ASSERT_EQUALITY(
A.numCols(),
numStages );
114 TEUCHOS_ASSERT_EQUALITY(
b.length(),
numStages );
115 TEUCHOS_ASSERT_EQUALITY(
c.length(),
numStages );
116 TEUCHOS_ASSERT(
order > 0 );
137 Teuchos::RCP<Teuchos::ParameterList>
const& pList)
139 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
143 TEUCHOS_TEST_FOR_EXCEPTION(
144 pl->get<std::string>(
"Stepper Type") != this->description()
147 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
148 this->setMyParamList(pl);
152 virtual Teuchos::RCP<const Teuchos::ParameterList>
155 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
156 pl->setName(
"Default Stepper - " + this->
description());
158 pl->set<std::string>(
"Stepper Type", this->
description());
159 pl->set<
bool>(
"Use Embedded",
false);
169 const Teuchos::EVerbosityLevel verbLevel)
const
171 if (verbLevel != Teuchos::VERB_NONE) {
174 out <<
"number of Stages = " << this->
numStages() << std::endl;
175 out <<
"A = " << this->
A() << std::endl;
176 out <<
"b = " << this->
b() << std::endl;
177 out <<
"c = " << this->
c() << std::endl;
178 out <<
"bstar = " << this->
bstar() << std::endl;
179 out <<
"order = " << this->
order() << std::endl;
180 out <<
"orderMin = " << this->
orderMin() << std::endl;
181 out <<
"orderMax = " << this->
orderMax() << std::endl;
182 out <<
"isImplicit = " << this->
isImplicit() << std::endl;
183 out <<
"isDIRK = " << this->
isDIRK() << std::endl;
184 out <<
"isEmbedded = " << this->
isEmbedded() << std::endl;
193 void set_A(
const Teuchos::SerialDenseMatrix<int,Scalar>&
A) {
A_ =
A; }
194 void set_b(
const Teuchos::SerialDenseVector<int,Scalar>&
b) {
b_ =
b; }
195 void set_c(
const Teuchos::SerialDenseVector<int,Scalar>&
c) {
c_ =
c; }
201 for (
size_t i = 0; i < this->
numStages(); i++)
202 for (
size_t j = i; j < this->
numStages(); j++)
208 bool nonZero =
false;
209 for (
size_t i = 0; i < this->
numStages(); i++) {
210 if (
A_(i,i) != 0.0) nonZero =
true;
211 for (
size_t j = i+1; j < this->
numStages(); j++)
214 if (nonZero ==
false)
isDIRK_ =
false;
218 Teuchos::SerialDenseMatrix<int,Scalar>
A_;
219 Teuchos::SerialDenseVector<int,Scalar>
b_;
220 Teuchos::SerialDenseVector<int,Scalar>
c_;
229 Teuchos::SerialDenseVector<int,Scalar>
bstar_;
237 template<
class Scalar>
244 template<
class Scalar>
246 const Teuchos::SerialDenseMatrix<int,Scalar>& A,
247 const Teuchos::SerialDenseVector<int,Scalar>& b,
248 const Teuchos::SerialDenseVector<int,Scalar>& c,
250 const std::string& description =
""
253 Teuchos::RCP<RKButcherTableau<Scalar> > rkbt =
255 rkbt->initialize(A,b,c,order,order,order,description);
261 template<
class Scalar>
263 const Teuchos::SerialDenseMatrix<int,Scalar>& A,
264 const Teuchos::SerialDenseVector<int,Scalar>& b,
265 const Teuchos::SerialDenseVector<int,Scalar>& c,
269 const std::string& description =
""
272 Teuchos::RCP<RKButcherTableau<Scalar> > rkbt =
274 rkbt->initialize(A,b,c,order,orderMin,orderMax,description);
278 template<
class Scalar>
287 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
292 TEUCHOS_TEST_FOR_EXCEPTION(
293 pl->get<std::string>(
"Stepper Type") != this->description()
296 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
298 Teuchos::RCP<Teuchos::ParameterList> tableauPL = sublist(pl,
"Tableau",
true);
300 int order = tableauPL->get<
int>(
"order");
301 Teuchos::SerialDenseMatrix<int,Scalar>
A;
302 Teuchos::SerialDenseVector<int,Scalar>
b;
303 Teuchos::SerialDenseVector<int,Scalar>
c;
304 Teuchos::SerialDenseVector<int,Scalar>
bstar;
308 std::vector<std::string> A_row_tokens;
319 for(std::size_t row=0;row<
numStages;row++) {
321 std::vector<std::string> tokens;
324 std::vector<double> values;
327 TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=
numStages,std::runtime_error,
328 "Error parsing A matrix, wrong number of stages in row "
331 for(std::size_t col=0;col<
numStages;col++)
332 A(row,col) = values[col];
342 std::vector<std::string> tokens;
344 std::vector<double> values;
347 TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=
numStages,std::runtime_error,
348 "Error parsing b vector, wrong number of stages.\n"
357 std::vector<std::string> tokens;
359 std::vector<double> values;
362 TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=
numStages,std::runtime_error,
363 "Error parsing c vector, wrong number of stages.\n"
370 if (tableauPL->isParameter(
"bstar") and
371 tableauPL->get<std::string>(
"bstar") !=
"1.0") {
375 std::vector<std::string> tokens;
377 tokens, tableauPL->get<std::string>(
"bstar"),
" ",
true);
378 std::vector<double> values;
381 TEUCHOS_TEST_FOR_EXCEPTION(values.size()!=
numStages,std::runtime_error,
382 "Error parsing bstar vector, wrong number of stages.\n"
386 bstar(i) = values[i];
393 this->setMyParamList(pl);
427 template<
class Scalar>
434 std::stringstream Description;
436 <<
"The format of the Butcher Tableau parameter list is\n"
437 <<
" <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
440 <<
" <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
441 <<
" <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
442 <<
"Note the number of stages is implicit in the number of entries.\n"
443 <<
"The number of stages must be consistent.\n"
445 <<
"Default tableau is RK4 (order=4):\n"
446 <<
"c = [ 0 1/2 1/2 1 ]'\n"
451 <<
"b = [ 1/6 1/3 1/3 1/6 ]'" << std::endl;
462 TEUCHOS_TEST_FOR_EXCEPTION(this->
isImplicit() ==
true, std::logic_error,
463 "Error - General ERK received an implicit Butcher Tableau!\n");
466 Teuchos::RCP<const Teuchos::ParameterList>
469 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
470 pl->setName(
"Default Stepper - " + this->
description());
472 pl->set<std::string>(
"Stepper Type", this->
description());
473 pl->set<
bool>(
"Use Embedded",
false);
476 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
477 tableauPL->set<std::string>(
"A",
478 "0.0 0.0 0.0 0.0; 0.5 0.0 0.0 0.0; 0.0 0.5 0.0 0.0; 0.0 0.0 1.0 0.0");
479 tableauPL->set<std::string>(
"b",
480 "0.166666666666667 0.333333333333333 0.333333333333333 0.166666666666667");
482 tableauPL->set<std::string>(
"c",
"0.0 0.5 0.5 1.0");
483 tableauPL->set<
int>(
"order", 4);
484 pl->set(
"Tableau", *tableauPL);
505 template<
class Scalar>
512 std::ostringstream Description;
516 <<
"b = [ 1 ]'" << std::endl;
522 virtual std::string
description()
const {
return "RK Backward Euler"; }
526 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
531 TEUCHOS_TEST_FOR_EXCEPTION(
532 pl->get<std::string>(
"Stepper Type") != this->description()
535 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
537 typedef Teuchos::ScalarTraits<Scalar> ST;
538 Teuchos::SerialDenseMatrix<int,Scalar>
A(1,1);
540 Teuchos::SerialDenseVector<int,Scalar>
b(1);
542 Teuchos::SerialDenseVector<int,Scalar>
c(1);
547 this->setMyParamList(pl);
551 Teuchos::RCP<const Teuchos::ParameterList>
554 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
555 pl->setName(
"Default Stepper - " + this->
description());
557 pl->set<std::string>(
"Stepper Type", this->
description());
558 pl->set<
bool>(
"Use Embedded",
false);
559 pl->set<std::string>(
"Solver Name",
"",
560 "Name of ParameterList containing the solver specifications.");
586 template<
class Scalar>
593 std::ostringstream Description;
597 <<
"b = [ 1 ]'" << std::endl;
598 typedef Teuchos::ScalarTraits<Scalar> ST;
599 Teuchos::SerialDenseMatrix<int,Scalar>
A(1,1);
600 Teuchos::SerialDenseVector<int,Scalar>
b(1);
602 Teuchos::SerialDenseVector<int,Scalar>
c(1);
607 virtual std::string
description()
const {
return "RK Forward Euler"; }
628 template<
class Scalar>
635 std::ostringstream Description;
637 <<
"\"The\" Runge-Kutta Method (explicit):\n"
638 <<
"Solving Ordinary Differential Equations I:\n"
639 <<
"Nonstiff Problems, 2nd Revised Edition\n"
640 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
641 <<
"Table 1.2, pg 138\n"
642 <<
"c = [ 0 1/2 1/2 1 ]'\n"
647 <<
"b = [ 1/6 1/3 1/3 1/6 ]'" << std::endl;
648 typedef Teuchos::ScalarTraits<Scalar> ST;
649 const Scalar one = ST::one();
650 const Scalar zero = ST::zero();
651 const Scalar onehalf = one/(2*one);
652 const Scalar onesixth = one/(6*one);
653 const Scalar onethird = one/(3*one);
656 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
657 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
658 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
697 virtual std::string
description()
const {
return "RK Explicit 4 Stage"; }
724 template<
class Scalar>
731 std::ostringstream Description;
733 <<
"P. Bogacki and L.F. Shampine.\n"
734 <<
"A 3(2) pair of Runge–Kutta formulas.\n"
735 <<
"Applied Mathematics Letters, 2(4):321 – 325, 1989.\n"
736 <<
"c = [ 0 1/3 2/3 1 ]'\n"
740 <<
" [ 2/9 1/3 4/9 0 ]\n"
741 <<
"b = [ 2/9 1/3 4/9 0 ]\n"
742 <<
"bstar = [ 7/24 1/4 1/3 1/8 ]\n" << std::endl;
743 typedef Teuchos::ScalarTraits<Scalar> ST;
746 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
747 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
748 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
749 Teuchos::SerialDenseVector<int,Scalar>
bstar(NumStages);
751 const Scalar one = ST::one();
752 const Scalar zero = ST::zero();
760 A(1,0) = as<Scalar>(one/(2*one));
766 A(2,1) = as<Scalar>(3*one/(4*one));
770 A(3,0) = as<Scalar>(2*one/(9*one));
771 A(3,1) = as<Scalar>(1*one/(3*one));
772 A(3,2) = as<Scalar>(4*one/(9*one));
783 c(1) = as<Scalar>(1*one/(3*one));
784 c(2) = as<Scalar>(2*one/(3*one));
788 bstar(0) = as<Scalar>(7.0*one/(24*one));
789 bstar(1) = as<Scalar>(1*one/(4*one));
790 bstar(2) = as<Scalar>(1*one/(3*one));
791 bstar(3) = as<Scalar>(1*one/(8*one));
796 virtual std::string
description()
const {
return "Bogacki-Shampine 3(2) Pair"; }
825 template<
class Scalar>
832 std::ostringstream Description;
834 <<
"Solving Ordinary Differential Equations I:\n"
835 <<
"Nonstiff Problems, 2nd Revised Edition\n"
836 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
837 <<
"Table 4.1, pg 167\n"
838 <<
"c = [ 0 1/3 1/3 1/2 1 ]'\n"
841 <<
" [ 1/6 1/6 0 ]\n"
842 <<
" [ 1/8 0 3/8 0 ]\n"
843 <<
" [ 1/2 0 -3/2 2 0 ]\n"
844 <<
"b = [ 1/6 0 0 2/3 1/6 ]\n"
845 <<
"bstar = [ 1/10 0 3/10 2/5 1/5 ]\n" << std::endl;
846 typedef Teuchos::ScalarTraits<Scalar> ST;
849 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages,
true);
850 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages,
true);
851 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages,
true);
852 Teuchos::SerialDenseVector<int,Scalar>
bstar(NumStages,
true);
854 const Scalar one = ST::one();
855 const Scalar zero = ST::zero();
858 A(1,0) = as<Scalar>(one/(3*one));;
860 A(2,0) = as<Scalar>(one/(6*one));;
861 A(2,1) = as<Scalar>(one/(6*one));;
863 A(3,0) = as<Scalar>(one/(8*one));;
864 A(3,2) = as<Scalar>(3*one/(8*one));;
866 A(4,0) = as<Scalar>(one/(2*one));;
867 A(4,2) = as<Scalar>(-3*one/(2*one));;
871 b(0) = as<Scalar>(one/(6*one));
872 b(3) = as<Scalar>(2*one/(3*one));
873 b(4) = as<Scalar>(one/(6*one));
877 c(1) = as<Scalar>(1*one/(3*one));
878 c(2) = as<Scalar>(1*one/(3*one));
879 c(3) = as<Scalar>(1*one/(2*one));
883 bstar(0) = as<Scalar>(1*one/(10*one));
884 bstar(2) = as<Scalar>(3*one/(10*one));
885 bstar(3) = as<Scalar>(2*one/(5*one));
886 bstar(4) = as<Scalar>(1*one/(5*one));
891 virtual std::string
description()
const {
return "Merson 4(5) Pair"; }
915 template<
class Scalar>
922 std::ostringstream Description;
924 <<
"Solving Ordinary Differential Equations I:\n"
925 <<
"Nonstiff Problems, 2nd Revised Edition\n"
926 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
927 <<
"Table 1.2, pg 138\n"
928 <<
"c = [ 0 1/3 2/3 1 ]'\n"
933 <<
"b = [ 1/8 3/8 3/8 1/8 ]'" << std::endl;
934 typedef Teuchos::ScalarTraits<Scalar> ST;
937 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
938 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
939 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
941 const Scalar one = ST::one();
942 const Scalar zero = ST::zero();
943 const Scalar one_third = as<Scalar>(one/(3*one));
944 const Scalar two_third = as<Scalar>(2*one/(3*one));
945 const Scalar one_eighth = as<Scalar>(one/(8*one));
946 const Scalar three_eighth = as<Scalar>(3*one/(8*one));
959 A(2,0) = as<Scalar>(-one_third);
965 A(3,1) = as<Scalar>(-one);
985 virtual std::string
description()
const {
return "RK Explicit 3/8 Rule"; }
1010 template<
class Scalar>
1017 std::ostringstream Description;
1019 <<
"Solving Ordinary Differential Equations I:\n"
1020 <<
"Nonstiff Problems, 2nd Revised Edition\n"
1021 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
1022 <<
"Table 1.1, pg 135\n"
1023 <<
"c = [ 0 1/2 1 1 ]'\n"
1028 <<
"b = [ 1/6 2/3 0 1/6 ]'" << std::endl;
1029 typedef Teuchos::ScalarTraits<Scalar> ST;
1031 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1032 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1033 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1035 const Scalar one = ST::one();
1036 const Scalar onehalf = one/(2*one);
1037 const Scalar onesixth = one/(6*one);
1038 const Scalar twothirds = 2*one/(3*one);
1039 const Scalar zero = ST::zero();
1079 {
return "RK Explicit 4 Stage 3rd order by Runge"; }
1103 template<
class Scalar>
1110 std::ostringstream Description;
1112 <<
"Kinnmark & Gray 5 stage, 3rd order scheme \n"
1113 <<
"Modified by P. Ullrich. From the prim_advance_mod.F90 \n"
1114 <<
"routine in the HOMME atmosphere model code.\n"
1115 <<
"c = [ 0 1/5 1/5 1/3 2/3 ]'\n"
1119 <<
" [ 0 0 1/3 0 ]\n"
1120 <<
" [ 0 0 0 2/3 0 ]\n"
1121 <<
"b = [ 1/4 0 0 0 3/4 ]'" << std::endl;
1122 typedef Teuchos::ScalarTraits<Scalar> ST;
1124 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1125 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1126 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1128 const Scalar one = ST::one();
1129 const Scalar onefifth = one/(5*one);
1130 const Scalar onefourth = one/(4*one);
1131 const Scalar onethird = one/(3*one);
1132 const Scalar twothirds = 2*one/(3*one);
1133 const Scalar threefourths = 3*one/(4*one);
1134 const Scalar zero = ST::zero();
1172 b(4) = threefourths;
1186 {
return "RK Explicit 5 Stage 3rd order by Kinnmark and Gray"; }
1206 template<
class Scalar>
1213 std::ostringstream Description;
1215 <<
"c = [ 0 1/2 1 ]'\n"
1219 <<
"b = [ 1/6 4/6 1/6 ]'" << std::endl;
1220 typedef Teuchos::ScalarTraits<Scalar> ST;
1221 const Scalar one = ST::one();
1222 const Scalar two = Teuchos::as<Scalar>(2*one);
1223 const Scalar zero = ST::zero();
1224 const Scalar onehalf = one/(2*one);
1225 const Scalar onesixth = one/(6*one);
1226 const Scalar foursixth = 4*one/(6*one);
1229 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1230 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1231 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1261 {
return "RK Explicit 3 Stage 3rd order"; }
1292 template<
class Scalar>
1299 std::ostringstream Description;
1301 <<
"Sigal Gottlieb and Chi-Wang Shu\n"
1302 <<
"`Total Variation Diminishing Runge-Kutta Schemes'\n"
1303 <<
"Mathematics of Computation\n"
1304 <<
"Volume 67, Number 221, January 1998, pp. 73-85\n"
1305 <<
"c = [ 0 1 1/2 ]'\n"
1308 <<
" [ 1/4 1/4 0 ]\n"
1309 <<
"b = [ 1/6 1/6 4/6 ]'\n"
1310 <<
"This is also written in the following set of updates.\n"
1311 <<
"u1 = u^n + dt L(u^n)\n"
1312 <<
"u2 = 3 u^n/4 + u1/4 + dt L(u1)/4\n"
1313 <<
"u^(n+1) = u^n/3 + 2 u2/2 + 2 dt L(u2)/3"
1315 typedef Teuchos::ScalarTraits<Scalar> ST;
1316 const Scalar one = ST::one();
1317 const Scalar zero = ST::zero();
1318 const Scalar onehalf = one/(2*one);
1319 const Scalar onefourth = one/(4*one);
1320 const Scalar onesixth = one/(6*one);
1321 const Scalar foursixth = 4*one/(6*one);
1324 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1325 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1326 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1356 {
return "RK Explicit 3 Stage 3rd order TVD"; }
1380 template<
class Scalar>
1387 std::ostringstream Description;
1389 <<
"Solving Ordinary Differential Equations I:\n"
1390 <<
"Nonstiff Problems, 2nd Revised Edition\n"
1391 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
1392 <<
"Table 1.1, pg 135\n"
1393 <<
"c = [ 0 1/3 2/3 ]'\n"
1397 <<
"b = [ 1/4 0 3/4 ]'" << std::endl;
1398 typedef Teuchos::ScalarTraits<Scalar> ST;
1399 const Scalar one = ST::one();
1400 const Scalar zero = ST::zero();
1401 const Scalar onethird = one/(3*one);
1402 const Scalar twothirds = 2*one/(3*one);
1403 const Scalar onefourth = one/(4*one);
1404 const Scalar threefourths = 3*one/(4*one);
1407 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1408 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1409 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1427 b(2) = threefourths;
1439 {
return "RK Explicit 3 Stage 3rd order by Heun"; }
1462 template<
class Scalar>
1469 std::ostringstream Description;
1471 <<
"Also known as Explicit Midpoint\n"
1472 <<
"Solving Ordinary Differential Equations I:\n"
1473 <<
"Nonstiff Problems, 2nd Revised Edition\n"
1474 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
1475 <<
"Table 1.1, pg 135\n"
1476 <<
"c = [ 0 1/2 ]'\n"
1479 <<
"b = [ 0 1 ]'" << std::endl;
1480 typedef Teuchos::ScalarTraits<Scalar> ST;
1481 const Scalar one = ST::one();
1482 const Scalar zero = ST::zero();
1483 const Scalar onehalf = one/(2*one);
1486 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1487 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1488 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1510 {
return "RK Explicit 2 Stage 2nd order by Runge"; }
1529 template<
class Scalar>
1536 std::ostringstream Description;
1541 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1542 typedef Teuchos::ScalarTraits<Scalar> ST;
1543 const Scalar one = ST::one();
1544 const Scalar zero = ST::zero();
1545 const Scalar onehalf = one/(2*one);
1548 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1549 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1550 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1571 virtual std::string
description()
const {
return "RK Explicit Trapezoidal"; }
1606 template<
class Scalar>
1613 std::stringstream Description;
1615 <<
"The format of the Butcher Tableau parameter list is\n"
1616 <<
" <Parameter name=\"A\" type=\"string\" value=\"# # # ;\n"
1619 <<
" <Parameter name=\"b\" type=\"string\" value=\"# # #\"/>\n"
1620 <<
" <Parameter name=\"c\" type=\"string\" value=\"# # #\"/>\n\n"
1621 <<
"Note the number of stages is implicit in the number of entries.\n"
1622 <<
"The number of stages must be consistent.\n"
1624 <<
"Default tableau is 'SDIRK 2 Stage 2nd order':\n"
1625 <<
" Computer Methods for ODEs and DAEs\n"
1626 <<
" U. M. Ascher and L. R. Petzold\n"
1628 <<
" gamma = (2+-sqrt(2))/2\n"
1629 <<
" c = [ gamma 1 ]'\n"
1630 <<
" A = [ gamma 0 ]\n"
1631 <<
" [ 1-gamma gamma ]\n"
1632 <<
" b = [ 1-gamma gamma ]'" << std::endl;
1643 TEUCHOS_TEST_FOR_EXCEPTION(this->
isImplicit() !=
true, std::logic_error,
1644 "Error - General DIRK did not receive a DIRK Butcher Tableau!\n");
1647 Teuchos::RCP<const Teuchos::ParameterList>
1650 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1651 pl->setName(
"Default Stepper - " + this->
description());
1653 pl->set<std::string>(
"Stepper Type", this->
description());
1654 pl->set<
bool>(
"Use Embedded",
false);
1657 typedef Teuchos::ScalarTraits<Scalar> ST;
1658 std::string gamma = std::to_string((2.0 - ST::squareroot(2.0))/(2.0));
1659 std::string one_gamma = std::to_string(1.0-(2.0-ST::squareroot(2.0))/(2.0));
1660 Teuchos::RCP<Teuchos::ParameterList> tableauPL = Teuchos::parameterList();
1661 tableauPL->set<std::string>(
"A", gamma +
" 0.0; " + one_gamma +
" "+gamma);
1662 tableauPL->set<std::string>(
"b", one_gamma +
" " + gamma);
1663 tableauPL->set<std::string>(
"c", gamma +
" 1.0");
1664 tableauPL->set<
int>(
"order", 2);
1665 pl->set(
"Tableau", *tableauPL);
1686 template<
class Scalar>
1693 std::stringstream Description;
1697 <<
"b = [ 1 ]'" << std::endl;
1703 virtual std::string
description()
const {
return "SDIRK 1 Stage 1st order"; }
1707 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1712 TEUCHOS_TEST_FOR_EXCEPTION(
1713 pl->get<std::string>(
"Stepper Type") != this->description()
1714 ,std::runtime_error,
1716 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
1718 typedef Teuchos::ScalarTraits<Scalar> ST;
1719 Teuchos::SerialDenseMatrix<int,Scalar>
A(1,1);
1721 Teuchos::SerialDenseVector<int,Scalar>
b(1);
1723 Teuchos::SerialDenseVector<int,Scalar>
c(1);
1728 this->setMyParamList(pl);
1732 Teuchos::RCP<const Teuchos::ParameterList>
1735 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1736 pl->setName(
"Default Stepper - " + this->
description());
1738 pl->set<std::string>(
"Stepper Type", this->
description());
1739 pl->set<
bool>(
"Use Embedded",
false);
1740 pl->set<std::string>(
"Solver Name",
"",
1741 "Name of ParameterList containing the solver specifications.");
1771 template<
class Scalar>
1778 std::ostringstream Description;
1780 <<
"Computer Methods for ODEs and DAEs\n"
1781 <<
"U. M. Ascher and L. R. Petzold\n"
1783 <<
"gamma = (2+-sqrt(2))/2\n"
1784 <<
"c = [ gamma 1 ]'\n"
1785 <<
"A = [ gamma 0 ]\n"
1786 <<
" [ 1-gamma gamma ]\n"
1787 <<
"b = [ 1-gamma gamma ]'" << std::endl;
1789 typedef Teuchos::ScalarTraits<Scalar> ST;
1790 const Scalar one = ST::one();
1791 gamma_default_ = Teuchos::as<Scalar>((2*one-ST::squareroot(2*one))/(2*one));
1798 virtual std::string
description()
const {
return "SDIRK 2 Stage 2nd order"; }
1802 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1807 TEUCHOS_TEST_FOR_EXCEPTION(
1808 pl->get<std::string>(
"Stepper Type") != this->description()
1809 ,std::runtime_error,
1811 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
1815 typedef Teuchos::ScalarTraits<Scalar> ST;
1817 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1818 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1819 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1820 const Scalar one = ST::one();
1821 const Scalar zero = ST::zero();
1824 A(1,0) = Teuchos::as<Scalar>( one -
gamma_ );
1826 b(0) = Teuchos::as<Scalar>( one -
gamma_ );
1835 this->setMyParamList(pl);
1839 Teuchos::RCP<const Teuchos::ParameterList>
1842 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1843 pl->setName(
"Default Stepper - " + this->
description());
1845 pl->set<std::string>(
"Stepper Type", this->
description());
1846 pl->set<
bool>(
"Use Embedded",
false);
1847 pl->set(
"Solver Name",
"",
1848 "Name of ParameterList containing the solver specifications.");
1850 "The default value is gamma = (2-sqrt(2))/2. "
1851 "This will produce an L-stable 2nd order method with the stage "
1852 "times within the timestep. Other values of gamma will still "
1853 "produce an L-stable scheme, but will only be 1st order accurate.");
1891 template<
class Scalar>
1898 std::ostringstream Description;
1900 <<
"Solving Ordinary Differential Equations I:\n"
1901 <<
"Nonstiff Problems, 2nd Revised Edition\n"
1902 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
1903 <<
"Table 7.2, pg 207\n"
1904 <<
"gamma = (3+-sqrt(3))/6 -> 3rd order and A-stable\n"
1905 <<
"gamma = (2+-sqrt(2))/2 -> 2nd order and L-stable\n"
1906 <<
"c = [ gamma 1-gamma ]'\n"
1907 <<
"A = [ gamma 0 ]\n"
1908 <<
" [ 1-2*gamma gamma ]\n"
1909 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1915 typedef Teuchos::ScalarTraits<Scalar> ST;
1916 const Scalar one = ST::one();
1918 Teuchos::as<Scalar>( (3*one + ST::squareroot(3*one))/(6*one) );
1927 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1932 TEUCHOS_TEST_FOR_EXCEPTION(
1933 pl->get<std::string>(
"Stepper Type") != this->description()
1934 ,std::runtime_error,
1936 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
1940 TEUCHOS_TEST_FOR_EXCEPTION(
1942 "'3rd Order A-stable' and '2nd Order L-stable' can not both be true.");
1945 typedef Teuchos::ScalarTraits<Scalar> ST;
1948 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
1949 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
1950 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
1951 const Scalar one = ST::one();
1952 const Scalar zero = ST::zero();
1953 const Scalar gammaLStable =
1954 as<Scalar>( (2*one + ST::squareroot(2*one))/(2*one) );
1961 A(1,0) = as<Scalar>( one - 2*
gamma_ );
1963 b(0) = as<Scalar>( one/(2*one) );
1964 b(1) = as<Scalar>( one/(2*one) );
1966 c(1) = as<Scalar>( one -
gamma_ );
1973 }
else if ( std::abs((
gamma_-gammaLStable)/
gamma_) < 1.0e-08 ) {
1982 this->setMyParamList(pl);
1986 Teuchos::RCP<const Teuchos::ParameterList>
1989 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
1990 pl->setName(
"Default Stepper - " + this->
description());
1992 pl->set<std::string>(
"Stepper Type", this->
description());
1993 pl->set<
bool>(
"Use Embedded",
false);
1994 pl->set(
"Solver Name",
"",
1995 "Name of ParameterList containing the solver specifications.");
1997 "If true, set gamma to gamma = (3+sqrt(3))/6 to obtain "
1998 "a 3rd order A-stable scheme. '3rd Order A-stable' and "
1999 "'2nd Order L-stable' can not both be true.");
2001 "If true, set gamma to gamma = (2+sqrt(2))/2 to obtain "
2002 "a 2nd order L-stable scheme. '3rd Order A-stable' and "
2003 "'2nd Order L-stable' can not both be true.");
2005 "If both '3rd Order A-stable' and '2nd Order L-stable' "
2006 "are false, gamma will be used. The default value is the "
2007 "'3rd Order A-stable' gamma value, (3+sqrt(3))/6.");
2012 virtual std::string
description()
const {
return "SDIRK 2 Stage 3rd order"; }
2043 template<
class Scalar>
2050 std::ostringstream Description;
2052 <<
"Hammer & Hollingsworth method\n"
2053 <<
"Solving Ordinary Differential Equations I:\n"
2054 <<
"Nonstiff Problems, 2nd Revised Edition\n"
2055 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
2056 <<
"Table 7.1, pg 205\n"
2057 <<
"c = [ 0 2/3 ]'\n"
2060 <<
"b = [ 1/4 3/4 ]'" << std::endl;
2066 virtual std::string
description()
const {
return "EDIRK 2 Stage 3rd order"; }
2070 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2075 TEUCHOS_TEST_FOR_EXCEPTION(
2076 pl->get<std::string>(
"Stepper Type") != this->description()
2077 ,std::runtime_error,
2079 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
2082 typedef Teuchos::ScalarTraits<Scalar> ST;
2085 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2086 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2087 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2088 const Scalar one = ST::one();
2089 const Scalar zero = ST::zero();
2092 A(1,0) = as<Scalar>( one/(3*one) );
2093 A(1,1) = as<Scalar>( one/(3*one) );
2094 b(0) = as<Scalar>( one/(4*one) );
2095 b(1) = as<Scalar>( 3*one/(4*one) );
2097 c(1) = as<Scalar>( 2*one/(3*one) );
2101 this->setMyParamList(pl);
2105 Teuchos::RCP<const Teuchos::ParameterList>
2108 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2109 pl->setName(
"Default Stepper - " + this->
description());
2111 pl->set<std::string>(
"Stepper Type", this->
description());
2112 pl->set<
bool>(
"Use Embedded",
false);
2113 pl->set(
"Solver Name",
"",
2114 "Name of ParameterList containing the solver specifications.");
2123 template<
class Scalar>
2130 std::ostringstream Description;
2132 <<
"Kuntzmann & Butcher method\n"
2133 <<
"Solving Ordinary Differential Equations I:\n"
2134 <<
"Nonstiff Problems, 2nd Revised Edition\n"
2135 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
2136 <<
"Table 7.4, pg 209\n"
2137 <<
"c = [ 1/2-sqrt(15)/10 1/2 1/2+sqrt(15)/10 ]'\n"
2138 <<
"A = [ 5/36 2/9-sqrt(15)/15 5/36-sqrt(15)/30 ]\n"
2139 <<
" [ 5/36+sqrt(15)/24 2/9 5/36-sqrt(15)/24 ]\n"
2140 <<
" [ 5/36+sqrt(15)/30 2/9+sqrt(15)/15 5/36 ]\n"
2141 <<
"b = [ 5/18 4/9 5/18 ]'"
2143 typedef Teuchos::ScalarTraits<Scalar> ST;
2146 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2147 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2148 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2149 const Scalar one = ST::one();
2150 A(0,0) = as<Scalar>( 5*one/(36*one) );
2151 A(0,1) = as<Scalar>( 2*one/(9*one) - ST::squareroot(15*one)/(15*one) );
2152 A(0,2) = as<Scalar>( 5*one/(36*one) - ST::squareroot(15*one)/(30*one) );
2153 A(1,0) = as<Scalar>( 5*one/(36*one) + ST::squareroot(15*one)/(24*one) );
2154 A(1,1) = as<Scalar>( 2*one/(9*one) );
2155 A(1,2) = as<Scalar>( 5*one/(36*one) - ST::squareroot(15*one)/(24*one) );
2156 A(2,0) = as<Scalar>( 5*one/(36*one) + ST::squareroot(15*one)/(30*one) );
2157 A(2,1) = as<Scalar>( 2*one/(9*one) + ST::squareroot(15*one)/(15*one) );
2158 A(2,2) = as<Scalar>( 5*one/(36*one) );
2159 b(0) = as<Scalar>( 5*one/(18*one) );
2160 b(1) = as<Scalar>( 4*one/(9*one) );
2161 b(2) = as<Scalar>( 5*one/(18*one) );
2162 c(0) = as<Scalar>( one/(2*one)-ST::squareroot(15*one)/(10*one) );
2163 c(1) = as<Scalar>( one/(2*one) );
2164 c(2) = as<Scalar>( one/(2*one)+ST::squareroot(15*one)/(10*one) );
2170 {
return "RK Implicit 3 Stage 6th Order Kuntzmann & Butcher"; }
2175 template<
class Scalar>
2182 std::ostringstream Description;
2184 <<
"Kuntzmann & Butcher method\n"
2185 <<
"Solving Ordinary Differential Equations I:\n"
2186 <<
"Nonstiff Problems, 2nd Revised Edition\n"
2187 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
2188 <<
"Table 7.5, pg 209\n"
2189 <<
"c = [ 1/2-w2 1/2-w2p 1/2+w2p 1/2+w2 ]'\n"
2190 <<
"A = [ w1 w1p-w3+w4p w1p-w3-w4p w1-w5 ]\n"
2191 <<
" [ w1-w3p+w4 w1p w1p-w5p w1-w3p-w4 ]\n"
2192 <<
" [ w1+w3p+w4 w1p+w5p w1p w1+w3p-w4 ]\n"
2193 <<
" [ w1+w5 w1p+w3+w4p w1p+w3-w4p w1 ]\n"
2194 <<
"b = [ 2*w1 2*w1p 2*w1p 2*w1 ]'\n"
2195 <<
"w1 = 1/8-sqrt(30)/144\n"
2196 <<
"w2 = (1/2)*sqrt((15+2*sqrt(3))/35)\n"
2197 <<
"w3 = w2*(1/6+sqrt(30)/24)\n"
2198 <<
"w4 = w2*(1/21+5*sqrt(30)/168)\n"
2200 <<
"w1p = 1/8+sqrt(30)/144\n"
2201 <<
"w2p = (1/2)*sqrt((15-2*sqrt(3))/35)\n"
2202 <<
"w3p = w2*(1/6-sqrt(30)/24)\n"
2203 <<
"w4p = w2*(1/21-5*sqrt(30)/168)\n"
2204 <<
"w5p = w2p-2*w3p" << std::endl;
2205 typedef Teuchos::ScalarTraits<Scalar> ST;
2208 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2209 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2210 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2211 const Scalar one = ST::one();
2212 const Scalar onehalf = as<Scalar>( one/(2*one) );
2213 const Scalar w1 = as<Scalar>( one/(8*one) - ST::squareroot(30*one)/(144*one) );
2214 const Scalar w2 = as<Scalar>( (one/(2*one))*ST::squareroot((15*one+2*one*ST::squareroot(30*one))/(35*one)) );
2215 const Scalar w3 = as<Scalar>( w2*(one/(6*one)+ST::squareroot(30*one)/(24*one)) );
2216 const Scalar w4 = as<Scalar>( w2*(one/(21*one)+5*one*ST::squareroot(30*one)/(168*one)) );
2217 const Scalar w5 = as<Scalar>( w2-2*w3 );
2218 const Scalar w1p = as<Scalar>( one/(8*one) + ST::squareroot(30*one)/(144*one) );
2219 const Scalar w2p = as<Scalar>( (one/(2*one))*ST::squareroot((15*one-2*one*ST::squareroot(30*one))/(35*one)) );
2220 const Scalar w3p = as<Scalar>( w2p*(one/(6*one)-ST::squareroot(30*one)/(24*one)) );
2221 const Scalar w4p = as<Scalar>( w2p*(one/(21*one)-5*one*ST::squareroot(30*one)/(168*one)) );
2222 const Scalar w5p = as<Scalar>( w2p-2*w3p );
2224 A(0,1) = w1p-w3+w4p;
2225 A(0,2) = w1p-w3-w4p;
2236 A(3,1) = w1p+w3+w4p;
2237 A(3,2) = w1p+w3-w4p;
2243 c(0) = onehalf - w2;
2244 c(1) = onehalf - w2p;
2245 c(2) = onehalf + w2p;
2246 c(3) = onehalf + w2;
2252 {
return "RK Implicit 4 Stage 8th Order Kuntzmann & Butcher"; }
2257 template<
class Scalar>
2264 std::ostringstream Description;
2266 <<
"Hammer & Hollingsworth method\n"
2267 <<
"Solving Ordinary Differential Equations I:\n"
2268 <<
"Nonstiff Problems, 2nd Revised Edition\n"
2269 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
2270 <<
"Table 7.3, pg 207\n"
2271 <<
"c = [ 1/2-sqrt(3)/6 1/2+sqrt(3)/6 ]'\n"
2272 <<
"A = [ 1/4 1/4-sqrt(3)/6 ]\n"
2273 <<
" [ 1/4+sqrt(3)/6 1/4 ]\n"
2274 <<
"b = [ 1/2 1/2 ]'" << std::endl;
2275 typedef Teuchos::ScalarTraits<Scalar> ST;
2278 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2279 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2280 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2281 const Scalar one = ST::one();
2282 const Scalar onequarter = as<Scalar>( one/(4*one) );
2283 const Scalar onehalf = as<Scalar>( one/(2*one) );
2284 A(0,0) = onequarter;
2285 A(0,1) = as<Scalar>( onequarter-ST::squareroot(3*one)/(6*one) );
2286 A(1,0) = as<Scalar>( onequarter+ST::squareroot(3*one)/(6*one) );
2287 A(1,1) = onequarter;
2290 c(0) = as<Scalar>( onehalf - ST::squareroot(3*one)/(6*one) );
2291 c(1) = as<Scalar>( onehalf + ST::squareroot(3*one)/(6*one) );
2297 {
return "RK Implicit 2 Stage 4th Order Hammer & Hollingsworth"; }
2302 template<
class Scalar>
2309 std::ostringstream Description;
2311 <<
"Non-standard finite-difference methods\n"
2312 <<
"in dynamical systems, P. Kama,\n"
2313 <<
"Dissertation, University of Pretoria, pg. 49.\n"
2314 <<
"Comment: Generalized Implicit Midpoint Method\n"
2315 <<
"c = [ theta ]'\n"
2316 <<
"A = [ theta ]\n"
2320 typedef Teuchos::ScalarTraits<Scalar> ST;
2330 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2335 TEUCHOS_TEST_FOR_EXCEPTION(
2336 pl->get<std::string>(
"Stepper Type") != this->description() and
2337 pl->get<std::string>(
"Stepper Type") !=
"Implicit Midpoint"
2338 ,std::runtime_error,
2340 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
2343 typedef Teuchos::ScalarTraits<Scalar> ST;
2345 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2346 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2347 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2356 this->setMyParamList(pl);
2360 virtual std::string
description()
const {
return "IRK 1 Stage Theta Method"; }
2362 Teuchos::RCP<const Teuchos::ParameterList>
2365 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2366 pl->setName(
"Default Stepper - " + this->
description());
2368 pl->set<std::string>(
"Stepper Type", this->
description());
2369 pl->set<
bool>(
"Use Embedded",
false);
2370 pl->set<std::string>(
"Solver Name",
"",
2371 "Name of ParameterList containing the solver specifications.");
2373 "Valid values are 0 <= theta <= 1, where theta = 0 "
2374 "implies Forward Euler, theta = 1/2 implies implicit midpoint "
2375 "method (default), and theta = 1 implies Backward Euler. "
2376 "For theta != 1/2, this method is first-order accurate, "
2377 "and with theta = 1/2, it is second-order accurate. "
2378 "This method is A-stable, but becomes L-stable with theta=1.");
2390 template<
class Scalar>
2397 std::ostringstream Description;
2399 <<
"Computer Methods for ODEs and DAEs\n"
2400 <<
"U. M. Ascher and L. R. Petzold\n"
2404 <<
" [ 1-theta theta ]\n"
2405 <<
"b = [ 1-theta theta ]'\n"
2408 typedef Teuchos::ScalarTraits<Scalar> ST;
2418 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2423 TEUCHOS_TEST_FOR_EXCEPTION(
2424 pl->get<std::string>(
"Stepper Type") != this->description()
2425 ,std::runtime_error,
2427 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
2430 typedef Teuchos::ScalarTraits<Scalar> ST;
2431 const Scalar one = ST::one();
2432 const Scalar zero = ST::zero();
2433 TEUCHOS_TEST_FOR_EXCEPTION(
2434 theta_ == zero, std::logic_error,
2435 "'theta' can not be zero, as it makes this IRK stepper explicit.");
2438 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2439 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2440 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2443 A(1,0) = Teuchos::as<Scalar>( one -
theta_ );
2445 b(0) = Teuchos::as<Scalar>( one -
theta_ );
2454 this->setMyParamList(pl);
2458 Teuchos::RCP<const Teuchos::ParameterList>
2461 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
2462 pl->setName(
"Default Stepper - " + this->
description());
2464 pl->set<std::string>(
"Stepper Type", this->
description());
2465 pl->set<
bool>(
"Use Embedded",
false);
2466 pl->set<std::string>(
"Solver Name",
"",
2467 "Name of ParameterList containing the solver specifications.");
2469 "Valid values are 0 < theta <= 1, where theta = 0 "
2470 "implies Forward Euler, theta = 1/2 implies trapezoidal "
2471 "method (default), and theta = 1 implies Backward Euler. "
2472 "For theta != 1/2, this method is first-order accurate, "
2473 "and with theta = 1/2, it is second-order accurate. "
2474 "This method is A-stable, but becomes L-stable with theta=1.");
2479 virtual std::string
description()
const {
return "EDIRK 2 Stage Theta Method";}
2488 template<
class Scalar>
2495 std::ostringstream Description;
2498 <<
"Solving Ordinary Differential Equations II:\n"
2499 <<
"Stiff and Differential-Algebraic Problems,\n"
2500 <<
"2nd Revised Edition\n"
2501 <<
"E. Hairer and G. Wanner\n"
2502 <<
"Table 5.2, pg 72\n"
2503 <<
"Also: Implicit midpoint rule\n"
2504 <<
"Solving Ordinary Differential Equations I:\n"
2505 <<
"Nonstiff Problems, 2nd Revised Edition\n"
2506 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
2507 <<
"Table 7.1, pg 205\n"
2510 <<
"b = [ 1 ]'" << std::endl;
2511 typedef Teuchos::ScalarTraits<Scalar> ST;
2513 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2514 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2515 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2516 const Scalar onehalf = ST::one()/(2*ST::one());
2517 const Scalar one = ST::one();
2526 {
return "RK Implicit 1 Stage 2nd order Gauss"; }
2531 template<
class Scalar>
2538 std::ostringstream Description;
2541 <<
"Solving Ordinary Differential Equations II:\n"
2542 <<
"Stiff and Differential-Algebraic Problems,\n"
2543 <<
"2nd Revised Edition\n"
2544 <<
"E. Hairer and G. Wanner\n"
2545 <<
"Table 5.2, pg 72\n"
2546 <<
"c = [ 1/2-sqrt(3)/6 1/2+sqrt(3)/6 ]'\n"
2547 <<
"A = [ 1/4 1/4-sqrt(3)/6 ]\n"
2548 <<
" [ 1/4+sqrt(3)/6 1/4 ]\n"
2549 <<
"b = [ 1/2 1/2 ]'" << std::endl;
2550 typedef Teuchos::ScalarTraits<Scalar> ST;
2553 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2554 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2555 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2556 const Scalar one = ST::one();
2557 const Scalar onehalf = as<Scalar>(one/(2*one));
2558 const Scalar three = as<Scalar>(3*one);
2559 const Scalar six = as<Scalar>(6*one);
2560 const Scalar onefourth = as<Scalar>(one/(4*one));
2561 const Scalar alpha = ST::squareroot(three)/six;
2564 A(0,1) = onefourth-alpha;
2565 A(1,0) = onefourth+alpha;
2569 c(0) = onehalf-alpha;
2570 c(1) = onehalf+alpha;
2576 {
return "RK Implicit 2 Stage 4th order Gauss"; }
2581 template<
class Scalar>
2588 std::ostringstream Description;
2591 <<
"Solving Ordinary Differential Equations II:\n"
2592 <<
"Stiff and Differential-Algebraic Problems,\n"
2593 <<
"2nd Revised Edition\n"
2594 <<
"E. Hairer and G. Wanner\n"
2595 <<
"Table 5.2, pg 72\n"
2596 <<
"c = [ 1/2-sqrt(15)/10 1/2 1/2+sqrt(15)/10 ]'\n"
2597 <<
"A = [ 5/36 2/9-sqrt(15)/15 5/36-sqrt(15)/30 ]\n"
2598 <<
" [ 5/36+sqrt(15)/24 2/9 5/36-sqrt(15)/24 ]\n"
2599 <<
" [ 5/36+sqrt(15)/30 2/9+sqrt(15)/15 5/36 ]\n"
2600 <<
"b = [ 5/18 4/9 5/18 ]'"
2602 typedef Teuchos::ScalarTraits<Scalar> ST;
2605 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2606 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2607 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2608 const Scalar one = ST::one();
2609 const Scalar ten = as<Scalar>(10*one);
2610 const Scalar fifteen = as<Scalar>(15*one);
2611 const Scalar twentyfour = as<Scalar>(24*one);
2612 const Scalar thirty = as<Scalar>(30*one);
2613 const Scalar sqrt15over10 = as<Scalar>(ST::squareroot(fifteen)/ten);
2614 const Scalar sqrt15over15 = as<Scalar>(ST::squareroot(fifteen)/fifteen);
2615 const Scalar sqrt15over24 = as<Scalar>(ST::squareroot(fifteen)/twentyfour);
2616 const Scalar sqrt15over30 = as<Scalar>(ST::squareroot(fifteen)/thirty);
2618 A(0,0) = as<Scalar>(5*one/(36*one));
2619 A(0,1) = as<Scalar>(2*one/(9*one))-sqrt15over15;
2620 A(0,2) = as<Scalar>(5*one/(36*one))-sqrt15over30;
2621 A(1,0) = as<Scalar>(5*one/(36*one))+sqrt15over24;
2622 A(1,1) = as<Scalar>(2*one/(9*one));
2623 A(1,2) = as<Scalar>(5*one/(36*one))-sqrt15over24;
2624 A(2,0) = as<Scalar>(5*one/(36*one))+sqrt15over30;
2625 A(2,1) = as<Scalar>(2*one/(9*one))+sqrt15over15;
2626 A(2,2) = as<Scalar>(5*one/(36*one));
2627 b(0) = as<Scalar>(5*one/(18*one));
2628 b(1) = as<Scalar>(4*one/(9*one));
2629 b(2) = as<Scalar>(5*one/(18*one));
2630 c(0) = as<Scalar>(one/(2*one))-sqrt15over10;
2631 c(1) = as<Scalar>(one/(2*one));
2632 c(2) = as<Scalar>(one/(2*one))+sqrt15over10;
2638 {
return "RK Implicit 3 Stage 6th order Gauss"; }
2643 template<
class Scalar>
2650 std::ostringstream Description;
2653 <<
"Solving Ordinary Differential Equations II:\n"
2654 <<
"Stiff and Differential-Algebraic Problems,\n"
2655 <<
"2nd Revised Edition\n"
2656 <<
"E. Hairer and G. Wanner\n"
2657 <<
"Table 5.3, pg 73\n"
2660 <<
"b = [ 1 ]'" << std::endl;
2661 typedef Teuchos::ScalarTraits<Scalar> ST;
2663 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2664 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2665 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2666 const Scalar one = ST::one();
2667 const Scalar zero = ST::zero();
2676 {
return "RK Implicit 1 Stage 1st order Radau left"; }
2681 template<
class Scalar>
2688 std::ostringstream Description;
2691 <<
"Solving Ordinary Differential Equations II:\n"
2692 <<
"Stiff and Differential-Algebraic Problems,\n"
2693 <<
"2nd Revised Edition\n"
2694 <<
"E. Hairer and G. Wanner\n"
2695 <<
"Table 5.3, pg 73\n"
2696 <<
"c = [ 0 2/3 ]'\n"
2697 <<
"A = [ 1/4 -1/4 ]\n"
2698 <<
" [ 1/4 5/12 ]\n"
2699 <<
"b = [ 1/4 3/4 ]'" << std::endl;
2700 typedef Teuchos::ScalarTraits<Scalar> ST;
2703 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2704 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2705 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2706 const Scalar zero = ST::zero();
2707 const Scalar one = ST::one();
2708 A(0,0) = as<Scalar>(one/(4*one));
2709 A(0,1) = as<Scalar>(-one/(4*one));
2710 A(1,0) = as<Scalar>(one/(4*one));
2711 A(1,1) = as<Scalar>(5*one/(12*one));
2712 b(0) = as<Scalar>(one/(4*one));
2713 b(1) = as<Scalar>(3*one/(4*one));
2715 c(1) = as<Scalar>(2*one/(3*one));
2721 {
return "RK Implicit 2 Stage 3rd order Radau left"; }
2726 template<
class Scalar>
2733 std::ostringstream Description;
2736 <<
"Solving Ordinary Differential Equations II:\n"
2737 <<
"Stiff and Differential-Algebraic Problems,\n"
2738 <<
"2nd Revised Edition\n"
2739 <<
"E. Hairer and G. Wanner\n"
2740 <<
"Table 5.4, pg 73\n"
2741 <<
"c = [ 0 (6-sqrt(6))/10 (6+sqrt(6))/10 ]'\n"
2742 <<
"A = [ 1/9 (-1-sqrt(6))/18 (-1+sqrt(6))/18 ]\n"
2743 <<
" [ 1/9 (88+7*sqrt(6))/360 (88-43*sqrt(6))/360 ]\n"
2744 <<
" [ 1/9 (88+43*sqrt(6))/360 (88-7*sqrt(6))/360 ]\n"
2745 <<
"b = [ 1/9 (16+sqrt(6))/36 (16-sqrt(6))/36 ]'"
2747 typedef Teuchos::ScalarTraits<Scalar> ST;
2750 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2751 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2752 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2753 const Scalar zero = ST::zero();
2754 const Scalar one = ST::one();
2755 A(0,0) = as<Scalar>(one/(9*one));
2756 A(0,1) = as<Scalar>( (-one-ST::squareroot(6*one))/(18*one) );
2757 A(0,2) = as<Scalar>( (-one+ST::squareroot(6*one))/(18*one) );
2758 A(1,0) = as<Scalar>(one/(9*one));
2759 A(1,1) = as<Scalar>( (88*one+7*one*ST::squareroot(6*one))/(360*one) );
2760 A(1,2) = as<Scalar>( (88*one-43*one*ST::squareroot(6*one))/(360*one) );
2761 A(2,0) = as<Scalar>(one/(9*one));
2762 A(2,1) = as<Scalar>( (88*one+43*one*ST::squareroot(6*one))/(360*one) );
2763 A(2,2) = as<Scalar>( (88*one-7*one*ST::squareroot(6*one))/(360*one) );
2764 b(0) = as<Scalar>(one/(9*one));
2765 b(1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
2766 b(2) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
2768 c(1) = as<Scalar>( (6*one-ST::squareroot(6*one))/(10*one) );
2769 c(2) = as<Scalar>( (6*one+ST::squareroot(6*one))/(10*one) );
2775 {
return "RK Implicit 3 Stage 5th order Radau left"; }
2780 template<
class Scalar>
2787 std::ostringstream Description;
2790 <<
"Solving Ordinary Differential Equations II:\n"
2791 <<
"Stiff and Differential-Algebraic Problems,\n"
2792 <<
"2nd Revised Edition\n"
2793 <<
"E. Hairer and G. Wanner\n"
2794 <<
"Table 5.5, pg 74\n"
2797 <<
"b = [ 1 ]'" << std::endl;
2798 typedef Teuchos::ScalarTraits<Scalar> ST;
2800 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2801 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2802 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2803 const Scalar one = ST::one();
2812 {
return "RK Implicit 1 Stage 1st order Radau right"; }
2817 template<
class Scalar>
2824 std::ostringstream Description;
2827 <<
"Solving Ordinary Differential Equations II:\n"
2828 <<
"Stiff and Differential-Algebraic Problems,\n"
2829 <<
"2nd Revised Edition\n"
2830 <<
"E. Hairer and G. Wanner\n"
2831 <<
"Table 5.5, pg 74\n"
2832 <<
"c = [ 1/3 1 ]'\n"
2833 <<
"A = [ 5/12 -1/12 ]\n"
2835 <<
"b = [ 3/4 1/4 ]'" << std::endl;
2836 typedef Teuchos::ScalarTraits<Scalar> ST;
2839 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2840 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2841 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2842 const Scalar one = ST::one();
2843 A(0,0) = as<Scalar>( 5*one/(12*one) );
2844 A(0,1) = as<Scalar>( -one/(12*one) );
2845 A(1,0) = as<Scalar>( 3*one/(4*one) );
2846 A(1,1) = as<Scalar>( one/(4*one) );
2847 b(0) = as<Scalar>( 3*one/(4*one) );
2848 b(1) = as<Scalar>( one/(4*one) );
2849 c(0) = as<Scalar>( one/(3*one) );
2856 {
return "RK Implicit 2 Stage 3rd order Radau right"; }
2861 template<
class Scalar>
2868 std::ostringstream Description;
2871 <<
"Solving Ordinary Differential Equations II:\n"
2872 <<
"Stiff and Differential-Algebraic Problems,\n"
2873 <<
"2nd Revised Edition\n"
2874 <<
"E. Hairer and G. Wanner\n"
2875 <<
"Table 5.6, pg 74\n"
2876 <<
"c = [ (4-sqrt(6))/10 (4+sqrt(6))/10 1 ]'\n"
2877 <<
"A = [ A1 A2 A3 ]\n"
2878 <<
" A1 = [ (88-7*sqrt(6))/360 ]\n"
2879 <<
" [ (296+169*sqrt(6))/1800 ]\n"
2880 <<
" [ (16-sqrt(6))/36 ]\n"
2881 <<
" A2 = [ (296-169*sqrt(6))/1800 ]\n"
2882 <<
" [ (88+7*sqrt(6))/360 ]\n"
2883 <<
" [ (16+sqrt(6))/36 ]\n"
2884 <<
" A3 = [ (-2+3*sqrt(6))/225 ]\n"
2885 <<
" [ (-2-3*sqrt(6))/225 ]\n"
2887 <<
"b = [ (16-sqrt(6))/36 (16+sqrt(6))/36 1/9 ]'"
2889 typedef Teuchos::ScalarTraits<Scalar> ST;
2892 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2893 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2894 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2895 const Scalar one = ST::one();
2896 A(0,0) = as<Scalar>( (88*one-7*one*ST::squareroot(6*one))/(360*one) );
2897 A(0,1) = as<Scalar>( (296*one-169*one*ST::squareroot(6*one))/(1800*one) );
2898 A(0,2) = as<Scalar>( (-2*one+3*one*ST::squareroot(6*one))/(225*one) );
2899 A(1,0) = as<Scalar>( (296*one+169*one*ST::squareroot(6*one))/(1800*one) );
2900 A(1,1) = as<Scalar>( (88*one+7*one*ST::squareroot(6*one))/(360*one) );
2901 A(1,2) = as<Scalar>( (-2*one-3*one*ST::squareroot(6*one))/(225*one) );
2902 A(2,0) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
2903 A(2,1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
2904 A(2,2) = as<Scalar>( one/(9*one) );
2905 b(0) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
2906 b(1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
2907 b(2) = as<Scalar>( one/(9*one) );
2908 c(0) = as<Scalar>( (4*one-ST::squareroot(6*one))/(10*one) );
2909 c(1) = as<Scalar>( (4*one+ST::squareroot(6*one))/(10*one) );
2916 {
return "RK Implicit 3 Stage 5th order Radau right"; }
2921 template<
class Scalar>
2928 std::ostringstream Description;
2931 <<
"Solving Ordinary Differential Equations II:\n"
2932 <<
"Stiff and Differential-Algebraic Problems,\n"
2933 <<
"2nd Revised Edition\n"
2934 <<
"E. Hairer and G. Wanner\n"
2935 <<
"Table 5.7, pg 75\n"
2939 <<
"b = [ 1/2 1/2 ]'" << std::endl;
2940 typedef Teuchos::ScalarTraits<Scalar> ST;
2943 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2944 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2945 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2946 const Scalar zero = ST::zero();
2947 const Scalar one = ST::one();
2950 A(1,0) = as<Scalar>( one/(2*one) );
2951 A(1,1) = as<Scalar>( one/(2*one) );
2952 b(0) = as<Scalar>( one/(2*one) );
2953 b(1) = as<Scalar>( one/(2*one) );
2961 {
return "RK Implicit 2 Stage 2nd order Lobatto A"; }
2966 template<
class Scalar>
2973 std::ostringstream Description;
2976 <<
"Solving Ordinary Differential Equations II:\n"
2977 <<
"Stiff and Differential-Algebraic Problems,\n"
2978 <<
"2nd Revised Edition\n"
2979 <<
"E. Hairer and G. Wanner\n"
2980 <<
"Table 5.7, pg 75\n"
2981 <<
"c = [ 0 1/2 1 ]'\n"
2982 <<
"A = [ 0 0 0 ]\n"
2983 <<
" [ 5/24 1/3 -1/24 ]\n"
2984 <<
" [ 1/6 2/3 1/6 ]\n"
2985 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
2986 typedef Teuchos::ScalarTraits<Scalar> ST;
2989 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
2990 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
2991 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
2992 const Scalar zero = ST::zero();
2993 const Scalar one = ST::one();
2997 A(1,0) = as<Scalar>( (5*one)/(24*one) );
2998 A(1,1) = as<Scalar>( (one)/(3*one) );
2999 A(1,2) = as<Scalar>( (-one)/(24*one) );
3000 A(2,0) = as<Scalar>( (one)/(6*one) );
3001 A(2,1) = as<Scalar>( (2*one)/(3*one) );
3002 A(2,2) = as<Scalar>( (1*one)/(6*one) );
3003 b(0) = as<Scalar>( (one)/(6*one) );
3004 b(1) = as<Scalar>( (2*one)/(3*one) );
3005 b(2) = as<Scalar>( (1*one)/(6*one) );
3007 c(1) = as<Scalar>( one/(2*one) );
3014 {
return "RK Implicit 3 Stage 4th order Lobatto A"; }
3019 template<
class Scalar>
3027 typedef Teuchos::ScalarTraits<Scalar> ST;
3028 std::ostringstream Description;
3031 <<
"Solving Ordinary Differential Equations II:\n"
3032 <<
"Stiff and Differential-Algebraic Problems,\n"
3033 <<
"2nd Revised Edition\n"
3034 <<
"E. Hairer and G. Wanner\n"
3035 <<
"Table 5.8, pg 75\n"
3036 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
3037 <<
"A = [ A1 A2 A3 A4 ]\n"
3039 <<
" [ (11+sqrt(5)/120 ]\n"
3040 <<
" [ (11-sqrt(5)/120 ]\n"
3043 <<
" [ (25-sqrt(5))/120 ]\n"
3044 <<
" [ (25+13*sqrt(5))/120 ]\n"
3047 <<
" [ (25-13*sqrt(5))/120 ]\n"
3048 <<
" [ (25+sqrt(5))/120 ]\n"
3051 <<
" [ (-1+sqrt(5))/120 ]\n"
3052 <<
" [ (-1-sqrt(5))/120 ]\n"
3054 <<
"b = [ 1/12 5/12 5/12 1/12 ]'" << std::endl;
3055 typedef Teuchos::ScalarTraits<Scalar> ST;
3057 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3058 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3059 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3060 const Scalar zero = ST::zero();
3061 const Scalar one = ST::one();
3066 A(1,0) = as<Scalar>( (11*one+ST::squareroot(5*one))/(120*one) );
3067 A(1,1) = as<Scalar>( (25*one-ST::squareroot(5*one))/(120*one) );
3068 A(1,2) = as<Scalar>( (25*one-13*one*ST::squareroot(5*one))/(120*one) );
3069 A(1,3) = as<Scalar>( (-one+ST::squareroot(5*one))/(120*one) );
3070 A(2,0) = as<Scalar>( (11*one-ST::squareroot(5*one))/(120*one) );
3071 A(2,1) = as<Scalar>( (25*one+13*one*ST::squareroot(5*one))/(120*one) );
3072 A(2,2) = as<Scalar>( (25*one+ST::squareroot(5*one))/(120*one) );
3073 A(2,3) = as<Scalar>( (-one-ST::squareroot(5*one))/(120*one) );
3074 A(3,0) = as<Scalar>( one/(12*one) );
3075 A(3,1) = as<Scalar>( 5*one/(12*one) );
3076 A(3,2) = as<Scalar>( 5*one/(12*one) );
3077 A(3,3) = as<Scalar>( one/(12*one) );
3078 b(0) = as<Scalar>( one/(12*one) );
3079 b(1) = as<Scalar>( 5*one/(12*one) );
3080 b(2) = as<Scalar>( 5*one/(12*one) );
3081 b(3) = as<Scalar>( one/(12*one) );
3083 c(1) = as<Scalar>( (5*one-ST::squareroot(5))/(10*one) );
3084 c(2) = as<Scalar>( (5*one+ST::squareroot(5))/(10*one) );
3091 {
return "RK Implicit 4 Stage 6th order Lobatto A"; }
3096 template<
class Scalar>
3103 std::ostringstream Description;
3106 <<
"Solving Ordinary Differential Equations II:\n"
3107 <<
"Stiff and Differential-Algebraic Problems,\n"
3108 <<
"2nd Revised Edition\n"
3109 <<
"E. Hairer and G. Wanner\n"
3110 <<
"Table 5.9, pg 76\n"
3112 <<
"A = [ 1/2 0 ]\n"
3114 <<
"b = [ 1/2 1/2 ]'" << std::endl;
3115 typedef Teuchos::ScalarTraits<Scalar> ST;
3118 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3119 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3120 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3121 const Scalar zero = ST::zero();
3122 const Scalar one = ST::one();
3123 A(0,0) = as<Scalar>( one/(2*one) );
3125 A(1,0) = as<Scalar>( one/(2*one) );
3127 b(0) = as<Scalar>( one/(2*one) );
3128 b(1) = as<Scalar>( one/(2*one) );
3136 {
return "RK Implicit 2 Stage 2nd order Lobatto B"; }
3141 template<
class Scalar>
3148 std::ostringstream Description;
3151 <<
"Solving Ordinary Differential Equations II:\n"
3152 <<
"Stiff and Differential-Algebraic Problems,\n"
3153 <<
"2nd Revised Edition\n"
3154 <<
"E. Hairer and G. Wanner\n"
3155 <<
"Table 5.9, pg 76\n"
3156 <<
"c = [ 0 1/2 1 ]'\n"
3157 <<
"A = [ 1/6 -1/6 0 ]\n"
3158 <<
" [ 1/6 1/3 0 ]\n"
3159 <<
" [ 1/6 5/6 0 ]\n"
3160 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
3161 typedef Teuchos::ScalarTraits<Scalar> ST;
3164 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3165 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3166 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3167 const Scalar zero = ST::zero();
3168 const Scalar one = ST::one();
3169 A(0,0) = as<Scalar>( one/(6*one) );
3170 A(0,1) = as<Scalar>( -one/(6*one) );
3172 A(1,0) = as<Scalar>( one/(6*one) );
3173 A(1,1) = as<Scalar>( one/(3*one) );
3175 A(2,0) = as<Scalar>( one/(6*one) );
3176 A(2,1) = as<Scalar>( 5*one/(6*one) );
3178 b(0) = as<Scalar>( one/(6*one) );
3179 b(1) = as<Scalar>( 2*one/(3*one) );
3180 b(2) = as<Scalar>( one/(6*one) );
3182 c(1) = as<Scalar>( one/(2*one) );
3189 {
return "RK Implicit 3 Stage 4th order Lobatto B"; }
3194 template<
class Scalar>
3201 std::ostringstream Description;
3204 <<
"Solving Ordinary Differential Equations II:\n"
3205 <<
"Stiff and Differential-Algebraic Problems,\n"
3206 <<
"2nd Revised Edition\n"
3207 <<
"E. Hairer and G. Wanner\n"
3208 <<
"Table 5.10, pg 76\n"
3209 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
3210 <<
"A = [ 1/12 (-1-sqrt(5))/24 (-1+sqrt(5))/24 0 ]\n"
3211 <<
" [ 1/12 (25+sqrt(5))/120 (25-13*sqrt(5))/120 0 ]\n"
3212 <<
" [ 1/12 (25+13*sqrt(5))/120 (25-sqrt(5))/120 0 ]\n"
3213 <<
" [ 1/12 (11-sqrt(5))/24 (11+sqrt(5))/24 0 ]\n"
3214 <<
"b = [ 1/12 5/12 5/12 1/12 ]'"
3216 typedef Teuchos::ScalarTraits<Scalar> ST;
3219 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3220 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3221 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3222 const Scalar zero = ST::zero();
3223 const Scalar one = ST::one();
3224 A(0,0) = as<Scalar>( one/(12*one) );
3225 A(0,1) = as<Scalar>( (-one-ST::squareroot(5))/(24*one) );
3226 A(0,2) = as<Scalar>( (-one+ST::squareroot(5))/(24*one) );
3228 A(1,0) = as<Scalar>( one/(12*one) );
3229 A(1,1) = as<Scalar>( (25*one+ST::squareroot(5))/(120*one) );
3230 A(1,2) = as<Scalar>( (25*one-13*one*ST::squareroot(5))/(120*one) );
3232 A(2,0) = as<Scalar>( one/(12*one) );
3233 A(2,1) = as<Scalar>( (25*one+13*one*ST::squareroot(5))/(120*one) );
3234 A(2,2) = as<Scalar>( (25*one-ST::squareroot(5))/(120*one) );
3236 A(3,0) = as<Scalar>( one/(12*one) );
3237 A(3,1) = as<Scalar>( (11*one-ST::squareroot(5*one))/(24*one) );
3238 A(3,2) = as<Scalar>( (11*one+ST::squareroot(5*one))/(24*one) );
3240 b(0) = as<Scalar>( one/(12*one) );
3241 b(1) = as<Scalar>( 5*one/(12*one) );
3242 b(2) = as<Scalar>( 5*one/(12*one) );
3243 b(3) = as<Scalar>( one/(12*one) );
3245 c(1) = as<Scalar>( (5*one-ST::squareroot(5*one))/(10*one) );
3246 c(2) = as<Scalar>( (5*one+ST::squareroot(5*one))/(10*one) );
3253 {
return "RK Implicit 4 Stage 6th order Lobatto B"; }
3258 template<
class Scalar>
3265 std::ostringstream Description;
3268 <<
"Solving Ordinary Differential Equations II:\n"
3269 <<
"Stiff and Differential-Algebraic Problems,\n"
3270 <<
"2nd Revised Edition\n"
3271 <<
"E. Hairer and G. Wanner\n"
3272 <<
"Table 5.11, pg 76\n"
3274 <<
"A = [ 1/2 -1/2 ]\n"
3276 <<
"b = [ 1/2 1/2 ]'" << std::endl;
3277 typedef Teuchos::ScalarTraits<Scalar> ST;
3280 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3281 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3282 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3283 const Scalar zero = ST::zero();
3284 const Scalar one = ST::one();
3285 A(0,0) = as<Scalar>( one/(2*one) );
3286 A(0,1) = as<Scalar>( -one/(2*one) );
3287 A(1,0) = as<Scalar>( one/(2*one) );
3288 A(1,1) = as<Scalar>( one/(2*one) );
3289 b(0) = as<Scalar>( one/(2*one) );
3290 b(1) = as<Scalar>( one/(2*one) );
3298 {
return "RK Implicit 2 Stage 2nd order Lobatto C"; }
3303 template<
class Scalar>
3310 std::ostringstream Description;
3313 <<
"Solving Ordinary Differential Equations II:\n"
3314 <<
"Stiff and Differential-Algebraic Problems,\n"
3315 <<
"2nd Revised Edition\n"
3316 <<
"E. Hairer and G. Wanner\n"
3317 <<
"Table 5.11, pg 76\n"
3318 <<
"c = [ 0 1/2 1 ]'\n"
3319 <<
"A = [ 1/6 -1/3 1/6 ]\n"
3320 <<
" [ 1/6 5/12 -1/12 ]\n"
3321 <<
" [ 1/6 2/3 1/6 ]\n"
3322 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
3323 typedef Teuchos::ScalarTraits<Scalar> ST;
3326 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3327 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3328 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3329 const Scalar zero = ST::zero();
3330 const Scalar one = ST::one();
3331 A(0,0) = as<Scalar>( one/(6*one) );
3332 A(0,1) = as<Scalar>( -one/(3*one) );
3333 A(0,2) = as<Scalar>( one/(6*one) );
3334 A(1,0) = as<Scalar>( one/(6*one) );
3335 A(1,1) = as<Scalar>( 5*one/(12*one) );
3336 A(1,2) = as<Scalar>( -one/(12*one) );
3337 A(2,0) = as<Scalar>( one/(6*one) );
3338 A(2,1) = as<Scalar>( 2*one/(3*one) );
3339 A(2,2) = as<Scalar>( one/(6*one) );
3340 b(0) = as<Scalar>( one/(6*one) );
3341 b(1) = as<Scalar>( 2*one/(3*one) );
3342 b(2) = as<Scalar>( one/(6*one) );
3344 c(1) = as<Scalar>( one/(2*one) );
3351 {
return "RK Implicit 3 Stage 4th order Lobatto C"; }
3356 template<
class Scalar>
3363 std::ostringstream Description;
3366 <<
"Solving Ordinary Differential Equations II:\n"
3367 <<
"Stiff and Differential-Algebraic Problems,\n"
3368 <<
"2nd Revised Edition\n"
3369 <<
"E. Hairer and G. Wanner\n"
3370 <<
"Table 5.12, pg 76\n"
3371 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
3372 <<
"A = [ 1/12 -sqrt(5)/12 sqrt(5)/12 -1/12 ]\n"
3373 <<
" [ 1/12 1/4 (10-7*sqrt(5))/60 sqrt(5)/60 ]\n"
3374 <<
" [ 1/12 (10+7*sqrt(5))/60 1/4 -sqrt(5)/60 ]\n"
3375 <<
" [ 1/12 5/12 5/12 1/12 ]\n"
3376 <<
"b = [ 1/12 5/12 5/12 1/12 ]'"
3378 typedef Teuchos::ScalarTraits<Scalar> ST;
3381 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3382 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3383 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3384 const Scalar zero = ST::zero();
3385 const Scalar one = ST::one();
3386 A(0,0) = as<Scalar>( one/(12*one) );
3387 A(0,1) = as<Scalar>( -ST::squareroot(5*one)/(12*one) );
3388 A(0,2) = as<Scalar>( ST::squareroot(5*one)/(12*one) );
3389 A(0,3) = as<Scalar>( -one/(12*one) );
3390 A(1,0) = as<Scalar>( one/(12*one) );
3391 A(1,1) = as<Scalar>( one/(4*one) );
3392 A(1,2) = as<Scalar>( (10*one-7*one*ST::squareroot(5*one))/(60*one) );
3393 A(1,3) = as<Scalar>( ST::squareroot(5*one)/(60*one) );
3394 A(2,0) = as<Scalar>( one/(12*one) );
3395 A(2,1) = as<Scalar>( (10*one+7*one*ST::squareroot(5*one))/(60*one) );
3396 A(2,2) = as<Scalar>( one/(4*one) );
3397 A(2,3) = as<Scalar>( -ST::squareroot(5*one)/(60*one) );
3398 A(3,0) = as<Scalar>( one/(12*one) );
3399 A(3,1) = as<Scalar>( 5*one/(12*one) );
3400 A(3,2) = as<Scalar>( 5*one/(12*one) );
3401 A(3,3) = as<Scalar>( one/(12*one) );
3402 b(0) = as<Scalar>( one/(12*one) );
3403 b(1) = as<Scalar>( 5*one/(12*one) );
3404 b(2) = as<Scalar>( 5*one/(12*one) );
3405 b(3) = as<Scalar>( one/(12*one) );
3407 c(1) = as<Scalar>( (5*one-ST::squareroot(5*one))/(10*one) );
3408 c(2) = as<Scalar>( (5*one+ST::squareroot(5*one))/(10*one) );
3415 {
return "RK Implicit 4 Stage 6th order Lobatto C"; }
3420 template<
class Scalar>
3427 std::ostringstream Description;
3430 <<
"Solving Ordinary Differential Equations II:\n"
3431 <<
"Stiff and Differential-Algebraic Problems,\n"
3432 <<
"2nd Revised Edition\n"
3433 <<
"E. Hairer and G. Wanner\n"
3435 <<
"c = [ (6-sqrt(6))/10 ]\n"
3436 <<
" [ (6+9*sqrt(6))/35 ]\n"
3438 <<
" [ (4-sqrt(6))/10 ]\n"
3439 <<
" [ (4+sqrt(6))/10 ]\n"
3440 <<
"A = [ A1 A2 A3 A4 A5 ]\n"
3441 <<
" A1 = [ (6-sqrt(6))/10 ]\n"
3442 <<
" [ (-6+5*sqrt(6))/14 ]\n"
3443 <<
" [ (888+607*sqrt(6))/2850 ]\n"
3444 <<
" [ (3153-3082*sqrt(6))/14250 ]\n"
3445 <<
" [ (-32583+14638*sqrt(6))/71250 ]\n"
3447 <<
" [ (6-sqrt(6))/10 ]\n"
3448 <<
" [ (126-161*sqrt(6))/1425 ]\n"
3449 <<
" [ (3213+1148*sqrt(6))/28500 ]\n"
3450 <<
" [ (-17199+364*sqrt(6))/142500 ]\n"
3453 <<
" [ (6-sqrt(6))/10 ]\n"
3454 <<
" [ (-267+88*sqrt(6))/500 ]\n"
3455 <<
" [ (1329-544*sqrt(6))/2500 ]\n"
3459 <<
" [ (6-sqrt(6))/10 ]\n"
3460 <<
" [ (-96+131*sqrt(6))/625 ]\n"
3465 <<
" [ (6-sqrt(6))/10 ]\n"
3469 <<
" [ (16-sqrt(6))/36 ]\n"
3470 <<
" [ (16+sqrt(6))/36 ]" << std::endl;
3476 virtual std::string
description()
const {
return "SDIRK 5 Stage 5th order"; }
3480 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3485 TEUCHOS_TEST_FOR_EXCEPTION(
3486 pl->get<std::string>(
"Stepper Type") != this->description()
3487 ,std::runtime_error,
3489 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
3491 typedef Teuchos::ScalarTraits<Scalar> ST;
3494 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3495 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3496 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3497 const Scalar zero = ST::zero();
3498 const Scalar one = ST::one();
3499 const Scalar sqrt6 = ST::squareroot(as<Scalar>(6*one));
3500 const Scalar gamma = as<Scalar>( (6*one - sqrt6) / (10*one) );
3507 A(1,0) = as<Scalar>( (-6*one+5*one*sqrt6)/(14*one) );
3513 A(2,0) = as<Scalar>( (888*one+607*one*sqrt6)/(2850*one) );
3514 A(2,1) = as<Scalar>( (126*one-161*one*sqrt6)/(1425*one) );
3519 A(3,0) = as<Scalar>( (3153*one-3082*one*sqrt6)/(14250*one) );
3520 A(3,1) = as<Scalar>( (3213*one+1148*one*sqrt6)/(28500*one) );
3521 A(3,2) = as<Scalar>( (-267*one+88*one*sqrt6)/(500*one) );
3525 A(4,0) = as<Scalar>( (-32583*one+14638*one*sqrt6)/(71250*one) );
3526 A(4,1) = as<Scalar>( (-17199*one+364*one*sqrt6)/(142500*one) );
3527 A(4,2) = as<Scalar>( (1329*one-544*one*sqrt6)/(2500*one) );
3528 A(4,3) = as<Scalar>( (-96*one+131*sqrt6)/(625*one) );
3533 b(2) = as<Scalar>( one/(9*one) );
3534 b(3) = as<Scalar>( (16*one-sqrt6)/(36*one) );
3535 b(4) = as<Scalar>( (16*one+sqrt6)/(36*one) );
3538 c(1) = as<Scalar>( (6*one+9*one*sqrt6)/(35*one) );
3540 c(3) = as<Scalar>( (4*one-sqrt6)/(10*one) );
3541 c(4) = as<Scalar>( (4*one+sqrt6)/(10*one) );
3546 this->setMyParamList(pl);
3550 Teuchos::RCP<const Teuchos::ParameterList>
3553 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3554 pl->setName(
"Default Stepper - " + this->
description());
3556 pl->set<std::string>(
"Stepper Type", this->
description());
3557 pl->set<
bool>(
"Use Embedded",
false);
3558 pl->set<std::string>(
"Solver Name",
"",
3559 "Name of ParameterList containing the solver specifications.");
3567 template<
class Scalar>
3574 std::ostringstream Description;
3577 <<
"Solving Ordinary Differential Equations II:\n"
3578 <<
"Stiff and Differential-Algebraic Problems,\n"
3579 <<
"2nd Revised Edition\n"
3580 <<
"E. Hairer and G. Wanner\n"
3582 <<
"c = [ 1/4 3/4 11/20 1/2 1 ]'\n"
3585 <<
" [ 17/50 -1/25 1/4 ]\n"
3586 <<
" [ 371/1360 -137/2720 15/544 1/4 ]\n"
3587 <<
" [ 25/24 -49/48 125/16 -85/12 1/4 ]\n"
3588 <<
"b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'\n"
3589 <<
"b' = [ 59/48 -17/96 225/32 -85/12 0 ]'" << std::endl;
3595 virtual std::string
description()
const {
return "SDIRK 5 Stage 4th order"; }
3599 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3604 TEUCHOS_TEST_FOR_EXCEPTION(
3605 pl->get<std::string>(
"Stepper Type") != this->description()
3606 ,std::runtime_error,
3608 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
3610 typedef Teuchos::ScalarTraits<Scalar> ST;
3613 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3614 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3615 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3616 const Scalar zero = ST::zero();
3617 const Scalar one = ST::one();
3618 const Scalar onequarter = as<Scalar>( one/(4*one) );
3619 A(0,0) = onequarter;
3625 A(1,0) = as<Scalar>( one / (2*one) );
3626 A(1,1) = onequarter;
3631 A(2,0) = as<Scalar>( 17*one/(50*one) );
3632 A(2,1) = as<Scalar>( -one/(25*one) );
3633 A(2,2) = onequarter;
3637 A(3,0) = as<Scalar>( 371*one/(1360*one) );
3638 A(3,1) = as<Scalar>( -137*one/(2720*one) );
3639 A(3,2) = as<Scalar>( 15*one/(544*one) );
3640 A(3,3) = onequarter;
3643 A(4,0) = as<Scalar>( 25*one/(24*one) );
3644 A(4,1) = as<Scalar>( -49*one/(48*one) );
3645 A(4,2) = as<Scalar>( 125*one/(16*one) );
3646 A(4,3) = as<Scalar>( -85*one/(12*one) );
3647 A(4,4) = onequarter;
3649 b(0) = as<Scalar>( 25*one/(24*one) );
3650 b(1) = as<Scalar>( -49*one/(48*one) );
3651 b(2) = as<Scalar>( 125*one/(16*one) );
3652 b(3) = as<Scalar>( -85*one/(12*one) );
3664 c(1) = as<Scalar>( 3*one/(4*one) );
3665 c(2) = as<Scalar>( 11*one/(20*one) );
3666 c(3) = as<Scalar>( one/(2*one) );
3672 this->setMyParamList(pl);
3676 Teuchos::RCP<const Teuchos::ParameterList>
3679 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3680 pl->setName(
"Default Stepper - " + this->
description());
3682 pl->set<std::string>(
"Stepper Type", this->
description());
3683 pl->set<
bool>(
"Use Embedded",
false);
3684 pl->set<std::string>(
"Solver Name",
"",
3685 "Name of ParameterList containing the solver specifications.");
3693 template<
class Scalar>
3700 std::ostringstream Description;
3703 <<
"Solving Ordinary Differential Equations II:\n"
3704 <<
"Stiff and Differential-Algebraic Problems,\n"
3705 <<
"2nd Revised Edition\n"
3706 <<
"E. Hairer and G. Wanner\n"
3708 <<
"gamma = (1/sqrt(3))*cos(pi/18)+1/2\n"
3709 <<
"delta = 1/(6*(2*gamma-1)^2)\n"
3710 <<
"c = [ gamma 1/2 1-gamma ]'\n"
3711 <<
"A = [ gamma ]\n"
3712 <<
" [ 1/2-gamma gamma ]\n"
3713 <<
" [ 2*gamma 1-4*gamma gamma ]\n"
3714 <<
"b = [ delta 1-2*delta delta ]'" << std::endl;
3720 virtual std::string
description()
const {
return "SDIRK 3 Stage 4th order"; }
3724 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3729 TEUCHOS_TEST_FOR_EXCEPTION(
3730 pl->get<std::string>(
"Stepper Type") != this->description()
3731 ,std::runtime_error,
3733 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
3735 typedef Teuchos::ScalarTraits<Scalar> ST;
3738 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3739 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3740 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3741 const Scalar zero = ST::zero();
3742 const Scalar one = ST::one();
3743 const Scalar pi = as<Scalar>(4*one)*std::atan(one);
3744 const Scalar gamma = as<Scalar>( one/ST::squareroot(3*one)*std::cos(pi/(18*one))+one/(2*one) );
3745 const Scalar delta = as<Scalar>( one/(6*one*std::pow(2*gamma-one,2*one)) );
3750 A(1,0) = as<Scalar>( one/(2*one) - gamma );
3754 A(2,0) = as<Scalar>( 2*gamma );
3755 A(2,1) = as<Scalar>( one - 4*gamma );
3759 b(1) = as<Scalar>( one-2*delta );
3763 c(1) = as<Scalar>( one/(2*one) );
3764 c(2) = as<Scalar>( one - gamma );
3769 this->setMyParamList(pl);
3773 Teuchos::RCP<const Teuchos::ParameterList>
3776 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3777 pl->setName(
"Default Stepper - " + this->
description());
3779 pl->set<std::string>(
"Stepper Type", this->
description());
3780 pl->set<
bool>(
"Use Embedded",
false);
3781 pl->set<std::string>(
"Solver Name",
"",
3782 "Name of ParameterList containing the solver specifications.");
3806 template<
class Scalar>
3813 std::ostringstream Description;
3818 <<
"b = [ 1/2 1/2 ]\n"
3819 <<
"bstar = [ 1 0 ]\n" << std::endl;
3828 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3833 TEUCHOS_TEST_FOR_EXCEPTION(
3834 pl->get<std::string>(
"Stepper Type") != this->description()
3835 ,std::runtime_error,
3837 " Stepper Type = " + pl->get<std::string>(
"Stepper Type"));
3839 typedef Teuchos::ScalarTraits<Scalar> ST;
3842 Teuchos::SerialDenseMatrix<int,Scalar>
A(NumStages,NumStages);
3843 Teuchos::SerialDenseVector<int,Scalar>
b(NumStages);
3844 Teuchos::SerialDenseVector<int,Scalar>
c(NumStages);
3845 Teuchos::SerialDenseVector<int,Scalar>
bstar(NumStages);
3847 const Scalar one = ST::one();
3848 const Scalar zero = ST::zero();
3859 b(0) = as<Scalar>(one/(2*one));
3860 b(1) = as<Scalar>(one/(2*one));
3872 this->setMyParamList(pl);
3876 Teuchos::RCP<const Teuchos::ParameterList>
3879 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
3880 pl->setName(
"Default Stepper - " + this->
description());
3882 pl->set<std::string>(
"Stepper Type", this->
description());
3883 pl->set<
bool>(
"Use Embedded",
false);
3884 pl->set<std::string>(
"Solver Name",
"",
3885 "Name of ParameterList containing the solver specifications.");
3895 #endif // Tempus_RKButcherTableau_hpp