15#include "libmesh/quadrature.h"
28 "Compute a histogram of volume fractions binned according to variable values.");
29 params.
addParam<
unsigned int>(
"bin_number", 50,
"Number of histogram bins");
30 params.
addCoupledVar(
"variable",
"Variable to bin the volume of");
31 params.
addRequiredParam<PostprocessorName>(
"min_value",
"Minimum variable value");
32 params.
addRequiredParam<PostprocessorName>(
"max_value",
"Maximum variable value");
38 _nbins(getParam<unsigned
int>(
"bin_number")),
39 _min_value(getPostprocessorValue(
"min_value")),
40 _max_value(getPostprocessorValue(
"max_value")),
41 _value(coupledValue(
"variable")),
42 _bin_center(declareVector(coupledName(
"variable"))),
43 _volume(declareVector(
"n"))
46 mooseError(
"VariableValueVolumeHistogram works on exactly one coupled variable");
50 for (
unsigned i = 0; i <
_nbins; ++i)
61 mooseError(
"max_value is less than or equal to min_value! Please ensure the "
62 "post-processors supplied to this object yield valid bounds for a histogram.");
65 for (
const unsigned int i : make_range(
_nbins))
79 if (bin >= 0 &&
static_cast<unsigned int>(bin) <
_nbins)
93 const auto & uo = cast_ref<const VariableValueVolumeHistogram &>(y);
94 mooseAssert(uo._volume.size() ==
_volume.size(),
95 "Inconsistent volume vector lengths across threads.");
97 for (
unsigned int i = 0; i <
_volume.size(); ++i)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObjectRenamed("MooseApp", VolumeHistogram, "06/30/2022 24:00", VariableValueVolumeHistogram)
registerMooseObject("MooseApp", VariableValueVolumeHistogram)
void ErrorVector unsigned int
unsigned int coupledComponents(const std::string &var_name) const
Number of coupled components.
const QBase *const & _qrule
const MooseArray< Real > & _coord
const MooseArray< Real > & _JxW
static InputParameters validParams()
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Base class for user-specific data.
Compute a histogram of volume fractions binned according to variable values.
virtual void finalize() override
Finalize.
virtual Real computeVolume()
compute the volume contribution at the current quadrature point
const VariableValue & _value
coupled variable that is being binned
VectorPostprocessorValue & _bin_center
value mid point of the bin
const Real & _min_value
minimum variable value
const unsigned int _nbins
number of histogram bins
Real binWidth() const
get the width of a histogram bin
VariableValueVolumeHistogram(const InputParameters ¶meters)
static InputParameters validParams()
const Real & _max_value
maximum variable value
unsigned int _qp
current quadrature point - used in computeVolume()
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void execute() override
Execute method.
VectorPostprocessorValue & _volume
aggregated volume for the given bin