www.mooseframework.org
Reaction.C
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 #include "Reaction.h"
11 
12 registerMooseObject("MooseApp", Reaction);
13 registerMooseObject("MooseApp", ADReaction);
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription(
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 
28 template <bool is_ad>
30  : GenericKernel<is_ad>(parameters), _rate(this->template getParam<Real>("rate"))
31 {
32 }
33 
34 template <bool is_ad>
37 {
38  return _test[_i][_qp] * _rate * _u[_qp];
39 }
40 
41 template <bool is_ad>
42 Real
44 {
45  // This function will never be called for the AD version. But because C++ does
46  // not support an optional function declaration based on a template parameter,
47  // we must keep this template for all cases.
48  mooseAssert(!is_ad,
49  "In ADReaction, computeQpJacobian should not be called. Check computeJacobian "
50  "implementation.");
51  return _test[_i][_qp] * _rate * _phi[_j][_qp];
52 }
53 
54 template class ReactionTempl<false>;
55 template class ReactionTempl<true>;
Implements a simple consuming reaction term with weak form $(\psi_i, \lambda u_h)$.
Definition: Reaction.h:18
static InputParameters validParams()
Definition: GenericKernel.h:19
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", Reaction)
static InputParameters validParams()
Definition: Reaction.C:17
virtual Real computeQpJacobian() override
Compute this Kernel&#39;s contribution to the Jacobian at the current quadrature point.
Definition: Reaction.C:43
ReactionTempl(const InputParameters &parameters)
Definition: Reaction.C:29
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
typename Moose::GenericType< Real, is_ad > GenericReal
Definition: MooseTypes.h:559
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
virtual GenericReal< is_ad > computeQpResidual() override
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
Definition: Reaction.C:36