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}\) is the frozen volume fraction, \(\phi_\mathrm{l}\) is the liquid one. \(\mathrm{R}\) stands for the real/pure phase property.

Definition at line 43 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 19 of file VolumeFractionAverage.cpp.

20{
21 // get the corresponding property's name
22 name_ = std::move(name);
23
25}
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 27 of file VolumeFractionAverage.cpp.

28{
29 if (!std::holds_alternative<Medium*>(scale_))
30 {
32 "The property 'VolumeFractionAverage' is "
33 "implemented on the 'medium' scale only.");
34 }
35}
#define OGS_FATAL(...)
Definition Error.h:26
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297

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 105 of file VolumeFractionAverage.cpp.

109{
110 (void)variable;
111 assert((variable == Variable::temperature) &&
112 "VolumeFractionAverage::dValue is implemented for "
113 "derivatives with respect to temperature only.");
114
115 double dphi_fr_dT = 0;
116 double prop_value_frozen = 0;
117
118 auto const& medium = *std::get<Medium*>(scale_);
119 if (medium.hasProperty(PropertyType::volume_fraction))
120 {
121 auto const& fraction = medium[PropertyType::volume_fraction];
122 dphi_fr_dT = std::get<double>(
123 fraction.dValue(variable_array, Variable::temperature, pos, t, dt));
124 prop_value_frozen = std::get<double>(
125 properties_.frozen->value(variable_array, pos, t, dt));
126 }
127
128 double prop_value_liquid =
129 std::get<double>(properties_.liquid->value(variable_array, pos, t, dt));
130
131 return (prop_value_frozen - prop_value_liquid) * dphi_fr_dT;
132}
virtual PropertyDataType value() const
Definition Property.cpp:76

References MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::frozen, MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::liquid, properties_, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::temperature, MaterialPropertyLib::Property::value(), and MaterialPropertyLib::volume_fraction.

◆ 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 37 of file VolumeFractionAverage.cpp.

39{
40 // run over phases, identify them and get properties
41 for (auto const& phase : phases)
42 {
43 if (phase == nullptr)
44 {
46 "One of the required phases (AqueousLiquid/FrozenLiquid/Solid) "
47 "does not exist!");
48 }
49 std::string const& phase_name = phase->name;
50
51 if (!phase->hasProperty(prop_type_))
52 {
54 "The phase '{}' does not have the required property '{}'!",
56 }
57 auto const& property = phase->property(prop_type_);
58 if (phase_name == "AqueousLiquid")
59 {
60 properties_.liquid = &property;
61 }
62 else if (phase_name == "FrozenLiquid")
63 {
64 properties_.frozen = &property;
65 }
66 else if (phase_name == "Solid")
67 {
68 properties_.porous = &property;
69 }
70 }
71}
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string

References MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::frozen, MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::liquid, OGS_FATAL, MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::porous, prop_type_, properties_, and MaterialPropertyLib::property_enum_to_string.

◆ 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 73 of file VolumeFractionAverage.cpp.

77{
78 auto const& medium = *std::get<Medium*>(scale_);
79 auto const& porosity = medium[PropertyType::porosity];
80
81 double phi_fr = 0;
82 double prop_value_frozen = 0;
83
84 // get frozen pore volume fraction, and porosity
85 if (medium.hasProperty(PropertyType::volume_fraction))
86 {
87 assert(properties_.frozen != nullptr);
88 auto const& fraction = medium[PropertyType::volume_fraction];
89 phi_fr = std::get<double>(fraction.value(variable_array, pos, t, dt));
90 prop_value_frozen = std::get<double>(
91 properties_.frozen->value(variable_array, pos, t, dt));
92 }
93
94 auto const phi =
95 std::get<double>(porosity.value(variable_array, pos, t, dt));
96 auto const prop_value_liquid =
97 std::get<double>(properties_.liquid->value(variable_array, pos, t, dt));
98 auto const prop_value_porous =
99 std::get<double>(properties_.porous->value(variable_array, pos, t, dt));
100
101 return (phi - phi_fr) * prop_value_liquid + phi_fr * prop_value_frozen +
102 (1 - phi) * prop_value_porous;
103}

References MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::frozen, MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::liquid, MaterialPropertyLib::porosity, MaterialPropertyLib::VolumeFractionAverage::PhaseProperties::porous, properties_, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::Property::value(), and MaterialPropertyLib::volume_fraction.

Member Data Documentation

◆ prop_type_

PropertyType MaterialPropertyLib::VolumeFractionAverage::prop_type_
protected

Definition at line 74 of file VolumeFractionAverage.h.

Referenced by VolumeFractionAverage(), and setProperties().

◆ properties_

PhaseProperties MaterialPropertyLib::VolumeFractionAverage::properties_
protected

Definition at line 75 of file VolumeFractionAverage.h.

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


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