OGS
MaterialPropertyLib::VolumeFractionAverage Class Reference

Detailed Description

Effective medium property obtained by volume fraction averaging

This property must be a medium property. It computes the effective property based on the phase properties as a volume fraction weighted average in the following form

\[ X_{\mathrm{eff}} = \phi_\mathrm{p}\,X_\mathrm{pR} + \phi_\mathrm{f}\,X_\mathrm{fR} + \phi_\mathrm{l}\,X_\mathrm{lR} = (1-\phi) X_\mathrm{pR} + \phi_\mathrm{f}\,X_\mathrm{fR} + (\phi - \phi_\mathrm{f}) X_\mathrm{lR} \]

where \(\phi\) is the porosity (pore space volume fraction), \(\phi_\mathrm{p}\) is the porous solid skeleton volume fraction, \(\phi_\mathrm{f}=\phi\,S_\mathrm{fr}\) is the frozen volume fraction, obtained from the frozen liquid (ice) saturation \(S_\mathrm{fr}\) (the fraction of the pore space occupied by ice, given by the medium's frozen_liquid_saturation property), \(\phi_\mathrm{l}\) is the liquid one. \(\mathrm{R}\) stands for the real/pure phase property.

Definition at line 39 of file VolumeFractionAverage.h.

#include <VolumeFractionAverage.h>

Inheritance diagram for MaterialPropertyLib::VolumeFractionAverage:
[legend]
Collaboration diagram for MaterialPropertyLib::VolumeFractionAverage:
[legend]

Classes

struct  PhaseProperties

Public Member Functions

 VolumeFractionAverage (std::string name)
void checkScale () const override
void setProperties (std::vector< std::unique_ptr< Phase > > const &phases) override
 Default implementation:
PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
PropertyDataType dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Public Member Functions inherited from MaterialPropertyLib::Property
virtual ~Property ()
virtual PropertyDataType initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
virtual PropertyDataType value () const
virtual PropertyDataType value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
virtual PropertyDataType dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
virtual PropertyDataType d2Value (VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 Default implementation: 2nd derivative of any constant property is zero.
void setScale (std::variant< Medium *, Phase *, Component * > scale)
template<typename T>
initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
template<typename T>
value () const
template<typename T>
value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
d2Value (VariableArray const &variable_array, Variable const &variable1, Variable const &variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const

Protected Attributes

PropertyType prop_type_
PhaseProperties properties_
Protected Attributes inherited from MaterialPropertyLib::Property
std::string name_
PropertyDataType value_
 The single value of a property.
PropertyDataType dvalue_
std::variant< Medium *, Phase *, Component * > scale_

Constructor & Destructor Documentation

◆ VolumeFractionAverage()

MaterialPropertyLib::VolumeFractionAverage::VolumeFractionAverage ( std::string name)
explicit

Definition at line 11 of file VolumeFractionAverage.cpp.

12{
13 // get the corresponding property's name
14 name_ = std::move(name);
15
17}
PropertyType convertStringToProperty(std::string const &string)

References MaterialPropertyLib::convertStringToProperty(), MaterialPropertyLib::name, MaterialPropertyLib::Property::name_, and prop_type_.

Member Function Documentation

◆ checkScale()

void MaterialPropertyLib::VolumeFractionAverage::checkScale ( ) const
overridevirtual

Reimplemented from MaterialPropertyLib::Property.

Definition at line 19 of file VolumeFractionAverage.cpp.

20{
21 if (!std::holds_alternative<Medium*>(scale_))
22 {
24 "The property 'VolumeFractionAverage' is "
25 "implemented on the 'medium' scale only.");
26 }
27}
#define OGS_FATAL(...)
Definition Error.h:10
std::variant< Medium *, Phase *, Component * > scale_

References OGS_FATAL, and MaterialPropertyLib::Property::scale_.

◆ dValue()

PropertyDataType MaterialPropertyLib::VolumeFractionAverage::dValue ( VariableArray const & variable_array,
Variable const variable,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

This virtual method will compute the property derivative value based on the variables that are passed as arguments with the default implementation using empty variables array for the previous time step.

The default implementation of this method only returns the property value derivative without altering it.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 117 of file VolumeFractionAverage.cpp.

121{
122 if (variable != Variable::temperature)
123 {
124 OGS_FATAL(
125 "VolumeFractionAverage::dValue is implemented for derivatives with "
126 "respect to temperature only.");
127 }
128
129 auto const& medium = *std::get<Medium*>(scale_);
130 auto const& porosity = medium[PropertyType::porosity];
131 auto const phi =
132 std::get<double>(porosity.value(variable_array, pos, t, dt));
133
134 double dS_fr_dT = 0;
135 double prop_value_frozen = 0;
136
137 if (medium.hasProperty(PropertyType::frozen_liquid_saturation))
138 {
140 dS_fr_dT = std::get<double>(saturation.dValue(
141 variable_array, Variable::temperature, pos, t, dt));
142 prop_value_frozen = std::get<double>(
143 properties_.frozen->value(variable_array, pos, t, dt));
144 }
145
146 double prop_value_liquid =
147 std::get<double>(properties_.liquid->value(variable_array, pos, t, dt));
148
149 // Only the frozen liquid saturation S_fr is treated as temperature
150 // dependent here; the porosity and the phase properties are assumed to be
151 // temperature independent, so their temperature derivatives are omitted.
152 return phi * (prop_value_frozen - prop_value_liquid) * dS_fr_dT;
153}

References MaterialPropertyLib::frozen_liquid_saturation, OGS_FATAL, MaterialPropertyLib::porosity, properties_, MaterialPropertyLib::saturation, MaterialPropertyLib::Property::scale_, and MaterialPropertyLib::temperature.

◆ setProperties()

void MaterialPropertyLib::VolumeFractionAverage::setProperties ( std::vector< std::unique_ptr< Phase > > const & phases)
overridevirtual

Default implementation:

This virtual method will collect the properties of the phases in order to access them from the medium property level.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 29 of file VolumeFractionAverage.cpp.

31{
32 // run over phases, identify them and get properties
33 for (auto const& phase : phases)
34 {
35 if (phase == nullptr)
36 {
38 "One of the required phases (AqueousLiquid/FrozenLiquid/Solid) "
39 "does not exist!");
40 }
41
42 if (!phase->hasProperty(prop_type_))
43 {
45 "The phase '{}' does not have the required property '{}'!",
46 toString(phase->phaseName),
48 }
49 auto const& property = phase->property(prop_type_);
50 if (phase->phaseName == PhaseName::AqueousLiquid)
51 {
52 properties_.liquid = &property;
53 }
54 else if (phase->phaseName == PhaseName::FrozenLiquid)
55 {
56 properties_.frozen = &property;
57 }
58 else if (phase->phaseName == PhaseName::Solid)
59 {
60 properties_.porous = &property;
61 }
62 }
63
64 // Consistency check performed once at setup (scale_ is already set to the
65 // medium by setScale() before setProperties() runs), instead of on every
66 // value()/dValue() call: a FrozenLiquid phase providing this property and
67 // the medium's frozen_liquid_saturation property must either both be
68 // present or both be absent.
69 auto const& medium = *std::get<Medium*>(scale_);
70 if ((properties_.frozen != nullptr) !=
72 {
74 "In the 'VolumeFractionAverage' property '{}', a FrozenLiquid "
75 "phase "
76 "and the medium's 'frozen_liquid_saturation' property must be "
77 "provided together. Found FrozenLiquid phase property: {}, medium "
78 "frozen_liquid_saturation property: {}.",
79 name_, properties_.frozen != nullptr,
80 medium.hasProperty(PropertyType::frozen_liquid_saturation));
81 }
82}
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
std::string_view toString(PhaseName phase_name)
Convert phase enum to its string representation.
Definition Phase.cpp:13

References MaterialPropertyLib::AqueousLiquid, MaterialPropertyLib::frozen_liquid_saturation, MaterialPropertyLib::FrozenLiquid, MaterialPropertyLib::Property::name_, OGS_FATAL, prop_type_, properties_, MaterialPropertyLib::property_enum_to_string, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::Solid, and MaterialPropertyLib::toString().

◆ value()

PropertyDataType MaterialPropertyLib::VolumeFractionAverage::value ( VariableArray const & variable_array,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

This virtual method will compute the property value based on the variables that are passed as arguments with the default implementation using empty variables array for the previous time step.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 84 of file VolumeFractionAverage.cpp.

88{
89 auto const& medium = *std::get<Medium*>(scale_);
90 auto const& porosity = medium[PropertyType::porosity];
91
92 auto const phi =
93 std::get<double>(porosity.value(variable_array, pos, t, dt));
94
95 double S_fr = 0;
96 double prop_value_frozen = 0;
97
98 // get frozen liquid (ice) saturation, i.e. the fraction of the pore space
99 // occupied by ice (the frozen-phase/saturation consistency is enforced once
100 // in setProperties())
101 if (medium.hasProperty(PropertyType::frozen_liquid_saturation))
102 {
104 S_fr = std::get<double>(saturation.value(variable_array, pos, t, dt));
105 prop_value_frozen = std::get<double>(
106 properties_.frozen->value(variable_array, pos, t, dt));
107 }
108 auto const prop_value_liquid =
109 std::get<double>(properties_.liquid->value(variable_array, pos, t, dt));
110 auto const prop_value_porous =
111 std::get<double>(properties_.porous->value(variable_array, pos, t, dt));
112
113 return phi * (1.0 - S_fr) * prop_value_liquid +
114 phi * S_fr * prop_value_frozen + (1 - phi) * prop_value_porous;
115}

References MaterialPropertyLib::frozen_liquid_saturation, MaterialPropertyLib::porosity, properties_, MaterialPropertyLib::saturation, and MaterialPropertyLib::Property::scale_.

Member Data Documentation

◆ prop_type_

PropertyType MaterialPropertyLib::VolumeFractionAverage::prop_type_
protected

Definition at line 70 of file VolumeFractionAverage.h.

Referenced by VolumeFractionAverage(), and setProperties().

◆ properties_

PhaseProperties MaterialPropertyLib::VolumeFractionAverage::properties_
protected

Definition at line 71 of file VolumeFractionAverage.h.

Referenced by dValue(), setProperties(), and value().


The documentation for this class was generated from the following files: