www.mooseframework.org
LStableDirk2.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 LStableDirk2;
15 
16 template <>
18 
44 {
45 public:
47 
48  virtual int order() override { return 2; }
49  virtual void computeTimeDerivatives() override;
50  void computeADTimeDerivatives(DualReal & ad_u_dot, const dof_id_type & dof) const override;
51  virtual void solve() override;
52  virtual void postResidual(NumericVector<Number> & residual) override;
53 
54 protected:
58  template <typename T, typename T2>
59  void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
60 
62  unsigned int _stage;
63 
65  NumericVector<Number> & _residual_stage1;
66 
68  NumericVector<Number> & _residual_stage2;
69 
70  // The parameter of the method, set at construction time and cannot be changed.
71  const Real _alpha;
72 };
73 
74 template <typename T, typename T2>
75 void
76 LStableDirk2::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
77 {
78  u_dot -= u_old;
79  u_dot *= 1. / _dt;
80 }
81 
virtual void computeTimeDerivatives() override
Definition: LStableDirk2.C:37
LStableDirk2(const InputParameters &parameters)
Definition: LStableDirk2.C:25
const Real _alpha
Definition: LStableDirk2.h:71
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
virtual void solve() override
Solves the time step and sets the number of nonlinear and linear iterations.
Definition: LStableDirk2.C:60
InputParameters validParams< LStableDirk2 >()
Definition: LStableDirk2.C:19
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
virtual int order() override
Definition: LStableDirk2.h:48
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the TimeIntegrator called immediately after the residuals are computed in NonlinearSystem...
Definition: LStableDirk2.C:103
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old) const
Helper function that actually does the math for computing the time derivative.
Definition: LStableDirk2.h:76
Base class for time integrators.
unsigned int _stage
Indicates the current stage (1 or 2).
Definition: LStableDirk2.h:62
void computeADTimeDerivatives(DualReal &ad_u_dot, const dof_id_type &dof) const override
method for computing local automatic differentiation time derivatives
Definition: LStableDirk2.C:54
NumericVector< Number > & _residual_stage2
Buffer to store non-time residual from second stage solve.
Definition: LStableDirk2.h:68
Second order diagonally implicit Runge Kutta method (Dirk) with two stages.
Definition: LStableDirk2.h:43
NumericVector< Number > & _residual_stage1
Buffer to store non-time residual from first stage solve.
Definition: LStableDirk2.h:65