https://mooseframework.inl.gov
FeatureVolumeFraction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "FeatureVolumeFraction.h"
11 #include <cmath>
12 
14 
17 {
19  params.addClassDescription("Computes the total feature volume fraction from a "
20  "vectorpostprocessor computing the feature volume");
21  MooseEnum value_type("VOLUME_FRACTION AVRAMI", "VOLUME_FRACTION");
22  params.addParam<MooseEnum>(
23  "value_type", value_type, "The value to output (VOLUME_FRACTION or AVRAMI value)");
24  params.addRequiredParam<PostprocessorName>("mesh_volume",
25  "Postprocessor from which to get mesh volume");
26  params.addRequiredParam<VectorPostprocessorName>("feature_volumes",
27  "The feature volume VectorPostprocessorValue.");
28  params.addParam<Real>(
29  "equil_fraction", -1.0, "Equilibrium volume fraction of 2nd phase for Avrami analysis");
30  return params;
31 }
32 
34  : GeneralPostprocessor(parameters),
35  _value_type(getParam<MooseEnum>("value_type").getEnum<ValueType>()),
36  _mesh_volume(getPostprocessorValue("mesh_volume")),
37  _feature_volumes(getVectorPostprocessorValue("feature_volumes", "feature_volumes")),
38  _equil_fraction(getParam<Real>("equil_fraction")),
39  _avrami_value(0)
40 {
41 }
42 
43 void
45 {
46 }
47 
48 void
50 {
51  Real volume = 0.0;
52 
53  // sum the values in the vector to get total volume
54  for (const auto & feature_volume : _feature_volumes)
55  volume += feature_volume;
56 
57  mooseAssert(!MooseUtils::absoluteFuzzyEqual(_mesh_volume, 0.0), "Mesh volume is zero");
59 
61 }
62 
63 Real
65 {
66  switch (_value_type)
67  {
69  return _volume_fraction;
70  case ValueType::AVRAMI:
71  return _avrami_value;
72  default:
73  return 0;
74  }
75 }
76 
77 Real
79 {
80  return std::log(std::log(1.0 / (1.0 - (_volume_fraction / _equil_fraction))));
81 }
virtual void initialize() override
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual void execute() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
FeatureVolumeFraction(const InputParameters &parameters)
static InputParameters validParams()
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
const VectorPostprocessorValue & _feature_volumes
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const PostprocessorValue & _mesh_volume
void addClassDescription(const std::string &doc_string)
virtual Real getValue() const override
static InputParameters validParams()
registerMooseObject("PhaseFieldApp", FeatureVolumeFraction)