https://mooseframework.inl.gov
AStableDirk4.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 
14 class LStableDirk4;
15 
52 {
53 public:
55 
57 
58  virtual int order() override { return 4; }
59  virtual void computeTimeDerivatives() override;
60  void computeADTimeDerivatives(ADReal & ad_u_dot,
61  const dof_id_type & dof,
62  ADReal & ad_u_dotdot) const override;
63  virtual void solve() override;
64  virtual void postResidual(NumericVector<Number> & residual) override;
65  virtual bool overridesSolve() const override { return true; }
66 
67 protected:
71  template <typename T, typename T2>
72  void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
73 
74  // Indicates the current stage.
75  unsigned int _stage;
76 
77  // Store pointers to the various stage residuals
79 
80  // The parameter of the method, set at construction time and cannot be changed.
81  const Real _gamma; // 1.06857902130162881
82 
83  // Butcher tableau "C" parameters derived from _gamma
84  // 1.06857902130162881, 0.5, -.06857902130162881
85  Real _c[3];
86 
87  // Butcher tableau "A" values derived from _gamma. We only use the
88  // lower triangle of this.
89  // 1.06857902130162881
90  // -.56857902130162881, 1.06857902130162881
91  // 2.13715804260325762, -3.27431608520651524, 1.06857902130162881
92  Real _a[3][3];
93 
94  // The Butcher tableau "b" parameters derived from _gamma;
95  // 1.2888640051572051e-01, 7.4222719896855893e-01, 1.2888640051572051e-01
96  Real _b[3];
97 
98  // If true, we use a more expensive method (LStableDirk4) to
99  // "bootstrap" the first timestep of this method and avoid
100  // evaluating residuals before the initial time.
102 
103  // A pointer to the "bootstrapping" method to use if _safe_start==true.
104  std::shared_ptr<LStableDirk4> _bootstrap_method;
105 };
106 
107 template <typename T, typename T2>
108 void
109 AStableDirk4::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
110 {
111  u_dot -= u_old;
112  u_dot *= 1. / _dt;
113 }
Fourth-order diagonally implicit Runge Kutta method (Dirk) with five stages.
Definition: LStableDirk4.h:51
std::shared_ptr< LStableDirk4 > _bootstrap_method
Definition: AStableDirk4.h:104
virtual void solve() override
Solves the time step and sets the number of nonlinear and linear iterations.
Definition: AStableDirk4.C:109
virtual int order() override
Definition: AStableDirk4.h:58
Real _a[3][3]
Definition: AStableDirk4.h:92
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
AStableDirk4(const InputParameters &parameters)
Definition: AStableDirk4.C:31
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:47
Real & _dt
The current time step size.
Real _b[3]
Definition: AStableDirk4.h:96
virtual bool overridesSolve() const override
Definition: AStableDirk4.h:65
static InputParameters validParams()
Definition: AStableDirk4.C:22
const Real _gamma
Definition: AStableDirk4.h:81
unsigned int _stage
Definition: AStableDirk4.h:75
NumericVector< Number > * _stage_residuals[3]
Definition: AStableDirk4.h:78
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: AStableDirk4.C:101
Fourth-order diagonally implicit Runge Kutta method (Dirk) with three stages plus an update...
Definition: AStableDirk4.h:51
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old) const
Helper function that actually does the math for computing the time derivative.
Definition: AStableDirk4.h:109
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base class for time integrators.
Real _c[3]
Definition: AStableDirk4.h:85
const InputParameters & parameters() const
Get the parameters of the object.
virtual void computeTimeDerivatives() override
Computes the time derivative and the Jacobian of the time derivative.
Definition: AStableDirk4.C:84
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the NonLinearTimeIntegratorInterface called immediately after the residuals are computed ...
Definition: AStableDirk4.C:165
uint8_t dof_id_type