9 #ifndef Tempus_Stepper_decl_hpp
10 #define Tempus_Stepper_decl_hpp
13 #include "Teuchos_TimeMonitor.hpp"
16 #include "Thyra_ModelEvaluator.hpp"
17 #include "Thyra_NonlinearSolverBase.hpp"
20 #include "Tempus_config.hpp"
21 #include "Tempus_SolutionHistory.hpp"
60 template<
class Scalar>
62 :
virtual public Teuchos::Describable,
63 virtual public Teuchos::VerboseObject<Stepper<Scalar> >
70 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& appModel) = 0;
72 const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& appModel) = 0;
73 virtual Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >
getModel() = 0;
77 Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> > solver = Teuchos::null) = 0;
80 virtual Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >
85 Teuchos::RCP<StepperObserver<Scalar> > obs = Teuchos::null) = 0;
88 virtual Teuchos::RCP<StepperObserver<Scalar> >
getObserver()
const = 0;
105 Teuchos::RCP<
const Thyra::VectorBase<Scalar> > initial_guess = Teuchos::null) = 0;
107 virtual Teuchos::RCP<Tempus::StepperState<Scalar> >
109 virtual Scalar
getOrder()
const = 0;
113 const Teuchos::RCP<SolutionHistory<Scalar> >&
solutionHistory)
const = 0;
148 std::vector<Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > > ){}
165 Teuchos::RCP<Teuchos::ParameterList> pl, std::string stepperType);
172 template<
class Scalar>
174 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model)
176 TEUCHOS_TEST_FOR_EXCEPT( is_null(model) );
177 typedef Thyra::ModelEvaluatorBase MEB;
178 const MEB::InArgs<Scalar> inArgs = model->createInArgs();
179 const MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
180 const bool supports = inArgs.supports(MEB::IN_ARG_x) and
181 outArgs.supports(MEB::OUT_ARG_f);
183 TEUCHOS_TEST_FOR_EXCEPTION( supports ==
false, std::logic_error,
184 model->description() <<
"can not support an explicit ODE with\n"
185 <<
" IN_ARG_x = " << inArgs.supports(MEB::IN_ARG_x) <<
"\n"
186 <<
" OUT_ARG_f = " << outArgs.supports(MEB::OUT_ARG_f) <<
"\n"
187 <<
"Explicit ODE requires:\n"
188 <<
" IN_ARG_x = true\n"
189 <<
" OUT_ARG_f = true\n"
191 <<
"NOTE: Currently the convention to evaluate f(x,t) is to set\n"
192 <<
"xdot=null! There is no InArgs support to test if xdot is null,\n"
193 <<
"so we set xdot=null and hope the ModelEvaluator can handle it.\n");
204 template<
class Scalar>
206 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model)
208 TEUCHOS_TEST_FOR_EXCEPT( is_null(model) );
209 typedef Thyra::ModelEvaluatorBase MEB;
210 const MEB::InArgs<Scalar> inArgs = model->createInArgs();
211 const MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
212 const bool supports = inArgs.supports(MEB::IN_ARG_x) and
213 inArgs.supports(MEB::IN_ARG_x_dot) and
214 outArgs.supports(MEB::OUT_ARG_f);
216 TEUCHOS_TEST_FOR_EXCEPTION( supports ==
false, std::logic_error,
217 model->description() <<
"can not support an explicit ODE with\n"
218 <<
" IN_ARG_x = " << inArgs.supports(MEB::IN_ARG_x) <<
"\n"
219 <<
" IN_ARG_x_dot = " << inArgs.supports(MEB::IN_ARG_x_dot) <<
"\n"
220 <<
" OUT_ARG_f = " << outArgs.supports(MEB::OUT_ARG_f) <<
"\n"
221 <<
"Explicit ODE requires:\n"
222 <<
" IN_ARG_x = true\n"
223 <<
" IN_ARG_x_dot = true\n"
224 <<
" OUT_ARG_f = true\n"
226 <<
"NOTE: Currently the convention to evaluate f(x, xdot, t) is to\n"
227 <<
"set xdotdot=null! There is no InArgs support to test if xdotdot\n"
228 <<
"is null, so we set xdotdot=null and hope the ModelEvaluator can\n"
236 template<
class Scalar>
238 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model)
240 TEUCHOS_TEST_FOR_EXCEPT( is_null(model) );
241 typedef Thyra::ModelEvaluatorBase MEB;
242 const MEB::InArgs<Scalar> inArgs = model->createInArgs();
243 const MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
244 const bool supports = inArgs.supports(MEB::IN_ARG_x) and
245 inArgs.supports(MEB::IN_ARG_x_dot) and
246 inArgs.supports(MEB::IN_ARG_alpha) and
247 inArgs.supports(MEB::IN_ARG_beta) and
248 !inArgs.supports(MEB::IN_ARG_W_x_dot_dot_coeff) and
249 outArgs.supports(MEB::OUT_ARG_f) and
250 outArgs.supports(MEB::OUT_ARG_W);
252 TEUCHOS_TEST_FOR_EXCEPTION( supports ==
false, std::logic_error,
253 model->description() <<
" can not support an implicit ODE with\n"
255 << inArgs.supports(MEB::IN_ARG_x) <<
"\n"
256 <<
" IN_ARG_x_dot = "
257 << inArgs.supports(MEB::IN_ARG_x_dot) <<
"\n"
258 <<
" IN_ARG_alpha = "
259 << inArgs.supports(MEB::IN_ARG_alpha) <<
"\n"
261 << inArgs.supports(MEB::IN_ARG_beta) <<
"\n"
262 <<
" IN_ARG_W_x_dot_dot_coeff = "
263 << inArgs.supports(MEB::IN_ARG_W_x_dot_dot_coeff) <<
"\n"
265 << outArgs.supports(MEB::OUT_ARG_f) <<
"\n"
267 << outArgs.supports(MEB::OUT_ARG_W) <<
"\n"
268 <<
"Implicit ODE requires:\n"
269 <<
" IN_ARG_x = true\n"
270 <<
" IN_ARG_x_dot = true\n"
271 <<
" IN_ARG_alpha = true\n"
272 <<
" IN_ARG_beta = true\n"
273 <<
" IN_ARG_W_x_dot_dot_coeff = false\n"
274 <<
" OUT_ARG_f = true\n"
275 <<
" OUT_ARG_W = true\n");
282 template<
class Scalar>
284 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> >& model)
286 TEUCHOS_TEST_FOR_EXCEPT( is_null(model) );
287 typedef Thyra::ModelEvaluatorBase MEB;
288 const MEB::InArgs<Scalar> inArgs = model->createInArgs();
289 const MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
290 const bool supports = inArgs.supports(MEB::IN_ARG_x) and
291 inArgs.supports(MEB::IN_ARG_x_dot) and
292 inArgs.supports(MEB::IN_ARG_x_dot_dot) and
293 inArgs.supports(MEB::IN_ARG_alpha) and
294 inArgs.supports(MEB::IN_ARG_beta) and
295 inArgs.supports(MEB::IN_ARG_W_x_dot_dot_coeff) and
296 outArgs.supports(MEB::OUT_ARG_f) and
297 outArgs.supports(MEB::OUT_ARG_W);
299 TEUCHOS_TEST_FOR_EXCEPTION( supports ==
false, std::logic_error,
300 model->description() <<
" can not support an implicit ODE with\n"
302 << inArgs.supports(MEB::IN_ARG_x) <<
"\n"
303 <<
" IN_ARG_x_dot = "
304 << inArgs.supports(MEB::IN_ARG_x_dot) <<
"\n"
305 <<
" IN_ARG_x_dot_dot = "
306 << inArgs.supports(MEB::IN_ARG_x_dot_dot) <<
"\n"
307 <<
" IN_ARG_alpha = "
308 << inArgs.supports(MEB::IN_ARG_alpha) <<
"\n"
310 << inArgs.supports(MEB::IN_ARG_beta) <<
"\n"
311 <<
" IN_ARG_W_x_dot_dot_coeff = "
312 << inArgs.supports(MEB::IN_ARG_W_x_dot_dot_coeff) <<
"\n"
314 << outArgs.supports(MEB::OUT_ARG_f) <<
"\n"
316 << outArgs.supports(MEB::OUT_ARG_W) <<
"\n"
317 <<
"Implicit Second Order ODE requires:\n"
318 <<
" IN_ARG_x = true\n"
319 <<
" IN_ARG_x_dot = true\n"
320 <<
" IN_ARG_x_dot_dot = true\n"
321 <<
" IN_ARG_alpha = true\n"
322 <<
" IN_ARG_beta = true\n"
323 <<
" IN_ARG_W_x_dot_dot_coeff = true\n"
324 <<
" OUT_ARG_f = true\n"
325 <<
" OUT_ARG_W = true\n");
337 #endif // Tempus_Stepper_decl_hpp
virtual void setObserver(Teuchos::RCP< StepperObserver< Scalar > > obs=Teuchos::null)=0
Set Observer.
virtual Scalar getOrderMax() const =0
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)=0
Take the specified timestep, dt, and return true if successful.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel()=0
virtual OrderODE getOrderODE() const =0
std::string getStepperType() const
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver=Teuchos::null)=0
Set solver.
bool getICConsistencyCheck() const
virtual bool isExplicit() const =0
virtual Teuchos::RCP< StepperObserver< Scalar > > getObserver() const =0
Get Observer.
virtual bool getICConsistencyCheckDefault() const
Teuchos::RCP< Teuchos::ParameterList > defaultSolverParameters()
Returns the default solver ParameterList for implicit Steppers.
void validExplicitODE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate that the model supports explicit ODE evaluation, f(x,t) [=xdot].
virtual std::string getICConsistencyDefault() const
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)=0
virtual bool isOneStepMethod() const =0
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > > initial_guess=Teuchos::null)=0
Pass initial guess to Newton solver (for implicit schemes)
virtual void initialize()=0
Initialize during construction and after changing input parameters.
virtual Scalar getOrderMin() const =0
std::string getICConsistency() const
virtual bool isMultiStepMethod() const =0
Stepper integrates second-order ODEs.
virtual std::string description() const
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory) const =0
void setICConsistencyCheck(bool c)
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const =0
Get solver.
virtual void setNonConstModel(const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &appModel)=0
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()=0
std::string ICConsistency_
Stepper integrates first-order ODEs.
void validSecondOrderExplicitODE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate that the model supports explicit second order ODE evaluation, f(x,xdot,t) [=xdotdot]...
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)=0
Set initial conditions, make them consistent, and set stepper memory.
void validSecondOrderODE_DAE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate ME supports 2nd order implicit ODE/DAE evaluation, f(xdotdot,xdot,x,t) [= 0]...
virtual bool getUseFSALDefault() const
void validImplicitODE_DAE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate ME supports implicit ODE/DAE evaluation, f(xdot,x,t) [= 0].
virtual bool isImplicit() const =0
virtual void createSubSteppers(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > >)
void getValidParametersBasic(Teuchos::RCP< Teuchos::ParameterList > pl, std::string stepperType)
Provide basic parameters to Steppers.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const =0
void setStepperType(std::string s)
virtual bool isExplicitImplicit() const =0
virtual Scalar getOrder() const =0
void setICConsistency(std::string s)