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  /// Set the initial conditions and make them consistent.
88  virtual void setInitialConditions (
89  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
90 
91  /// Take the specified timestep, dt, and return true if successful.
92  virtual void takeStep(
93  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
94 
95  /// Get a default (initial) StepperState
96  virtual Teuchos::RCP<Tempus::StepperState<Scalar> > getDefaultStepperState();
97  virtual Scalar getOrder() const {
98  if (gamma_ == 0.5) return 2.0;
99  else return 1.0;
100  }
101  virtual Scalar getOrderMin() const {return 1.0;}
102  virtual Scalar getOrderMax() const {return 2.0;}
103  virtual Scalar getInitTimeStep(
104  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
105  {return Scalar(1.0e+99);}
106 
107  virtual bool isExplicit() const {return true;}
108  virtual bool isImplicit() const {return false;}
109  virtual bool isExplicitImplicit() const
110  {return isExplicit() and isImplicit();}
111  virtual bool isOneStepMethod() const {return true;}
112  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
113 
114  virtual OrderODE getOrderODE() const {return SECOND_ORDER_ODE;}
115  //@}
116 
117  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
118 
119  /// \name Overridden from Teuchos::Describable
120  //@{
121  virtual void describe(Teuchos::FancyOStream & out,
122  const Teuchos::EVerbosityLevel verbLevel) const;
123  //@}
124 
125  virtual bool isValidSetup(Teuchos::FancyOStream & out) const;
126 
127  void predictVelocity(Thyra::VectorBase<Scalar>& vPred,
128  const Thyra::VectorBase<Scalar>& v,
129  const Thyra::VectorBase<Scalar>& a,
130  const Scalar dt) const;
131 
132  void predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
133  const Thyra::VectorBase<Scalar>& d,
134  const Thyra::VectorBase<Scalar>& v,
135  const Thyra::VectorBase<Scalar>& a,
136  const Scalar dt) const;
137 
138  void correctVelocity(Thyra::VectorBase<Scalar>& v,
139  const Thyra::VectorBase<Scalar>& vPred,
140  const Thyra::VectorBase<Scalar>& a,
141  const Scalar dt) const;
142 
143  void setGamma(Scalar gamma)
144  {
145  gamma_ = gamma;
146 
147  TEUCHOS_TEST_FOR_EXCEPTION( (gamma_ > 1.0) || (gamma_ < 0.0),
148  std::logic_error,
149  "Error in 'Newmark Explicit a-Form' stepper: invalid value of Gamma = "
150  << gamma_ << ". Please select 0 <= Gamma <= 1. \n");
151 
152  this->isInitialized_ = false;
153  }
154 
155  bool getUseFSALDefault() const { return true; }
156  std::string getICConsistencyDefault() const { return "Consistent"; }
157 
158 protected:
159 
161  Scalar gamma_;
162 
163 };
164 } // namespace Tempus
165 
166 #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.
bool isInitialized_
True if stepper&#39;s member data is initialized.
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
Stepper integrates second-order ODEs.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperObserver class for Stepper class.
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.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
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