OGS
MaterialLib::Fluid::LiquidDensity Class Referencefinal

Detailed Description

Class of a generic density model for liquid fluids varying with temperature or pressure.

The formula is given on engineeringtoolbox which reads

\[ \rho_l = \rho_0/(1+\beta(T-T_0))/(1-(p-p_0)/E) \]

where

\begin{eqnarray*} &\rho_l:& \mbox{liquid density,}\\ &\rho_0:& \mbox{initial liquid density,}\\ &\beta: & \mbox{volumetric temperature expansion coefficient,}\\ &T:& \mbox{temperature,}\\ &T_0:& \mbox{initial temperature,}\\ &p:& \mbox{pressure,}\\ &p_0:& \mbox{initial pressure,}\\ &E:& \mbox{bulk modulus fluid elasticity.}\\ \end{eqnarray*}

Definition at line 49 of file LiquidDensity.h.

#include <LiquidDensity.h>

Inheritance diagram for MaterialLib::Fluid::LiquidDensity:
[legend]
Collaboration diagram for MaterialLib::Fluid::LiquidDensity:
[legend]

Public Member Functions

 LiquidDensity (const double beta, const double rho0, const double T0, const double p0, const double E)
 
std::string getName () const override
 Get density model name.
 
double getValue (const ArrayType &var_vals) const override
 
double getdValue (const ArrayType &var_vals, const PropertyVariableType var) const override
 
- Public Member Functions inherited from MaterialLib::Fluid::FluidProperty
virtual ~FluidProperty ()=default
 

Private Member Functions

double dLiquidDensity_dT (const double T, const double p) const
 
double dLiquidDensity_dp (const double T, const double p) const
 

Private Attributes

const double _beta
 Volumetric temperature expansion coefficient.
 
const double _rho0
 Initial density.
 
const double _temperature0
 Initial temperature.
 
const double _p0
 Initial pressure.
 
const double _bulk_modulus
 Bulk modulus.
 

Additional Inherited Members

- Public Types inherited from MaterialLib::Fluid::FluidProperty
using ArrayType = std::array<double, PropertyVariableNumber>
 

Constructor & Destructor Documentation

◆ LiquidDensity()

MaterialLib::Fluid::LiquidDensity::LiquidDensity ( const double beta,
const double rho0,
const double T0,
const double p0,
const double E )
inlineexplicit

Definition at line 52 of file LiquidDensity.h.

54 : _beta(beta), _rho0(rho0), _temperature0(T0), _p0(p0), _bulk_modulus(E)
55 {
56 }
const double _beta
Volumetric temperature expansion coefficient.
const double _p0
Initial pressure.
const double _rho0
Initial density.
const double _temperature0
Initial temperature.
const double _bulk_modulus
Bulk modulus.

Member Function Documentation

◆ dLiquidDensity_dp()

double MaterialLib::Fluid::LiquidDensity::dLiquidDensity_dp ( const double T,
const double p ) const
inlineprivate

Calculate the derivative of density of fluids with respect to pressure.

Parameters
TTemperature (K).
pPressure (Pa).

Definition at line 130 of file LiquidDensity.h.

131 {
132 const double fac_p = 1. - (p - _p0) / _bulk_modulus;
133 return _rho0 / (1. + _beta * (T - _temperature0)) /
134 (fac_p * fac_p * _bulk_modulus);
135 }

References _beta, _bulk_modulus, _p0, _rho0, _temperature0, MaterialLib::Fluid::p, and MaterialLib::Fluid::T.

Referenced by getdValue().

◆ dLiquidDensity_dT()

double MaterialLib::Fluid::LiquidDensity::dLiquidDensity_dT ( const double T,
const double p ) const
inlineprivate

Calculate the derivative of density of fluids with respect to temperature.

Parameters
TTemperature (K).
pPressure (Pa).

Definition at line 118 of file LiquidDensity.h.

