www.mooseframework.org
FeatureVolumeFraction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 #include <cmath>
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<GeneralPostprocessor>();
16  MooseEnum value_type("VOLUME_FRACTION AVRAMI", "VOLUME_FRACTION");
17  params.addParam<MooseEnum>(
18  "value_type", value_type, "The value to output (VOLUME_FRACTION or AVRAMI value)");
19  params.addRequiredParam<PostprocessorName>("mesh_volume",
20  "Postprocessor from which to get mesh volume");
21  params.addRequiredParam<VectorPostprocessorName>("feature_volumes",
22  "The feature volume VectorPostprocessorValue.");
23  params.addParam<Real>(
24  "equil_fraction", -1.0, "Equilibrium volume fraction of 2nd phase for Avrami analysis");
25  return params;
26 }
27 
28 FeatureVolumeFraction::FeatureVolumeFraction(const InputParameters & parameters)
29  : GeneralPostprocessor(parameters),
30  _value_type(getParam<MooseEnum>("value_type").getEnum<ValueType>()),
31  _mesh_volume(getPostprocessorValue("mesh_volume")),
32  _feature_volumes(getVectorPostprocessorValue("feature_volumes", "feature_volumes")),
33  _equil_fraction(getParam<Real>("equil_fraction")),
34  _avrami_value(0)
35 {
36 }
37 
38 void
40 {
41 }
42 
43 void
45 {
46  Real volume = 0.0;
47 
48  // sum the values in the vector to get total volume
49  for (const auto & feature_volume : _feature_volumes)
50  volume += feature_volume;
51 
52  mooseAssert(!MooseUtils::absoluteFuzzyEqual(_mesh_volume, 0.0), "Mesh volume is zero");
53  _volume_fraction = volume / _mesh_volume;
54 
56 }
57 
58 Real
60 {
61  switch (_value_type)
62  {
64  return _volume_fraction;
65  case ValueType::AVRAMI:
66  return _avrami_value;
67  default:
68  return 0;
69  }
70 }
71 
72 Real
74 {
75  return std::log(std::log(1.0 / (1.0 - (_volume_fraction / _equil_fraction))));
76 }
virtual void initialize() override
InputParameters validParams< FeatureVolumeFraction >()
virtual void execute() override
FeatureVolumeFraction(const InputParameters &parameters)
virtual Real getValue() override
const VectorPostprocessorValue & _feature_volumes
const PostprocessorValue & _mesh_volume