OGS
MaterialPropertyLib::ClausiusClapeyron Class Referencefinal

Detailed Description

Vapour pressure as function of temperature based on Clausius-Clapeyron equation. This property must be either a phase or a component property, it computes the saturation vapour pressure of a substance

Definition at line 29 of file ClausiusClapeyron.h.

#include <ClausiusClapeyron.h>

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

Public Member Functions

 ClausiusClapeyron (std::string name, const double triple_temperature, const double triple_pressure, const double critical_temperature, const double critical_pressure, const double ref_temperature, const double ref_pressure)
 
void checkScale () const override
 
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
 
PropertyDataType d2Value (VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
 Default implementation: 2nd derivative of any constant property is zero.
 
- 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 void setProperties (std::vector< std::unique_ptr< Phase > > const &phases)
 Default implementation:
 
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 Member Functions

double molarMass (std::variant< Medium *, Phase *, Component * > const scale, VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 

Private Attributes

double T_triple_
 
double p_triple_
 
double T_critical_
 
double p_critical_
 
double T_ref_
 
double p_ref_
 

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

◆ ClausiusClapeyron()

MaterialPropertyLib::ClausiusClapeyron::ClausiusClapeyron ( std::string name,
const double triple_temperature,
const double triple_pressure,
const double critical_temperature,
const double critical_pressure,
const double ref_temperature,
const double ref_pressure )
explicit

Member Function Documentation

◆ checkScale()

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

Reimplemented from MaterialPropertyLib::Property.

Definition at line 38 of file ClausiusClapeyron.cpp.

39{
40 if (!(std::holds_alternative<Phase*>(scale_) ||
41 std::holds_alternative<Component*>(scale_)))
42 {
44 "The property 'ClausiusClapeyron' is implemented on 'phase' and "
45 "'component' scales only.");
46 }
47}
#define OGS_FATAL(...)
Definition Error.h:26
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297

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

◆ d2Value()

PropertyDataType MaterialPropertyLib::ClausiusClapeyron::d2Value ( VariableArray const & variable_array,
Variable const variable1,
Variable const variable2,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

Default implementation: 2nd derivative of any constant property is zero.

This virtual method will compute the second derivative of a property with respect to the given variables pv1 and pv2.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 122 of file ClausiusClapeyron.cpp.

126{
127 OGS_FATAL("ClausiusClapeyron::d2Value is not implemented.");
128}

References OGS_FATAL.

◆ dValue()

PropertyDataType MaterialPropertyLib::ClausiusClapeyron::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 88 of file ClausiusClapeyron.cpp.

92{
93 const double T = variable_array.temperature;
94 const double M = molarMass(scale_, variable_array, pos, t, dt);
95
96 if (T > T_critical_)
97 {
98 return 0.;
99 }
100 if (T < T_triple_)
101 {
102 return 0.;
103 }
104 if (variable == Variable::gas_phase_pressure)
105 {
106 return 0.;
107 }
108
110 const double dh = variable_array.enthalpy_of_evaporation;
111 const double p_vap = std::get<double>(value(variable_array, pos, t, dt));
112
113 if (variable == Variable::temperature)
114 {
115 return p_vap * M * dh / (R * T * T);
116 }
117 OGS_FATAL(
118 "ClausiusClapeyron::dValue is implemented for derivatives with respect "
119 "to phase pressure and temperature only.");
120}
double molarMass(std::variant< Medium *, Phase *, Component * > const scale, VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
virtual PropertyDataType value() const
Definition Property.cpp:76

References MaterialPropertyLib::VariableArray::enthalpy_of_evaporation, MaterialPropertyLib::gas_phase_pressure, MaterialLib::PhysicalConstant::IdealGasConstant, molarMass(), OGS_FATAL, MaterialPropertyLib::Property::scale_, T_critical_, T_triple_, MaterialPropertyLib::temperature, MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::Property::value().

◆ molarMass()

double MaterialPropertyLib::ClausiusClapeyron::molarMass ( std::variant< Medium *, Phase *, Component * > const scale,
VariableArray const & variable_array,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
private

Definition at line 49 of file ClausiusClapeyron.cpp.

54{
55 return std::visit(
56 [&variable_array, &pos, t, dt](auto&& s) -> double
57 {
58 return s->property(PropertyType::molar_mass)
59 .template value<double>(variable_array, pos, t, dt);
60 },
61 scale);
62}
void scale(PETScVector &x, PetscScalar const a)
Definition LinAlg.cpp:44

References MaterialPropertyLib::molar_mass.

Referenced by dValue(), and value().

◆ value()

PropertyDataType MaterialPropertyLib::ClausiusClapeyron::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 64 of file ClausiusClapeyron.cpp.

68{
69 const double T = variable_array.temperature;
70
71 const double M = molarMass(scale_, variable_array, pos, t, dt);
72
73 if (T >= T_critical_)
74 {
75 return p_critical_;
76 }
77 if (T <= T_triple_)
78 {
79 return p_triple_;
80 }
81
82 const double dh = variable_array.enthalpy_of_evaporation;
84
85 return p_ref_ * std::exp((1. / T_ref_ - 1. / T) * M * dh / R);
86}

References MaterialPropertyLib::VariableArray::enthalpy_of_evaporation, MaterialLib::PhysicalConstant::IdealGasConstant, molarMass(), p_critical_, p_ref_, p_triple_, MaterialPropertyLib::Property::scale_, T_critical_, T_ref_, T_triple_, and MaterialPropertyLib::VariableArray::temperature.

Member Data Documentation

◆ p_critical_

double MaterialPropertyLib::ClausiusClapeyron::p_critical_
private

Definition at line 62 of file ClausiusClapeyron.h.

Referenced by value().

◆ p_ref_

double MaterialPropertyLib::ClausiusClapeyron::p_ref_
private

Definition at line 64 of file ClausiusClapeyron.h.

Referenced by value().

◆ p_triple_

double MaterialPropertyLib::ClausiusClapeyron::p_triple_
private

Definition at line 60 of file ClausiusClapeyron.h.

Referenced by value().

◆ T_critical_

double MaterialPropertyLib::ClausiusClapeyron::T_critical_
private

Definition at line 61 of file ClausiusClapeyron.h.

Referenced by dValue(), and value().

◆ T_ref_

double MaterialPropertyLib::ClausiusClapeyron::T_ref_
private

Definition at line 63 of file ClausiusClapeyron.h.

Referenced by value().

◆ T_triple_

double MaterialPropertyLib::ClausiusClapeyron::T_triple_
private

Definition at line 59 of file ClausiusClapeyron.h.

Referenced by dValue(), and value().


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