30 #ifndef RYTHMOS_RK_BUTCHER_TABLEAU_HPP
31 #define RYTHMOS_RK_BUTCHER_TABLEAU_HPP
33 #include "Rythmos_Types.hpp"
34 #include "Rythmos_RKButcherTableauBase.hpp"
36 #include "Teuchos_Assert.hpp"
37 #include "Teuchos_as.hpp"
38 #include "Teuchos_StandardParameterEntryValidators.hpp"
39 #include "Teuchos_Describable.hpp"
40 #include "Teuchos_VerboseObject.hpp"
41 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
42 #include "Teuchos_ParameterListAcceptor.hpp"
43 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
45 #include "Thyra_ProductVectorBase.hpp"
51 inline const std::string RKBT_ForwardEuler_name() {
return "Forward Euler"; }
52 inline const std::string RKBT_BackwardEuler_name() {
return "Backward Euler"; }
53 inline const std::string Explicit4Stage_name() {
return "Explicit 4 Stage"; }
54 inline const std::string Explicit3_8Rule_name() {
return "Explicit 3/8 Rule"; }
56 inline const std::string ExplicitTrapezoidal_name() {
return "Explicit Trapezoidal"; }
57 inline const std::string Explicit2Stage2ndOrderRunge_name() {
return "Explicit 2 Stage 2nd order by Runge"; }
58 inline const std::string Explicit3Stage3rdOrderHeun_name() {
return "Explicit 3 Stage 3rd order by Heun"; }
59 inline const std::string Explicit3Stage3rdOrder_name() {
return "Explicit 3 Stage 3rd order"; }
60 inline const std::string Explicit3Stage3rdOrderTVD_name() {
return "Explicit 3 Stage 3rd order TVD"; }
61 inline const std::string Explicit4Stage3rdOrderRunge_name() {
return "Explicit 4 Stage 3rd order by Runge"; }
63 inline const std::string Implicit1Stage2ndOrderGauss_name() {
return "Implicit 1 Stage 2nd order Gauss"; }
64 inline const std::string Implicit2Stage4thOrderGauss_name() {
return "Implicit 2 Stage 4th order Gauss"; }
65 inline const std::string Implicit3Stage6thOrderGauss_name() {
return "Implicit 3 Stage 6th order Gauss"; }
67 inline const std::string Implicit1Stage1stOrderRadauA_name() {
return "Implicit 1 Stage 1st order Radau left"; }
68 inline const std::string Implicit2Stage3rdOrderRadauA_name() {
return "Implicit 2 Stage 3rd order Radau left"; }
69 inline const std::string Implicit3Stage5thOrderRadauA_name() {
return "Implicit 3 Stage 5th order Radau left"; }
71 inline const std::string Implicit1Stage1stOrderRadauB_name() {
return "Implicit 1 Stage 1st order Radau right"; }
72 inline const std::string Implicit2Stage3rdOrderRadauB_name() {
return "Implicit 2 Stage 3rd order Radau right"; }
73 inline const std::string Implicit3Stage5thOrderRadauB_name() {
return "Implicit 3 Stage 5th order Radau right"; }
75 inline const std::string Implicit2Stage2ndOrderLobattoA_name() {
return "Implicit 2 Stage 2nd order Lobatto A"; }
76 inline const std::string Implicit3Stage4thOrderLobattoA_name() {
return "Implicit 3 Stage 4th order Lobatto A"; }
77 inline const std::string Implicit4Stage6thOrderLobattoA_name() {
return "Implicit 4 Stage 6th order Lobatto A"; }
79 inline const std::string Implicit2Stage2ndOrderLobattoB_name() {
return "Implicit 2 Stage 2nd order Lobatto B"; }
80 inline const std::string Implicit3Stage4thOrderLobattoB_name() {
return "Implicit 3 Stage 4th order Lobatto B"; }
81 inline const std::string Implicit4Stage6thOrderLobattoB_name() {
return "Implicit 4 Stage 6th order Lobatto B"; }
83 inline const std::string Implicit2Stage2ndOrderLobattoC_name() {
return "Implicit 2 Stage 2nd order Lobatto C"; }
84 inline const std::string Implicit3Stage4thOrderLobattoC_name() {
return "Implicit 3 Stage 4th order Lobatto C"; }
85 inline const std::string Implicit4Stage6thOrderLobattoC_name() {
return "Implicit 4 Stage 6th order Lobatto C"; }
87 inline const std::string Implicit2Stage4thOrderHammerHollingsworth_name() {
return "Implicit 2 Stage 4th Order Hammer & Hollingsworth"; }
88 inline const std::string Implicit3Stage6thOrderKuntzmannButcher_name() {
return "Implicit 3 Stage 6th Order Kuntzmann & Butcher"; }
89 inline const std::string Implicit4Stage8thOrderKuntzmannButcher_name() {
return "Implicit 4 Stage 8th Order Kuntzmann & Butcher"; }
91 inline const std::string DIRK2Stage3rdOrder_name() {
return "Diagonal IRK 2 Stage 3rd order"; }
93 inline const std::string SDIRK2Stage2ndOrder_name() {
return "Singly Diagonal IRK 2 Stage 2nd order"; }
94 inline const std::string SDIRK2Stage3rdOrder_name() {
return "Singly Diagonal IRK 2 Stage 3rd order"; }
95 inline const std::string SDIRK5Stage5thOrder_name() {
return "Singly Diagonal IRK 5 Stage 5th order"; }
96 inline const std::string SDIRK5Stage4thOrder_name() {
return "Singly Diagonal IRK 5 Stage 4th order"; }
97 inline const std::string SDIRK3Stage4thOrder_name() {
return "Singly Diagonal IRK 3 Stage 4th order"; }
99 template<
class Scalar>
100 class RKButcherTableauDefaultBase :
101 virtual public RKButcherTableauBase<Scalar>,
102 virtual public Teuchos::ParameterListAcceptorDefaultBase
106 virtual int numStages()
const {
return A_.numRows(); }
108 virtual const Teuchos::SerialDenseMatrix<int,Scalar>& A()
const {
return A_; }
110 virtual const Teuchos::SerialDenseVector<int,Scalar>& b()
const {
return b_; }
112 virtual const Teuchos::SerialDenseVector<int,Scalar>& c()
const {
return c_; }
114 virtual int order()
const {
return order_; }
116 virtual void setDescription(std::string longDescription) { longDescription_ = longDescription; }
119 virtual void initialize(
120 const Teuchos::SerialDenseMatrix<int,Scalar>& A_in,
121 const Teuchos::SerialDenseVector<int,Scalar>& b_in,
122 const Teuchos::SerialDenseVector<int,Scalar>& c_in,
124 const std::string& longDescription_in
127 const int numStages_in = A_in.numRows();
128 TEUCHOS_ASSERT_EQUALITY( A_in.numRows(), numStages_in );
129 TEUCHOS_ASSERT_EQUALITY( A_in.numCols(), numStages_in );
130 TEUCHOS_ASSERT_EQUALITY( b_in.length(), numStages_in );
131 TEUCHOS_ASSERT_EQUALITY( c_in.length(), numStages_in );
132 TEUCHOS_ASSERT( order_in > 0 );
137 longDescription_ = longDescription_in;
144 virtual void setParameterList(RCP<Teuchos::ParameterList>
const& paramList)
146 TEUCHOS_TEST_FOR_EXCEPT( is_null(paramList) );
147 paramList->validateParameters(*this->getValidParameters());
148 Teuchos::readVerboseObjectSublist(&*paramList,
this);
149 setMyParamList(paramList);
153 virtual RCP<const Teuchos::ParameterList> getValidParameters()
const
155 if (is_null(validPL_)) {
156 validPL_ = Teuchos::parameterList();
157 validPL_->set(
"Description",
"",this->getMyDescription());
158 Teuchos::setupVerboseObjectSublist(&*validPL_);
169 virtual std::string description()
const {
return "Rythmos::RKButcherTableauDefaultBase"; }
172 virtual void describe(
173 Teuchos::FancyOStream &out,
174 const Teuchos::EVerbosityLevel verbLevel
177 if (verbLevel != Teuchos::VERB_NONE) {
178 out << this->description() << std::endl;
179 out << this->getMyDescription() << std::endl;
180 out <<
"number of Stages = " << this->numStages() << std::endl;
181 out <<
"A = " << this->A() << std::endl;
182 out <<
"b = " << this->b() << std::endl;
183 out <<
"c = " << this->c() << std::endl;
184 out <<
"order = " << this->order() << std::endl;
191 void setMyDescription(std::string longDescription) { longDescription_ = longDescription; }
192 const std::string& getMyDescription()
const {
return longDescription_; }
194 void setMy_A(
const Teuchos::SerialDenseMatrix<int,Scalar>& new_A) { A_ = new_A; }
195 void setMy_b(
const Teuchos::SerialDenseVector<int,Scalar>& new_b) { b_ = new_b; }
196 void setMy_c(
const Teuchos::SerialDenseVector<int,Scalar>& new_c) { c_ = new_c; }
197 void setMy_order(
const int& new_order) { order_ = new_order; }
199 void setMyValidParameterList(
const RCP<ParameterList> validPL ) { validPL_ = validPL; }
200 RCP<ParameterList> getMyNonconstValidParameterList() {
return validPL_; }
203 Teuchos::SerialDenseMatrix<int,Scalar> A_;
204 Teuchos::SerialDenseVector<int,Scalar> b_;
205 Teuchos::SerialDenseVector<int,Scalar> c_;
207 std::string longDescription_;
208 mutable RCP<ParameterList> validPL_;
213 template<
class Scalar>
214 RCP<RKButcherTableauBase<Scalar> > rKButcherTableau()
216 return(rcp(
new RKButcherTableauDefaultBase<Scalar>()));
220 template<
class Scalar>
221 RCP<RKButcherTableauBase<Scalar> > rKButcherTableau(
222 const Teuchos::SerialDenseMatrix<int,Scalar>& A_in,
223 const Teuchos::SerialDenseVector<int,Scalar>& b_in,
224 const Teuchos::SerialDenseVector<int,Scalar>& c_in,
226 const std::string& description_in =
""
229 RCP<RKButcherTableauDefaultBase<Scalar> > rkbt = rcp(
new RKButcherTableauDefaultBase<Scalar>());
230 rkbt->initialize(A_in,b_in,c_in,order_in,description_in);
235 template<
class Scalar>
236 class BackwardEuler_RKBT :
237 virtual public RKButcherTableauDefaultBase<Scalar>
242 std::ostringstream myDescription;
243 myDescription << RKBT_BackwardEuler_name() <<
"\n"
246 <<
"b = [ 1 ]'" << std::endl;
247 typedef ScalarTraits<Scalar> ST;
248 Teuchos::SerialDenseMatrix<int,Scalar> myA(1,1);
249 myA(0,0) = ST::one();
250 Teuchos::SerialDenseVector<int,Scalar> myb(1);
252 Teuchos::SerialDenseVector<int,Scalar> myc(1);
255 this->setMyDescription(myDescription.str());
259 this->setMy_order(1);
265 template<
class Scalar>
266 class ForwardEuler_RKBT :
267 virtual public RKButcherTableauDefaultBase<Scalar>
273 std::ostringstream myDescription;
274 myDescription << RKBT_ForwardEuler_name() <<
"\n"
277 <<
"b = [ 1 ]'" << std::endl;
278 typedef ScalarTraits<Scalar> ST;
279 Teuchos::SerialDenseMatrix<int,Scalar> myA(1,1);
280 Teuchos::SerialDenseVector<int,Scalar> myb(1);
282 Teuchos::SerialDenseVector<int,Scalar> myc(1);
284 this->setMyDescription(myDescription.str());
288 this->setMy_order(1);
293 template<
class Scalar>
294 class Explicit4Stage4thOrder_RKBT :
295 virtual public RKButcherTableauDefaultBase<Scalar>
298 Explicit4Stage4thOrder_RKBT()
300 std::ostringstream myDescription;
301 myDescription << Explicit4Stage_name() <<
"\n"
302 <<
"\"The\" Runge-Kutta Method (explicit):\n"
303 <<
"Solving Ordinary Differential Equations I:\n"
304 <<
"Nonstiff Problems, 2nd Revised Edition\n"
305 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
306 <<
"Table 1.2, pg 138\n"
307 <<
"c = [ 0 1/2 1/2 1 ]'\n"
312 <<
"b = [ 1/6 1/3 1/3 1/6 ]'" << std::endl;
313 typedef ScalarTraits<Scalar> ST;
314 Scalar one = ST::one();
315 Scalar zero = ST::zero();
316 Scalar onehalf = ST::one()/(2*ST::one());
317 Scalar onesixth = ST::one()/(6*ST::one());
318 Scalar onethird = ST::one()/(3*ST::one());
321 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
322 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
323 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
358 this->setMyDescription(myDescription.str());
362 this->setMy_order(4);
367 template<
class Scalar>
368 class Explicit3_8Rule_RKBT :
369 virtual public RKButcherTableauDefaultBase<Scalar>
372 Explicit3_8Rule_RKBT()
375 std::ostringstream myDescription;
376 myDescription << Explicit3_8Rule_name() <<
"\n"
377 <<
"Solving Ordinary Differential Equations I:\n"
378 <<
"Nonstiff Problems, 2nd Revided Edition\n"
379 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
380 <<
"Table 1.2, pg 138\n"
381 <<
"c = [ 0 1/3 2/3 1 ]'\n"
386 <<
"b = [ 1/8 3/8 3/8 1/8 ]'" << std::endl;
387 typedef ScalarTraits<Scalar> ST;
389 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
390 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
391 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
393 Scalar one = ST::one();
394 Scalar zero = ST::zero();
395 Scalar one_third = as<Scalar>(ST::one()/(3*ST::one()));
396 Scalar two_third = as<Scalar>(2*ST::one()/(3*ST::one()));
397 Scalar one_eighth = as<Scalar>(ST::one()/(8*ST::one()));
398 Scalar three_eighth = as<Scalar>(3*ST::one()/(8*ST::one()));
406 myA(1,0) = one_third;
411 myA(2,0) = as<Scalar>(-one_third);
417 myA(3,1) = as<Scalar>(-one);
423 myb(1) = three_eighth;
424 myb(2) = three_eighth;
433 this->setMyDescription(myDescription.str());
437 this->setMy_order(4);
442 template<
class Scalar>
443 class Explicit4Stage3rdOrderRunge_RKBT :
444 virtual public RKButcherTableauDefaultBase<Scalar>
447 Explicit4Stage3rdOrderRunge_RKBT()
450 std::ostringstream myDescription;
451 myDescription << Explicit4Stage3rdOrderRunge_name() <<
"\n"
452 <<
"Solving Ordinary Differential Equations I:\n"
453 <<
"Nonstiff Problems, 2nd Revided Edition\n"
454 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
455 <<
"Table 1.1, pg 135\n"
456 <<
"c = [ 0 1/2 1 1 ]'\n"
461 <<
"b = [ 1/6 2/3 0 1/6 ]'" << std::endl;
462 typedef ScalarTraits<Scalar> ST;
464 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
465 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
466 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
468 Scalar one = ST::one();
469 Scalar onehalf = ST::one()/(2*ST::one());
470 Scalar onesixth = ST::one()/(6*ST::one());
471 Scalar twothirds = 2*ST::one()/(3*ST::one());
472 Scalar zero = ST::zero();
507 this->setMyDescription(myDescription.str());
511 this->setMy_order(3);
516 template<
class Scalar>
517 class Explicit3Stage3rdOrder_RKBT :
518 virtual public RKButcherTableauDefaultBase<Scalar>
521 Explicit3Stage3rdOrder_RKBT()
524 std::ostringstream myDescription;
525 myDescription << Explicit3Stage3rdOrder_name() <<
"\n"
526 <<
"c = [ 0 1/2 1 ]'\n"
530 <<
"b = [ 1/6 4/6 1/6 ]'" << std::endl;
531 typedef ScalarTraits<Scalar> ST;
532 Scalar one = ST::one();
533 Scalar two = as<Scalar>(2*ST::one());
534 Scalar zero = ST::zero();
535 Scalar onehalf = ST::one()/(2*ST::one());
536 Scalar onesixth = ST::one()/(6*ST::one());
537 Scalar foursixth = 4*ST::one()/(6*ST::one());
540 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
541 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
542 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
567 this->setMyDescription(myDescription.str());
571 this->setMy_order(3);
576 template<
class Scalar>
577 class Explicit3Stage3rdOrderTVD_RKBT :
578 virtual public RKButcherTableauDefaultBase<Scalar>
581 Explicit3Stage3rdOrderTVD_RKBT()
584 std::ostringstream myDescription;
585 myDescription << Explicit3Stage3rdOrderTVD_name() <<
"\n"
586 <<
"Sigal Gottlieb and Chi-Wang Shu\n"
587 <<
"'Total Variation Diminishing Runge-Kutta Schemes'\n"
588 <<
"Mathematics of Computation\n"
589 <<
"Volume 67, Number 221, January 1998, pp. 73-85\n"
590 <<
"c = [ 0 1 1/2 ]'\n"
593 <<
" [ 1/4 1/4 0 ]\n"
594 <<
"b = [ 1/6 1/6 4/6 ]'" << std::endl;
595 typedef ScalarTraits<Scalar> ST;
596 Scalar one = ST::one();
597 Scalar zero = ST::zero();
598 Scalar onehalf = ST::one()/(2*ST::one());
599 Scalar onefourth = ST::one()/(4*ST::one());
600 Scalar onesixth = ST::one()/(6*ST::one());
601 Scalar foursixth = 4*ST::one()/(6*ST::one());
604 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
605 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
606 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
617 myA(2,0) = onefourth;
618 myA(2,1) = onefourth;
631 this->setMyDescription(myDescription.str());
635 this->setMy_order(3);
640 template<
class Scalar>
641 class Explicit3Stage3rdOrderHeun_RKBT :
642 virtual public RKButcherTableauDefaultBase<Scalar>
645 Explicit3Stage3rdOrderHeun_RKBT()
647 std::ostringstream myDescription;
648 myDescription << Explicit3Stage3rdOrderHeun_name() <<
"\n"
649 <<
"Solving Ordinary Differential Equations I:\n"
650 <<
"Nonstiff Problems, 2nd Revided Edition\n"
651 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
652 <<
"Table 1.1, pg 135\n"
653 <<
"c = [ 0 1/3 2/3 ]'\n"
657 <<
"b = [ 1/4 0 3/4 ]'" << std::endl;
658 typedef ScalarTraits<Scalar> ST;
659 Scalar one = ST::one();
660 Scalar zero = ST::zero();
661 Scalar onethird = one/(3*one);
662 Scalar twothirds = 2*one/(3*one);
663 Scalar onefourth = one/(4*one);
664 Scalar threefourths = 3*one/(4*one);
667 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
668 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
669 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
681 myA(2,1) = twothirds;
687 myb(2) = threefourths;
694 this->setMyDescription(myDescription.str());
698 this->setMy_order(3);
703 template<
class Scalar>
704 class Explicit2Stage2ndOrderRunge_RKBT :
705 virtual public RKButcherTableauDefaultBase<Scalar>
708 Explicit2Stage2ndOrderRunge_RKBT()
710 std::ostringstream myDescription;
711 myDescription << Explicit2Stage2ndOrderRunge_name() <<
"\n"
712 <<
"Also known as Explicit Midpoint\n"
713 <<
"Solving Ordinary Differential Equations I:\n"
714 <<
"Nonstiff Problems, 2nd Revided Edition\n"
715 <<
"E. Hairer, S.P. Norsett, G. Wanner\n"
716 <<
"Table 1.1, pg 135\n"
717 <<
"c = [ 0 1/2 ]'\n"
720 <<
"b = [ 0 1 ]'" << std::endl;
721 typedef ScalarTraits<Scalar> ST;
722 Scalar one = ST::one();
723 Scalar zero = ST::zero();
724 Scalar onehalf = ST::one()/(2*ST::one());
727 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
728 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
729 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
746 this->setMyDescription(myDescription.str());
750 this->setMy_order(2);
755 template<
class Scalar>
756 class ExplicitTrapezoidal_RKBT :
757 virtual public RKButcherTableauDefaultBase<Scalar>
760 ExplicitTrapezoidal_RKBT()
762 std::ostringstream myDescription;
763 myDescription << ExplicitTrapezoidal_name() <<
"\n"
767 <<
"b = [ 1/2 1/2 ]'" << std::endl;
768 typedef ScalarTraits<Scalar> ST;
769 Scalar one = ST::one();
770 Scalar zero = ST::zero();
771 Scalar onehalf = ST::one()/(2*ST::one());
774 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
775 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
776 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
793 this->setMyDescription(myDescription.str());
797 this->setMy_order(2);
802 template<
class Scalar>
803 class SDIRK2Stage2ndOrder_RKBT :
804 virtual public RKButcherTableauDefaultBase<Scalar>
807 SDIRK2Stage2ndOrder_RKBT()
809 std::ostringstream myDescription;
810 myDescription << SDIRK2Stage2ndOrder_name() <<
"\n"
811 <<
"Computer Methods for ODEs and DAEs\n"
812 <<
"U. M. Ascher and L. R. Petzold\n"
814 <<
"gamma = (2+-sqrt(2))/2\n"
815 <<
"c = [ gamma 1 ]'\n"
816 <<
"A = [ gamma 0 ]\n"
817 <<
" [ 1-gamma gamma ]\n"
818 <<
"b = [ 1-gamma gamma ]'" << std::endl;
820 this->setMyDescription(myDescription.str());
821 typedef ScalarTraits<Scalar> ST;
822 Scalar one = ST::one();
823 gamma_default_ = as<Scalar>( (2*one - ST::squareroot(2*one))/(2*one) );
824 gamma_ = gamma_default_;
827 RCP<ParameterList> validPL = Teuchos::parameterList();
828 validPL->set(
"Description",
"",this->getMyDescription());
829 validPL->set<
double>(
"gamma",gamma_default_,
830 "The default value is gamma = (2-sqrt(2))/2 = 0.29289321881345243. "
831 "This will produce an L-stable 2nd order method with the stage "
832 "times within the timestep. Other values of gamma will still "
833 "produce an L-stable scheme, but will only be 1st order accurate.");
834 Teuchos::setupVerboseObjectSublist(&*validPL);
835 this->setMyValidParameterList(validPL);
839 typedef ScalarTraits<Scalar> ST;
841 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
842 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
843 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
844 Scalar one = ST::one();
845 Scalar zero = ST::zero();
848 myA(1,0) = as<Scalar>( one - gamma_ );
850 myb(0) = as<Scalar>( one - gamma_ );
858 this->setMy_order(2);
860 void setParameterList(RCP<Teuchos::ParameterList>
const& paramList)
862 TEUCHOS_TEST_FOR_EXCEPT( is_null(paramList) );
863 paramList->validateParameters(*this->getValidParameters());
864 Teuchos::readVerboseObjectSublist(&*paramList,
this);
865 gamma_ = paramList->get<
double>(
"gamma",gamma_default_);
867 this->setMyParamList(paramList);
870 Scalar gamma_default_;
877 template<
class Scalar>
878 class SDIRK2Stage3rdOrder_RKBT :
879 virtual public RKButcherTableauDefaultBase<Scalar>
882 SDIRK2Stage3rdOrder_RKBT()
884 std::ostringstream myDescription;
885 myDescription << SDIRK2Stage3rdOrder_name() <<
"\n"
886 <<
"Solving Ordinary Differential Equations I:\n"
887 <<
"Nonstiff Problems, 2nd Revided Edition\n"
888 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
889 <<
"Table 7.2, pg 207\n"
890 <<
"gamma = (3+-sqrt(3))/6 -> 3rd order and A-stable\n"
891 <<
"gamma = (2+-sqrt(2))/2 -> 2nd order and L-stable\n"
892 <<
"c = [ gamma 1-gamma ]'\n"
893 <<
"A = [ gamma 0 ]\n"
894 <<
" [ 1-2*gamma gamma ]\n"
895 <<
"b = [ 1/2 1/2 ]'" << std::endl;
897 this->setMyDescription(myDescription.str());
898 thirdOrderAStable_default_ =
true;
899 secondOrderLStable_default_ =
false;
900 thirdOrderAStable_ =
true;
901 secondOrderLStable_ =
false;
902 typedef ScalarTraits<Scalar> ST;
903 Scalar one = ST::one();
904 gamma_default_ = as<Scalar>( (3*one + ST::squareroot(3*one))/(6*one) );
905 gamma_ = gamma_default_;
908 RCP<ParameterList> validPL = Teuchos::parameterList();
909 validPL->set(
"Description",
"",this->getMyDescription());
910 validPL->set(
"3rd Order A-stable",thirdOrderAStable_default_,
911 "If true, set gamma to gamma = (3+sqrt(3))/6 to obtain "
912 "a 3rd order A-stable scheme. '3rd Order A-stable' and "
913 "'2nd Order L-stable' can not both be true.");
914 validPL->set(
"2nd Order L-stable",secondOrderLStable_default_,
915 "If true, set gamma to gamma = (2+sqrt(2))/2 to obtain "
916 "a 2nd order L-stable scheme. '3rd Order A-stable' and "
917 "'2nd Order L-stable' can not both be true.");
918 validPL->set(
"gamma",gamma_default_,
919 "If both '3rd Order A-stable' and '2nd Order L-stable' "
920 "are false, gamma will be used. The default value is the "
921 "'3rd Order A-stable' gamma value, (3+sqrt(3))/6.");
923 Teuchos::setupVerboseObjectSublist(&*validPL);
924 this->setMyValidParameterList(validPL);
928 typedef ScalarTraits<Scalar> ST;
930 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
931 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
932 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
933 Scalar one = ST::one();
934 Scalar zero = ST::zero();
936 if (thirdOrderAStable_)
937 gamma = as<Scalar>( (3*one + ST::squareroot(3*one))/(6*one) );
938 else if (secondOrderLStable_)
939 gamma = as<Scalar>( (2*one + ST::squareroot(2*one))/(2*one) );
944 myA(1,0) = as<Scalar>( one - 2*gamma );
946 myb(0) = as<Scalar>( one/(2*one) );
947 myb(1) = as<Scalar>( one/(2*one) );
949 myc(1) = as<Scalar>( one - gamma );
954 this->setMy_order(3);
956 void setParameterList(RCP<Teuchos::ParameterList>
const& paramList)
958 TEUCHOS_TEST_FOR_EXCEPT( is_null(paramList) );
959 paramList->validateParameters(*this->getValidParameters());
960 Teuchos::readVerboseObjectSublist(&*paramList,
this);
961 thirdOrderAStable_ = paramList->get(
"3rd Order A-stable",
962 thirdOrderAStable_default_);
963 secondOrderLStable_ = paramList->get(
"2nd Order L-stable",
964 secondOrderLStable_default_);
965 TEUCHOS_TEST_FOR_EXCEPTION(
966 thirdOrderAStable_ && secondOrderLStable_, std::logic_error,
967 "'3rd Order A-stable' and '2nd Order L-stable' can not both be true.");
968 gamma_ = paramList->get(
"gamma",gamma_default_);
971 this->setMyParamList(paramList);
974 bool thirdOrderAStable_default_;
975 bool thirdOrderAStable_;
976 bool secondOrderLStable_default_;
977 bool secondOrderLStable_;
978 Scalar gamma_default_;
983 template<
class Scalar>
984 class DIRK2Stage3rdOrder_RKBT :
985 virtual public RKButcherTableauDefaultBase<Scalar>
988 DIRK2Stage3rdOrder_RKBT()
991 std::ostringstream myDescription;
992 myDescription << DIRK2Stage3rdOrder_name() <<
"\n"
993 <<
"Hammer & Hollingsworth method\n"
994 <<
"Solving Ordinary Differential Equations I:\n"
995 <<
"Nonstiff Problems, 2nd Revided Edition\n"
996 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
997 <<
"Table 7.1, pg 205\n"
998 <<
"c = [ 0 2/3 ]'\n"
1001 <<
"b = [ 1/4 3/4 ]'" << std::endl;
1002 typedef ScalarTraits<Scalar> ST;
1003 int myNumStages = 2;
1004 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1005 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1006 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1007 Scalar one = ST::one();
1008 Scalar zero = ST::zero();
1011 myA(1,0) = as<Scalar>( one/(3*one) );
1012 myA(1,1) = as<Scalar>( one/(3*one) );
1013 myb(0) = as<Scalar>( one/(4*one) );
1014 myb(1) = as<Scalar>( 3*one/(4*one) );
1016 myc(1) = as<Scalar>( 2*one/(3*one) );
1017 this->setMyDescription(myDescription.str());
1021 this->setMy_order(3);
1026 template<
class Scalar>
1027 class Implicit3Stage6thOrderKuntzmannButcher_RKBT :
1028 virtual public RKButcherTableauDefaultBase<Scalar>
1031 Implicit3Stage6thOrderKuntzmannButcher_RKBT()
1034 std::ostringstream myDescription;
1035 myDescription << Implicit3Stage6thOrderKuntzmannButcher_name() <<
"\n"
1036 <<
"Kuntzmann & Butcher method\n"
1037 <<
"Solving Ordinary Differential Equations I:\n"
1038 <<
"Nonstiff Problems, 2nd Revided Edition\n"
1039 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
1040 <<
"Table 7.4, pg 209\n"
1041 <<
"c = [ 1/2-sqrt(15)/10 1/2 1/2-sqrt(15)/10 ]'\n"
1042 <<
"A = [ 5/36 2/9-sqrt(15)/15 5/36-sqrt(15)/30 ]\n"
1043 <<
" [ 5/36+sqrt(15)/24 2/9 5/36-sqrt(15)/24 ]\n"
1044 <<
" [ 5/36+sqrt(15)/30 2/9+sqrt(15)/15 5/36 ]\n"
1045 <<
"b = [ 5/18 4/9 5/18 ]'" << std::endl;
1046 typedef ScalarTraits<Scalar> ST;
1047 int myNumStages = 3;
1048 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1049 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1050 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1051 Scalar one = ST::one();
1052 myA(0,0) = as<Scalar>( 5*one/(36*one) );
1053 myA(0,1) = as<Scalar>( 2*one/(9*one) - ST::squareroot(15*one)/(15*one) );
1054 myA(0,2) = as<Scalar>( 5*one/(36*one) - ST::squareroot(15*one)/(30*one) );
1055 myA(1,0) = as<Scalar>( 5*one/(36*one) + ST::squareroot(15*one)/(24*one) );
1056 myA(1,1) = as<Scalar>( 2*one/(9*one) );
1057 myA(1,2) = as<Scalar>( 5*one/(36*one) - ST::squareroot(15*one)/(24*one) );
1058 myA(2,0) = as<Scalar>( 5*one/(36*one) + ST::squareroot(15*one)/(30*one) );
1059 myA(2,1) = as<Scalar>( 2*one/(9*one) + ST::squareroot(15*one)/(15*one) );
1060 myA(2,2) = as<Scalar>( 5*one/(36*one) );
1061 myb(0) = as<Scalar>( 5*one/(18*one) );
1062 myb(1) = as<Scalar>( 4*one/(9*one) );
1063 myb(2) = as<Scalar>( 5*one/(18*one) );
1064 myc(0) = as<Scalar>( one/(2*one)-ST::squareroot(15*one)/(10*one) );
1065 myc(1) = as<Scalar>( one/(2*one) );
1066 myc(2) = as<Scalar>( one/(2*one)+ST::squareroot(15*one)/(10*one) );
1067 this->setMyDescription(myDescription.str());
1071 this->setMy_order(6);
1076 template<
class Scalar>
1077 class Implicit4Stage8thOrderKuntzmannButcher_RKBT :
1078 virtual public RKButcherTableauDefaultBase<Scalar>
1081 Implicit4Stage8thOrderKuntzmannButcher_RKBT()
1084 std::ostringstream myDescription;
1085 myDescription << Implicit4Stage8thOrderKuntzmannButcher_name() <<
"\n"
1086 <<
"Kuntzmann & Butcher method\n"
1087 <<
"Solving Ordinary Differential Equations I:\n"
1088 <<
"Nonstiff Problems, 2nd Revided Edition\n"
1089 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
1090 <<
"Table 7.5, pg 209\n"
1091 <<
"c = [ 1/2-w2 1/2-w2p 1/2+w2p 1/2+w2 ]'\n"
1092 <<
"A = [ w1 w1p-w3+w4p w1p-w3-w4p w1-w5 ]\n"
1093 <<
" [ w1-w3p+w4 w1p w1p-w5p w1-w3p-w4 ]\n"
1094 <<
" [ w1+w3p+w4 w1p+w5p w1p w1+w3p-w4 ]\n"
1095 <<
" [ w1+w5 w1p+w3+w4p w1p+w3-w4p w1 ]\n"
1096 <<
"b = [ 2*w1 2*w1p 2*w1p 2*w1 ]'\n"
1097 <<
"w1 = 1/8-sqrt(30)/144\n"
1098 <<
"w2 = (1/2)*sqrt((15+2*sqrt(3))/35)\n"
1099 <<
"w3 = w2*(1/6+sqrt(30)/24)\n"
1100 <<
"w4 = w2*(1/21+5*sqrt(30)/168)\n"
1102 <<
"w1p = 1/8+sqrt(30)/144\n"
1103 <<
"w2p = (1/2)*sqrt((15-2*sqrt(3))/35)\n"
1104 <<
"w3p = w2*(1/6-sqrt(30)/24)\n"
1105 <<
"w4p = w2*(1/21-5*sqrt(30)/168)\n"
1106 <<
"w5p = w2p-2*w3p" << std::endl;
1107 typedef ScalarTraits<Scalar> ST;
1108 int myNumStages = 4;
1109 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1110 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1111 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1112 Scalar one = ST::one();
1113 Scalar onehalf = as<Scalar>( one/(2*one) );
1114 Scalar w1 = as<Scalar>( one/(8*one) - ST::squareroot(30*one)/(144*one) );
1115 Scalar w2 = as<Scalar>( (one/(2*one))*ST::squareroot((15*one+2*one*ST::squareroot(30*one))/(35*one)) );
1116 Scalar w3 = as<Scalar>( w2*(one/(6*one)+ST::squareroot(30*one)/(24*one)) );
1117 Scalar w4 = as<Scalar>( w2*(one/(21*one)+5*one*ST::squareroot(30*one)/(168*one)) );
1118 Scalar w5 = as<Scalar>( w2-2*w3 );
1119 Scalar w1p = as<Scalar>( one/(8*one) + ST::squareroot(30*one)/(144*one) );
1120 Scalar w2p = as<Scalar>( (one/(2*one))*ST::squareroot((15*one-2*one*ST::squareroot(30*one))/(35*one)) );
1121 Scalar w3p = as<Scalar>( w2p*(one/(6*one)-ST::squareroot(30*one)/(24*one)) );
1122 Scalar w4p = as<Scalar>( w2p*(one/(21*one)-5*one*ST::squareroot(30*one)/(168*one)) );
1123 Scalar w5p = as<Scalar>( w2p-2*w3p );
1125 myA(0,1) = w1p-w3+w4p;
1126 myA(0,2) = w1p-w3-w4p;
1128 myA(1,0) = w1-w3p+w4;
1131 myA(1,3) = w1-w3p-w4;
1132 myA(2,0) = w1+w3p+w4;
1135 myA(2,3) = w1+w3p-w4;
1137 myA(3,1) = w1p+w3+w4p;
1138 myA(3,2) = w1p+w3-w4p;
1144 myc(0) = onehalf - w2;
1145 myc(1) = onehalf - w2p;
1146 myc(2) = onehalf + w2p;
1147 myc(3) = onehalf + w2;
1148 this->setMyDescription(myDescription.str());
1152 this->setMy_order(8);
1157 template<
class Scalar>
1158 class Implicit2Stage4thOrderHammerHollingsworth_RKBT :
1159 virtual public RKButcherTableauDefaultBase<Scalar>
1162 Implicit2Stage4thOrderHammerHollingsworth_RKBT()
1165 std::ostringstream myDescription;
1166 myDescription << Implicit2Stage4thOrderHammerHollingsworth_name() <<
"\n"
1167 <<
"Hammer & Hollingsworth method\n"
1168 <<
"Solving Ordinary Differential Equations I:\n"
1169 <<
"Nonstiff Problems, 2nd Revided Edition\n"
1170 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
1171 <<
"Table 7.3, pg 207\n"
1172 <<
"c = [ 1/2-sqrt(3)/6 1/2+sqrt(3)/6 ]'\n"
1173 <<
"A = [ 1/4 1/4-sqrt(3)/6 ]\n"
1174 <<
" [ 1/4+sqrt(3)/6 1/4 ]\n"
1175 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1176 typedef ScalarTraits<Scalar> ST;
1177 int myNumStages = 2;
1178 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1179 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1180 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1181 Scalar one = ST::one();
1182 Scalar onequarter = as<Scalar>( one/(4*one) );
1183 Scalar onehalf = as<Scalar>( one/(2*one) );
1184 myA(0,0) = onequarter;
1185 myA(0,1) = as<Scalar>( onequarter-ST::squareroot(3*one)/(6*one) );
1186 myA(1,0) = as<Scalar>( onequarter+ST::squareroot(3*one)/(6*one) );
1187 myA(1,1) = onequarter;
1190 myc(0) = as<Scalar>( onehalf - ST::squareroot(3*one)/(6*one) );
1191 myc(1) = as<Scalar>( onehalf + ST::squareroot(3*one)/(6*one) );
1192 this->setMyDescription(myDescription.str());
1196 this->setMy_order(4);
1201 template<
class Scalar>
1202 class Implicit1Stage2ndOrderGauss_RKBT :
1203 virtual public RKButcherTableauDefaultBase<Scalar>
1206 Implicit1Stage2ndOrderGauss_RKBT()
1209 std::ostringstream myDescription;
1210 myDescription << Implicit1Stage2ndOrderGauss_name() <<
"\n"
1212 <<
"Solving Ordinary Differential Equations II:\n"
1213 <<
"Stiff and Differential-Algebraic Problems,\n"
1214 <<
"2nd Revised Edition\n"
1215 <<
"E. Hairer and G. Wanner\n"
1216 <<
"Table 5.2, pg 72\n"
1217 <<
"Also: Implicit midpoint rule\n"
1218 <<
"Solving Ordinary Differential Equations I:\n"
1219 <<
"Nonstiff Problems, 2nd Revided Edition\n"
1220 <<
"E. Hairer, S. P. Norsett, and G. Wanner\n"
1221 <<
"Table 7.1, pg 205\n"
1224 <<
"b = [ 1 ]'" << std::endl;
1225 typedef ScalarTraits<Scalar> ST;
1226 int myNumStages = 1;
1227 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1228 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1229 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1230 Scalar onehalf = ST::one()/(2*ST::one());
1231 Scalar one = ST::one();
1235 this->setMyDescription(myDescription.str());
1239 this->setMy_order(2);
1244 template<
class Scalar>
1245 class Implicit2Stage4thOrderGauss_RKBT :
1246 virtual public RKButcherTableauDefaultBase<Scalar>
1249 Implicit2Stage4thOrderGauss_RKBT()
1252 std::ostringstream myDescription;
1253 myDescription << Implicit2Stage4thOrderGauss_name() <<
"\n"
1255 <<
"Solving Ordinary Differential Equations II:\n"
1256 <<
"Stiff and Differential-Algebraic Problems,\n"
1257 <<
"2nd Revised Edition\n"
1258 <<
"E. Hairer and G. Wanner\n"
1259 <<
"Table 5.2, pg 72\n"
1260 <<
"c = [ 1/2-sqrt(3)/6 1/2+sqrt(3)/6 ]'\n"
1261 <<
"A = [ 1/4 1/4-sqrt(3)/6 ]\n"
1262 <<
" [ 1/4+sqrt(3)/6 1/4 ]\n"
1263 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1264 typedef ScalarTraits<Scalar> ST;
1265 int myNumStages = 2;
1266 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1267 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1268 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1269 Scalar one = ST::one();
1270 Scalar onehalf = as<Scalar>(one/(2*one));
1271 Scalar three = as<Scalar>(3*one);
1272 Scalar six = as<Scalar>(6*one);
1273 Scalar onefourth = as<Scalar>(one/(4*one));
1274 Scalar alpha = ST::squareroot(three)/six;
1276 myA(0,0) = onefourth;
1277 myA(0,1) = onefourth-alpha;
1278 myA(1,0) = onefourth+alpha;
1279 myA(1,1) = onefourth;
1282 myc(0) = onehalf-alpha;
1283 myc(1) = onehalf+alpha;
1284 this->setMyDescription(myDescription.str());
1288 this->setMy_order(4);
1293 template<
class Scalar>
1294 class Implicit3Stage6thOrderGauss_RKBT :
1295 virtual public RKButcherTableauDefaultBase<Scalar>
1298 Implicit3Stage6thOrderGauss_RKBT()
1301 std::ostringstream myDescription;
1302 myDescription << Implicit3Stage6thOrderGauss_name() <<
"\n"
1304 <<
"Solving Ordinary Differential Equations II:\n"
1305 <<
"Stiff and Differential-Algebraic Problems,\n"
1306 <<
"2nd Revised Edition\n"
1307 <<
"E. Hairer and G. Wanner\n"
1308 <<
"Table 5.2, pg 72\n"
1309 <<
"c = [ 1/2-sqrt(15)/10 1/2 1/2+sqrt(15)/10 ]'\n"
1310 <<
"A = [ 5/36 2/9-sqrt(15)/15 5/36-sqrt(15)/30 ]\n"
1311 <<
" [ 5/36+sqrt(15)/24 2/9 5/36-sqrt(15)/24 ]\n"
1312 <<
" [ 5/36+sqrt(15)/30 2/9+sqrt(15)/15 5/36 ]\n"
1313 <<
"b = [ 5/18 4/9 5/18 ]'" << std::endl;
1314 typedef ScalarTraits<Scalar> ST;
1315 int myNumStages = 3;
1316 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1317 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1318 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1319 Scalar one = ST::one();
1320 Scalar ten = as<Scalar>(10*one);
1321 Scalar fifteen = as<Scalar>(15*one);
1322 Scalar twentyfour = as<Scalar>(24*one);
1323 Scalar thirty = as<Scalar>(30*one);
1324 Scalar sqrt15over10 = as<Scalar>(ST::squareroot(fifteen)/ten);
1325 Scalar sqrt15over15 = as<Scalar>(ST::squareroot(fifteen)/fifteen);
1326 Scalar sqrt15over24 = as<Scalar>(ST::squareroot(fifteen)/twentyfour);
1327 Scalar sqrt15over30 = as<Scalar>(ST::squareroot(fifteen)/thirty);
1329 myA(0,0) = as<Scalar>(5*one/(36*one));
1330 myA(0,1) = as<Scalar>(2*one/(9*one))-sqrt15over15;
1331 myA(0,2) = as<Scalar>(5*one/(36*one))-sqrt15over30;
1332 myA(1,0) = as<Scalar>(5*one/(36*one))+sqrt15over24;
1333 myA(1,1) = as<Scalar>(2*one/(9*one));
1334 myA(1,2) = as<Scalar>(5*one/(36*one))-sqrt15over24;
1335 myA(2,0) = as<Scalar>(5*one/(36*one))+sqrt15over30;
1336 myA(2,1) = as<Scalar>(2*one/(9*one))+sqrt15over15;
1337 myA(2,2) = as<Scalar>(5*one/(36*one));
1338 myb(0) = as<Scalar>(5*one/(18*one));
1339 myb(1) = as<Scalar>(4*one/(9*one));
1340 myb(2) = as<Scalar>(5*one/(18*one));
1341 myc(0) = as<Scalar>(one/(2*one))-sqrt15over10;
1342 myc(1) = as<Scalar>(one/(2*one));
1343 myc(2) = as<Scalar>(one/(2*one))+sqrt15over10;
1344 this->setMyDescription(myDescription.str());
1348 this->setMy_order(6);
1353 template<
class Scalar>
1354 class Implicit1Stage1stOrderRadauA_RKBT :
1355 virtual public RKButcherTableauDefaultBase<Scalar>
1358 Implicit1Stage1stOrderRadauA_RKBT()
1361 std::ostringstream myDescription;
1362 myDescription << Implicit1Stage1stOrderRadauA_name() <<
"\n"
1364 <<
"Solving Ordinary Differential Equations II:\n"
1365 <<
"Stiff and Differential-Algebraic Problems,\n"
1366 <<
"2nd Revised Edition\n"
1367 <<
"E. Hairer and G. Wanner\n"
1368 <<
"Table 5.3, pg 73\n"
1371 <<
"b = [ 1 ]'" << std::endl;
1372 typedef ScalarTraits<Scalar> ST;
1373 int myNumStages = 1;
1374 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1375 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1376 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1377 Scalar one = ST::one();
1378 Scalar zero = ST::zero();
1382 this->setMyDescription(myDescription.str());
1386 this->setMy_order(1);
1391 template<
class Scalar>
1392 class Implicit2Stage3rdOrderRadauA_RKBT :
1393 virtual public RKButcherTableauDefaultBase<Scalar>
1396 Implicit2Stage3rdOrderRadauA_RKBT()
1399 std::ostringstream myDescription;
1400 myDescription << Implicit2Stage3rdOrderRadauA_name() <<
"\n"
1402 <<
"Solving Ordinary Differential Equations II:\n"
1403 <<
"Stiff and Differential-Algebraic Problems,\n"
1404 <<
"2nd Revised Edition\n"
1405 <<
"E. Hairer and G. Wanner\n"
1406 <<
"Table 5.3, pg 73\n"
1407 <<
"c = [ 0 2/3 ]'\n"
1408 <<
"A = [ 1/4 -1/4 ]\n"
1409 <<
" [ 1/4 5/12 ]\n"
1410 <<
"b = [ 1/4 3/4 ]'" << std::endl;
1411 typedef ScalarTraits<Scalar> ST;
1412 int myNumStages = 2;
1413 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1414 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1415 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1416 Scalar zero = ST::zero();
1417 Scalar one = ST::one();
1418 myA(0,0) = as<Scalar>(one/(4*one));
1419 myA(0,1) = as<Scalar>(-one/(4*one));
1420 myA(1,0) = as<Scalar>(one/(4*one));
1421 myA(1,1) = as<Scalar>(5*one/(12*one));
1422 myb(0) = as<Scalar>(one/(4*one));
1423 myb(1) = as<Scalar>(3*one/(4*one));
1425 myc(1) = as<Scalar>(2*one/(3*one));
1426 this->setMyDescription(myDescription.str());
1430 this->setMy_order(3);
1435 template<
class Scalar>
1436 class Implicit3Stage5thOrderRadauA_RKBT :
1437 virtual public RKButcherTableauDefaultBase<Scalar>
1440 Implicit3Stage5thOrderRadauA_RKBT()
1443 std::ostringstream myDescription;
1444 myDescription << Implicit3Stage5thOrderRadauA_name() <<
"\n"
1446 <<
"Solving Ordinary Differential Equations II:\n"
1447 <<
"Stiff and Differential-Algebraic Problems,\n"
1448 <<
"2nd Revised Edition\n"
1449 <<
"E. Hairer and G. Wanner\n"
1450 <<
"Table 5.4, pg 73\n"
1451 <<
"c = [ 0 (6-sqrt(6))/10 (6+sqrt(6))/10 ]'\n"
1452 <<
"A = [ 1/9 (-1-sqrt(6))/18 (-1+sqrt(6))/18 ]\n"
1453 <<
" [ 1/9 (88+7*sqrt(6))/360 (88-43*sqrt(6))/360 ]\n"
1454 <<
" [ 1/9 (88+43*sqrt(6))/360 (88-7*sqrt(6))/360 ]\n"
1455 <<
"b = [ 1/9 (16+sqrt(6))/36 (16-sqrt(6))/36 ]'" << std::endl;
1456 typedef ScalarTraits<Scalar> ST;
1457 int myNumStages = 3;
1458 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1459 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1460 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1461 Scalar zero = ST::zero();
1462 Scalar one = ST::one();
1463 myA(0,0) = as<Scalar>(one/(9*one));
1464 myA(0,1) = as<Scalar>( (-one-ST::squareroot(6*one))/(18*one) );
1465 myA(0,2) = as<Scalar>( (-one+ST::squareroot(6*one))/(18*one) );
1466 myA(1,0) = as<Scalar>(one/(9*one));
1467 myA(1,1) = as<Scalar>( (88*one+7*one*ST::squareroot(6*one))/(360*one) );
1468 myA(1,2) = as<Scalar>( (88*one-43*one*ST::squareroot(6*one))/(360*one) );
1469 myA(2,0) = as<Scalar>(one/(9*one));
1470 myA(2,1) = as<Scalar>( (88*one+43*one*ST::squareroot(6*one))/(360*one) );
1471 myA(2,2) = as<Scalar>( (88*one-7*one*ST::squareroot(6*one))/(360*one) );
1472 myb(0) = as<Scalar>(one/(9*one));
1473 myb(1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
1474 myb(2) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
1476 myc(1) = as<Scalar>( (6*one-ST::squareroot(6*one))/(10*one) );
1477 myc(2) = as<Scalar>( (6*one+ST::squareroot(6*one))/(10*one) );
1478 this->setMyDescription(myDescription.str());
1482 this->setMy_order(5);
1487 template<
class Scalar>
1488 class Implicit1Stage1stOrderRadauB_RKBT :
1489 virtual public RKButcherTableauDefaultBase<Scalar>
1492 Implicit1Stage1stOrderRadauB_RKBT()
1495 std::ostringstream myDescription;
1496 myDescription << Implicit1Stage1stOrderRadauB_name() <<
"\n"
1498 <<
"Solving Ordinary Differential Equations II:\n"
1499 <<
"Stiff and Differential-Algebraic Problems,\n"
1500 <<
"2nd Revised Edition\n"
1501 <<
"E. Hairer and G. Wanner\n"
1502 <<
"Table 5.5, pg 74\n"
1505 <<
"b = [ 1 ]'" << std::endl;
1506 typedef ScalarTraits<Scalar> ST;
1507 int myNumStages = 1;
1508 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1509 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1510 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1511 Scalar one = ST::one();
1515 this->setMyDescription(myDescription.str());
1519 this->setMy_order(1);
1524 template<
class Scalar>
1525 class Implicit2Stage3rdOrderRadauB_RKBT :
1526 virtual public RKButcherTableauDefaultBase<Scalar>
1529 Implicit2Stage3rdOrderRadauB_RKBT()
1532 std::ostringstream myDescription;
1533 myDescription << Implicit2Stage3rdOrderRadauB_name() <<
"\n"
1535 <<
"Solving Ordinary Differential Equations II:\n"
1536 <<
"Stiff and Differential-Algebraic Problems,\n"
1537 <<
"2nd Revised Edition\n"
1538 <<
"E. Hairer and G. Wanner\n"
1539 <<
"Table 5.5, pg 74\n"
1540 <<
"c = [ 1/3 1 ]'\n"
1541 <<
"A = [ 5/12 -1/12 ]\n"
1543 <<
"b = [ 3/4 1/4 ]'" << std::endl;
1544 typedef ScalarTraits<Scalar> ST;
1545 int myNumStages = 2;
1546 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1547 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1548 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1549 Scalar one = ST::one();
1550 myA(0,0) = as<Scalar>( 5*one/(12*one) );
1551 myA(0,1) = as<Scalar>( -one/(12*one) );
1552 myA(1,0) = as<Scalar>( 3*one/(4*one) );
1553 myA(1,1) = as<Scalar>( one/(4*one) );
1554 myb(0) = as<Scalar>( 3*one/(4*one) );
1555 myb(1) = as<Scalar>( one/(4*one) );
1556 myc(0) = as<Scalar>( one/(3*one) );
1558 this->setMyDescription(myDescription.str());
1562 this->setMy_order(3);
1567 template<
class Scalar>
1568 class Implicit3Stage5thOrderRadauB_RKBT :
1569 virtual public RKButcherTableauDefaultBase<Scalar>
1572 Implicit3Stage5thOrderRadauB_RKBT()
1575 std::ostringstream myDescription;
1576 myDescription << Implicit3Stage5thOrderRadauB_name() <<
"\n"
1578 <<
"Solving Ordinary Differential Equations II:\n"
1579 <<
"Stiff and Differential-Algebraic Problems,\n"
1580 <<
"2nd Revised Edition\n"
1581 <<
"E. Hairer and G. Wanner\n"
1582 <<
"Table 5.6, pg 74\n"
1583 <<
"c = [ (4-sqrt(6))/10 (4+sqrt(6))/10 1 ]'\n"
1584 <<
"A = [ (88-7*sqrt(6))/360 (296-169*sqrt(6))/1800 (-2+3*sqrt(6))/225 ]\n"
1585 <<
" [ (296+169*sqrt(6))/1800 (88+7*sqrt(6))/360 (-2-3*sqrt(6))/225 ]\n"
1586 <<
" [ (16-sqrt(6))/36 (16+sqrt(6))/36 1/9 ]\n"
1587 <<
"b = [ (16-sqrt(6))/36 (16+sqrt(6))/36 1/9 ]'" << std::endl;
1588 typedef ScalarTraits<Scalar> ST;
1589 int myNumStages = 3;
1590 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1591 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1592 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1593 Scalar one = ST::one();
1594 myA(0,0) = as<Scalar>( (88*one-7*one*ST::squareroot(6*one))/(360*one) );
1595 myA(0,1) = as<Scalar>( (296*one-169*one*ST::squareroot(6*one))/(1800*one) );
1596 myA(0,2) = as<Scalar>( (-2*one+3*one*ST::squareroot(6*one))/(225*one) );
1597 myA(1,0) = as<Scalar>( (296*one+169*one*ST::squareroot(6*one))/(1800*one) );
1598 myA(1,1) = as<Scalar>( (88*one+7*one*ST::squareroot(6*one))/(360*one) );
1599 myA(1,2) = as<Scalar>( (-2*one-3*one*ST::squareroot(6*one))/(225*one) );
1600 myA(2,0) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
1601 myA(2,1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
1602 myA(2,2) = as<Scalar>( one/(9*one) );
1603 myb(0) = as<Scalar>( (16*one-ST::squareroot(6*one))/(36*one) );
1604 myb(1) = as<Scalar>( (16*one+ST::squareroot(6*one))/(36*one) );
1605 myb(2) = as<Scalar>( one/(9*one) );
1606 myc(0) = as<Scalar>( (4*one-ST::squareroot(6*one))/(10*one) );
1607 myc(1) = as<Scalar>( (4*one+ST::squareroot(6*one))/(10*one) );
1609 this->setMyDescription(myDescription.str());
1613 this->setMy_order(5);
1618 template<
class Scalar>
1619 class Implicit2Stage2ndOrderLobattoA_RKBT :
1620 virtual public RKButcherTableauDefaultBase<Scalar>
1623 Implicit2Stage2ndOrderLobattoA_RKBT()
1626 std::ostringstream myDescription;
1627 myDescription << Implicit2Stage2ndOrderLobattoA_name() <<
"\n"
1629 <<
"Solving Ordinary Differential Equations II:\n"
1630 <<
"Stiff and Differential-Algebraic Problems,\n"
1631 <<
"2nd Revised Edition\n"
1632 <<
"E. Hairer and G. Wanner\n"
1633 <<
"Table 5.7, pg 75\n"
1637 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1638 typedef ScalarTraits<Scalar> ST;
1639 int myNumStages = 2;
1640 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1641 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1642 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1643 Scalar zero = ST::zero();
1644 Scalar one = ST::one();
1647 myA(1,0) = as<Scalar>( one/(2*one) );
1648 myA(1,1) = as<Scalar>( one/(2*one) );
1649 myb(0) = as<Scalar>( one/(2*one) );
1650 myb(1) = as<Scalar>( one/(2*one) );
1653 this->setMyDescription(myDescription.str());
1657 this->setMy_order(2);
1662 template<
class Scalar>
1663 class Implicit3Stage4thOrderLobattoA_RKBT :
1664 virtual public RKButcherTableauDefaultBase<Scalar>
1667 Implicit3Stage4thOrderLobattoA_RKBT()
1670 std::ostringstream myDescription;
1671 myDescription << Implicit3Stage4thOrderLobattoA_name() <<
"\n"
1673 <<
"Solving Ordinary Differential Equations II:\n"
1674 <<
"Stiff and Differential-Algebraic Problems,\n"
1675 <<
"2nd Revised Edition\n"
1676 <<
"E. Hairer and G. Wanner\n"
1677 <<
"Table 5.7, pg 75\n"
1678 <<
"c = [ 0 1/2 1 ]'\n"
1679 <<
"A = [ 0 0 0 ]\n"
1680 <<
" [ 5/24 1/3 -1/24 ]\n"
1681 <<
" [ 1/6 2/3 1/6 ]\n"
1682 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
1683 typedef ScalarTraits<Scalar> ST;
1684 int myNumStages = 3;
1685 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1686 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1687 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1688 Scalar zero = ST::zero();
1689 Scalar one = ST::one();
1693 myA(1,0) = as<Scalar>( (5*one)/(24*one) );
1694 myA(1,1) = as<Scalar>( (one)/(3*one) );
1695 myA(1,2) = as<Scalar>( (-one)/(24*one) );
1696 myA(2,0) = as<Scalar>( (one)/(6*one) );
1697 myA(2,1) = as<Scalar>( (2*one)/(3*one) );
1698 myA(2,2) = as<Scalar>( (1*one)/(6*one) );
1699 myb(0) = as<Scalar>( (one)/(6*one) );
1700 myb(1) = as<Scalar>( (2*one)/(3*one) );
1701 myb(2) = as<Scalar>( (1*one)/(6*one) );
1703 myc(1) = as<Scalar>( one/(2*one) );
1705 this->setMyDescription(myDescription.str());
1709 this->setMy_order(4);
1714 template<
class Scalar>
1715 class Implicit4Stage6thOrderLobattoA_RKBT :
1716 virtual public RKButcherTableauDefaultBase<Scalar>
1719 Implicit4Stage6thOrderLobattoA_RKBT()
1723 typedef Teuchos::ScalarTraits<Scalar> ST;
1725 std::ostringstream myDescription;
1726 myDescription << Implicit4Stage6thOrderLobattoA_name() <<
"\n"
1728 <<
"Solving Ordinary Differential Equations II:\n"
1729 <<
"Stiff and Differential-Algebraic Problems,\n"
1730 <<
"2nd Revised Edition\n"
1731 <<
"E. Hairer and G. Wanner\n"
1732 <<
"Table 5.8, pg 75\n"
1733 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
1734 <<
"A = [ 0 0 0 0 ]\n"
1735 <<
" [ (11+sqrt(5)/120 (25-sqrt(5))/120 (25-13*sqrt(5))/120 (-1+sqrt(5))/120 ]\n"
1736 <<
" [ (11-sqrt(5)/120 (25+13*sqrt(5))/120 (25+sqrt(5))/120 (-1-sqrt(5))/120 ]\n"
1737 <<
" [ 1/12 5/12 5/12 1/12 ]\n"
1738 <<
"b = [ 1/12 5/12 5/12 1/12 ]'" << std::endl;
1739 typedef ScalarTraits<Scalar> ST;
1740 int myNumStages = 4;
1741 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1742 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1743 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1744 Scalar zero = ST::zero();
1745 Scalar one = ST::one();
1750 myA(1,0) = as<Scalar>( (11*one+ST::squareroot(5*one))/(120*one) );
1751 myA(1,1) = as<Scalar>( (25*one-ST::squareroot(5*one))/(120*one) );
1752 myA(1,2) = as<Scalar>( (25*one-13*one*ST::squareroot(5*one))/(120*one) );
1753 myA(1,3) = as<Scalar>( (-one+ST::squareroot(5*one))/(120*one) );
1754 myA(2,0) = as<Scalar>( (11*one-ST::squareroot(5*one))/(120*one) );
1755 myA(2,1) = as<Scalar>( (25*one+13*one*ST::squareroot(5*one))/(120*one) );
1756 myA(2,2) = as<Scalar>( (25*one+ST::squareroot(5*one))/(120*one) );
1757 myA(2,3) = as<Scalar>( (-one-ST::squareroot(5*one))/(120*one) );
1758 myA(3,0) = as<Scalar>( one/(12*one) );
1759 myA(3,1) = as<Scalar>( 5*one/(12*one) );
1760 myA(3,2) = as<Scalar>( 5*one/(12*one) );
1761 myA(3,3) = as<Scalar>( one/(12*one) );
1762 myb(0) = as<Scalar>( one/(12*one) );
1763 myb(1) = as<Scalar>( 5*one/(12*one) );
1764 myb(2) = as<Scalar>( 5*one/(12*one) );
1765 myb(3) = as<Scalar>( one/(12*one) );
1767 myc(1) = as<Scalar>( (5*one-ST::squareroot(5))/(10*one) );
1768 myc(2) = as<Scalar>( (5*one+ST::squareroot(5))/(10*one) );
1770 this->setMyDescription(myDescription.str());
1774 this->setMy_order(6);
1779 template<
class Scalar>
1780 class Implicit2Stage2ndOrderLobattoB_RKBT :
1781 virtual public RKButcherTableauDefaultBase<Scalar>
1784 Implicit2Stage2ndOrderLobattoB_RKBT()
1787 std::ostringstream myDescription;
1788 myDescription << Implicit2Stage2ndOrderLobattoB_name() <<
"\n"
1790 <<
"Solving Ordinary Differential Equations II:\n"
1791 <<
"Stiff and Differential-Algebraic Problems,\n"
1792 <<
"2nd Revised Edition\n"
1793 <<
"E. Hairer and G. Wanner\n"
1794 <<
"Table 5.9, pg 76\n"
1796 <<
"A = [ 1/2 0 ]\n"
1798 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1799 typedef ScalarTraits<Scalar> ST;
1800 int myNumStages = 2;
1801 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1802 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1803 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1804 Scalar zero = ST::zero();
1805 Scalar one = ST::one();
1806 myA(0,0) = as<Scalar>( one/(2*one) );
1808 myA(1,0) = as<Scalar>( one/(2*one) );
1810 myb(0) = as<Scalar>( one/(2*one) );
1811 myb(1) = as<Scalar>( one/(2*one) );
1814 this->setMyDescription(myDescription.str());
1818 this->setMy_order(2);
1823 template<
class Scalar>
1824 class Implicit3Stage4thOrderLobattoB_RKBT :
1825 virtual public RKButcherTableauDefaultBase<Scalar>
1828 Implicit3Stage4thOrderLobattoB_RKBT()
1831 std::ostringstream myDescription;
1832 myDescription << Implicit3Stage4thOrderLobattoB_name() <<
"\n"
1834 <<
"Solving Ordinary Differential Equations II:\n"
1835 <<
"Stiff and Differential-Algebraic Problems,\n"
1836 <<
"2nd Revised Edition\n"
1837 <<
"E. Hairer and G. Wanner\n"
1838 <<
"Table 5.9, pg 76\n"
1839 <<
"c = [ 0 1/2 1 ]'\n"
1840 <<
"A = [ 1/6 -1/6 0 ]\n"
1841 <<
" [ 1/6 1/3 0 ]\n"
1842 <<
" [ 1/6 5/6 0 ]\n"
1843 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
1844 typedef ScalarTraits<Scalar> ST;
1845 int myNumStages = 3;
1846 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1847 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1848 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1849 Scalar zero = ST::zero();
1850 Scalar one = ST::one();
1851 myA(0,0) = as<Scalar>( one/(6*one) );
1852 myA(0,1) = as<Scalar>( -one/(6*one) );
1854 myA(1,0) = as<Scalar>( one/(6*one) );
1855 myA(1,1) = as<Scalar>( one/(3*one) );
1857 myA(2,0) = as<Scalar>( one/(6*one) );
1858 myA(2,1) = as<Scalar>( 5*one/(6*one) );
1860 myb(0) = as<Scalar>( one/(6*one) );
1861 myb(1) = as<Scalar>( 2*one/(3*one) );
1862 myb(2) = as<Scalar>( one/(6*one) );
1864 myc(1) = as<Scalar>( one/(2*one) );
1866 this->setMyDescription(myDescription.str());
1870 this->setMy_order(4);
1875 template<
class Scalar>
1876 class Implicit4Stage6thOrderLobattoB_RKBT :
1877 virtual public RKButcherTableauDefaultBase<Scalar>
1880 Implicit4Stage6thOrderLobattoB_RKBT()
1883 std::ostringstream myDescription;
1884 myDescription << Implicit4Stage6thOrderLobattoB_name() <<
"\n"
1886 <<
"Solving Ordinary Differential Equations II:\n"
1887 <<
"Stiff and Differential-Algebraic Problems,\n"
1888 <<
"2nd Revised Edition\n"
1889 <<
"E. Hairer and G. Wanner\n"
1890 <<
"Table 5.10, pg 76\n"
1891 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
1892 <<
"A = [ 1/12 (-1-sqrt(5))/24 (-1+sqrt(5))/24 0 ]\n"
1893 <<
" [ 1/12 (25+sqrt(5))/120 (25-13*sqrt(5))/120 0 ]\n"
1894 <<
" [ 1/12 (25+13*sqrt(5))/120 (25-sqrt(5))/120 0 ]\n"
1895 <<
" [ 1/12 (11-sqrt(5))/24 (11+sqrt(5))/24 0 ]\n"
1896 <<
"b = [ 1/12 5/12 5/12 1/12 ]'" << std::endl;
1897 typedef ScalarTraits<Scalar> ST;
1898 int myNumStages = 4;
1899 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1900 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1901 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1902 Scalar zero = ST::zero();
1903 Scalar one = ST::one();
1904 myA(0,0) = as<Scalar>( one/(12*one) );
1905 myA(0,1) = as<Scalar>( (-one-ST::squareroot(5))/(24*one) );
1906 myA(0,2) = as<Scalar>( (-one+ST::squareroot(5))/(24*one) );
1908 myA(1,0) = as<Scalar>( one/(12*one) );
1909 myA(1,1) = as<Scalar>( (25*one+ST::squareroot(5))/(120*one) );
1910 myA(1,2) = as<Scalar>( (25*one-13*one*ST::squareroot(5))/(120*one) );
1912 myA(2,0) = as<Scalar>( one/(12*one) );
1913 myA(2,1) = as<Scalar>( (25*one+13*one*ST::squareroot(5))/(120*one) );
1914 myA(2,2) = as<Scalar>( (25*one-ST::squareroot(5))/(120*one) );
1916 myA(3,0) = as<Scalar>( one/(12*one) );
1917 myA(3,1) = as<Scalar>( (11*one-ST::squareroot(5*one))/(24*one) );
1918 myA(3,2) = as<Scalar>( (11*one+ST::squareroot(5*one))/(24*one) );
1920 myb(0) = as<Scalar>( one/(12*one) );
1921 myb(1) = as<Scalar>( 5*one/(12*one) );
1922 myb(2) = as<Scalar>( 5*one/(12*one) );
1923 myb(3) = as<Scalar>( one/(12*one) );
1925 myc(1) = as<Scalar>( (5*one-ST::squareroot(5*one))/(10*one) );
1926 myc(2) = as<Scalar>( (5*one+ST::squareroot(5*one))/(10*one) );
1928 this->setMyDescription(myDescription.str());
1932 this->setMy_order(6);
1937 template<
class Scalar>
1938 class Implicit2Stage2ndOrderLobattoC_RKBT :
1939 virtual public RKButcherTableauDefaultBase<Scalar>
1942 Implicit2Stage2ndOrderLobattoC_RKBT()
1945 std::ostringstream myDescription;
1946 myDescription << Implicit2Stage2ndOrderLobattoC_name() <<
"\n"
1948 <<
"Solving Ordinary Differential Equations II:\n"
1949 <<
"Stiff and Differential-Algebraic Problems,\n"
1950 <<
"2nd Revised Edition\n"
1951 <<
"E. Hairer and G. Wanner\n"
1952 <<
"Table 5.11, pg 76\n"
1954 <<
"A = [ 1/2 -1/2 ]\n"
1956 <<
"b = [ 1/2 1/2 ]'" << std::endl;
1957 typedef ScalarTraits<Scalar> ST;
1958 int myNumStages = 2;
1959 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
1960 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
1961 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
1962 Scalar zero = ST::zero();
1963 Scalar one = ST::one();
1964 myA(0,0) = as<Scalar>( one/(2*one) );
1965 myA(0,1) = as<Scalar>( -one/(2*one) );
1966 myA(1,0) = as<Scalar>( one/(2*one) );
1967 myA(1,1) = as<Scalar>( one/(2*one) );
1968 myb(0) = as<Scalar>( one/(2*one) );
1969 myb(1) = as<Scalar>( one/(2*one) );
1972 this->setMyDescription(myDescription.str());
1976 this->setMy_order(2);
1981 template<
class Scalar>
1982 class Implicit3Stage4thOrderLobattoC_RKBT :
1983 virtual public RKButcherTableauDefaultBase<Scalar>
1986 Implicit3Stage4thOrderLobattoC_RKBT()
1989 std::ostringstream myDescription;
1990 myDescription << Implicit3Stage4thOrderLobattoC_name() <<
"\n"
1992 <<
"Solving Ordinary Differential Equations II:\n"
1993 <<
"Stiff and Differential-Algebraic Problems,\n"
1994 <<
"2nd Revised Edition\n"
1995 <<
"E. Hairer and G. Wanner\n"
1996 <<
"Table 5.11, pg 76\n"
1997 <<
"c = [ 0 1/2 1 ]'\n"
1998 <<
"A = [ 1/6 -1/3 1/6 ]\n"
1999 <<
" [ 1/6 5/12 -1/12 ]\n"
2000 <<
" [ 1/6 2/3 1/6 ]\n"
2001 <<
"b = [ 1/6 2/3 1/6 ]'" << std::endl;
2002 typedef ScalarTraits<Scalar> ST;
2003 int myNumStages = 3;
2004 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
2005 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
2006 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
2007 Scalar zero = ST::zero();
2008 Scalar one = ST::one();
2009 myA(0,0) = as<Scalar>( one/(6*one) );
2010 myA(0,1) = as<Scalar>( -one/(3*one) );
2011 myA(0,2) = as<Scalar>( one/(6*one) );
2012 myA(1,0) = as<Scalar>( one/(6*one) );
2013 myA(1,1) = as<Scalar>( 5*one/(12*one) );
2014 myA(1,2) = as<Scalar>( -one/(12*one) );
2015 myA(2,0) = as<Scalar>( one/(6*one) );
2016 myA(2,1) = as<Scalar>( 2*one/(3*one) );
2017 myA(2,2) = as<Scalar>( one/(6*one) );
2018 myb(0) = as<Scalar>( one/(6*one) );
2019 myb(1) = as<Scalar>( 2*one/(3*one) );
2020 myb(2) = as<Scalar>( one/(6*one) );
2022 myc(1) = as<Scalar>( one/(2*one) );
2024 this->setMyDescription(myDescription.str());
2028 this->setMy_order(4);
2033 template<
class Scalar>
2034 class Implicit4Stage6thOrderLobattoC_RKBT :
2035 virtual public RKButcherTableauDefaultBase<Scalar>
2038 Implicit4Stage6thOrderLobattoC_RKBT()
2041 std::ostringstream myDescription;
2042 myDescription << Implicit4Stage6thOrderLobattoC_name() <<
"\n"
2044 <<
"Solving Ordinary Differential Equations II:\n"
2045 <<
"Stiff and Differential-Algebraic Problems,\n"
2046 <<
"2nd Revised Edition\n"
2047 <<
"E. Hairer and G. Wanner\n"
2048 <<
"Table 5.12, pg 76\n"
2049 <<
"c = [ 0 (5-sqrt(5))/10 (5+sqrt(5))/10 1 ]'\n"
2050 <<
"A = [ 1/12 -sqrt(5)/12 sqrt(5)/12 -1/12 ]\n"
2051 <<
" [ 1/12 1/4 (10-7*sqrt(5))/60 sqrt(5)/60 ]\n"
2052 <<
" [ 1/12 (10+7*sqrt(5))/60 1/4 -sqrt(5)/60 ]\n"
2053 <<
" [ 1/12 5/12 5/12 1/12 ]\n"
2054 <<
"b = [ 1/12 5/12 5/12 1/12 ]'" << std::endl;
2055 typedef ScalarTraits<Scalar> ST;
2056 int myNumStages = 4;
2057 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
2058 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
2059 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
2060 Scalar zero = ST::zero();
2061 Scalar one = ST::one();
2062 myA(0,0) = as<Scalar>( one/(12*one) );
2063 myA(0,1) = as<Scalar>( -ST::squareroot(5*one)/(12*one) );
2064 myA(0,2) = as<Scalar>( ST::squareroot(5*one)/(12*one) );
2065 myA(0,3) = as<Scalar>( -one/(12*one) );
2066 myA(1,0) = as<Scalar>( one/(12*one) );
2067 myA(1,1) = as<Scalar>( one/(4*one) );
2068 myA(1,2) = as<Scalar>( (10*one-7*one*ST::squareroot(5*one))/(60*one) );
2069 myA(1,3) = as<Scalar>( ST::squareroot(5*one)/(60*one) );
2070 myA(2,0) = as<Scalar>( one/(12*one) );
2071 myA(2,1) = as<Scalar>( (10*one+7*one*ST::squareroot(5*one))/(60*one) );
2072 myA(2,2) = as<Scalar>( one/(4*one) );
2073 myA(2,3) = as<Scalar>( -ST::squareroot(5*one)/(60*one) );
2074 myA(3,0) = as<Scalar>( one/(12*one) );
2075 myA(3,1) = as<Scalar>( 5*one/(12*one) );
2076 myA(3,2) = as<Scalar>( 5*one/(12*one) );
2077 myA(3,3) = as<Scalar>( one/(12*one) );
2078 myb(0) = as<Scalar>( one/(12*one) );
2079 myb(1) = as<Scalar>( 5*one/(12*one) );
2080 myb(2) = as<Scalar>( 5*one/(12*one) );
2081 myb(3) = as<Scalar>( one/(12*one) );
2083 myc(1) = as<Scalar>( (5*one-ST::squareroot(5*one))/(10*one) );
2084 myc(2) = as<Scalar>( (5*one+ST::squareroot(5*one))/(10*one) );
2086 this->setMyDescription(myDescription.str());
2090 this->setMy_order(6);
2096 template<
class Scalar>
2097 class SDIRK5Stage5thOrder_RKBT :
2098 virtual public RKButcherTableauDefaultBase<Scalar>
2101 SDIRK5Stage5thOrder_RKBT()
2104 std::ostringstream myDescription;
2105 myDescription << SDIRK5Stage5thOrder_name() <<
"\n"
2107 <<
"Solving Ordinary Differential Equations II:\n"
2108 <<
"Stiff and Differential-Algebraic Problems,\n"
2109 <<
"2nd Revised Edition\n"
2110 <<
"E. Hairer and G. Wanner\n"
2112 <<
"c = [ (6-sqrt(6))/10 (6+9*sqrt(6))/35 1 (4-sqrt(6))/10 (4+sqrt(6))/10 ]'\n"
2113 <<
"A = [ (6-sqrt(6))/10 ]\n"
2114 <<
" [ (-6+5*sqrt(6))/14 (6-sqrt(6))/10 ]\n"
2115 <<
" [ (888+607*sqrt(6))/2850 (126-161*sqrt(6))/1425 (6-sqrt(6))/10 ]\n"
2116 <<
" [ (3153-3082*sqrt(6))/14250 (3213+1148*sqrt(6))/28500 (-267+88*sqrt(6))/500 (6-sqrt(6))/10 ]\n"
2117 <<
" [ (-32583+14638*sqrt(6))/71250 (-17199+364*sqrt(6))/142500 (1329-544*sqrt(6))/2500 (-96+131*sqrt(6))/625 (6-sqrt(6))/10 ]\n"
2118 <<
"b = [ 0 0 1/9 (16-sqrt(6))/36 (16+sqrt(6))/36 ]'" << std::endl;
2119 typedef ScalarTraits<Scalar> ST;
2120 int myNumStages = 5;
2121 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
2122 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
2123 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
2124 Scalar zero = ST::zero();
2125 Scalar one = ST::one();
2126 Scalar sqrt6 = ST::squareroot(as<Scalar>(6*one));
2127 Scalar gamma = as<Scalar>( (6*one - sqrt6) / (10*one) );
2134 myA(1,0) = as<Scalar>( (-6*one+5*one*sqrt6)/(14*one) );
2140 myA(2,0) = as<Scalar>( (888*one+607*one*sqrt6)/(2850*one) );
2141 myA(2,1) = as<Scalar>( (126*one-161*one*sqrt6)/(1425*one) );
2146 myA(3,0) = as<Scalar>( (3153*one-3082*one*sqrt6)/(14250*one) );
2147 myA(3,1) = as<Scalar>( (3213*one+1148*one*sqrt6)/(28500*one) );
2148 myA(3,2) = as<Scalar>( (-267*one+88*one*sqrt6)/(500*one) );
2152 myA(4,0) = as<Scalar>( (-32583*one+14638*one*sqrt6)/(71250*one) );
2153 myA(4,1) = as<Scalar>( (-17199*one+364*one*sqrt6)/(142500*one) );
2154 myA(4,2) = as<Scalar>( (1329*one-544*one*sqrt6)/(2500*one) );
2155 myA(4,3) = as<Scalar>( (-96*one+131*sqrt6)/(625*one) );
2160 myb(2) = as<Scalar>( one/(9*one) );
2161 myb(3) = as<Scalar>( (16*one-sqrt6)/(36*one) );
2162 myb(4) = as<Scalar>( (16*one+sqrt6)/(36*one) );
2165 myc(1) = as<Scalar>( (6*one+9*one*sqrt6)/(35*one) );
2167 myc(3) = as<Scalar>( (4*one-sqrt6)/(10*one) );
2168 myc(4) = as<Scalar>( (4*one+sqrt6)/(10*one) );
2170 this->setMyDescription(myDescription.str());
2174 this->setMy_order(5);
2179 template<
class Scalar>
2180 class SDIRK5Stage4thOrder_RKBT :
2181 virtual public RKButcherTableauDefaultBase<Scalar>
2184 SDIRK5Stage4thOrder_RKBT()
2187 std::ostringstream myDescription;
2188 myDescription << SDIRK5Stage4thOrder_name() <<
"\n"
2190 <<
"Solving Ordinary Differential Equations II:\n"
2191 <<
"Stiff and Differential-Algebraic Problems,\n"
2192 <<
"2nd Revised Edition\n"
2193 <<
"E. Hairer and G. Wanner\n"
2195 <<
"c = [ 1/4 3/4 11/20 1/2 1 ]'\n"
2198 <<
" [ 17/50 -1/25 1/4 ]\n"
2199 <<
" [ 371/1360 -137/2720 15/544 1/4 ]\n"
2200 <<
" [ 25/24 -49/48 125/16 -85/12 1/4 ]\n"
2201 <<
"b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'\n"
2202 <<
"b' = [ 59/48 -17/96 225/32 -85/12 0 ]'" << std::endl;
2203 typedef ScalarTraits<Scalar> ST;
2204 int myNumStages = 5;
2205 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
2206 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
2207 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
2208 Scalar zero = ST::zero();
2209 Scalar one = ST::one();
2210 Scalar onequarter = as<Scalar>( one/(4*one) );
2211 myA(0,0) = onequarter;
2217 myA(1,0) = as<Scalar>( one / (2*one) );
2218 myA(1,1) = onequarter;
2223 myA(2,0) = as<Scalar>( 17*one/(50*one) );
2224 myA(2,1) = as<Scalar>( -one/(25*one) );
2225 myA(2,2) = onequarter;
2229 myA(3,0) = as<Scalar>( 371*one/(1360*one) );
2230 myA(3,1) = as<Scalar>( -137*one/(2720*one) );
2231 myA(3,2) = as<Scalar>( 15*one/(544*one) );
2232 myA(3,3) = onequarter;
2235 myA(4,0) = as<Scalar>( 25*one/(24*one) );
2236 myA(4,1) = as<Scalar>( -49*one/(48*one) );
2237 myA(4,2) = as<Scalar>( 125*one/(16*one) );
2238 myA(4,3) = as<Scalar>( -85*one/(12*one) );
2239 myA(4,4) = onequarter;
2241 myb(0) = as<Scalar>( 25*one/(24*one) );
2242 myb(1) = as<Scalar>( -49*one/(48*one) );
2243 myb(2) = as<Scalar>( 125*one/(16*one) );
2244 myb(3) = as<Scalar>( -85*one/(12*one) );
2245 myb(4) = onequarter;
2255 myc(0) = onequarter;
2256 myc(1) = as<Scalar>( 3*one/(4*one) );
2257 myc(2) = as<Scalar>( 11*one/(20*one) );
2258 myc(3) = as<Scalar>( one/(2*one) );
2261 this->setMyDescription(myDescription.str());
2265 this->setMy_order(4);
2270 template<
class Scalar>
2271 class SDIRK3Stage4thOrder_RKBT :
2272 virtual public RKButcherTableauDefaultBase<Scalar>
2275 SDIRK3Stage4thOrder_RKBT()
2278 std::ostringstream myDescription;
2279 myDescription << SDIRK3Stage4thOrder_name() <<
"\n"
2281 <<
"Solving Ordinary Differential Equations II:\n"
2282 <<
"Stiff and Differential-Algebraic Problems,\n"
2283 <<
"2nd Revised Edition\n"
2284 <<
"E. Hairer and G. Wanner\n"
2286 <<
"gamma = (1/sqrt(3))*cos(pi/18)+1/2\n"
2287 <<
"delta = 1/(6*(2*gamma-1)^2)\n"
2288 <<
"c = [ gamma 1/2 1-gamma ]'\n"
2289 <<
"A = [ gamma ]\n"
2290 <<
" [ 1/2-gamma gamma ]\n"
2291 <<
" [ 2*gamma 1-4*gamma gamma ]\n"
2292 <<
"b = [ delta 1-2*delta delta ]'" << std::endl;
2293 typedef ScalarTraits<Scalar> ST;
2294 int myNumStages = 3;
2295 Teuchos::SerialDenseMatrix<int,Scalar> myA(myNumStages,myNumStages);
2296 Teuchos::SerialDenseVector<int,Scalar> myb(myNumStages);
2297 Teuchos::SerialDenseVector<int,Scalar> myc(myNumStages);
2298 Scalar zero = ST::zero();
2299 Scalar one = ST::one();
2300 Scalar pi = as<Scalar>(4*one)*std::atan(one);
2301 Scalar gamma = as<Scalar>( one/ST::squareroot(3*one)*std::cos(pi/(18*one))+one/(2*one) );
2302 Scalar delta = as<Scalar>( one/(6*one*std::pow(2*gamma-one,2*one)) );
2307 myA(1,0) = as<Scalar>( one/(2*one) - gamma );
2311 myA(2,0) = as<Scalar>( 2*gamma );
2312 myA(2,1) = as<Scalar>( one - 4*gamma );
2316 myb(1) = as<Scalar>( one-2*delta );
2320 myc(1) = as<Scalar>( one/(2*one) );
2321 myc(2) = as<Scalar>( one - gamma );
2323 this->setMyDescription(myDescription.str());
2327 this->setMy_order(4);
2335 #endif // RYTHMOS_RK_BUTCHER_TABLEAU_HPP