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 std::string stepperType =
"Forward Euler",
50 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >&
51 model = Teuchos::null)
53 if (stepperType ==
"") stepperType =
"Forward Euler";
54 return this->
createStepper(model, stepperType, Teuchos::null);
59 Teuchos::RCP<Teuchos::ParameterList> stepperPL,
60 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >&
61 model = Teuchos::null)
63 std::string stepperType =
"Forward Euler";
64 if (stepperPL != Teuchos::null)
65 stepperType = stepperPL->get<std::string>(
"Stepper Type",
"Forward Euler");
71 Teuchos::RCP<Teuchos::ParameterList> stepperPL,
72 std::vector<Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > >
73 models = Teuchos::null)
75 std::string stepperType = stepperPL->get<std::string>(
"Stepper Type");
82 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model,
83 std::string stepperType,
84 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
87 if (stepperType ==
"Forward Euler")
89 else if (stepperType ==
"Backward Euler")
91 else if (stepperType ==
"Trapezoidal Method")
93 else if (stepperType ==
"BDF2")
95 else if (stepperType ==
"Newmark Implicit a-Form")
97 else if (stepperType ==
"Newmark Implicit d-Form")
99 else if (stepperType ==
"Newmark Explicit a-Form")
101 else if (stepperType ==
"HHT-Alpha")
104 stepperType ==
"RK Forward Euler" ||
105 stepperType ==
"RK Explicit 4 Stage" ||
106 stepperType ==
"RK Explicit 3/8 Rule" ||
107 stepperType ==
"RK Explicit 4 Stage 3rd order by Runge" ||
108 stepperType ==
"RK Explicit 5 Stage 3rd order by Kinnmark and Gray"||
109 stepperType ==
"RK Explicit 3 Stage 3rd order" ||
110 stepperType ==
"RK Explicit 3 Stage 3rd order TVD" ||
111 stepperType ==
"RK Explicit 3 Stage 3rd order by Heun" ||
112 stepperType ==
"RK Explicit 2 Stage 2nd order by Runge" ||
113 stepperType ==
"RK Explicit Trapezoidal" ||
114 stepperType ==
"Bogacki-Shampine 3(2) Pair" ||
115 stepperType ==
"Merson 4(5) Pair" ||
116 stepperType ==
"General ERK" )
119 stepperType ==
"RK Backward Euler" ||
120 stepperType ==
"IRK 1 Stage Theta Method" ||
121 stepperType ==
"Implicit Midpoint" ||
122 stepperType ==
"SDIRK 1 Stage 1st order" ||
123 stepperType ==
"SDIRK 2 Stage 2nd order" ||
124 stepperType ==
"SDIRK 2 Stage 3rd order" ||
125 stepperType ==
"EDIRK 2 Stage 3rd order" ||
126 stepperType ==
"EDIRK 2 Stage Theta Method" ||
127 stepperType ==
"SDIRK 3 Stage 4th order" ||
128 stepperType ==
"SDIRK 5 Stage 4th order" ||
129 stepperType ==
"SDIRK 5 Stage 5th order" ||
130 stepperType ==
"SDIRK 2(1) Pair" ||
131 stepperType ==
"General DIRK"
135 stepperType ==
"RK Implicit 3 Stage 6th Order Kuntzmann & Butcher" ||
136 stepperType ==
"RK Implicit 4 Stage 8th Order Kuntzmann & Butcher" ||
137 stepperType ==
"RK Implicit 2 Stage 4th Order Hammer & Hollingsworth" ||
138 stepperType ==
"RK Implicit 1 Stage 2nd order Gauss" ||
139 stepperType ==
"RK Implicit 2 Stage 4th order Gauss" ||
140 stepperType ==
"RK Implicit 3 Stage 6th order Gauss" ||
141 stepperType ==
"RK Implicit 1 Stage 1st order Radau left" ||
142 stepperType ==
"RK Implicit 2 Stage 3rd order Radau left" ||
143 stepperType ==
"RK Implicit 3 Stage 5th order Radau left" ||
144 stepperType ==
"RK Implicit 1 Stage 1st order Radau right" ||
145 stepperType ==
"RK Implicit 2 Stage 3rd order Radau right" ||
146 stepperType ==
"RK Implicit 3 Stage 5th order Radau right" ||
147 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto A" ||
148 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto A" ||
149 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto A" ||
150 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto B" ||
151 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto B" ||
152 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto B" ||
153 stepperType ==
"RK Implicit 2 Stage 2nd order Lobatto C" ||
154 stepperType ==
"RK Implicit 3 Stage 4th order Lobatto C" ||
155 stepperType ==
"RK Implicit 4 Stage 6th order Lobatto C" ) {
156 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
157 "Error - Implicit RK not implemented yet!.\n");
160 stepperType ==
"IMEX RK 1st order" ||
161 stepperType ==
"IMEX RK SSP2" ||
162 stepperType ==
"IMEX RK ARS 233" ||
163 stepperType ==
"General IMEX RK" )
166 stepperType ==
"Partitioned IMEX RK 1st order" ||
167 stepperType ==
"Partitioned IMEX RK SSP2" ||
168 stepperType ==
"Partitioned IMEX RK ARS 233" ||
169 stepperType ==
"General Partitioned IMEX RK" )
171 model, stepperType, stepperPL));
172 else if (stepperType ==
"Leapfrog")
175 Teuchos::RCP<Teuchos::FancyOStream> out =
176 Teuchos::VerboseObjectBase::getDefaultOStream();
177 Teuchos::OSTab ostab(out,1,
"StepperFactory::createStepper");
179 <<
"Unknown Stepper Type! Here is a list of available Steppers.\n"
180 <<
" One-Step Methods:\n"
181 <<
" 'Forward Euler'\n"
182 <<
" 'Backward Euler'\n"
183 <<
" 'Trapezoidal Method'\n"
184 <<
" Multi-Step Methods:\n"
186 <<
" Second-order PDE Methods:\n"
188 <<
" 'Newmark Implicit a-Form'\n"
189 <<
" 'Newmark Implicit d-Form'\n"
190 <<
" 'Newmark Explicit a-Form'\n"
192 <<
" Explicit Runge-Kutta Methods:\n"
193 <<
" 'RK Forward Euler'\n"
194 <<
" 'RK Explicit 4 Stage'\n"
195 <<
" 'RK Explicit 3/8 Rule'\n"
196 <<
" 'RK Explicit 4 Stage 3rd order by Runge'\n"
197 <<
" 'RK Explicit 5 Stage 3rd order by Kinnmark and Gray'\n"
198 <<
" 'RK Explicit 3 Stage 3rd order'\n"
199 <<
" 'RK Explicit 3 Stage 3rd order TVD'\n"
200 <<
" 'RK Explicit 3 Stage 3rd order by Heun'\n"
201 <<
" 'RK Explicit 2 Stage 2nd order by Runge'\n"
202 <<
" 'RK Explicit Trapezoidal'\n"
203 <<
" 'Bogacki-Shampine 3(2) Pair'\n"
204 <<
" 'General ERK'\n"
205 <<
" Implicit Runge-Kutta Methods:\n"
206 <<
" 'RK Backward Euler'\n"
207 <<
" 'IRK 1 Stage Theta Method'\n"
208 <<
" 'SDIRK 1 Stage 1st order'\n"
209 <<
" 'SDIRK 2 Stage 2nd order'\n"
210 <<
" 'SDIRK 2 Stage 3rd order'\n"
211 <<
" 'EDIRK 2 Stage 3rd order'\n"
212 <<
" 'EDIRK 2 Stage Theta Method'\n"
213 <<
" 'SDIRK 3 Stage 4th order'\n"
214 <<
" 'SDIRK 5 Stage 4th order'\n"
215 <<
" 'SDIRK 5 Stage 5th order'\n"
216 <<
" 'General DIRK'\n"
217 <<
" Implicit-Explicit (IMEX) Methods:\n"
218 <<
" 'IMEX RK 1st order'\n"
219 <<
" 'IMEX RK SSP2'\n"
220 <<
" 'IMEX RK ARS 233'\n"
221 <<
" 'General IMEX RK'\n"
222 <<
" 'Partitioned IMEX RK 1st order'\n"
223 <<
" 'Partitioned IMEX RK SSP2'\n"
224 <<
" 'Partitioned IMEX RK ARS 233'\n"
225 <<
" 'General Partitioned IMEX RK'\n"
226 <<
" Steppers with subSteppers:\n"
227 <<
" 'Operator Split'\n"
229 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
230 "Unknown 'Stepper Type' = " << stepperType);
235 std::vector<Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > > models,
236 std::string stepperType,
237 Teuchos::RCP<Teuchos::ParameterList> stepperPL)
239 if (stepperType ==
"Operator Split")
242 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
243 "Unknown 'Stepper Type' = " << stepperType);
251 #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)
Trapezoidal method time stepper.
Explicit Runge-Kutta time stepper.
Forward Euler time stepper.
Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
StepperFactory()
Constructor.
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.
Teuchos::RCP< Stepper< Scalar > > createStepper(Teuchos::RCP< Teuchos::ParameterList > stepperPL, std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > models=Teuchos::null)
Create stepper from ParameterList with its details.
Backward Euler time stepper.
Teuchos::RCP< Stepper< Scalar > > createStepper(Teuchos::RCP< Teuchos::ParameterList > stepperPL, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model=Teuchos::null)
Create stepper from ParameterList with its details.
Teuchos::RCP< Stepper< Scalar > > createStepper(std::string stepperType="Forward Euler", const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model=Teuchos::null)
Create default stepper from stepper type (e.g., "Forward Euler").