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  /// Set the initial conditions and make them consistent.
110  virtual void setInitialConditions (
111  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
112 
113  /// Take the specified timestep, dt, and return true if successful.
114  virtual void takeStep(
115  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
116 
117  /// Get a default (initial) StepperState
118  virtual Teuchos::RCP<Tempus::StepperState<Scalar> >
120  virtual Scalar getOrder() const {
121  if (gamma_ == 0.5) return 2.0;
122  else return 1.0;
123  }
124  virtual Scalar getOrderMin() const {return 1.0;}
125  virtual Scalar getOrderMax() const {return 2.0;}
126 
127  virtual bool isExplicit() const {return false;}
128  virtual bool isImplicit() const {return true;}
129  virtual bool isExplicitImplicit() const
130  {return isExplicit() and isImplicit();}
131  virtual bool isOneStepMethod() const {return true;}
132  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
133 
134  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
135  //@}
136 
137  /// Return W_xDotxDot_coeff = d(xDotDot)/d(xDotDot).
138  virtual Scalar getW_xDotDot_coeff (const Scalar) const {return Scalar(1.0);}
139  /// Return alpha = d(xDot)/d(xDotDot).
140  virtual Scalar getAlpha(const Scalar dt) const { return gamma_*dt; }
141  /// Return beta = d(x)/d(xDotDot).
142  virtual Scalar getBeta (const Scalar dt) const { return beta_*dt*dt; }
143 
144  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
145 
146  /// \name Overridden from Teuchos::Describable
147  //@{
148  virtual void describe(Teuchos::FancyOStream & out,
149  const Teuchos::EVerbosityLevel verbLevel) const;
150  //@}
151 
152  virtual bool isValidSetup(Teuchos::FancyOStream & out) const;
153 
154  void predictVelocity(Thyra::VectorBase<Scalar>& vPred,
155  const Thyra::VectorBase<Scalar>& v,
156  const Thyra::VectorBase<Scalar>& a,
157  const Scalar dt) const;
158 
159  void predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
160  const Thyra::VectorBase<Scalar>& d,
161  const Thyra::VectorBase<Scalar>& v,
162  const Thyra::VectorBase<Scalar>& a,
163  const Scalar dt) const;
164 
165  void correctVelocity(Thyra::VectorBase<Scalar>& v,
166  const Thyra::VectorBase<Scalar>& vPred,
167  const Thyra::VectorBase<Scalar>& a,
168  const Scalar dt) const;
169 
170  void correctDisplacement(Thyra::VectorBase<Scalar>& d,
171  const Thyra::VectorBase<Scalar>& dPred,
172  const Thyra::VectorBase<Scalar>& a,
173  const Scalar dt) const;
174 
175  void setSchemeName(std::string schemeName);
176  void setBeta(Scalar beta);
177  void setGamma(Scalar gamma);
178 
179  virtual bool getUseFSALDefault() const { return true; }
180  virtual std::string getICConsistencyDefault() const { return "Consistent"; }
181 
182 private:
183 
184  std::string schemeName_;
185  Scalar beta_;
186  Scalar gamma_;
187 
188  Teuchos::RCP<Teuchos::FancyOStream> out_;
189 
190 };
191 } // namespace Tempus
192 
193 #endif // Tempus_StepperNewmarkImplicitAForm_decl_hpp
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
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.
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
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.