www.mooseframework.org
NewmarkBeta.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "TimeIntegrator.h"
13 #include "MathUtils.h"
14 
15 class NewmarkBeta;
16 
17 template <>
19 
24 {
25 public:
27  virtual ~NewmarkBeta();
28 
29  virtual int order() override { return 1; }
30  virtual void computeTimeDerivatives() override;
31  virtual void computeADTimeDerivatives(DualReal & ad_u_dot,
32  const dof_id_type & dof) const override;
33  virtual void postResidual(NumericVector<Number> & residual) override;
34 
35 protected:
39  template <typename T, typename T2, typename T3, typename T4, typename T5>
40  void computeTimeDerivativeHelper(T & u_dot,
41  const T2 & u_old,
42  const T3 & u_dot_old,
43  T4 & u_dotdot,
44  const T5 & u_dotdot_old) const;
45 
47  Real _beta;
48 
50  Real _gamma;
51 
53  Real & _du_dotdot_du;
54 };
55 
56 template <typename T, typename T2, typename T3, typename T4, typename T5>
57 void
59  T & u_dot, const T2 & u_old, const T3 & u_dot_old, T4 & u_dotdot, const T5 & u_dotdot_old) const
60 {
61  u_dotdot -= u_old;
62  u_dotdot *= 1.0 / _beta / _dt / _dt;
63  MathUtils::addScaled(-1.0 / _beta / _dt, u_dot_old, u_dotdot);
64  MathUtils::addScaled(-0.5 / _beta + 1.0, u_dotdot_old, u_dotdot);
65 
66  // compute first derivative
67  // according to Newmark-Beta method
68  // u_dot = first_term + second_term + third_term
69  // first_term = u_dot_old
70  // second_term = u_dotdot_old * (1 - gamma) * dt
71  // third_term = u_dotdot * gamma * dt
72  u_dot = u_dot_old;
73  MathUtils::addScaled((1.0 - _gamma) * _dt, u_dotdot_old, u_dot);
74  MathUtils::addScaled(_gamma * _dt, u_dotdot, u_dot);
75 }
76 
void addScaled(const T &a, const T2 &b, T3 &result)
Definition: MathUtils.h:65
Real & _du_dotdot_du
solution vector for
Definition: NewmarkBeta.h:53
virtual ~NewmarkBeta()
Definition: NewmarkBeta.C:48
Newmark-Beta time integration method.
Definition: NewmarkBeta.h:23
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the TimeIntegrator called immediately after the residuals are computed in NonlinearSystem...
Definition: NewmarkBeta.C:107
DualNumber< Real, NumberArray< AD_MAX_DOFS_PER_ELEM, Real > > DualReal
Definition: DualReal.h:29
Real _gamma
Newmark time integration parameter-gamma.
Definition: NewmarkBeta.h:50
Real _beta
Newmark time integration parameter-beta.
Definition: NewmarkBeta.h:47
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
NewmarkBeta(const InputParameters &parameters)
Definition: NewmarkBeta.C:28
virtual int order() override
Definition: NewmarkBeta.h:29
virtual void computeADTimeDerivatives(DualReal &ad_u_dot, const dof_id_type &dof) const override
method for computing local automatic differentiation time derivatives
Definition: NewmarkBeta.C:95
Base class for time integrators.
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old, const T3 &u_dot_old, T4 &u_dotdot, const T5 &u_dotdot_old) const
Helper function that actually does the math for computing the time derivative.
Definition: NewmarkBeta.h:58
virtual void computeTimeDerivatives() override
Definition: NewmarkBeta.C:51
InputParameters validParams< NewmarkBeta >()
Definition: NewmarkBeta.C:18