OGS
MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat Class Referencefinal

Detailed Description

Model for the apparent specific heat capacity including latent heat \(\ell\)

This model is for media with a phase change. This property must be a medium property, it computes the apparent specific heat capacity based on a phase transition spread over a temperature interval:

\[ C_{\mathrm{app}} = \left[C - \varrho_\mathrm{fR} \ell \frac{\partial \phi_\mathrm{f}}{\partial T} \right] \quad\rightarrow\quad c_{\mathrm{app}} = \frac{C_{\mathrm{app}}}{\varrho} \]

with \(\ell\) as specific enthalpy of melting, \(C\) as effective volumetric heat capacity and \(\varrho\) as the effective density of the mixture, \(\varrho_\mathrm{fR}\) as the real density of the frozen phase as well as \(\phi_\mathrm{f}\) as the temperature-dependent frozen liquid volume fraction.

Definition at line 37 of file SpecificHeatCapacityWithLatentHeat.h.

#include <SpecificHeatCapacityWithLatentHeat.h>

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

Classes

struct  PhaseProperties
 

Public Member Functions

 SpecificHeatCapacityWithLatentHeat (std::string name, double const l)
 
void checkScale () const override
 
void setProperties (std::vector< std::unique_ptr< Phase > > const &phases) override
 Default implementation:
 
double effectiveVolumetricHeatCapacity (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 
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
 

Private Attributes

double const l_
 
PhaseProperties densities_
 Pointers to the properties in each phase.
 
PhaseProperties spec_heat_capacities_
 Pointers to the properties in each phase.
 

Additional Inherited Members

- 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

◆ SpecificHeatCapacityWithLatentHeat()

MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::SpecificHeatCapacityWithLatentHeat ( std::string name,
double const l )

Member Function Documentation

◆ checkScale()

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

Reimplemented from MaterialPropertyLib::Property.

Definition at line 25 of file SpecificHeatCapacityWithLatentHeat.cpp.

26{
27 if (!std::holds_alternative<Medium*>(scale_))
28 {
30 "The property 'SpecificHeatCapacityWithLatentHeat' is "
31 "implemented on the 'medium' scale only.");
32 }
33}
#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::SpecificHeatCapacityWithLatentHeat::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 134 of file SpecificHeatCapacityWithLatentHeat.cpp.

