9 #ifndef Tempus_StepperFactory_hpp 10 #define Tempus_StepperFactory_hpp 12 #include "Teuchos_ParameterList.hpp" 13 #include "Tempus_StepperForwardEuler.hpp" 14 #include "Tempus_StepperBackwardEuler.hpp" 15 #include "Tempus_StepperBDF2.hpp" 16 #include "Tempus_StepperNewmarkImplicitAForm.hpp" 17 #include "Tempus_StepperNewmarkImplicitDForm.hpp" 18 #include "Tempus_StepperNewmarkExplicitAForm.hpp" 19 #include "Tempus_StepperHHTAlpha.hpp" 20 #include "Tempus_StepperExplicitRK.hpp" 21 #include "Tempus_StepperDIRK.hpp" 22 #include "Tempus_StepperIMEX_RK.hpp" 23 #include "Tempus_StepperIMEX_RK_Partition.hpp" 24 #include "Tempus_StepperLeapfrog.hpp" 25 #include "Tempus_StepperOperatorSplit.hpp" 26 #include "Tempus_StepperTrapezoidal.hpp" 36 template<
class Scalar>
49 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model,
50 std::string stepperType =
"Forward Euler")
52 if (stepperType ==
"") stepperType =
"Forward Euler";
53 return this->
createStepper(model, stepperType, Teuchos::null);
58 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model,
59 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
61 std::string stepperType =
"Forward Euler";
62 if (stepperPL != Teuchos::null)
63 stepperType = stepperPL->get<std::string>(
"Stepper Type",
"Forward Euler");
69 std::vector<Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > > models,
70 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
72 std::string stepperType = stepperPL->get<std::string>(
"Stepper Type");
79 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model,
80 std::string stepperType,
81 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
84 if (stepperType ==
"Forward Euler")
86 else if (stepperType ==
"Backward Euler")
88 else if (stepperType ==
"Trapezoidal Method")
90 else if (stepperType ==
"BDF2")
92 else if (stepperType ==
"Newmark Implicit a-Form")
94 else if (stepperType ==
"Newmark Implicit d-Form")
96 else if (stepperType ==
"Newmark Explicit a-Form")
98 else if (stepperType ==
"HHT-Alpha")
101 stepperType ==
"RK Forward Euler" ||
102 stepperType ==
"RK Explicit 4 Stage" ||
103 stepperType ==
"RK Explicit 3/8 Rule" ||
104 stepperType ==
"RK Explicit 4 Stage 3rd order by Runge" ||
105 stepperType ==
"RK Explicit 5 Stage 3rd order by Kinnmark and Gray"||
106 stepperType ==
"RK Explicit 3 Stage 3rd order" ||
107 stepperType ==
"RK Explicit 3 Stage 3rd order TVD" ||
108 stepperType ==
"RK Explicit 3 Stage 3rd order by Heun" ||
109 stepperType ==
"RK Explicit 2 Stage 2nd order by Runge" ||
110 stepperType ==
"RK Explicit Trapezoidal" ||
111 stepperType ==
"Bogacki-Shampine 3(2) Pair" ||
112 stepperType ==
"Merson 4(5) Pair" ||
113 stepperType ==
"General ERK" )
116 stepperType ==
"RK Backward Euler" ||
117 stepperType ==
"IRK 1 Stage Theta Method" ||
118 stepperType ==
"Implicit Midpoint" ||
119 stepperType ==
"SDIRK 1 Stage 1st order" ||
120 stepperType ==
"SDIRK 2 Stage 2nd order" ||
121 stepperType ==
"SDIRK 2 Stage 3rd order" ||
122 stepperType ==
"EDIRK 2 Stage 3rd order" ||
123 stepperType ==
"EDIRK 2 Stage Theta Method" ||
124 stepperType ==
"SDIRK 3 Stage 4th order" ||
125 stepperType ==
"SDIRK 5 Stage 4th order" ||
126 stepperType ==
"SDIRK 5 Stage 5th order" ||
127 stepperType ==
"SDIRK 2(1) Pair" ||
128 stepperType ==
"General DIRK" 132 stepperType ==
"RK Implicit 3 Stage 6th Order Kuntzmann & Butcher" ||
133 stepperType ==
"RK Implicit 4 Stage 8th Order Kuntzmann & Butcher" ||
134 stepperType ==
"RK Implicit 2 Stage 4th Order Hammer & Hollingsworth" ||
135 stepperType ==
"RK Implicit 1 Stage 2nd order Gauss" ||
136 stepperType ==
"RK Implicit 2 Stage 4th order Gauss" ||
137 stepperType ==
"RK Implicit 3 Stage 6th order Gauss" ||
138 stepperType ==
"RK Implicit 1 Stage 1st order Radau left" ||
139 stepperType ==
"RK Implicit 2 Stage 3rd order Radau left" ||
140 stepperType ==
"RK Implicit 3 Stage 5th order Radau left" ||
141 stepperType ==
"RK Implicit 1 Stage 1st order Radau right" ||
142 stepperType ==
"RK Implicit 2 Stage 3rd order Radau right" ||
143 stepperType ==
"RK Implicit 3 Stage 5th order Radau right" ||
144 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto A" ||
145 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto A" ||
146 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto A" ||
147 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto B" ||
148 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto B" ||
149 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto B" ||
150 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto C" ||
151 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto C" ||
152 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto C" ) {
153 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
154 "Error - Implicit RK not implemented yet!.\n");
157 stepperType ==
"IMEX RK 1st order" ||
158 stepperType ==
"IMEX RK SSP2" ||
159 stepperType ==
"IMEX RK ARS 233" ||
160 stepperType ==
"General IMEX RK" )
163 stepperType ==
"Partitioned IMEX RK 1st order" ||
164 stepperType ==
"Partitioned IMEX RK SSP2" ||
165 stepperType ==
"Partitioned IMEX RK ARS 233" ||
166 stepperType ==
"General Partitioned IMEX RK" )
168 model, stepperType, stepperPL));
169 else if (stepperType ==
"Leapfrog")
172 Teuchos::RCP<Teuchos::FancyOStream> out =
173 Teuchos::VerboseObjectBase::getDefaultOStream();
174 Teuchos::OSTab ostab(out,1,
"StepperFactory::createStepper");
176 <<
"Unknown Stepper Type! Here is a list of available Steppers.\n" 177 <<
" One-Step Methods:\n" 178 <<
" 'Forward Euler'\n" 179 <<
" 'Backward Euler'\n" 180 <<
" 'Trapezoidal Method'\n" 181 <<
" Multi-Step Methods:\n" 183 <<
" Second-order PDE Methods:\n" 185 <<
" 'Newmark Implicit a-Form'\n" 186 <<
" 'Newmark Implicit d-Form'\n" 187 <<
" 'Newmark Explicit a-Form'\n" 189 <<
" Explicit Runge-Kutta Methods:\n" 190 <<
" 'RK Forward Euler'\n" 191 <<
" 'RK Explicit 4 Stage'\n" 192 <<
" 'RK Explicit 3/8 Rule'\n" 193 <<
" 'RK Explicit 4 Stage 3rd order by Runge'\n" 194 <<
" 'RK Explicit 5 Stage 3rd order by Kinnmark and Gray'\n" 195 <<
" 'RK Explicit 3 Stage 3rd order'\n" 196 <<
" 'RK Explicit 3 Stage 3rd order TVD'\n" 197 <<
" 'RK Explicit 3 Stage 3rd order by Heun'\n" 198 <<
" 'RK Explicit 2 Stage 2nd order by Runge'\n" 199 <<
" 'RK Explicit Trapezoidal'\n" 200 <<
" 'Bogacki-Shampine 3(2) Pair'\n" 201 <<
" 'General ERK'\n" 202 <<
" Implicit Runge-Kutta Methods:\n" 203 <<
" 'RK Backward Euler'\n" 204 <<
" 'IRK 1 Stage Theta Method'\n" 205 <<
" 'SDIRK 1 Stage 1st order'\n" 206 <<
" 'SDIRK 2 Stage 2nd order'\n" 207 <<
" 'SDIRK 2 Stage 3rd order'\n" 208 <<
" 'EDIRK 2 Stage 3rd order'\n" 209 <<
" 'EDIRK 2 Stage Theta Method'\n" 210 <<
" 'SDIRK 3 Stage 4th order'\n" 211 <<
" 'SDIRK 5 Stage 4th order'\n" 212 <<
" 'SDIRK 5 Stage 5th order'\n" 213 <<
" 'General DIRK'\n" 214 <<
" Implicit-Explicit (IMEX) Methods:\n" 215 <<
" 'IMEX RK 1st order'\n" 216 <<
" 'IMEX RK SSP2'\n" 217 <<
" 'IMEX RK ARS 233'\n" 218 <<
" 'General IMEX RK'\n" 219 <<
" 'Partitioned IMEX RK 1st order'\n" 220 <<
" 'Partitioned IMEX RK SSP2'\n" 221 <<
" 'Partitioned IMEX RK ARS 233'\n" 222 <<
" 'General Partitioned IMEX RK'\n" 223 <<
" Steppers with subSteppers:\n" 224 <<
" 'Operator Split'\n" 226 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
227 "Unknown 'Stepper Type' = " << stepperType);
232 std::vector<Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > > models,
233 std::string stepperType,
234 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
236 if (stepperType ==
"Operator Split")
239 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
240 "Unknown 'Stepper Type' = " << stepperType);
248 #endif // Tempus_StepperFactory_hpp BDF2 (Backward-Difference-Formula-2) time stepper.
virtual ~StepperFactory()
Destructor.
Teuchos::RCP< Stepper< Scalar > > createStepper(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > models, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Teuchos::RCP< Stepper< Scalar > > createStepper(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType="Forward Euler")
Create default stepper from stepper type (e.g., "Forward Euler").
Trapezoidal method time stepper.
Explicit Runge-Kutta time stepper.
Forward Euler time stepper.
Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
StepperFactory()
Constructor.
Teuchos::RCP< Stepper< Scalar > > createStepper(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Create stepper from ParameterList with its details.
Partitioned Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
Teuchos::RCP< Stepper< Scalar > > createStepper(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Very simple factory method.
OperatorSplit stepper loops through the Stepper list.
Diagonally Implicit Runge-Kutta (DIRK) time stepper.
Backward Euler time stepper.
Teuchos::RCP< Stepper< Scalar > > createStepper(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > models, Teuchos::RCP< Teuchos::ParameterList > stepperPL)
Create stepper from ParameterList with its details.