Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_StepperHHTAlpha_decl.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_StepperHHTAlpha_decl_hpp
11 #define Tempus_StepperHHTAlpha_decl_hpp
12 
13 #include "Tempus_config.hpp"
14 #include "Tempus_StepperImplicit.hpp"
15 #include "Tempus_WrapperModelEvaluatorSecondOrder.hpp"
17 
18 namespace Tempus {
19 
45 template <class Scalar>
46 class StepperHHTAlpha : virtual public Tempus::StepperImplicit<Scalar> {
47  public:
54 
57  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
59  bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
60  bool zeroInitialGuess, std::string schemeName, Scalar beta, Scalar gamma,
61  Scalar alpha_f_, Scalar alpha_m_,
63  stepperHHTAlphaAppAction);
64 
66 
67  virtual void setModel(
68  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel);
69 
70  virtual void setAppAction(
72 
74  {
76  }
77 
79  virtual void setInitialConditions(
80  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */)
81  {
82  }
83 
85  virtual void takeStep(
86  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
87 
90  virtual Scalar getOrder() const
91  {
92  if (gamma_ == 0.5)
93  return 2.0;
94  else
95  return 1.0;
96  }
97  virtual Scalar getOrderMin() const { return 1.0; }
98  virtual Scalar getOrderMax() const { return 2.0; }
99 
100  virtual bool isExplicit() const { return false; }
101  virtual bool isImplicit() const { return true; }
102  virtual bool isExplicitImplicit() const
103  {
104  return isExplicit() && isImplicit();
105  }
106  virtual bool isOneStepMethod() const { return true; }
107  virtual bool isMultiStepMethod() const { return !isOneStepMethod(); }
108  virtual OrderODE getOrderODE() const { return SECOND_ORDER_ODE; }
110 
112  virtual Scalar getW_xDotDot_coeff(const Scalar dt) const
113  {
114  return Scalar(1.0) / (beta_ * dt * dt);
115  }
117  virtual Scalar getAlpha(const Scalar dt) const
118  {
119  return gamma_ / (beta_ * dt);
120  }
122  virtual Scalar getBeta(const Scalar) const { return Scalar(1.0); }
123 
125 
127 
128  virtual void describe(Teuchos::FancyOStream& out,
129  const Teuchos::EVerbosityLevel verbLevel) const;
131 
132  virtual bool isValidSetup(Teuchos::FancyOStream& out) const;
133 
135  const Thyra::VectorBase<Scalar>& v,
136  const Thyra::VectorBase<Scalar>& a,
137  const Scalar dt) const;
138 
140  const Thyra::VectorBase<Scalar>& d,
141  const Thyra::VectorBase<Scalar>& v,
142  const Thyra::VectorBase<Scalar>& a,
143  const Scalar dt) const;
144 
146  const Thyra::VectorBase<Scalar>& v) const;
147 
149  const Thyra::VectorBase<Scalar>& d) const;
150 
152  const Thyra::VectorBase<Scalar>& a_n) const;
153 
155  const Thyra::VectorBase<Scalar>& vPred,
156  const Thyra::VectorBase<Scalar>& a,
157  const Scalar dt) const;
158 
160  const Thyra::VectorBase<Scalar>& dPred,
161  const Thyra::VectorBase<Scalar>& a,
162  const Scalar dt) const;
163 
164  void setSchemeName(std::string schemeName);
165  void setBeta(Scalar beta);
166  void setGamma(Scalar gamma);
167  void setAlphaF(Scalar alpha_f);
168  void setAlphaM(Scalar alpha_m);
169 
170  private:
172 
173  std::string schemeName_;
174  Scalar beta_;
175  Scalar gamma_;
176  Scalar alpha_f_;
177  Scalar alpha_m_;
178 
180 };
181 
183 // ------------------------------------------------------------------------
184 template <class Scalar>
186  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
188 
189 } // namespace Tempus
190 
191 #endif // Tempus_StepperHHTAlpha_decl_hpp
void correctDisplacement(Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual Scalar getW_xDotDot_coeff(const Scalar dt) const
Return W_xDotxDot_coeff = d(xDotDot)/d(x).
virtual Teuchos::RCP< StepperHHTAlphaAppAction< Scalar > > getAppAction() const
virtual bool isExplicitImplicit() const
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual OrderODE getOrderODE() const
virtual Scalar getOrderMin() const
void correctAcceleration(Thyra::VectorBase< Scalar > &a_n_plus1, const Thyra::VectorBase< Scalar > &a_n) const
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
StepperHHTAlpha()
Default constructor.
Stepper integrates second-order ODEs.
virtual Scalar getAlpha(const Scalar dt) const
Return alpha = d(xDot)/d(x).
Thyra Base interface for implicit time steppers.
void predictVelocity_alpha_f(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v) const
void setSchemeName(std::string schemeName)
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
void predictDisplacement_alpha_f(Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &d) const
virtual Scalar getBeta(const Scalar) const
Return beta = d(x)/d(x).
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 Scalar getOrderMax() const
Teuchos::RCP< StepperHHTAlpha< Scalar > > createStepperHHTAlpha(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
Teuchos::RCP< Teuchos::FancyOStream > out_
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &)
Set the initial conditions and make them consistent.
virtual void setAppAction(Teuchos::RCP< StepperHHTAlphaAppAction< Scalar > > appAction)
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
Set the model.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
Teuchos::RCP< StepperHHTAlphaAppAction< Scalar > > stepperHHTAlphaAppAction_