Line data Source code
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 : 12 : registerMooseObject("MooseApp", Reaction); 13 : registerMooseObject("MooseApp", ADReaction); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 119390 : ReactionTempl<is_ad>::validParams() 18 : { 19 119390 : InputParameters params = GenericKernel<is_ad>::validParams(); 20 119390 : params.addClassDescription( 21 : "Implements a simple consuming reaction term with weak form $(\\psi_i, \\lambda u_h)$."); 22 358170 : params.addParam<Real>( 23 238780 : "rate", 1.0, "The $(\\lambda)$ multiplier, the relative amount consumed per unit time."); 24 119390 : params.declareControllable("rate"); 25 119390 : return params; 26 0 : } 27 : 28 : template <bool is_ad> 29 2715 : ReactionTempl<is_ad>::ReactionTempl(const InputParameters & parameters) 30 2715 : : GenericKernel<is_ad>(parameters), _rate(this->template getParam<Real>("rate")) 31 : { 32 2715 : } 33 : 34 : template <bool is_ad> 35 : GenericReal<is_ad> 36 277553536 : ReactionTempl<is_ad>::computeQpResidual() 37 : { 38 277815136 : return _test[_i][_qp] * _rate * _u[_qp]; 39 : } 40 : 41 : template <bool is_ad> 42 : Real 43 366409388 : ReactionTempl<is_ad>::computeQpJacobian() 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 366409388 : return _test[_i][_qp] * _rate * _phi[_j][_qp]; 52 : } 53 : 54 : template class ReactionTempl<false>; 55 : template class ReactionTempl<true>;