Line data Source code
1 : //* This file is part of the RACCOON application 2 : //* being developed at Dolbow lab at Duke University 3 : //* http://dolbow.pratt.duke.edu 4 : 5 : #include "ADCoefMatReaction.h" 6 : 7 : registerMooseObject("raccoonApp", ADCoefMatReaction); 8 : 9 : InputParameters 10 142 : ADCoefMatReaction::validParams() 11 : { 12 142 : InputParameters params = ADKernelValue::validParams(); 13 142 : params.addClassDescription( 14 : "Reaction term optionally multiplied with a coefficient and material properties. The weak " 15 : "form is $(w, c u)$, where $c$ is the product of all multipliers."); 16 284 : params.addParam<Real>("coefficient", 1.0, "Coefficient of the term"); 17 284 : params.addParam<std::vector<MaterialPropertyName>>( 18 : "prop_names", {}, "names of the material properties to provide the multiplier"); 19 142 : return params; 20 0 : } 21 : 22 2 : ADCoefMatReaction::ADCoefMatReaction(const InputParameters & parameters) 23 : : ADKernelValue(parameters), 24 2 : _coef(getParam<Real>("coefficient")), 25 4 : _prop_names(getParam<std::vector<MaterialPropertyName>>("prop_names")), 26 4 : _num_props(_prop_names.size()) 27 : { 28 2 : _props.resize(_num_props); 29 4 : for (unsigned int i = 0; i < _num_props; i++) 30 2 : _props[i] = &getADMaterialProperty<Real>(_prop_names[i]); 31 2 : } 32 : 33 : ADReal 34 8720000 : ADCoefMatReaction::precomputeQpResidual() 35 : { 36 8720000 : ADReal factor = _coef; 37 17440000 : for (auto prop : _props) 38 8720000 : factor *= (*prop)[_qp]; 39 17440000 : return factor * _u[_qp]; 40 : }