Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperNewmarkImplicitDForm_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_StepperNewmarkImplicitDForm_decl_hpp
10 #define Tempus_StepperNewmarkImplicitDForm_decl_hpp
11 
12 #include "Tempus_WrapperModelEvaluatorSecondOrder.hpp"
13 #include "Tempus_StepperImplicit.hpp"
14 
15 namespace Tempus {
16 
17 /** \brief Newmark time stepper.
18  *
19  * Here, we implement the Newmark scheme in displacement predictor/corrector
20  * form; see equations (34)-(35) in: A. Mota, W. Klug, M. Ortiz,
21  * "Finite element simulation of firearm injury to the human cranium",
22  * Computational Mechanics 31(1) 115-121 (2003).
23  *
24  * Newmark has two parameters: \f$\beta\f$
25  * and \f$\gamma\f$, both of which need to be in the range \f$[0,1]\f$.
26  * Newmark can be an explicit or implicit method, depending on
27  * the value of the \f$\beta\f$ parameter. If \f$\beta = 0\f$, the method
28  * is explicit; but note that the d-form of the Newmark scheme is not defined
29  * for the explicit case.
30  *
31  * Newmark is second order accurate if \f$\gamma = 0.5\f$; otherwise it
32  * is first order accurate. Some additional properties about the Newmark
33  * Beta scheme can be found
34  * <a href="http://opensees.berkeley.edu/wiki/index.php/Newmark_Method">here</a>.
35  *
36  * The First-Step-As-Last (FSAL) principle is not used with the
37  * Newmark implicit D-Form method.
38  */
39 template <class Scalar>
40 class StepperNewmarkImplicitDForm : virtual public Tempus::StepperImplicit<Scalar> {
41  public:
42 
43  /** \brief Default constructor.
44  *
45  * Requires subsequent setModel(), setSolver() and initialize()
46  * calls before calling takeStep().
47  */
49 
50  /// Constructor
52  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>& appModel,
53  const Teuchos::RCP<StepperObserver<Scalar> >& obs,
54  const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
55  bool useFSAL,
56  std::string ICConsistency,
57  bool ICConsistencyCheck,
58  bool zeroInitialGuess,
59  std::string schemeName,
60  Scalar beta,
61  Scalar gamma);
62 
63  /// \name Basic stepper methods
64  //@{
65  virtual void
66  setModel(const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>& appModel);
67 
68  virtual void setObserver(
69  Teuchos::RCP<StepperObserver<Scalar> > /* obs */ = Teuchos::null){}
70 
71  virtual Teuchos::RCP<StepperObserver<Scalar> > getObserver() const
72  { return Teuchos::null; }
73 
74  /// Initialize during construction and after changing input parameters.
75  virtual void
76  initialize();
77 
78  /// Set the initial conditions and make them consistent.
79  virtual void setInitialConditions (
80  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */){}
81 
82  /// Take the specified timestep, dt, and return true if successful.
83  virtual void
84  takeStep(const Teuchos::RCP<SolutionHistory<Scalar>>& solutionHistory);
85 
86  /// Get a default (initial) StepperState
87  virtual Teuchos::RCP<Tempus::StepperState<Scalar>>
89  virtual Scalar
90  getOrder() const {
91  if (gamma_ == 0.5)
92  return 2.0;
93  else
94  return 1.0;
95  }
96  virtual Scalar
97  getOrderMin() const {
98  return 1.0;
99  }
100  virtual Scalar
101  getOrderMax() const {
102  return 2.0;
103  }
104  virtual bool isExplicit() const {return false;}
105  virtual bool isImplicit() const {return true;}
106  virtual bool isExplicitImplicit() const
107  {return isExplicit() and isImplicit();}
108  virtual bool isOneStepMethod() const {return true;}
109  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
110 
111  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
112  //@}
113 
114  /// Return W_xDotxDot_coeff = d(xDotDot)/d(x).
115  virtual Scalar getW_xDotDot_coeff (const Scalar dt) const
116  { return Scalar(1.0)/(beta_*dt*dt); }
117  /// Return alpha = d(xDot)/d(x).
118  virtual Scalar getAlpha(const Scalar dt) const { return gamma_/(beta_*dt); }
119  /// Return beta = d(x)/d(x).
120  virtual Scalar getBeta (const Scalar ) const { return Scalar(1.0); }
121 
122  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
123 
124  /// \name Overridden from Teuchos::Describable
125  //@{
126  virtual void describe(Teuchos::FancyOStream& out,
127  const Teuchos::EVerbosityLevel verbLevel) const;
128  //@}
129 
130  void
132  Thyra::VectorBase<Scalar>& vPred, const Thyra::VectorBase<Scalar>& v,
133  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const;
134 
135  void
137  Thyra::VectorBase<Scalar>& dPred, const Thyra::VectorBase<Scalar>& d,
138  const Thyra::VectorBase<Scalar>& v, const Thyra::VectorBase<Scalar>& a,
139  const Scalar dt) const;
140 
141  void
143  Thyra::VectorBase<Scalar>& v, const Thyra::VectorBase<Scalar>& vPred,
144  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const;
145 
146  void
148  Thyra::VectorBase<Scalar>& d, const Thyra::VectorBase<Scalar>& dPred,
149  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const;
150 
151  void
153  Thyra::VectorBase<Scalar>& a, const Thyra::VectorBase<Scalar>& dPred,
154  const Thyra::VectorBase<Scalar>& d, const Scalar dt) const;
155 
156 
157  void setSchemeName(std::string schemeName);
158  void setBeta(Scalar beta);
159  void setGamma(Scalar gamma);
160 
161  protected:
162 
163  Thyra::ModelEvaluatorBase::InArgs<Scalar> inArgs_;
164  Thyra::ModelEvaluatorBase::OutArgs<Scalar> outArgs_;
165 
166  std::string schemeName_;
167  Scalar beta_;
168  Scalar gamma_;
169 
170  Teuchos::RCP<Teuchos::FancyOStream> out_;
171 
172 };
173 } // namespace Tempus
174 
175 #endif // Tempus_StepperNewmarkImplicitDForm_decl_hpp
Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs_
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
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.
Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs_
virtual Teuchos::RCP< StepperObserver< Scalar > > getObserver() const
Get Observer.
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
Stepper integrates second-order ODEs.
Thyra Base interface for implicit time steppers.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar >> &solutionHistory)
Take the specified timestep, dt, and return true if successful.
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
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void setObserver(Teuchos::RCP< StepperObserver< Scalar > >=Teuchos::null)
Set Observer.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &)
Set the initial conditions and make them consistent.
StepperObserver class for Stepper class.
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
virtual Scalar getW_xDotDot_coeff(const Scalar dt) const
Return W_xDotxDot_coeff = d(xDotDot)/d(x).
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual Scalar getAlpha(const Scalar dt) const
Return alpha = d(xDot)/d(x).
virtual Scalar getBeta(const Scalar) const
Return beta = d(x)/d(x).
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar >> &appModel)
void correctAcceleration(Thyra::VectorBase< Scalar > &a, const Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &d, const Scalar dt) const