119 {
120 const double fac_T = 1. + _beta * (T - _temperature0);
121 return -_beta * _rho0 / (fac_T * fac_T) /
122 (1. - (p - _p0) / _bulk_modulus);
123 }

References _beta, _bulk_modulus, _p0, _rho0, _temperature0, MaterialLib::Fluid::p, and MaterialLib::Fluid::T.

Referenced by getdValue().

◆ getdValue()

double MaterialLib::Fluid::LiquidDensity::getdValue ( const ArrayType & var_vals,
const PropertyVariableType var ) const
inlineoverridevirtual

Get the partial differential of the density with respect to temperature or liquid pressure.

Parameters
var_valsVariable values in an array. The order of its elements is given in enum class PropertyVariableType.
varVariable type.

Implements MaterialLib::Fluid::FluidProperty.

Definition at line 80 of file LiquidDensity.h.

82 {
83 const double T = var_vals[static_cast<int>(PropertyVariableType::T)];
84 const double p = var_vals[static_cast<int>(PropertyVariableType::p)];
85 switch (var)
86 {
88 return dLiquidDensity_dT(T, p);
90 return dLiquidDensity_dp(T, p);
91 default:
92 return 0.;
93 }
94 }
double dLiquidDensity_dp(const double T, const double p) const
double dLiquidDensity_dT(const double T, const double p) const

References dLiquidDensity_dp(), dLiquidDensity_dT(), MaterialLib::Fluid::p, and MaterialLib::Fluid::T.

◆ getName()

std::string MaterialLib::Fluid::LiquidDensity::getName ( ) const
inlineoverridevirtual

Get density model name.

Implements MaterialLib::Fluid::FluidProperty.

Definition at line 59 of file LiquidDensity.h.

60 {
61 return "Temperature or pressure dependent liquid density";
62 }

◆ getValue()

double MaterialLib::Fluid::LiquidDensity::getValue ( const ArrayType & var_vals) const
inlineoverridevirtual

Get density value.

Parameters
var_valsVariable values in an array. The order of its elements is given in enum class PropertyVariableType.

Implements MaterialLib::Fluid::FluidProperty.

Definition at line 67 of file LiquidDensity.h.

68 {
69 const double T = var_vals[static_cast<int>(PropertyVariableType::T)];
70 const double p = var_vals[static_cast<int>(PropertyVariableType::p)];
71 return _rho0 / (1. + _beta * (T - _temperature0)) /
72 (1. - (p - _p0) / _bulk_modulus);
73 }

References _beta, _bulk_modulus, _p0, _rho0, _temperature0, MaterialLib::Fluid::p, and MaterialLib::Fluid::T.

Member Data Documentation

◆ _beta

const double MaterialLib::Fluid::LiquidDensity::_beta
private

Volumetric temperature expansion coefficient.

Definition at line 98 of file LiquidDensity.h.

Referenced by dLiquidDensity_dp(), dLiquidDensity_dT(), and getValue().

◆ _bulk_modulus

const double MaterialLib::Fluid::LiquidDensity::_bulk_modulus
private

Bulk modulus.

Definition at line 110 of file LiquidDensity.h.

Referenced by dLiquidDensity_dp(), dLiquidDensity_dT(), and getValue().

◆ _p0

const double MaterialLib::Fluid::LiquidDensity::_p0
private

Initial pressure.

Definition at line 107 of file LiquidDensity.h.

Referenced by dLiquidDensity_dp(), dLiquidDensity_dT(), and getValue().

◆ _rho0

const double MaterialLib::Fluid::LiquidDensity::_rho0
private

Initial density.

Definition at line 101 of file LiquidDensity.h.

Referenced by dLiquidDensity_dp(), dLiquidDensity_dT(), and getValue().

◆ _temperature0

const double MaterialLib::Fluid::LiquidDensity::_temperature0
private

Initial temperature.

Definition at line 104 of file LiquidDensity.h.

Referenced by dLiquidDensity_dp(), dLiquidDensity_dT(), and getValue().


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