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");
38 _nbins(getParam<unsigned
int>(
"bin_number")),
39 _min_value(getParam<Real>(
"min_value")),
40 _max_value(getParam<Real>(
"max_value")),
41 _deltaV((_max_value - _min_value) / _nbins),
42 _value(coupledValue(
"variable")),
43 _bin_center(declareVector(coupledName(
"variable"))),
44 _volume(declareVector(
"n"))
47 mooseError(
"VariableValueVolumeHistogram works on exactly one coupled variable");
51 for (
unsigned i = 0; i <
_nbins; ++i)
72 if (bin >= 0 &&
static_cast<unsigned int>(bin) <
_nbins)
87 mooseAssert(uo._volume.size() ==
_volume.size(),
88 "Inconsistent volume vector lengths across threads.");
90 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 unsigned int _nbins
number of histogram bins
VariableValueVolumeHistogram(const InputParameters ¶meters)
static InputParameters validParams()
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.
const Real _min_value
minimum variable value
const Real _deltaV
bin width
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void execute() override
Execute method.
VectorPostprocessorValue & _volume
aggregated volume for the given bin