138{
139 (void)variable;
140 assert((variable == Variable::temperature) &&
141 "SpecificHeatCapacityWithLatentHeat::dvalue is implemented for "
142 "derivatives with respect to temperature only.");
143
144 auto const& medium = *std::get<Medium*>(scale_);
145 auto const& effective_density_property = medium[PropertyType::density];
146 auto const& frozen_fraction_property =
148
149 auto const rho_eff = effective_density_property.template value<double>(
150 variable_array, pos, t, dt);
151 auto const rho_li =
152 std::get<double>(densities_.liquid->value(variable_array, pos, t, dt));
153 auto const rho_fr =
154 std::get<double>(densities_.frozen->value(variable_array, pos, t, dt));
155 auto const c_li = std::get<double>(
156 spec_heat_capacities_.liquid->value(variable_array, pos, t, dt));
157 auto const c_fr = std::get<double>(
158 spec_heat_capacities_.frozen->value(variable_array, pos, t, dt));
159 auto const drho_dT = effective_density_property.template dValue<double>(
160 variable_array, Variable::temperature, pos, t, dt);
161 auto const dphi_fr_dT = frozen_fraction_property.template dValue<double>(
162 variable_array, Variable::temperature, pos, t, dt);
163 auto const d2phi_fr_dT2 = frozen_fraction_property.template d2Value<double>(
164 variable_array, Variable::temperature, Variable::temperature, pos, t,
165 dt);
166 auto const Cvol =
167 effectiveVolumetricHeatCapacity(variable_array, pos, t, dt);
168 // TODO: avoid duplicate code, call value()?
169 auto const C_app = (Cvol - l_ * rho_eff * dphi_fr_dT) / rho_eff;
170 auto const dCvol_dphi_fr = rho_fr * c_fr - rho_li * c_li;
171 auto const dCvol_app_dT =
172 dCvol_dphi_fr * dphi_fr_dT - l_ * rho_eff * d2phi_fr_dT2;
173
174 return (dCvol_app_dT - drho_dT / rho_eff * C_app) / rho_eff;
175}
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.
Definition Property.cpp:131
virtual PropertyDataType value() const
Definition Property.cpp:76
PhaseProperties spec_heat_capacities_
Pointers to the properties in each phase.
PhaseProperties densities_
Pointers to the properties in each phase.
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
double effectiveVolumetricHeatCapacity(VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const

References MaterialPropertyLib::Property::d2Value(), densities_, MaterialPropertyLib::density, dValue(), effectiveVolumetricHeatCapacity(), MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::frozen, l_, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::liquid, MaterialPropertyLib::Property::scale_, spec_heat_capacities_, MaterialPropertyLib::temperature, MaterialPropertyLib::Property::value(), and MaterialPropertyLib::volume_fraction.

Referenced by dValue(), and value().

◆ effectiveVolumetricHeatCapacity()

double MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::effectiveVolumetricHeatCapacity ( VariableArray const & variable_array,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const

Definition at line 72 of file SpecificHeatCapacityWithLatentHeat.cpp.

76{
77 auto const& medium = *std::get<Medium*>(scale_);
78 auto const& porosity_property = medium[PropertyType::porosity];
79 auto const& frozen_fraction_property =
81
82 auto const phi =
83 std::get<double>(porosity_property.value(variable_array, pos, t, dt));
84 auto const phi_fr = std::get<double>(
85 frozen_fraction_property.value(variable_array, pos, t, dt));
86 auto const phi_li = phi - phi_fr;
87 auto const phi_po = 1 - phi;
88
89 auto const rho_li =
90 std::get<double>(densities_.liquid->value(variable_array, pos, t, dt));
91 auto const rho_fr =
92 std::get<double>(densities_.frozen->value(variable_array, pos, t, dt));
93 auto const rho_po =
94 std::get<double>(densities_.porous->value(variable_array, pos, t, dt));
95
96 auto const c_li = std::get<double>(
97 spec_heat_capacities_.liquid->value(variable_array, pos, t, dt));
98 auto const c_fr = std::get<double>(
99 spec_heat_capacities_.frozen->value(variable_array, pos, t, dt));
100 auto const c_po = std::get<double>(
101 spec_heat_capacities_.porous->value(variable_array, pos, t, dt));
102
103 // rule of mixtures for resulting volumetric heat capacity
104 // (mass fraction average of specific heat capacities!)
105 return phi_li * rho_li * c_li + phi_fr * rho_fr * c_fr +
106 phi_po * rho_po * c_po;
107}

References densities_, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::frozen, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::liquid, MaterialPropertyLib::porosity, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::porous, MaterialPropertyLib::Property::scale_, spec_heat_capacities_, MaterialPropertyLib::Property::value(), and MaterialPropertyLib::volume_fraction.

Referenced by dValue(), and value().

◆ setProperties()

void MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::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 35 of file SpecificHeatCapacityWithLatentHeat.cpp.

37{
38 // run over phases, identify them and get properties
39 for (auto const& phase : phases)
40 {
41 if (phase == nullptr)
42 {
44 "One of the required phases (AqueousLiquid/FrozenLiquid/Solid) "
45 "does not exist!");
46 }
47 std::string const& phase_name = phase->name;
48
49 auto const& density_property =
51 auto const& specific_heat_capacity_property = phase->property(
53
54 if (phase_name == "AqueousLiquid")
55 {
56 densities_.liquid = &density_property;
57 spec_heat_capacities_.liquid = &specific_heat_capacity_property;
58 }
59 else if (phase_name == "FrozenLiquid")
60 {
61 densities_.frozen = &density_property;
62 spec_heat_capacities_.frozen = &specific_heat_capacity_property;
63 }
64 else if (phase_name == "Solid")
65 {
66 densities_.porous = &density_property;
67 spec_heat_capacities_.porous = &specific_heat_capacity_property;
68 }
69 }
70}

References densities_, MaterialPropertyLib::density, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::frozen, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::liquid, OGS_FATAL, MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::porous, spec_heat_capacities_, and MaterialPropertyLib::specific_heat_capacity.

◆ value()

PropertyDataType MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::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 109 of file SpecificHeatCapacityWithLatentHeat.cpp.

113{
114 auto const& medium = *std::get<Medium*>(scale_);
115 auto const& effective_density_property = medium[PropertyType::density];
116 auto const& frozen_fraction_property =
118
119 auto const rho_eff = effective_density_property.template value<double>(
120 variable_array, pos, t, dt);
121 auto const rho_fr =
122 std::get<double>(densities_.frozen->value(variable_array, pos, t, dt));
123 auto const dphi_fr_dT = frozen_fraction_property.template dValue<double>(
124 variable_array, Variable::temperature, pos, t, dt);
125
126 auto const Cvol =
127 effectiveVolumetricHeatCapacity(variable_array, pos, t, dt);
128 auto const Lvol = l_ * rho_fr;
129 auto const Cvol_app = Cvol - Lvol * dphi_fr_dT;
130 // divide volumetric quantity by density in order to obtain specific value
131 return Cvol_app / rho_eff;
132}

References densities_, MaterialPropertyLib::density, dValue(), effectiveVolumetricHeatCapacity(), MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::PhaseProperties::frozen, l_, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::temperature, MaterialPropertyLib::Property::value(), and MaterialPropertyLib::volume_fraction.

Member Data Documentation

◆ densities_

PhaseProperties MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::densities_
private

Pointers to the properties in each phase.

Definition at line 76 of file SpecificHeatCapacityWithLatentHeat.h.

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

◆ l_

double const MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::l_
private

Definition at line 73 of file SpecificHeatCapacityWithLatentHeat.h.

Referenced by dValue(), and value().

◆ spec_heat_capacities_

PhaseProperties MaterialPropertyLib::SpecificHeatCapacityWithLatentHeat::spec_heat_capacities_
private

Pointers to the properties in each phase.

Definition at line 78 of file SpecificHeatCapacityWithLatentHeat.h.

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


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