Compute the average grain area in a polycrystal.
More...
#include <AverageGrainVolume.h>
|
void | accumulateVolumes (const std::vector< unsigned int > &var_to_features, std::size_t libmesh_dbg_var(num_features)) |
|
Real | computeIntegral (std::size_t var_index) const |
|
Compute the average grain area in a polycrystal.
Definition at line 27 of file AverageGrainVolume.h.
◆ AverageGrainVolume()
AverageGrainVolume::AverageGrainVolume |
( |
const InputParameters & |
parameters | ) |
|
Definition at line 45 of file AverageGrainVolume.C.
46 : GeneralPostprocessor(parameters),
47 Coupleable(
this,
false),
48 MooseVariableDependencyInterface(),
49 _mesh(_subproblem.mesh()),
56 ? &getUserObject<FeatureFloodCount>(
"feature_counter")
61 if (isParamValid(
"variable") && isParamValid(
"grain_num"))
63 auto num_coupled_vars = coupledComponents(
"variable");
64 if (num_coupled_vars != getParam<unsigned int>(
"grain_num"))
65 mooseError(
"The number of grains must match the number of OPs if a feature_counter is not " 68 _vals.resize(num_coupled_vars);
69 for (
unsigned int i = 0; i < num_coupled_vars; ++i)
70 _vals[i] = &coupledValue(
"variable", i);
80 mooseError(
"Must supply either a feature_counter object or coupled variables and grain_num");
85 _vals.reserve(coupled_vars.size());
87 for (
auto & coupled_var : coupled_vars)
88 _vals.emplace_back(&coupled_var->sln());
std::vector< unsigned int > _static_var_to_feature
const FeatureFloodCount * _feature_counter
const MooseArray< Point > & _q_point
const std::vector< MooseVariable * > & getCoupledVars() const
Returns a const vector to the coupled variable pointers.
const MooseArray< Real > & _coord
std::vector< Real > _feature_volumes
const MooseArray< Real > & _JxW
MooseMesh & _mesh
A reference to the mesh.
const std::vector< MooseVariableFEBase * > & getFECoupledVars() const
Returns a const vector to the coupled MooseVariableFEBase pointers.
std::vector< const VariableValue * > _vals
◆ accumulateVolumes()
void AverageGrainVolume::accumulateVolumes |
( |
const std::vector< unsigned int > & |
var_to_features, |
|
|
std::size_t |
libmesh_dbg_varnum_features |
|
) |
| |
|
protected |
Definition at line 124 of file AverageGrainVolume.C.
Referenced by execute().
127 for (
auto var_index = beginIndex(var_to_features); var_index < var_to_features.size();
133 auto feature_id = var_to_features[var_index];
134 mooseAssert(feature_id < num_features,
"Feature ID out of range");
Real computeIntegral(std::size_t var_index) const
std::vector< Real > _feature_volumes
static const unsigned int invalid_id
◆ computeIntegral()
Real AverageGrainVolume::computeIntegral |
( |
std::size_t |
var_index | ) |
const |
|
protected |
Definition at line 143 of file AverageGrainVolume.C.
Referenced by accumulateVolumes().
147 for (
unsigned int qp = 0; qp <
_qrule->n_points(); ++qp)
const MooseArray< Real > & _coord
const MooseArray< Real > & _JxW
std::vector< const VariableValue * > _vals
◆ execute()
void AverageGrainVolume::execute |
( |
| ) |
|
|
overridevirtual |
Definition at line 107 of file AverageGrainVolume.C.
110 for (
const auto & elem :
_mesh.getMesh().active_local_element_ptr_range())
112 _fe_problem.prepare(elem, 0);
113 _fe_problem.reinitElem(elem, 0);
115 const std::vector<unsigned int> & var_to_feature_ptr =
std::vector< unsigned int > _static_var_to_feature
const FeatureFloodCount * _feature_counter
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.
void accumulateVolumes(const std::vector< unsigned int > &var_to_features, std::size_t libmesh_dbg_var(num_features))
std::vector< Real > _feature_volumes
MooseMesh & _mesh
A reference to the mesh.
◆ getValue()
Real AverageGrainVolume::getValue |
( |
| ) |
|
|
overridevirtual |
Definition at line 154 of file AverageGrainVolume.C.
158 Real total_volume = 0;
160 total_volume += volume;
162 unsigned int active_features =
165 return total_volume / active_features;
const FeatureFloodCount * _feature_counter
std::size_t getNumberActiveFeatures() const
Return the number of active features.
std::vector< Real > _feature_volumes
◆ initialize()
void AverageGrainVolume::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 95 of file AverageGrainVolume.C.
const FeatureFloodCount * _feature_counter
virtual std::size_t getTotalFeatureCount() const
Returns the total feature count (active and inactive ids, useful for sizing vectors) ...
std::vector< Real > _feature_volumes
◆ _assembly
Assembly& AverageGrainVolume::_assembly |
|
private |
◆ _coord
const MooseArray<Real>& AverageGrainVolume::_coord |
|
private |
◆ _feature_counter
◆ _feature_volumes
std::vector<Real> AverageGrainVolume::_feature_volumes |
|
private |
◆ _JxW
const MooseArray<Real>& AverageGrainVolume::_JxW |
|
private |
◆ _mesh
MooseMesh& AverageGrainVolume::_mesh |
|
private |
◆ _q_point
const MooseArray<Point>& AverageGrainVolume::_q_point |
|
private |
◆ _qrule
QBase*& AverageGrainVolume::_qrule |
|
private |
◆ _static_var_to_feature
std::vector<unsigned int> AverageGrainVolume::_static_var_to_feature |
|
private |
◆ _vals
std::vector<const VariableValue *> AverageGrainVolume::_vals |
|
private |
The documentation for this class was generated from the following files: