https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
43void
47
48void
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
63Real
65{
66 switch (_value_type)
67 {
68 case ValueType::VOLUME_FRACTION:
69 return _volume_fraction;
70 case ValueType::AVRAMI:
71 return _avrami_value;
72 default:
73 return 0;
74 }
75}
76
77Real
79{
80 return std::log(std::log(1.0 / (1.0 - (_volume_fraction / _equil_fraction))));
81}
registerMooseObject("PhaseFieldApp", FeatureVolumeFraction)
virtual Real getValue() const override
const PostprocessorValue & _mesh_volume
FeatureVolumeFraction(const InputParameters &parameters)
virtual void execute() override
virtual void initialize() override
const VectorPostprocessorValue & _feature_volumes
static InputParameters validParams()
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)