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 "ADCoefMatDiffusion.h" 6 : 7 : registerMooseObject("raccoonApp", ADCoefMatDiffusion); 8 : 9 : InputParameters 10 138 : ADCoefMatDiffusion::validParams() 11 : { 12 138 : InputParameters params = ADKernel::validParams(); 13 138 : params.addClassDescription( 14 : "Diffsuion term optionally multiplied with a coefficient and material properties. The weak " 15 : "form is $(\\grad w, c \\grad u)$, where $c$ is the product of all multipliers."); 16 276 : params.addParam<Real>("coefficient", 1.0, "Coefficient of the term"); 17 276 : params.addParam<std::vector<MaterialPropertyName>>( 18 : "prop_names", {}, "names of the material properties to provide the multiplier"); 19 138 : return params; 20 0 : } 21 : 22 0 : ADCoefMatDiffusion::ADCoefMatDiffusion(const InputParameters & parameters) 23 : : ADKernel(parameters), 24 0 : _coef(getParam<Real>("coefficient")), 25 0 : _prop_names(getParam<std::vector<MaterialPropertyName>>("prop_names")), 26 0 : _num_props(_prop_names.size()) 27 : { 28 0 : _props.resize(_num_props); 29 0 : for (unsigned int i = 0; i < _num_props; i++) 30 0 : _props[i] = &getADMaterialProperty<Real>(_prop_names[i]); 31 0 : } 32 : 33 : ADReal 34 0 : ADCoefMatDiffusion::computeQpResidual() 35 : { 36 0 : ADReal factor = _coef; 37 0 : for (auto prop : _props) 38 0 : factor *= (*prop)[_qp]; 39 : 40 0 : ADReal value = _grad_test[_i][_qp] * _grad_u[_qp]; 41 : 42 0 : return factor * value; 43 : }