www.mooseframework.org
LStableDirk3.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 
14 class LStableDirk3;
15 
16 template <>
18 
46 {
47 public:
49 
50  virtual int order() override { return 3; }
51  virtual void computeTimeDerivatives() override;
52  virtual void computeADTimeDerivatives(DualReal & ad_u_dot,
53  const dof_id_type & dof) const override;
54  virtual void solve() override;
55  virtual void postResidual(NumericVector<Number> & residual) override;
56 
57 protected:
61  template <typename T, typename T2>
62  void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
63 
64  // Indicates the current stage.
65  unsigned int _stage;
66 
67  // Store pointers to the various stage residuals
68  NumericVector<Number> * _stage_residuals[3];
69 
70  // The parameter of the method, set at construction time and cannot be changed.
71  const Real _gamma; // 0.4358665215084589
72 
73  // Butcher tableau "C" parameters derived from _gamma
74  // 0.4358665215084589, 0.7179332607542295, 1.0000000000000000
75  Real _c[3];
76 
77  // Butcher tableau "A" values derived from _gamma. We only use the
78  // lower triangle of this.
79  // 0.4358665215084589
80  // 0.2820667392457705, 0.4358665215084589
81  // 1.2084966491760099, -0.6443631706844688, 0.4358665215084589
82  Real _a[3][3];
83 };
84 
85 template <typename T, typename T2>
86 void
87 LStableDirk3::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
88 {
89  u_dot -= u_old;
90  u_dot *= 1. / _dt;
91 }
92 
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the TimeIntegrator called immediately after the residuals are computed in NonlinearSystem...
Definition: LStableDirk3.C:119
InputParameters validParams< LStableDirk3 >()
Definition: LStableDirk3.C:19
NumericVector< Number > * _stage_residuals[3]
Definition: LStableDirk3.h:68
virtual int order() override
Definition: LStableDirk3.h:50
virtual void solve() override
Solves the time step and sets the number of nonlinear and linear iterations.
Definition: LStableDirk3.C:79
Third order diagonally implicit Runge Kutta method (Dirk) with three stages.
Definition: LStableDirk3.h:45
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
DualNumber< Real, NumberArray< AD_MAX_DOFS_PER_ELEM, Real > > DualReal
Definition: DualReal.h:29
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old) const
Helper function that actually does the math for computing the time derivative.
Definition: LStableDirk3.h:87
Real _a[3][3]
Definition: LStableDirk3.h:82
virtual void computeADTimeDerivatives(DualReal &ad_u_dot, const dof_id_type &dof) const override
method for computing local automatic differentiation time derivatives
Definition: LStableDirk3.C:73
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
unsigned int _stage
Definition: LStableDirk3.h:65
virtual void computeTimeDerivatives() override
Definition: LStableDirk3.C:56
Base class for time integrators.
const Real _gamma
Definition: LStableDirk3.h:71
LStableDirk3(const InputParameters &parameters)
Definition: LStableDirk3.C:25
Real _c[3]
Definition: LStableDirk3.h:75