16 #include "MooseMesh.h"
17 #include "MooseVariable.h"
19 #include "libmesh/quadrature.h"
27 InputParameters params = validParams<GeneralVectorPostprocessor>();
28 params += validParams<BoundaryRestrictable>();
30 params.addRequiredParam<UserObjectName>(
"flood_counter",
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 "
42 params.suppressParameter<
bool>(
"contains_complete_history");
48 const InputParameters & parameters)
49 : GeneralVectorPostprocessor(parameters),
50 MooseVariableDependencyInterface(),
51 BoundaryRestrictable(this, false),
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)),
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())
70 addMooseVariableDependency(
_vars);
94 for (MooseIndex(num_features) feature_num = 0; feature_num < num_features; ++feature_num)
112 VectorPostprocessorValue & center_x = declareVector(
"centroid_x");
113 center_x.resize(num_features);
114 VectorPostprocessorValue & center_y = declareVector(
"centroid_y");
115 center_y.resize(num_features);
116 VectorPostprocessorValue & center_z = declareVector(
"centroid_z");
117 center_z.resize(num_features);
119 for (MooseIndex(
_var_num) feature_num = 0; feature_num < num_features; ++feature_num)
122 center_x[feature_num] = p(0);
123 center_y[feature_num] = p(1);
124 center_z[feature_num] = p(2);
134 const std::set<BoundaryID> supplied_bnd_ids = BoundaryRestrictable::boundaryIDs();
135 for (
auto elem_it =
_mesh.bndElemsBegin(), elem_end =
_mesh.bndElemsEnd(); elem_it != elem_end;
139 for (
auto & supplied_bnd_id : supplied_bnd_ids)
140 if (((*elem_it)->_bnd_id) == supplied_bnd_id)
142 const auto & elem = (*elem_it)->_elem;
143 auto rank = processor_id();
145 if (elem->processor_id() == rank)
147 _fe_problem.setCurrentSubdomainID(elem, 0);
148 _fe_problem.prepare(elem, 0);
149 _fe_problem.reinitElem(elem, 0);
150 _fe_problem.reinitElemFace(elem, (*elem_it)->_side, (*elem_it)->_bnd_id, 0);
159 for (
const auto & elem :
_mesh.getMesh().active_local_element_ptr_range())
161 _fe_problem.setCurrentSubdomainID(elem, 0);
162 _fe_problem.prepare(elem, 0);
163 _fe_problem.reinitElem(elem, 0);
187 mooseAssert(feature_id <
_feature_volumes.size(),
"feature_id is out of range");
194 const std::vector<unsigned int> & var_to_features,
195 std::size_t libmesh_dbg_var(num_features))
198 Real max_var_value = std::numeric_limits<Real>::lowest();
200 for (MooseIndex(var_to_features) var_index = 0; var_index < var_to_features.size(); ++var_index)
205 auto feature_id = var_to_features[var_index];
206 mooseAssert(feature_id < num_features,
"Feature ID out of range");
212 if (integral_value > max_var_value)
215 max_var_value = integral_value;
216 dominant_feature_id = feature_id;
235 for (
unsigned int qp = 0; qp <
_qrule->n_points(); ++qp)
244 const std::vector<unsigned int> & var_to_features,
245 std::size_t libmesh_dbg_var(num_features),
249 Real max_var_value = std::numeric_limits<Real>::lowest();
251 for (MooseIndex(var_to_features) var_index = 0; var_index < var_to_features.size(); ++var_index)
256 auto feature_id = var_to_features[var_index];
257 mooseAssert(feature_id < num_features,
"Feature ID out of range");
262 if (integral_value > max_var_value)
265 max_var_value = integral_value;
266 dominant_feature_id = feature_id;
284 for (
unsigned int qp = 0; qp <
_qrule_face->n_points(); ++qp)