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  * - Requires subsequent setModel() and initialize() calls before calling
66  * takeStep().
67  */
69 
70  /// Constructor
72  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
73  const Teuchos::RCP<StepperObserver<Scalar> >& obs,
74  bool useFSAL,
75  std::string ICConsistency,
76  bool ICConsistencyCheck,
77  Scalar gamma);
78 
79  /// \name Basic stepper methods
80  //@{
81  virtual void setObserver(
82  Teuchos::RCP<StepperObserver<Scalar> > /* obs */ = Teuchos::null){}
83 
84  virtual Teuchos::RCP<StepperObserver<Scalar> > getObserver() const
85  { return Teuchos::null; }
86 
87  /// Initialize during construction and after changing input parameters.
88  virtual void initialize();
89 
90  /// Set the initial conditions and make them consistent.
91  virtual void setInitialConditions (
92  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
93 
94  /// Take the specified timestep, dt, and return true if successful.
95  virtual void takeStep(
96  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
97 
98  /// Get a default (initial) StepperState
99  virtual Teuchos::RCP<Tempus::StepperState<Scalar> > getDefaultStepperState();
100  virtual Scalar getOrder() const {
101  if (gamma_ == 0.5) return 2.0;
102  else return 1.0;
103  }
104  virtual Scalar getOrderMin() const {return 1.0;}
105  virtual Scalar getOrderMax() const {return 2.0;}
106  virtual Scalar getInitTimeStep(
107  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
108  {return Scalar(1.0e+99);}
109 
110  virtual bool isExplicit() const {return true;}
111  virtual bool isImplicit() const {return false;}
112  virtual bool isExplicitImplicit() const
113  {return isExplicit() and isImplicit();}
114  virtual bool isOneStepMethod() const {return true;}
115  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
116 
117  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
118  //@}
119 
120  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
121 
122  /// \name Overridden from Teuchos::Describable
123  //@{
124  virtual void describe(Teuchos::FancyOStream & out,
125  const Teuchos::EVerbosityLevel verbLevel) const;
126  //@}
127 
128  void predictVelocity(Thyra::VectorBase<Scalar>& vPred,
129  const Thyra::VectorBase<Scalar>& v,
130  const Thyra::VectorBase<Scalar>& a,
131  const Scalar dt) const;
132 
133  void predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
134  const Thyra::VectorBase<Scalar>& d,
135  const Thyra::VectorBase<Scalar>& v,
136  const Thyra::VectorBase<Scalar>& a,
137  const Scalar dt) const;
138 
139  void correctVelocity(Thyra::VectorBase<Scalar>& v,
140  const Thyra::VectorBase<Scalar>& vPred,
141  const Thyra::VectorBase<Scalar>& a,
142  const Scalar dt) const;
143 
144  void setGamma(Scalar gamma)
145  {
146  gamma_ = gamma;
147 
148  TEUCHOS_TEST_FOR_EXCEPTION( (gamma_ > 1.0) || (gamma_ < 0.0),
149  std::logic_error,
150  "Error in 'Newmark Explicit a-Form' stepper: invalid value of Gamma = "
151  << gamma_ << ". Please select 0 <= Gamma <= 1. \n");
152  }
153 
154  bool getUseFSALDefault() const { return true; }
155  std::string getICConsistencyDefault() const { return "Consistent"; }
156 
157 protected:
158 
160  Scalar gamma_;
161 
162 };
163 } // namespace Tempus
164 
165 #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
virtual void initialize()
Initialize during construction and after changing input parameters.
Stepper integrates second-order ODEs.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
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...
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.
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 Teuchos::RCP< StepperObserver< Scalar > > getObserver() const
Get Observer.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const