https://mooseframework.inl.gov
NewmarkBeta.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
19 {
20 public:
22 
24  virtual ~NewmarkBeta();
25 
26  virtual int order() override { return 1; }
27  virtual void computeTimeDerivatives() override;
28  virtual void computeADTimeDerivatives(ADReal & ad_u_dot,
29  const dof_id_type & dof,
30  ADReal & ad_u_dotdot) const override;
31  virtual void postResidual(NumericVector<Number> & residual) override;
32  virtual bool overridesSolve() const override { return false; }
33 
34 protected:
38  template <typename T, typename T2, typename T3, typename T4, typename T5>
39  void computeTimeDerivativeHelper(T & u_dot,
40  const T2 & u_old,
41  const T3 & u_dot_old,
42  T4 & u_dotdot,
43  const T5 & u_dotdot_old) const;
44 
45  virtual Real duDotDuCoeff() const override;
46 
49 
52 
55 
58 };
59 
60 template <typename T, typename T2, typename T3, typename T4, typename T5>
61 void
63  T & u_dot, const T2 & u_old, const T3 & u_dot_old, T4 & u_dotdot, const T5 & u_dotdot_old) const
64 {
65  // compute second derivative
66  // according to Newmark-Beta method
67  // u_dotdot = first_term - second_term - third_term
68  // first_term = (u - u_old) / beta / dt ^ 2
69  // second_term = u_dot_old / beta / dt
70  // third_term = u_dotdot_old * (1 / 2 / beta - 1)
71  u_dotdot -= u_old;
72  u_dotdot *= 1.0 / _beta / _dt / _dt;
73  MathUtils::addScaled(-1.0 / _beta / _dt, u_dot_old, u_dotdot);
74  MathUtils::addScaled(-0.5 / _beta + 1.0, u_dotdot_old, u_dotdot);
75 
76  // compute first derivative
77  // according to Newmark-Beta method
78  // u_dot = first_term + second_term + third_term
79  // first_term = u_dot_old
80  // second_term = u_dotdot_old * (1 - gamma) * dt
81  // third_term = u_dotdot * gamma * dt
82  u_dot = u_dot_old;
83  MathUtils::addScaled((1.0 - _gamma) * _dt, u_dotdot_old, u_dot);
84  MathUtils::addScaled(_gamma * _dt, u_dotdot, u_dot);
85 }
void addScaled(const T &a, const T2 &b, T3 &result)
Definition: MathUtils.h:170
Real & _du_dotdot_du
solution vector for
Definition: NewmarkBeta.h:57
virtual ~NewmarkBeta()
Definition: NewmarkBeta.C:51
virtual Real duDotDuCoeff() const override
Definition: NewmarkBeta.C:123
static InputParameters validParams()
Definition: NewmarkBeta.C:17
Newmark-Beta time integration method.
Definition: NewmarkBeta.h:18
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 NonLinearTimeIntegratorInterface called immediately after the residuals are computed ...
Definition: NewmarkBeta.C:115
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:47
Real & _dt
The current time step size.
Real _gamma
Newmark time integration parameter-gamma.
Definition: NewmarkBeta.h:51
int _inactive_tsteps
Inactive time steps.
Definition: NewmarkBeta.h:54
Real _beta
Newmark time integration parameter-beta.
Definition: NewmarkBeta.h:48
NewmarkBeta(const InputParameters &parameters)
Definition: NewmarkBeta.C:30
virtual int order() override
Definition: NewmarkBeta.h:26
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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:62
const InputParameters & parameters() const
Get the parameters of the object.
virtual bool overridesSolve() const override
Definition: NewmarkBeta.h:32
virtual void computeADTimeDerivatives(ADReal &ad_u_dot, const dof_id_type &dof, ADReal &ad_u_dotdot) const override
method for computing local automatic differentiation time derivatives
Definition: NewmarkBeta.C:99
virtual void computeTimeDerivatives() override
Computes the time derivative and the Jacobian of the time derivative.
Definition: NewmarkBeta.C:54
uint8_t dof_id_type