22 "Set this to make v a coupled variable, otherwise it will use the "
23 "kernel's nonlinear variable for v");
25 "The reaction rate used with the kernel");
32 _rate(this->template getGenericMaterialProperty<Real, is_ad>(
"reaction_rate")),
33 _v(this->isCoupled(
"v") ? this->template coupledGenericValue<is_ad>(
"v") : this->_u)
36 paramError(
"v",
"In order to correctly couple the primal variable, leave 'v' blank");
43 return -_rate[_qp] * _v[_qp] * _test[_i][_qp];
50 params.
addCoupledVar(
"args",
"Vector of nonlinear variable arguments this object depends on");
56 _is_coupled(isCoupled(
"v")),
57 _v_name(_is_coupled ? coupledName(
"v") : _var.name()),
58 _v_var(_is_coupled ? coupled(
"v") : _var.number()),
59 _drate_du(getMaterialPropertyDerivative<Real>(
"reaction_rate", _var.name())),
60 _drate_dv(getMaterialPropertyDerivative<Real>(
"reaction_rate", _v_name)),
64 for (
unsigned int i = 0; i <
_n_args; ++i)
65 _drate_darg[i] = &getMaterialPropertyDerivative<Real>(
"reaction_rate", i);
71 validateNonlinearCoupling<Real>(
"reaction_rate");
78 return -
_drate_du[_qp] * _v[_qp] * _phi[_j][_qp] * _test[_i][_qp];
80 return -(_rate[_qp] +
_drate_du[_qp] * _v[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
90 return -(_rate[_qp] +
_drate_dv[_qp] * _v[_qp]) * _test[_i][_qp] * _phi[_j][_qp];
95 return -(*
_drate_darg[cvar])[_qp] * _v[_qp] * _test[_i][_qp] * _phi[_j][_qp];
registerMooseObject("MooseApp", MatReaction)
Moose::GenericType< Real, is_ad > GenericReal
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
Returns the index for a coupled variable by name.
virtual bool isCoupled(const std::string &var_name, unsigned int i=0) const
Returns true if a variables has been coupled as name.
Interface class ("Veneer") to provide generator methods for derivative material property names.
static InputParameters validParams()
const unsigned int _n_args
number of coupled moose variables
unsigned int mapJvarToCvar(unsigned int jvar)
Return index into the _coupled_moose_vars array for a given jvar.
Interface class ("Veneer") for Kernel to provide a mapping from 'jvar' in computeQpOffDiagJacobian in...
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
This kernel adds to the residual a contribution of where is a material property and is a variable ...
static InputParameters validParams()
MatReactionTempl(const InputParameters ¶meters)
virtual GenericReal< is_ad > computeQpResidual()
Compute this Kernel's contribution to the residual at the current quadrature point.
virtual void initialSetup()
const bool _is_coupled
is the kernel used in a coupled form?
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
static InputParameters validParams()
virtual Real computeQpJacobian()
const MaterialProperty< Real > & _drate_du
Reaction rate derivative w.r.t. primal variable.
std::vector< const MaterialProperty< Real > * > _drate_darg
Reaction rate derivatives w.r.t. other coupled variables.
const MaterialProperty< Real > & _drate_dv
Reaction rate derivative w.r.t. the variable being added by this kernel.
MatReaction(const InputParameters ¶meters)
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
unsigned int number() const
Get variable number coming from libMesh.