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 "ADCoefMatSource.h" 6 : 7 : registerMooseObject("raccoonApp", ADCoefMatSource); 8 : 9 : InputParameters 10 148 : ADCoefMatSource::validParams() 11 : { 12 148 : InputParameters params = ADKernelValue::validParams(); 13 148 : params.addClassDescription( 14 : "Source term defined by the product of a coefficient and material properties"); 15 296 : params.addParam<Real>("coefficient", 1.0, "Coefficient of the term"); 16 296 : params.addParam<std::vector<MaterialPropertyName>>( 17 : "prop_names", {}, "names of the material properties to provide the multiplier"); 18 148 : return params; 19 0 : } 20 : 21 5 : ADCoefMatSource::ADCoefMatSource(const InputParameters & parameters) 22 : : ADKernelValue(parameters), 23 5 : _coef(getParam<Real>("coefficient")), 24 10 : _prop_names(getParam<std::vector<MaterialPropertyName>>("prop_names")), 25 10 : _num_props(_prop_names.size()) 26 : { 27 5 : _props.resize(_num_props); 28 10 : for (unsigned int i = 0; i < _num_props; i++) 29 5 : _props[i] = &getADMaterialProperty<Real>(_prop_names[i]); 30 5 : } 31 : 32 : ADReal 33 703024 : ADCoefMatSource::precomputeQpResidual() 34 : { 35 703024 : ADReal factor = 1.0; 36 1406048 : for (auto prop : _props) 37 703024 : factor *= (*prop)[_qp]; 38 : 39 703024 : return factor * _coef; 40 : }