20 #include "libmesh/quadrature.h" 31 "The FeatureFloodCount UserObject to get values from.");
32 params.
addParam<
bool>(
"single_feature_per_element",
34 "Set this Boolean if you wish to use an element based volume where" 35 " the dominant order parameter determines the feature that accumulates the " 36 "entire element volume");
37 params.
addParam<
bool>(
"output_centroids",
false,
"Set to true to output the feature centroids");
38 params.
addClassDescription(
"This object is designed to pull information from the data structures " 39 "of a \"FeatureFloodCount\" or derived object (e.g. individual " 52 _single_feature_per_elem(getParam<bool>(
"single_feature_per_element")),
53 _output_centroids(getParam<bool>(
"output_centroids")),
55 _var_num(declareVector(
"var_num")),
56 _feature_volumes(declareVector(
"feature_volumes")),
57 _intersects_bounds(declareVector(
"intersects_bounds")),
58 _intersects_specified_bounds(declareVector(
"intersects_specified_bounds")),
59 _percolated(declareVector(
"percolated")),
60 _vars(_feature_counter.getFECoupledVars()),
61 _mesh(_subproblem.
mesh()),
62 _assembly(_subproblem.assembly(_tid, _sys.number())),
63 _q_point(_assembly.qPoints()),
64 _qrule(_assembly.qRule()),
65 _JxW(_assembly.JxW()),
66 _coord(_assembly.coordTransformation()),
67 _qrule_face(_assembly.qRuleFace()),
68 _JxW_face(_assembly.JxWFace())
78 const std::array<std::string, 3> suffix = {{
"x",
"y",
"z"}};
80 for (
unsigned int i = 0; i < 3; ++i)
99 for (MooseIndex(num_features) feature_num = 0; feature_num < num_features; ++feature_num)
117 for (std::size_t i = 0; i < 3; ++i)
119 for (std::size_t feature_num = 0; feature_num < num_features; ++feature_num)
122 for (std::size_t i = 0; i < 3; ++i)
138 for (
auto & supplied_bnd_id : supplied_bnd_ids)
139 if (((*elem_it)->_bnd_id) == supplied_bnd_id)
141 const auto & elem = (*elem_it)->_elem;
144 if (elem->processor_id() == rank)
158 for (
const auto & elem :
_mesh.
getMesh().active_local_element_ptr_range())
186 mooseAssert(feature_id <
_feature_volumes.size(),
"feature_id is out of range");
193 const std::vector<unsigned int> & var_to_features,
194 std::size_t libmesh_dbg_var(num_features))
197 Real max_var_value = std::numeric_limits<Real>::lowest();
199 for (MooseIndex(var_to_features) var_index = 0; var_index < var_to_features.size(); ++var_index)
204 auto feature_id = var_to_features[var_index];
205 mooseAssert(feature_id < num_features,
"Feature ID out of range");
211 if (integral_value > max_var_value)
214 max_var_value = integral_value;
215 dominant_feature_id = feature_id;
234 for (
unsigned int qp = 0; qp <
_qrule->n_points(); ++qp)
243 const std::vector<unsigned int> & var_to_features,
244 std::size_t libmesh_dbg_var(num_features),
248 Real max_var_value = std::numeric_limits<Real>::lowest();
250 for (MooseIndex(var_to_features) var_index = 0; var_index < var_to_features.size(); ++var_index)
255 auto feature_id = var_to_features[var_index];
256 mooseAssert(feature_id < num_features,
"Feature ID out of range");
261 if (integral_value > max_var_value)
264 max_var_value = integral_value;
265 dominant_feature_id = feature_id;
277 std::unique_ptr<const Elem> side_elem = elem->build_side_ptr(side);
286 for (
unsigned int qp = 0; qp <
_qrule_face->n_points(); ++qp)
virtual bnd_elem_iterator bndElemsEnd()
void accumulateVolumes(const Elem *elem, const std::vector< unsigned int > &var_to_features, std::size_t num_features)
Add volume contributions to one or entries in the feature volume vector.
This VectorPostprocessor is intended to be used to calculate accurate volumes from the FeatureFloodCo...
std::array< VectorPostprocessorValue *, 3 > _centroid
virtual bool boundaryRestricted() const
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
virtual void finalize() override
virtual const std::vector< unsigned int > & getVarToFeatureVector(dof_id_type elem_id) const
Returns a list of active unique feature ids for a particular element.
const std::vector< MooseVariableFEBase * > & _vars
const std::vector< MooseVariable * > & getCoupledVars() const
Returns a const vector to the coupled variable pointers.
Real getFeatureVolume(unsigned int feature_id) const
Returns the volume for the given grain number.
VectorPostprocessorValue & _var_num
VectorPostprocessorValue & _feature_volumes
const MooseArray< Real > & _JxW
virtual bnd_elem_iterator bndElemsBegin()
virtual std::size_t getTotalFeatureCount() const
Returns the total feature count (active and inactive ids, useful for sizing vectors) ...
const Parallel::Communicator & _communicator
virtual void execute() override
void accumulateBoundaryFaces(const Elem *elem, const std::vector< unsigned int > &var_to_features, std::size_t num_features, unsigned int side)
When boundary is supplied as input, compute coverage of that boundary by each feature.
virtual bool isFeaturePercolated(unsigned int feature_id) const
Returns a Boolean indicating whether this feature is percolated (e.g.
const bool _output_centroids
registerMooseObject("PhaseFieldApp", FeatureVolumeVectorPostprocessor)
static InputParameters validParams()
const QBase *const & _qrule_face
virtual unsigned int getFeatureVar(unsigned int feature_id) const
Returns the variable representing the passed in feature.
bool _is_boundary_restricted
Indicates whether the calculation should be run on volumes or area of a boundary. ...
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
VectorPostprocessorValue & _intersects_specified_bounds
static InputParameters validParams()
Real elementVolume(const Elem *elem) const
const MooseArray< Real > & _JxW_face
This object will mark nodes or elements of continuous regions all with a unique number for the purpos...
const FeatureFloodCount & _feature_counter
A reference to the feature flood count object.
static const unsigned int invalid_id
std::vector< const VariableValue * > _coupled_sln
VectorPostprocessorValue & _intersects_bounds
VectorPostprocessorValue & _percolated
VectorPostprocessorValue & declareVector(const std::string &vector_name)
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
static InputParameters validParams()
virtual bool doesFeatureIntersectSpecifiedBoundary(unsigned int feature_id) const
Returns a Boolean indicating whether this feature intersects boundaries in a user-supplied list...
Real computeFaceIntegral(std::size_t var_index) const
Calculate the integral on the face if boundary is supplied as input.
void addMooseVariableDependency(MooseVariableFieldBase *var)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseArray< Real > & _coord
FEProblemBase & _fe_problem
virtual void initialize() override
void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)
const bool _single_feature_per_elem
A Boolean indicating how the volume is calculated.
processor_id_type processor_id() const
Real computeIntegral(std::size_t var_index) const
Calculate the integral value of the passed in variable (index)
FeatureVolumeVectorPostprocessor(const InputParameters ¶meters)
virtual const std::set< BoundaryID > & boundaryIDs() const
virtual bool doesFeatureIntersectBoundary(unsigned int feature_id) const
Returns a Boolean indicating whether this feature intersects any boundary.
const QBase *const & _qrule
virtual Point featureCentroid(unsigned int feature_id) const
Returns the centroid of the designated feature (only supported without periodic boundaries) ...