https://mooseframework.inl.gov
Loading...
Searching...
No Matches
phase_field
src
postprocessors
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
13
registerMooseObject
(
"PhaseFieldApp"
,
FeatureVolumeFraction
);
14
15
InputParameters
16
FeatureVolumeFraction::validParams
()
17
{
18
InputParameters
params =
GeneralPostprocessor::validParams
();
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
33
FeatureVolumeFraction::FeatureVolumeFraction
(
const
InputParameters
& parameters)
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
44
FeatureVolumeFraction::initialize
()
45
{
46
}
47
48
void
49
FeatureVolumeFraction::execute
()
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"
);
58
_volume_fraction
= volume /
_mesh_volume
;
59
60
_avrami_value
=
calculateAvramiValue
();
61
}
62
63
Real
64
FeatureVolumeFraction::getValue
()
const
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
77
Real
78
FeatureVolumeFraction::calculateAvramiValue
()
79
{
80
return
std::log(std::log(1.0 / (1.0 - (
_volume_fraction
/
_equil_fraction
))));
81
}
registerMooseObject
registerMooseObject("PhaseFieldApp", FeatureVolumeFraction)
FeatureVolumeFraction.h
FeatureVolumeFraction
Definition
FeatureVolumeFraction.h:17
FeatureVolumeFraction::getValue
virtual Real getValue() const override
Definition
FeatureVolumeFraction.C:64
FeatureVolumeFraction::_avrami_value
Real _avrami_value
Definition
FeatureVolumeFraction.h:42
FeatureVolumeFraction::_value_type
const ValueType _value_type
Definition
FeatureVolumeFraction.h:36
FeatureVolumeFraction::_mesh_volume
const PostprocessorValue & _mesh_volume
Definition
FeatureVolumeFraction.h:37
FeatureVolumeFraction::FeatureVolumeFraction
FeatureVolumeFraction(const InputParameters ¶meters)
Definition
FeatureVolumeFraction.C:33
FeatureVolumeFraction::calculateAvramiValue
Real calculateAvramiValue()
Definition
FeatureVolumeFraction.C:78
FeatureVolumeFraction::execute
virtual void execute() override
Definition
FeatureVolumeFraction.C:49
FeatureVolumeFraction::ValueType
ValueType
Definition
FeatureVolumeFraction.h:31
FeatureVolumeFraction::_volume_fraction
Real _volume_fraction
Definition
FeatureVolumeFraction.h:40
FeatureVolumeFraction::initialize
virtual void initialize() override
Definition
FeatureVolumeFraction.C:44
FeatureVolumeFraction::_feature_volumes
const VectorPostprocessorValue & _feature_volumes
Definition
FeatureVolumeFraction.h:38
FeatureVolumeFraction::_equil_fraction
Real _equil_fraction
Definition
FeatureVolumeFraction.h:41
FeatureVolumeFraction::validParams
static InputParameters validParams()
Definition
FeatureVolumeFraction.C:16
GeneralPostprocessor
GeneralPostprocessor::validParams
static InputParameters validParams()
InputParameters::addRequiredParam
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters::addParam
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
MooseEnum
InputParameters
Generated on Fri Aug 21 2026 13:41:26 for https://mooseframework.inl.gov by
1.9.8