15 #include "libmesh/quadrature.h" 23 params.
addClassDescription(
"Compute histograms of volume fractions binned according to component " 24 "values of an array variable.");
25 params.
addParam<
unsigned int>(
"bin_number", 50,
"Number of histogram bins");
26 params.
addCoupledVar(
"variable",
"Variable to bin the volume of");
35 _nbins(getParam<unsigned
int>(
"bin_number")),
36 _min_value(getParam<
Real>(
"min_value")),
37 _max_value(getParam<
Real>(
"max_value")),
38 _deltaV((_max_value - _min_value) / _nbins),
39 _value(coupledArrayValue(
"variable")),
40 _var(*getArrayVar(
"variable", 0)),
41 _bin_center(declareVector(
"value"))
44 mooseError(
"ArrayVariableValueVolumeHistogram works on exactly one coupled variable");
75 if (bin >= 0 && static_cast<unsigned int>(bin) <
_nbins)
92 mooseAssert(uo._volumes.size() ==
_volumes.size(),
93 "Inconsistent number of array variable components across threads.");
97 mooseAssert(uo._volumes[i]->size() ==
_volumes[i]->size(),
98 "Inconsistent volume vector lengths across threads.");
100 (*
_volumes[i])[j] += (*uo._volumes[i])[j];
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
ArrayVariableValueVolumeHistogram(const InputParameters ¶meters)
const MooseArray< Real > & _coord
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one...
const Real _deltaV
bin width
virtual void execute() override
Execute method.
const Real _min_value
minimum variable value
const ArrayVariableValue & _value
coupled variable that is being binned
virtual void threadJoin(const UserObject &y) override
Must override.
static InputParameters validParams()
std::vector< VectorPostprocessorValue * > _volumes
aggregated volumes of all components for the given bin
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
VectorPostprocessorValue & _bin_center
value mid point of the bin
VectorPostprocessorValue & declareVector(const std::string &vector_name)
Register a new vector to fill up.
registerMooseObject("MooseApp", ArrayVariableValueVolumeHistogram)
unsigned int coupledComponents(const std::string &var_name) const
Number of coupled components.
virtual void finalize() override
Finalize.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
const MooseArray< Real > & _JxW
const std::string & arrayVariableComponent(const unsigned int i) const
Returns the variable name of a component of an array variable.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
static InputParameters validParams()
Compute histograms of volume fractions binned according to component values of an array variable...
const unsigned int _nbins
number of histogram bins
const ArrayMooseVariable & _var
coupled array variable
void ErrorVector unsigned int
auto index_range(const T &sizable)
Base class for user-specific data.
unsigned int _qp
current quadrature point - used in computeVolume()