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 "ADMatReaction.h" 11 : 12 : registerMooseObject("MooseApp", ADMatReaction); 13 : 14 : InputParameters 15 14311 : ADMatReaction::validParams() 16 : { 17 14311 : InputParameters params = ADKernel::validParams(); 18 14311 : params.addClassDescription( 19 : "Kernel representing the contribution of the PDE term $-L*v$, where $L$ is a reaction rate " 20 : "material property, $v$ is a scalar variable (nonlinear or coupled), and whose Jacobian " 21 : "contribution is calculated using automatic differentiation."); 22 14311 : params.addCoupledVar("v", 23 : "Set this to make v a coupled variable, otherwise it will use the " 24 : "kernel's nonlinear variable for v"); 25 14311 : params.addRequiredParam<MaterialPropertyName>("reaction_rate", 26 : "The reaction_rate used with the kernel."); 27 14311 : return params; 28 0 : } 29 : 30 24 : ADMatReaction::ADMatReaction(const InputParameters & parameters) 31 : : ADKernel(parameters), 32 24 : _v(isCoupled("v") ? adCoupledValue("v") : _u), 33 48 : _reaction_rate(getADMaterialProperty<Real>("reaction_rate")) 34 : { 35 24 : } 36 : 37 : ADReal 38 1475200 : ADMatReaction::computeQpResidual() 39 : { 40 2950400 : return -_reaction_rate[_qp] * _test[_i][_qp] * _v[_qp]; 41 : }