https://mooseframework.inl.gov
ImplicitMidpoint.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 
42 {
43 public:
45 
47 
48  virtual int order() override { return 2; }
49 
50  virtual void computeTimeDerivatives() override;
51  void computeADTimeDerivatives(ADReal & ad_u_dot,
52  const dof_id_type & dof,
53  ADReal & ad_u_dotdot) const override;
54  virtual void solve() override;
55  virtual void postResidual(NumericVector<Number> & residual) override;
56  virtual bool overridesSolve() const override { return true; }
57 
58 protected:
62  template <typename T, typename T2>
63  void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
64 
65  unsigned int _stage;
66 
69 };
70 
71 template <typename T, typename T2>
72 void
73 ImplicitMidpoint::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
74 {
75  u_dot -= u_old;
76  u_dot *= 1. / _dt;
77 }
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
Second-order Runge-Kutta (implicit midpoint) time integration.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual int order() override
ImplicitMidpoint(const InputParameters &parameters)
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:47
Real & _dt
The current time step size.
void computeTimeDerivativeHelper(T &u_dot, const T2 &u_old) const
Helper function that actually does the math for computing the time derivative.
virtual void computeTimeDerivatives() override
Computes the time derivative and the Jacobian of the time derivative.
virtual bool overridesSolve() const override
NumericVector< Number > * _residual_stage1
Buffer to store non-time residual from the first stage.
virtual void solve() override
Solves the time step and sets the number of nonlinear and linear iterations.
Base class for time integrators.
virtual void postResidual(NumericVector< Number > &residual) override
Callback to the NonLinearTimeIntegratorInterface called immediately after the residuals are computed ...
unsigned int _stage
const InputParameters & parameters() const
Get the parameters of the object.
uint8_t dof_id_type