https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ArrayReactionNodalKernel.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
14
15template <bool is_ad>
18{
21 "Implements a simple consuming reaction term at nodes for an array variable");
22 params.addRequiredParam<RealEigenVector>("coeff",
23 "Coefficients for multiplying the reaction term");
24 return params;
25}
26
27template <bool is_ad>
29 const InputParameters & parameters)
30 : GenericArrayNodalKernel<is_ad>(parameters),
31 _coeff(this->template getParam<RealEigenVector>("coeff"))
32{
33 if (_coeff.size() != _count)
34 paramError("coeff",
35 "The size of the coefficient vector must match the size of the array variable");
36}
37
38template <bool is_ad>
39void
41{
42 residual = _coeff.cwiseProduct(_u[_qp]);
43}
44
45template <bool is_ad>
46void
48{
49 for (const auto i : index_range(_coeff))
50 setJacobian(i, i, _coeff(i));
51}
52
registerMooseObject("MooseApp", ArrayReactionNodalKernel)
Moose::GenericType< RealEigenVector, is_ad > GenericRealEigenVector
Definition MooseTypes.h:724
const unsigned int _count
Number of components of the array variable.
Represents a nodal reaction term equivalent to $a * u$.
virtual void computeQpResidual(GenericRealEigenVector< is_ad > &residual) override
virtual void computeQpJacobian() override
The user can override this function to compute the intra-variable off-diagonal Jacobian contribution ...
const RealEigenVector & _coeff
rate coefficient
ArrayReactionNodalKernelTempl(const InputParameters &parameters)
Template for array nodal kernels, using or not automatic differentiation.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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 paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457