Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperNewmarkExplicitAForm_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_StepperNewmarkExplicitAForm_decl_hpp
10 #define Tempus_StepperNewmarkExplicitAForm_decl_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_StepperExplicit.hpp"
14 
15 namespace Tempus {
16 
17 
18 /** \brief Newmark Explicit time stepper.
19  *
20  * This is the specific case of the more general Newmark time stepper
21  * where this stepper is explicit (\f$\beta = 0\f$) (i.e., no solver used).
22  *
23  * The governing equation is solved by this stepper is
24  * \f[
25  * \mathbf{M}\, \ddot{\mathbf{x}} + \mathbf{C}\, \dot{\mathbf{x}}
26  * + \mathbf{K}\, \mathbf{x} = \mathbf{F}(t)
27  * \f]
28  * For the A-form (i.e., solving for the acceleration,
29  * \f$\mathbf{a} = \ddot{\mathbf{x}}\f$), we have the following explicit ODE
30  * \f[
31  * \mathbf{a} = -\mathbf{M}^{-1}\left[ \mathbf{C}\, \mathbf{v}
32  * + \mathbf{K}\, \mathbf{d} - \mathbf{F}(t) \right]
33  * = \bar{\mathbf{f}}(\mathbf{d}, \mathbf{v}, t)
34  * \f]
35  * where \f$\mathbf{v} = \dot{\mathbf{x}}\f$ and \f$\mathbf{d} = \mathbf{x}\f$.
36  *
37  * <b> Algorithm </b>
38  * The algorithm for the Newmark explicit A-form is
39  * - if ( !useFSAL )
40  * - \f$\mathbf{a}^{n-1} =
41  * \bar{\mathbf{f}}(\mathbf{d}^{n-1}, \mathbf{v}^{n-1}, t^{n-1})\f$
42  * - \f$\mathbf{d}^{\ast} = \mathbf{d}^{n-1} + \Delta t \mathbf{v}^{n-1}
43  * + \Delta t^2 \mathbf{a}^{n-1} / 2\f$
44  * - \f$\mathbf{v}^{\ast} =
45  * \mathbf{v}^{n-1} + \Delta t (1-\gamma) \mathbf{a}^{n-1}\f$
46  * - \f$\mathbf{a}^{\ast} =
47  * \bar{\mathbf{f}}(\mathbf{d}^{\ast}, \mathbf{v}^{\ast}, t^{n-1})\f$
48  * - \f$\mathbf{d}^n = \mathbf{d}^{\ast}\f$
49  * - \f$\mathbf{v}^n =
50  * \mathbf{v}^{\ast} + \Delta t \gamma \mathbf{a}^{\ast}\f$
51  * - if ( useFSAL )
52  * - \f$\mathbf{a}^n =
53  * \bar{\mathbf{f}}(\mathbf{d}^n, \mathbf{v}^n, t^n)\f$
54  *
55  * The default for Forward Euler is to use FSAL (useFSAL=true).
56  */
57 template<class Scalar>
59  : virtual public Tempus::StepperExplicit<Scalar>
60 {
61 public:
62 
63  /** \brief Default constructor.
64  *
65  * - Constructs with a default ParameterList.
66  * - Can reset ParameterList with setParameterList().
67  * - Requires subsequent setModel() and initialize() calls before calling
68  * takeStep().
69  */
71 
72  /// Constructor
74  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
75  Teuchos::RCP<Teuchos::ParameterList> pList = Teuchos::null);
76 
77  /// \name Basic stepper methods
78  //@{
79  virtual void setObserver(
80  Teuchos::RCP<StepperObserver<Scalar> > /* obs */ = Teuchos::null){}
81 
82  /// Initialize during construction and after changing input parameters.
83  virtual void initialize();
84 
85  /// Set the initial conditions and make them consistent.
86  virtual void setInitialConditions (
87  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
88 
89  /// Take the specified timestep, dt, and return true if successful.
90  virtual void takeStep(
91  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
92 
93  virtual std::string getStepperType() const
94  { return this->stepperPL_->template get<std::string>("Stepper Type"); }
95 
96  /// Get a default (initial) StepperState
97  virtual Teuchos::RCP<Tempus::StepperState<Scalar> > getDefaultStepperState();
98  virtual Scalar getOrder() const {
99  if (gamma_ == 0.5) return 2.0;
100  else return 1.0;
101  }
102  virtual Scalar getOrderMin() const {return 1.0;}
103  virtual Scalar getOrderMax() const {return 2.0;}
104  virtual Scalar getInitTimeStep(
105  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
106  {return Scalar(1.0e+99);}
107 
108  virtual bool isExplicit() const {return true;}
109  virtual bool isImplicit() const {return false;}
110  virtual bool isExplicitImplicit() const
111  {return isExplicit() and isImplicit();}
112  virtual bool isOneStepMethod() const {return true;}
113  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
114 
115  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
116  //@}
117 
118  /// \name ParameterList methods
119  //@{
120  void setParameterList(const Teuchos::RCP<Teuchos::ParameterList> & pl);
121  Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
122  Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
123  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
124  Teuchos::RCP<Teuchos::ParameterList> getDefaultParameters() const;
125  //@}
126 
127  /// \name Overridden from Teuchos::Describable
128  //@{
129  virtual std::string description() const;
130  virtual void describe(Teuchos::FancyOStream & out,
131  const Teuchos::EVerbosityLevel verbLevel) const;
132  //@}
133 
134  void predictVelocity(Thyra::VectorBase<Scalar>& vPred,
135  const Thyra::VectorBase<Scalar>& v,
136  const Thyra::VectorBase<Scalar>& a,
137  const Scalar dt) const;
138 
139  void predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
140  const Thyra::VectorBase<Scalar>& d,
141  const Thyra::VectorBase<Scalar>& v,
142  const Thyra::VectorBase<Scalar>& a,
143  const Scalar dt) const;
144 
145  void correctVelocity(Thyra::VectorBase<Scalar>& v,
146  const Thyra::VectorBase<Scalar>& vPred,
147  const Thyra::VectorBase<Scalar>& a,
148  const Scalar dt) const;
149 
150 protected:
151 
152  Scalar gamma_;
153 
154 };
155 } // namespace Tempus
156 
157 #endif // Tempus_StepperNewmarkExplicitAForm_decl_hpp
void predictDisplacement(Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
virtual void initialize()
Initialize during construction and after changing input parameters.
Stepper integrates second-order ODEs.
Teuchos::RCP< Teuchos::ParameterList > stepperPL_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperObserver class for Stepper class.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
Teuchos::RCP< Teuchos::ParameterList > getDefaultParameters() const
virtual void setObserver(Teuchos::RCP< StepperObserver< Scalar > >=Teuchos::null)
Set Observer.
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
Thyra Base interface for implicit time steppers.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const