www.mooseframework.org
LStableDirk4.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 
52 {
53 public:
55 
57 
58  virtual int order() override { return 4; }
59  virtual void computeTimeDerivatives() override;
60  virtual void computeADTimeDerivatives(DualReal & ad_u_dot,
61  const dof_id_type & dof,
62  DualReal & ad_u_dotdot) const override;
63  virtual void solve() override;
64  virtual void postResidual(NumericVector<Number> & residual) override;
65 
66 protected:
70  template <typename T, typename T2>
71  void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
72 
73  // Indicates the current stage.
74  unsigned int _stage;
75 
76  // The number of stages in the method. According to S9.4.2/4 of the
77  // standard, we can specify a constant initializer like this for
78  // integral types, it does not have to appear outside the class
79  // definition.
80  static const unsigned int _n_stages = 5;
81 
82  // Store pointers to the various stage residuals
84 
85  // Butcher tableau "C" parameters derived from _gamma
86  static const Real _c[_n_stages];
87 
88  // Butcher tableau "A" values derived from _gamma. We only use the
89  // lower triangle of this.
90  static const Real _a[_n_stages][_n_stages];
91 };
92 
93 template <typename T, typename T2>
94 void
95 LStableDirk4::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
96 {
97  u_dot -= u_old;
98  u_dot *= 1. / _dt;
99 }
Fourth-order diagonally implicit Runge Kutta method (Dirk) with five stages.
Definition: LStableDirk4.h:51
static const Real _a[_n_stages][_n_stages]
Definition: LStableDirk4.h:90
virtual void computeTimeDerivatives() override
Computes the time derivative and the Jacobian of the time derivative.
Definition: LStableDirk4.C:52
LStableDirk4(const InputParameters &parameters)
Definition: LStableDirk4.C:36
DualNumber< Real, DNDerivativeType, true > DualReal
Definition: DualReal.h:49
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void computeADTimeDerivatives(DualReal &ad_u_dot, const dof_id_type &dof, DualReal &ad_u_dotdot) const override
method for computing local automatic differentiation time derivatives
Definition: LStableDirk4.C:69
unsigned int _stage
Definition: LStableDirk4.h:74
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the TimeIntegrator called immediately after the residuals are computed in NonlinearSystem...
Definition: LStableDirk4.C:117
virtual int order() override
Definition: LStableDirk4.h:58
static const Real _c[_n_stages]
Definition: LStableDirk4.h:86
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base class for time integrators.
NumericVector< Number > * _stage_residuals[_n_stages]
Definition: LStableDirk4.h:83
static InputParameters validParams()
Definition: LStableDirk4.C:18
static const unsigned int _n_stages
Definition: LStableDirk4.h:80
const InputParameters & parameters() const
Get the parameters of the object.
virtual void solve() override
Solves the time step and sets the number of nonlinear and linear iterations.
Definition: LStableDirk4.C:77
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old) const
Helper function that actually does the math for computing the time derivative.
Definition: LStableDirk4.h:95
uint8_t dof_id_type