https://mooseframework.inl.gov
PorousFlowExponentialDecay.C
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 
11 
12 #include "MooseVariable.h"
13 
16 
17 template <bool is_ad>
20 {
22  params.addCoupledVar("rate", 1.0, "Rate of exponential decay");
23  params.addCoupledVar("reference", 0.0, "Reference value of the variable");
24  params.addClassDescription("Residual = rate * (variable - reference). Useful for modelling "
25  "exponential decay of a variable");
26  return params;
27 }
28 
29 template <bool is_ad>
31  const InputParameters & parameters)
32  : GenericKernel<is_ad>(parameters),
33  _rate(this->template coupledGenericValue<is_ad>("rate")),
34  _reference(this->template coupledGenericValue<is_ad>("reference"))
35 {
36 }
37 
38 template <bool is_ad>
41 {
42  return _test[_i][_qp] * _rate[_qp] * (_u[_qp] - _reference[_qp]);
43 }
44 
45 template <bool is_ad>
46 Real
48 {
49  if constexpr (!is_ad)
50  return _test[_i][_qp] * _rate[_qp] * _phi[_j][_qp];
51  return 0.0;
52 }
53 
Moose::GenericType< Real, is_ad > GenericReal
static InputParameters validParams()
Kernel = _rate * (variable - reference)
PorousFlowExponentialDecayTempl(const InputParameters &parameters)
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual GenericReal< is_ad > computeQpResidual() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
registerMooseObject("PorousFlowApp", PorousFlowExponentialDecay)