Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperNewmarkImplicitAForm_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_StepperNewmarkImplicitAForm_decl_hpp
10 #define Tempus_StepperNewmarkImplicitAForm_decl_hpp
11 
12 #include "Tempus_StepperImplicit.hpp"
13 #include "Tempus_WrapperModelEvaluatorSecondOrder.hpp"
14 
15 namespace Tempus {
16 
17 
18 /** \brief Newmark time stepper in acceleration form (a-form).
19  *
20  * Here, we implement the Newmark scheme in predictor/corrector form;
21  * see equations (34)-(35) in: A. Mota, W. Klug, M. Ortiz, "Finite element
22  * simulation of firearm injury to the human cranium", Computational
23  * Mechanics 31(1) 115-121 (2003).
24  *
25  * Newmark has two parameters: \f$\beta\f$
26  * and \f$\gamma\f$, both of which need to be in the range \f$[0,1]\f$.
27  * Newmark can be an explicit or implicit method, depending on
28  * the value of the \f$\beta\f$ parameter. If \f$\beta = 0\f$, the method
29  * is explicit. Regardless of whether the method is implicit
30  * or explicit, a linear solve is required. This linear solve can be
31  * optimized, however, for the explicit case by lumping the mass matrix.
32  * This optimization can be invoked by running "Newmark Explicit d-Form"
33  * Stepper through the Piro::TempusSolver class.
34  *
35  * Newmark is second order accurate if \f$\gamma = 0.5\f$; otherwise it
36  * is first order accurate. Some additional properties about the Newmark
37  * scheme can be found
38  *<a href="http://opensees.berkeley.edu/wiki/index.php/Newmark_Method">here</a>.
39  *
40  * The governing equation solved by this stepper is
41  * \f[
42  * \mathbf{M}\, \ddot{\mathbf{x}} + \mathbf{C}\, \dot{\mathbf{x}}
43  * + \mathbf{K}\, \mathbf{x} + \mathbf{F}(t) = 0
44  * \f]
45  * For the A-form (i.e., solving for the acceleration,
46  * \f$\mathbf{a} = \ddot{\mathbf{x}}\f$), we have the following implicit ODE
47  * \f[
48  * \mathbf{M}\, \mathbf{a} + \mathbf{C}\, \mathbf{v}
49  * + \mathbf{K}\, \mathbf{d} + \mathbf{F}(t) =
50  * \mathbf{f}(\mathbf{d}, \mathbf{v}, \mathbf{a}, t) = 0
51  * \f]
52  * where \f$\mathbf{v} = \dot{\mathbf{x}}\f$ and \f$\mathbf{d} = \mathbf{x}\f$.
53  *
54  * <b> Algorithm </b>
55  * The algorithm for the Newmark implicit A-form with predictors and
56  * correctors is
57  * - \f$\mathbf{d}^{\ast} = \mathbf{d}^{n-1} + \Delta t \mathbf{v}^{n-1}
58  * + \Delta t^2 (1-2 \beta) \mathbf{a}^{n-1} / 2\f$
59  * - \f$\mathbf{v}^{\ast} =
60  * \mathbf{v}^{n-1} + \Delta t (1-\gamma) \mathbf{a}^{n-1}\f$
61  * - Solve
62  * \f$\mathbf{f}(\mathbf{d}^n, \mathbf{v}^n, \mathbf{a}^n, t^n) = 0\f$
63  * for \f$\mathbf{a}^n\f$ where
64  * - \f$\mathbf{d}^n = \mathbf{d}^{\ast} + \beta \Delta t^2 \mathbf{a}^n\f$
65  * - \f$\mathbf{v}^n = \mathbf{v}^{\ast} + \gamma \Delta t \mathbf{a}^n\f$
66  *
67  * The First-Step-As-Last (FSAL) principle is part of the Newmark
68  * implicit A-Form as the acceleration from the previous time step is
69  * used for the predictors. The default is to set useFSAL=true,
70  * and useFSAL=false will be ignored.
71  */
72 template<class Scalar>
74  : virtual public Tempus::StepperImplicit<Scalar>
75 {
76 public:
77 
78  /** \brief Default constructor.
79  *
80  * Requires subsequent setModel(), setSolver() and initialize()
81  * calls before calling takeStep().
82  */
84 
85  /// Constructor
87  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
88  const Teuchos::RCP<StepperObserver<Scalar> >& obs,
89  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
90  bool useFSAL,
91  std::string ICConsistency,
92  bool ICConsistencyCheck,
93  bool zeroInitialGuess,
94  std::string schemeName,
95  Scalar beta,
96  Scalar gamma);
97 
98  /// \name Basic stepper methods
99  //@{
100  virtual void setModel(
101  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel);
102 
103  virtual void setObserver(
104  Teuchos::RCP<StepperObserver<Scalar> > /* obs */ = Teuchos::null){}
105 
106  virtual Teuchos::RCP<StepperObserver<Scalar> > getObserver() const
107  { return Teuchos::null; }
108 
109  /// Initialize during construction and after changing input parameters.
110  virtual void initialize();
111 
112  /// Set the initial conditions and make them consistent.
113  virtual void setInitialConditions (
114  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
115 
116  /// Take the specified timestep, dt, and return true if successful.
117  virtual void takeStep(
118  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
119 
120  /// Get a default (initial) StepperState
121  virtual Teuchos::RCP<Tempus::StepperState<Scalar> >
123  virtual Scalar getOrder() const {
124  if (gamma_ == 0.5) return 2.0;
125  else return 1.0;
126  }
127  virtual Scalar getOrderMin() const {return 1.0;}
128  virtual Scalar getOrderMax() const {return 2.0;}
129 
130  virtual bool isExplicit() const {return false;}
131  virtual bool isImplicit() const {return true;}
132  virtual bool isExplicitImplicit() const
133  {return isExplicit() and isImplicit();}
134  virtual bool isOneStepMethod() const {return true;}
135  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
136 
137  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
138  //@}
139 
140  /// Return W_xDotxDot_coeff = d(xDotDot)/d(xDotDot).
141  virtual Scalar getW_xDotDot_coeff (const Scalar) const {return Scalar(1.0);}
142  /// Return alpha = d(xDot)/d(xDotDot).
143  virtual Scalar getAlpha(const Scalar dt) const { return gamma_*dt; }
144  /// Return beta = d(x)/d(xDotDot).
145  virtual Scalar getBeta (const Scalar dt) const { return beta_*dt*dt; }
146 
147  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
148 
149  /// \name Overridden from Teuchos::Describable
150  //@{
151  virtual void describe(Teuchos::FancyOStream & out,
152  const Teuchos::EVerbosityLevel verbLevel) const;
153  //@}
154 
155  void predictVelocity(Thyra::VectorBase<Scalar>& vPred,
156  const Thyra::VectorBase<Scalar>& v,
157  const Thyra::VectorBase<Scalar>& a,
158  const Scalar dt) const;
159 
160  void predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
161  const Thyra::VectorBase<Scalar>& d,
162  const Thyra::VectorBase<Scalar>& v,
163  const Thyra::VectorBase<Scalar>& a,
164  const Scalar dt) const;
165 
166  void correctVelocity(Thyra::VectorBase<Scalar>& v,
167  const Thyra::VectorBase<Scalar>& vPred,
168  const Thyra::VectorBase<Scalar>& a,
169  const Scalar dt) const;
170 
171  void correctDisplacement(Thyra::VectorBase<Scalar>& d,
172  const Thyra::VectorBase<Scalar>& dPred,
173  const Thyra::VectorBase<Scalar>& a,
174  const Scalar dt) const;
175 
176  void setSchemeName(std::string schemeName);
177  void setBeta(Scalar beta);
178  void setGamma(Scalar gamma);
179 
180  virtual bool getUseFSALDefault() const { return true; }
181  virtual std::string getICConsistencyDefault() const { return "Consistent"; }
182 
183 private:
184 
185  std::string schemeName_;
186  Scalar beta_;
187  Scalar gamma_;
188 
189  Teuchos::RCP<Teuchos::FancyOStream> out_;
190 
191 };
192 } // namespace Tempus
193 
194 #endif // Tempus_StepperNewmarkImplicitAForm_decl_hpp
virtual Scalar getW_xDotDot_coeff(const Scalar) const
Return W_xDotxDot_coeff = d(xDotDot)/d(xDotDot).
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual Scalar getAlpha(const Scalar dt) const
Return alpha = d(xDot)/d(xDotDot).
virtual Scalar getBeta(const Scalar dt) const
Return beta = d(x)/d(xDotDot).
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Stepper integrates second-order ODEs.
Thyra Base interface for implicit time steppers.
virtual Teuchos::RCP< StepperObserver< Scalar > > getObserver() const
Get Observer.
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
StepperObserver class for Stepper class.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
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 void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
void correctDisplacement(Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void initialize()
Initialize during construction and after changing input parameters.
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Newmark time stepper in acceleration form (a-form).
virtual void setObserver(Teuchos::RCP< StepperObserver< Scalar > >=Teuchos::null)
Set Observer.