Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperExplicit_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_StepperExplicit_decl_hpp
10 #define Tempus_StepperExplicit_decl_hpp
11 
12 // Tempus
13 #include "Tempus_Stepper.hpp"
14 
15 
16 template<class Scalar>
18 {
19  public:
20  /// Constructor
22  : timeStepSize_(Scalar(0.0)), stageNumber_(0)
23  {}
24  /// Constructor
25  ExplicitODEParameters(Scalar timeStepSize, int stageNumber = 0)
26  : timeStepSize_(timeStepSize), stageNumber_(stageNumber)
27  {}
28 
29  Scalar timeStepSize_;
31 };
32 
33 
34 namespace Tempus {
35 
36 
37 /** \brief Thyra Base interface for implicit time steppers.
38  *
39  */
40 template<class Scalar>
41 class StepperExplicit : virtual public Tempus::Stepper<Scalar>
42 {
43 public:
44 
45  /// \name Basic explicit stepper methods
46  //@{
47  virtual void setModel(
48  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel);
49 
50  virtual Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >
51  getModel(){return appModel_;}
52 
53  virtual Scalar getInitTimeStep(
54  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
55  {return std::numeric_limits<Scalar>::max();}
56 
57  /// Set the initial conditions, make them consistent, and set needed memory.
58  virtual void setInitialConditions (
59  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
60 
61  virtual void setSolver(
62  Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> > solver);
63 
64  virtual Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> > getSolver() const
65  { return Teuchos::null; }
66 
67  /// Pass initial guess to Newton solver (only relevant for implicit solvers)
68  // thus a no-op for explicit steppers.
69  virtual void setInitialGuess(
70  Teuchos::RCP<const Thyra::VectorBase<Scalar> > /* initial_guess */){}
71 
72  virtual bool isExplicit() const {return true;}
73  virtual bool isImplicit() const {return false;}
74  virtual bool isExplicitImplicit() const
75  {return isExplicit() and isImplicit();}
76  virtual bool isOneStepMethod() const {return true;}
77  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
78 
79  /// Evaluate xDot = f(x,t).
80  virtual void evaluateExplicitODE(
81  Teuchos::RCP< Thyra::VectorBase<Scalar> > xDot,
82  Teuchos::RCP<const Thyra::VectorBase<Scalar> > x,
83  const Scalar time,
84  const Teuchos::RCP<ExplicitODEParameters<Scalar> > & p );
85 
86  /// Evaluate xDotDot = f(x, xDot, t).
87  virtual void evaluateExplicitODE(
88  Teuchos::RCP< Thyra::VectorBase<Scalar> > xDotDot,
89  Teuchos::RCP<const Thyra::VectorBase<Scalar> > x,
90  Teuchos::RCP<const Thyra::VectorBase<Scalar> > xDot,
91  const Scalar time,
92  const Teuchos::RCP<ExplicitODEParameters<Scalar> > & p );
93  //@}
94 
95  /// \name Overridden from Teuchos::Describable
96  //@{
97  virtual void describe(Teuchos::FancyOStream & out,
98  const Teuchos::EVerbosityLevel verbLevel) const;
99  //@}
100 
101  virtual bool isValidSetup(Teuchos::FancyOStream & out) const;
102 
103 protected:
104 
105  /// Explicit ODE ModelEvaluator
106  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > appModel_;
107 
108  Thyra::ModelEvaluatorBase::InArgs<Scalar> inArgs_;
109  Thyra::ModelEvaluatorBase::OutArgs<Scalar> outArgs_;
110 
111  Teuchos::RCP<StepperObserver<Scalar> > stepperObserver_;
112  };
113 
114 } // namespace Tempus
115 #endif // Tempus_StepperExplicit_decl_hpp
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > appModel_
Explicit ODE ModelEvaluator.
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver)
Set solver.
Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs_
Thyra Base interface for time steppers.
ExplicitODEParameters(Scalar timeStepSize, int stageNumber=0)
Constructor.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel()
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions, make them consistent, and set needed memory.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Teuchos::RCP< StepperObserver< Scalar > > stepperObserver_
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const
Get solver.
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > >)
Pass initial guess to Newton solver (only relevant for implicit solvers)
virtual void evaluateExplicitODE(Teuchos::RCP< Thyra::VectorBase< Scalar > > xDot, Teuchos::RCP< const Thyra::VectorBase< Scalar > > x, const Scalar time, const Teuchos::RCP< ExplicitODEParameters< Scalar > > &p)
Evaluate xDot = f(x,t).
virtual bool isExplicitImplicit() const
virtual bool isMultiStepMethod() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs_
Thyra Base interface for implicit time steppers.