https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Reaction.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
10#include "Reaction.h"
11
14
15template <bool is_ad>
18{
21 "Implements a simple consuming reaction term with weak form $(\\psi_i, \\lambda u_h)$.");
22 params.addParam<Real>(
23 "rate", 1.0, "The $(\\lambda)$ multiplier, the relative amount consumed per unit time.");
24 params.declareControllable("rate");
25 return params;
26}
27
28template <bool is_ad>
30 : GenericKernel<is_ad>(parameters), _rate(this->template getParam<Real>("rate"))
31{
32}
33
34template <bool is_ad>
37{
38 return _test[_i][_qp] * _rate * _u[_qp];
39}
40
41template <bool is_ad>
42Real
44{
45 mooseAssert(!is_ad,
46 "In ADReaction, computeQpJacobian should not be called. Check computeJacobian "
47 "implementation.");
48 return _test[_i][_qp] * _rate * _phi[_j][_qp];
49}
50
51template class ReactionTempl<false>;
52template class ReactionTempl<true>;
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
registerMooseObject("MooseApp", Reaction)
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Implements a simple consuming reaction term with weak form $(\psi_i, \lambda u_h)$.
Definition Reaction.h:19
virtual GenericReal< is_ad > computeQpResidual() override
Compute this Kernel's contribution to the residual at the current quadrature point.
Definition Reaction.C:36
static InputParameters validParams()
Definition Reaction.C:17
ReactionTempl(const InputParameters &parameters)
Definition Reaction.C:29
virtual Real computeQpJacobian() override
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
Definition Reaction.C:43