19 params.
addClassDescription(
"Weighted average of material properties using variables as weights");
22 "prop_name",
"The name of the material property where the average is stored");
24 "Vector of values to average");
32 _prop(declareADProperty<
Real>(getParam<MaterialPropertyName>(
"prop_name"))),
33 _n_values(getParam<
std::vector<MaterialPropertyName>>(
"values").size())
37 mooseError(
name(),
": The number of weights must equal the number of values");
40 const std::vector<MaterialPropertyName> & prop_names =
41 getParam<std::vector<MaterialPropertyName>>(
"values");
42 for (
unsigned int i = 0; i <
_n_values; i++)
44 _values.push_back(&getADMaterialPropertyByName<Real>(prop_names[i]));
53 for (
unsigned int i = 0; i <
_n_values; i++)
57 for (
unsigned int i = 0; i <
_n_values; i++)
60 _prop[
_qp] = weighted_sum / weight_total;
static InputParameters validParams()
const ADVariableValue & adCoupledValue(const std::string &var_name, unsigned int comp=0) const
ADWeightedAverageMaterial(const InputParameters ¶meters)
Weighted average of material properties using aux variables as the weights
virtual const std::string & name() const
virtual void computeQpProperties()
const unsigned int _n_values
Number of components (i.e. values and weights)
std::vector< const ADVariableValue * > _weights
Weights of the values.
static InputParameters validParams()
std::vector< const ADMaterialProperty< Real > * > _values
Values to average.
registerMooseObject("ThermalHydraulicsApp", ADWeightedAverageMaterial)
unsigned int coupledComponents(const std::string &var_name) const
ADMaterialProperty< Real > & _prop
The material property where the weighted average is stored.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const