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