Modelica.Media.Common

data structures and fundamental functions for fluid properties

Information

Package description

Package Modelica.Media.Common provides records and functions shared by many of the property sub-packages. High accuracy fluid property models share a lot of common structure, even if the actual models are different. Common data structures and computations shared by these property models are collected in this library.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
Rate  
MolarFlowRate  
MolarReactionRate  
MolarEnthalpy  
DerDensityByEntropy  
DerEnergyByPressure  
DerEnergyByMoles  
DerEntropyByTemperature  
DerEntropyByPressure  
DerEntropyByMoles  
DerPressureByDensity  
DerPressureBySpecificVolume  
DerPressureByTemperature  
DerVolumeByTemperature  
DerVolumeByPressure  
DerVolumeByMoles  
IsenthalpicExponent  
IsentropicExponent  
IsobaricVolumeExpansionCoefficient  
IsochoricPressureCoefficient  
IsothermalCompressibility  
JouleThomsonCoefficient  
MINPOS=1.0e-9minimal value for physical variables which are always > 0.0
AMIN=MINPOSminimal init area
AMAX=1.0e5maximal init area
ANOM=1.0nominal init area
MOLMIN=-1.0*MINPOSminimal Mole Number
MOLMAX=1.0e8maximal Mole Number
MOLNOM=1.0nominal Mole Number
DMIN=MINPOSminimal init density
DMAX=1.0e5maximal init density
DNOM=1.0nominal init density
LAMMIN=MINPOSminimal thermal conductivity
LAMNOM=1.0nominal thermal conductivity
LAMMAX=1000.0maximal thermal conductivity
ETAMIN=MINPOSminimal init dynamic viscosity
ETAMAX=1.0e8maximal init dynamic viscosity
ETANOM=100.0nominal init dynamic viscosity
EMIN=-1.0e10minimal init energy
EMAX=1.0e10maximal init energy
ENOM=1.0e3nominal init energy
SMIN=-1.0e6minimal init entropy
SMAX=1.0e6maximal init entropy
SNOM=1.0e3nominal init entropy
MDOTMIN=-1.0e5minimal init mass flow rate
MDOTMAX=1.0e5maximal init mass flow rate
MDOTNOM=1.0nominal init mass flow rate
MASSXMIN=-1.0*MINPOSminimal init mass fraction
MASSXMAX=1.0maximal init mass fraction
MASSXNOM=0.1nominal init mass fraction
MMIN=-1.0*MINPOSminimal init mass
MMAX=1.0e8maximal init mass
MNOM=1.0nominal init mass
MMMIN=0.001minimal initial molar mass
MMMAX=250.0maximal initial molar mass
MMNOM=0.2nominal initial molar mass
MOLEYMIN=-1.0*MINPOSminimal init mole fraction
MOLEYMAX=1.0maximal init mole fraction
MOLEYNOM=0.1nominal init mole fraction
GMIN=-1.0e8minimal init momentum flux
GMAX=1.0e8maximal init momentum flux
GNOM=1.0nominal init momentum flux
POWMIN=-1.0e8minimal init power or heat
POWMAX=1.0e8maximal init power or heat
POWNOM=1.0e3nominal init power or heat
PMIN=1.0e4minimal init pressure
PMAX=1.0e8maximal init pressure
PNOM=1.0e5nominal init pressure
COMPPMIN=-1.0*MINPOSminimal init pressure
COMPPMAX=1.0e8maximal init pressure
COMPPNOM=1.0e5nominal init pressure
KAPPAMIN=1.0minimal init isentropic exponent
KAPPAMAX=1.7maximal init isentropic exponent
KAPPANOM=1.2nominal init isentropic exponent
SEMIN=-1.0e8minimal init specific energy
SEMAX=1.0e8maximal init specific energy
SENOM=1.0e6nominal init specific energy
SHMIN=-1.0e8minimal init specific enthalpy
SHMAX=1.0e8maximal init specific enthalpy
SHNOM=1.0e6nominal init specific enthalpy
SSMIN=-1.0e6minimal init specific entropy
SSMAX=1.0e6maximal init specific entropy
SSNOM=1.0e3nominal init specific entropy
CPMIN=MINPOSminimal init specific heat capacity
CPMAX=1.0e6maximal init specific heat capacity
CPNOM=1.0e3nominal init specific heat capacity
TMIN=MINPOSminimal init temperature
TMAX=1.0e5maximal init temperature
TNOM=320.0nominal init temperature
LMIN=MINPOSminimal init thermal conductivity
LMAX=500.0maximal init thermal conductivity
LNOM=1.0nominal init thermal conductivity
VELMIN=-1.0e5minimal init speed
VELMAX=1.0e5maximal init speed
VELNOM=1.0nominal init speed
VMIN=0.0minimal init volume
VMAX=1.0e5maximal init volume
VNOM=1.0e-3nominal init volume
Modelica.Media.Common.ThermoFluidSpecial ThermoFluidSpecial property records used by the ThermoFluid library
Modelica.Media.Common.SaturationProperties SaturationProperties properties in the two phase region
Modelica.Media.Common.SaturationBoundaryProperties SaturationBoundaryProperties properties on both phase boundaries, including some derivatives
Modelica.Media.Common.IF97BaseTwoPhase IF97BaseTwoPhase Intermediate property data record for IF 97
Modelica.Media.Common.IF97PhaseBoundaryProperties IF97PhaseBoundaryProperties thermodynamic base properties on the phase boundary for IF97 steam tables
Modelica.Media.Common.GibbsDerivs GibbsDerivs derivatives of dimensionless Gibbs-function w.r.t. dimensionless pressure and temperature
Modelica.Media.Common.HelmholtzDerivs HelmholtzDerivs derivatives of dimensionless Helmholtz-function w.r.t. dimensionless pressuredensity and temperature
Modelica.Media.Common.TwoPhaseTransportProps TwoPhaseTransportProps defines properties on both phase boundaries, needed in the two phase region
Modelica.Media.Common.PhaseBoundaryProperties PhaseBoundaryProperties thermodynamic base properties on the phase boundary
Modelica.Media.Common.NewtonDerivatives_ph NewtonDerivatives_ph derivatives for fast inverse calculations of Helmholtz functions: p & h
Modelica.Media.Common.NewtonDerivatives_ps NewtonDerivatives_ps derivatives for fast inverse calculation of Helmholtz functions: p & s
Modelica.Media.Common.NewtonDerivatives_pT NewtonDerivatives_pT derivatives for fast inverse calculations of Helmholtz functions:p & T
Modelica.Media.Common.ExtraDerivatives ExtraDerivatives additional thermodynamic derivatives
Modelica.Media.Common.BridgmansTables BridgmansTables Calculates all entries in Bridgmans tables if first seven variables given
Modelica.Media.Common.gibbsToBridgmansTables gibbsToBridgmansTables calculates base coefficients for bridgemans tables from gibbs enthalpy
Modelica.Media.Common.helmholtzToBridgmansTables helmholtzToBridgmansTables calculates base coefficients for Bridgmans tables from helmholtz energy
Modelica.Media.Common.gibbsToBoundaryProps gibbsToBoundaryProps calulate phase boundary property record from dimensionless Gibbs function
Modelica.Media.Common.helmholtzToBoundaryProps helmholtzToBoundaryProps calulate phase boundary property record from dimensionless Helmholtz function
Modelica.Media.Common.cv2Phase cv2Phase compute isochoric specific heat capacity inside the two-phase region
Modelica.Media.Common.cvdpT2Phase cvdpT2Phase compute isochoric specific heat capacity inside the two-phase region and derivative of pressure w.r.t. temperature
Modelica.Media.Common.gibbsToExtraDerivs gibbsToExtraDerivs compute additional thermodynamic derivatives from dimensionless Gibbs function
Modelica.Media.Common.helmholtzToExtraDerivs helmholtzToExtraDerivs compute additional thermodynamic derivatives from dimensionless Helmholtz function
Modelica.Media.Common.Helmholtz_ph Helmholtz_ph function to calculate analytic derivatives for computing d and t given p and h
Modelica.Media.Common.Helmholtz_pT Helmholtz_pT function to calculate analytic derivatives for computing d and t given p and t
Modelica.Media.Common.Helmholtz_ps Helmholtz_ps function to calculate analytic derivatives for computing d and t given p and s
Modelica.Media.Common.smoothStep smoothStep Approximation of a general step, such that the characteristic is continuous and differentiable
Modelica.Media.Common.OneNonLinearEquation OneNonLinearEquation Determine solution of a non-linear algebraic equation in one unknown without derivatives in a reliable and efficient way

Types and constants

  type Rate = Real (final quantity="Rate", final unit="s-1");

  type MolarFlowRate = Real (final quantity="MolarFlowRate", final unit="mol/s");

  type MolarReactionRate = Real (final quantity="MolarReactionRate", final unit=
         "mol/(m3.s)");

  type MolarEnthalpy = Real (final quantity="MolarEnthalpy", final unit="J/mol");

  type DerDensityByEntropy = Real (final quantity="DerDensityByEntropy", final unit=
             "kg2.K/(m3.J)");

  type DerEnergyByPressure = Real (final quantity="DerEnergyByPressure", final unit=
             "J/Pa");

  type DerEnergyByMoles = Real (final quantity="DerEnergyByMoles", final unit=
          "J/mol");

  type DerEntropyByTemperature = Real (final quantity="DerEntropyByTemperature",
         final unit="J/K2");

  type DerEntropyByPressure = Real (final quantity="DerEntropyByPressure",
        final unit="J/(K.Pa)");

  type DerEntropyByMoles = Real (final quantity="DerEntropyByMoles", final unit=
         "J/(mol.K)");

  type DerPressureByDensity = Real (final quantity="DerPressureByDensity",
        final unit="Pa.m3/kg");

  type DerPressureBySpecificVolume = Real (final quantity=
          "DerPressureBySpecificVolume", final unit="Pa.kg/m3");

  type DerPressureByTemperature = Real (final quantity=
          "DerPressureByTemperature", final unit="Pa/K");

  type DerVolumeByTemperature = Real (final quantity="DerVolumeByTemperature",
        final unit="m3/K");

  type DerVolumeByPressure = Real (final quantity="DerVolumeByPressure", final unit=
             "m3/Pa");

  type DerVolumeByMoles = Real (final quantity="DerVolumeByMoles", final unit=
          "m3/mol");

  type IsenthalpicExponent = Real (final quantity="IsenthalpicExponent", unit=
          "1");

  type IsentropicExponent = Real (final quantity="IsentropicExponent", unit="1");

  type IsobaricVolumeExpansionCoefficient = Real (final quantity=
          "IsobaricVolumeExpansionCoefficient", unit="1/K");

  type IsochoricPressureCoefficient = Real (final quantity=
          "IsochoricPressureCoefficient", unit="1/K");

  type IsothermalCompressibility = Real (final quantity=
          "IsothermalCompressibility", unit="1/Pa");

  type JouleThomsonCoefficient = Real (final quantity="JouleThomsonCoefficient",
         unit="K/Pa");

  constant Real MINPOS=1.0e-9 
  "minimal value for physical variables which are always > 0.0";

  constant SI.Area AMIN=MINPOS "minimal init area";

  constant SI.Area AMAX=1.0e5 "maximal init area";

  constant SI.Area ANOM=1.0 "nominal init area";

  constant SI.AmountOfSubstance MOLMIN=-1.0*MINPOS "minimal Mole Number";

  constant SI.AmountOfSubstance MOLMAX=1.0e8 "maximal Mole Number";

  constant SI.AmountOfSubstance MOLNOM=1.0 "nominal Mole Number";

  constant SI.Density DMIN=MINPOS "minimal init density";

  constant SI.Density DMAX=1.0e5 "maximal init density";

  constant SI.Density DNOM=1.0 "nominal init density";

  constant SI.ThermalConductivity LAMMIN=MINPOS "minimal thermal conductivity";

  constant SI.ThermalConductivity LAMNOM=1.0 "nominal thermal conductivity";

  constant SI.ThermalConductivity LAMMAX=1000.0 "maximal thermal conductivity";

  constant SI.DynamicViscosity ETAMIN=MINPOS "minimal init dynamic viscosity";

  constant SI.DynamicViscosity ETAMAX=1.0e8 "maximal init dynamic viscosity";

  constant SI.DynamicViscosity ETANOM=100.0 "nominal init dynamic viscosity";

  constant SI.Energy EMIN=-1.0e10 "minimal init energy";

  constant SI.Energy EMAX=1.0e10 "maximal init energy";

  constant SI.Energy ENOM=1.0e3 "nominal init energy";

  constant SI.Entropy SMIN=-1.0e6 "minimal init entropy";

  constant SI.Entropy SMAX=1.0e6 "maximal init entropy";

  constant SI.Entropy SNOM=1.0e3 "nominal init entropy";

  constant SI.MassFlowRate MDOTMIN=-1.0e5 "minimal init mass flow rate";

  constant SI.MassFlowRate MDOTMAX=1.0e5 "maximal init mass flow rate";

  constant SI.MassFlowRate MDOTNOM=1.0 "nominal init mass flow rate";

  constant SI.MassFraction MASSXMIN=-1.0*MINPOS "minimal init mass fraction";

  constant SI.MassFraction MASSXMAX=1.0 "maximal init mass fraction";

  constant SI.MassFraction MASSXNOM=0.1 "nominal init mass fraction";

  constant SI.Mass MMIN=-1.0*MINPOS "minimal init mass";

  constant SI.Mass MMAX=1.0e8 "maximal init mass";

  constant SI.Mass MNOM=1.0 "nominal init mass";

  constant SI.MolarMass MMMIN=0.001 "minimal initial molar mass";

  constant SI.MolarMass MMMAX=250.0 "maximal initial molar mass";

  constant SI.MolarMass MMNOM=0.2 "nominal initial molar mass";

  constant SI.MoleFraction MOLEYMIN=-1.0*MINPOS "minimal init mole fraction";

  constant SI.MoleFraction MOLEYMAX=1.0 "maximal init mole fraction";

  constant SI.MoleFraction MOLEYNOM=0.1 "nominal init mole fraction";

  constant SI.MomentumFlux GMIN=-1.0e8 "minimal init momentum flux";

  constant SI.MomentumFlux GMAX=1.0e8 "maximal init momentum flux";

  constant SI.MomentumFlux GNOM=1.0 "nominal init momentum flux";

  constant SI.Power POWMIN=-1.0e8 "minimal init power or heat";

  constant SI.Power POWMAX=1.0e8 "maximal init power or heat";

  constant SI.Power POWNOM=1.0e3 "nominal init power or heat";

  constant SI.Pressure PMIN=1.0e4 "minimal init pressure";

  constant SI.Pressure PMAX=1.0e8 "maximal init pressure";

  constant SI.Pressure PNOM=1.0e5 "nominal init pressure";

  constant SI.Pressure COMPPMIN=-1.0*MINPOS "minimal init pressure";

  constant SI.Pressure COMPPMAX=1.0e8 "maximal init pressure";

  constant SI.Pressure COMPPNOM=1.0e5 "nominal init pressure";

  constant SI.RatioOfSpecificHeatCapacities KAPPAMIN=1.0 
  "minimal init isentropic exponent";

  constant SI.RatioOfSpecificHeatCapacities KAPPAMAX=1.7 
  "maximal init isentropic exponent";

  constant SI.RatioOfSpecificHeatCapacities KAPPANOM=1.2 
  "nominal init isentropic exponent";

  constant SI.SpecificEnergy SEMIN=-1.0e8 "minimal init specific energy";

  constant SI.SpecificEnergy SEMAX=1.0e8 "maximal init specific energy";

  constant SI.SpecificEnergy SENOM=1.0e6 "nominal init specific energy";

  constant SI.SpecificEnthalpy SHMIN=-1.0e8 "minimal init specific enthalpy";

  constant SI.SpecificEnthalpy SHMAX=1.0e8 "maximal init specific enthalpy";

  constant SI.SpecificEnthalpy SHNOM=1.0e6 "nominal init specific enthalpy";

  constant SI.SpecificEntropy SSMIN=-1.0e6 "minimal init specific entropy";

  constant SI.SpecificEntropy SSMAX=1.0e6 "maximal init specific entropy";

  constant SI.SpecificEntropy SSNOM=1.0e3 "nominal init specific entropy";

  constant SI.SpecificHeatCapacity CPMIN=MINPOS 
  "minimal init specific heat capacity";

  constant SI.SpecificHeatCapacity CPMAX=1.0e6 
  "maximal init specific heat capacity";

  constant SI.SpecificHeatCapacity CPNOM=1.0e3 
  "nominal init specific heat capacity";

  constant SI.Temperature TMIN=MINPOS "minimal init temperature";

  constant SI.Temperature TMAX=1.0e5 "maximal init temperature";

  constant SI.Temperature TNOM=320.0 "nominal init temperature";

  constant SI.ThermalConductivity LMIN=MINPOS 
  "minimal init thermal conductivity";

  constant SI.ThermalConductivity LMAX=500.0 
  "maximal init thermal conductivity";

  constant SI.ThermalConductivity LNOM=1.0 "nominal init thermal conductivity";

  constant SI.Velocity VELMIN=-1.0e5 "minimal init speed";

  constant SI.Velocity VELMAX=1.0e5 "maximal init speed";

  constant SI.Velocity VELNOM=1.0 "nominal init speed";

  constant SI.Volume VMIN=0.0 "minimal init volume";

  constant SI.Volume VMAX=1.0e5 "maximal init volume";

  constant SI.Volume VNOM=1.0e-3 "nominal init volume";


Modelica.Media.Common.SaturationProperties Modelica.Media.Common.SaturationProperties

properties in the two phase region

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record SaturationProperties "properties in the two phase region"
  extends Modelica.Icons.Record;
  SI.Temp_K T "temperature";
  SI.Density d "density";
  SI.Pressure p "pressure";
  SI.SpecificEnergy u "specific inner energy";
  SI.SpecificEnthalpy h "specific enthalpy";
  SI.SpecificEntropy s "specific entropy";
  SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  SI.SpecificHeatCapacity cv "heat capacity at constant volume";
  SI.SpecificHeatCapacity R "gas constant";
  SI.RatioOfSpecificHeatCapacities kappa "isentropic expansion coefficient";
  PhaseBoundaryProperties liq 
    "thermodynamic base properties on the boiling curve";
  PhaseBoundaryProperties vap "thermodynamic base properties on the dew curve";
  Real dpT(unit="Pa/K") "derivative of saturation pressure w.r.t. temperature";
  SI.MassFraction x "vapour mass fraction";
end SaturationProperties;

Modelica.Media.Common.SaturationBoundaryProperties Modelica.Media.Common.SaturationBoundaryProperties

properties on both phase boundaries, including some derivatives

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record SaturationBoundaryProperties 
  "properties on both phase boundaries, including some derivatives"

  extends Modelica.Icons.Record;
  SI.Temp_K T "Saturation temperature";
  SI.Density dl "Liquid density";
  SI.Density dv "Vapour density";
  SI.SpecificEnthalpy hl "Liquid specific enthalpy";
  SI.SpecificEnthalpy hv "Vapour specific enthalpy";
  Real dTp "derivative of temperature w.r.t. saturation pressure";
  Real ddldp "derivative of density along boiling curve";
  Real ddvdp "derivative of density along dew curve";
  Real dhldp "derivative of specific enthalpy along boiling curve";
  Real dhvdp "derivative of specific enthalpy along dew curve";
  SI.MassFraction x "vapour mass fraction";
end SaturationBoundaryProperties;

Modelica.Media.Common.IF97BaseTwoPhase Modelica.Media.Common.IF97BaseTwoPhase

Intermediate property data record for IF 97

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record IF97BaseTwoPhase "Intermediate property data record for IF 97"
  extends Modelica.Icons.Record;
  Integer phase= 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
  Integer region(min=1, max=5) "IF 97 region";
  SI.Pressure p "pressure";
  SI.Temperature T "temperature";
  SI.SpecificEnthalpy h "specific enthalpy";
  SI.SpecificHeatCapacity R "gas constant";
  SI.SpecificHeatCapacity cp "specific heat capacity";
  SI.SpecificHeatCapacity cv "specific heat capacity";
  SI.Density rho "density";
  SI.SpecificEntropy s "specific entropy";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
  Real vt "derivative of specific volume w.r.t. temperature";
  Real vp "derivative of specific volume w.r.t. pressure";
  Real x "dryness fraction";
  Real dpT "dp/dT derivative of saturation curve";
end IF97BaseTwoPhase;

Modelica.Media.Common.IF97PhaseBoundaryProperties Modelica.Media.Common.IF97PhaseBoundaryProperties

thermodynamic base properties on the phase boundary for IF97 steam tables

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record IF97PhaseBoundaryProperties 
  "thermodynamic base properties on the phase boundary for IF97 steam tables"

  extends Modelica.Icons.Record;
  Boolean region3boundary "true if boundary between 2-phase and region 3";
  SI.SpecificHeatCapacity R "specific heat capacity";
  SI.Temperature T "temperature";
  SI.Density d "density";
  SI.SpecificEnthalpy h "specific enthalpy";
  SI.SpecificEntropy s "specific entropy";
  SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  SI.SpecificHeatCapacity cv "heat capacity at constant volume";
  DerPressureByTemperature dpT "dp/dT derivative of saturation curve";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
  Real vt(unit="m3/(kg.K)") "derivative of specific volume w.r.t. temperature";
  Real vp(unit="m3/(kg.Pa)") "derivative of specific volume w.r.t. pressure";
end IF97PhaseBoundaryProperties;

Modelica.Media.Common.GibbsDerivs Modelica.Media.Common.GibbsDerivs

derivatives of dimensionless Gibbs-function w.r.t. dimensionless pressure and temperature

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record GibbsDerivs 
  "derivatives of dimensionless Gibbs-function w.r.t. dimensionless pressure and temperature"

  extends Modelica.Icons.Record;
  SI.Pressure p "pressure";
  SI.Temperature T "temperature";
  SI.SpecificHeatCapacity R "specific heat capacity";
  Real pi(unit="1") "dimensionless pressure";
  Real tau(unit="1") "dimensionless temperature";
  Real g(unit="1") "dimensionless Gibbs-function";
  Real gpi(unit="1") "derivative of g w.r.t. pi";
  Real gpipi(unit="1") "2nd derivative of g w.r.t. pi";
  Real gtau(unit="1") "derivative of g w.r.t. tau";
  Real gtautau(unit="1") "2nd derivative of g w.r.t. tau";
  Real gtaupi(unit="1") "mixed derivative of g w.r.t. pi and tau";
end GibbsDerivs;

Modelica.Media.Common.HelmholtzDerivs Modelica.Media.Common.HelmholtzDerivs

derivatives of dimensionless Helmholtz-function w.r.t. dimensionless pressuredensity and temperature

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record HelmholtzDerivs 
  "derivatives of dimensionless Helmholtz-function w.r.t. dimensionless pressuredensity and temperature"
  extends Modelica.Icons.Record;
  SI.Density d "density";
  SI.Temperature T "temperature";
  SI.SpecificHeatCapacity R "specific heat capacity";
  Real delta(unit="1") "dimensionless density";
  Real tau(unit="1") "dimensionless temperature";
  Real f(unit="1") "dimensionless Helmholtz-function";
  Real fdelta(unit="1") "derivative of f w.r.t. delta";
  Real fdeltadelta(unit="1") "2nd derivative of f w.r.t. delta";
  Real ftau(unit="1") "derivative of f w.r.t. tau";
  Real ftautau(unit="1") "2nd derivative of f w.r.t. tau";
  Real fdeltatau(unit="1") "mixed derivative of f w.r.t. delta and tau";
end HelmholtzDerivs;

Modelica.Media.Common.TwoPhaseTransportProps Modelica.Media.Common.TwoPhaseTransportProps

defines properties on both phase boundaries, needed in the two phase region

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record TwoPhaseTransportProps 
  "defines properties on both phase boundaries, needed in the two phase region"
  extends Modelica.Icons.Record;
  SI.Density d_vap "density on the dew line";
  SI.Density d_liq "density on the bubble line";
  SI.DynamicViscosity eta_vap "dynamic viscosity on the dew line";
  SI.DynamicViscosity eta_liq "dynamic viscosity on the bubble line";
  SI.ThermalConductivity lam_vap "thermal conductivity on the dew line";
  SI.ThermalConductivity lam_liq "thermal conductivity on the bubble line";
  SI.SpecificHeatCapacity cp_vap "cp on the dew line";
  SI.SpecificHeatCapacity cp_liq "cp on the bubble line";
  SI.MassFraction x "steam quality";
end TwoPhaseTransportProps;

Modelica.Media.Common.PhaseBoundaryProperties Modelica.Media.Common.PhaseBoundaryProperties

thermodynamic base properties on the phase boundary

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record PhaseBoundaryProperties 
  "thermodynamic base properties on the phase boundary"
  extends Modelica.Icons.Record;
  SI.Density d "density";
  SI.SpecificEnthalpy h "specific enthalpy";
  SI.SpecificEnergy u "inner energy";
  SI.SpecificEntropy s "specific entropy";
  SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  SI.SpecificHeatCapacity cv "heat capacity at constant volume";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
end PhaseBoundaryProperties;

Modelica.Media.Common.NewtonDerivatives_ph Modelica.Media.Common.NewtonDerivatives_ph

derivatives for fast inverse calculations of Helmholtz functions: p & h

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record NewtonDerivatives_ph 
  "derivatives for fast inverse calculations of Helmholtz functions: p & h"

  extends Modelica.Icons.Record;
  SI.Pressure p "pressure";
  SI.SpecificEnthalpy h "specific enthalpy";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  Real hd "derivative of specific enthalpy w.r.t. density";
  Real ht "derivative of specific enthalpy w.r.t. temperature";
end NewtonDerivatives_ph;

Modelica.Media.Common.NewtonDerivatives_ps Modelica.Media.Common.NewtonDerivatives_ps

derivatives for fast inverse calculation of Helmholtz functions: p & s

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record NewtonDerivatives_ps 
  "derivatives for fast inverse calculation of Helmholtz functions: p & s"

  extends Modelica.Icons.Record;
  SI.Pressure p "pressure";
  SI.SpecificEntropy s "specific entropy";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  Real sd "derivative of specific entropy w.r.t. density";
  Real st "derivative of specific entropy w.r.t. temperature";
end NewtonDerivatives_ps;

Modelica.Media.Common.NewtonDerivatives_pT Modelica.Media.Common.NewtonDerivatives_pT

derivatives for fast inverse calculations of Helmholtz functions:p & T

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record NewtonDerivatives_pT 
  "derivatives for fast inverse calculations of Helmholtz functions:p & T"

  extends Modelica.Icons.Record;
  SI.Pressure p "pressure";
  DerPressureByDensity pd "derivative of pressure w.r.t. density";
end NewtonDerivatives_pT;

Modelica.Media.Common.ExtraDerivatives Modelica.Media.Common.ExtraDerivatives

additional thermodynamic derivatives

Information

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record ExtraDerivatives "additional thermodynamic derivatives"
  extends Modelica.Icons.Record;
  IsentropicExponent kappa "isentropic expansion coefficient";
  // k in Bejan
  IsenthalpicExponent theta "isenthalpic exponent";
  // same as kappa, except derivative at const h
  IsobaricVolumeExpansionCoefficient alpha 
    "isobaric volume expansion coefficient";
  // beta in Bejan
  IsochoricPressureCoefficient beta "isochoric pressure coefficient";
  // kT in Bejan
  IsothermalCompressibility gamma "isothermal compressibility";
  // kappa in Bejan
  JouleThomsonCoefficient mu "Joule-Thomson coefficient";
  // mu_J in Bejan
end ExtraDerivatives;

Modelica.Media.Common.BridgmansTables Modelica.Media.Common.BridgmansTables

Calculates all entries in Bridgmans tables if first seven variables given

Information


Important: the phase equilibrium conditions are not yet considered. this means that bridgemans tables do not yet work in the two phase region. Some derivatives are 0 or infinity anyways. Idea: don't use the values in Bridgmans table directly, all derivatives are calculated as the quotient of two entries in the table. The last letter indicates which variable is held constant in taking the derivative. The second letters are the two variables involved in the derivative and the first letter is alwys a d to remind of differentiation.

Example 1: Get the derivative of specific entropy s w.r.t. Temperature at
constant specific volume (btw identical to constant density)
constant volume  --> last letter v
Temperature      --> second letter T
Specific entropy --> second letter s
--> the needed value is dsv/dTv
Known variables:
Temperature T
pressure p
specific volume v
specific inner energy u
specific enthalpy h
specific entropy s
specific helmholtz energy f
specific gibbs enthalpy g
Not included but useful:
density d
In order to convert derivatives involving density use the following
rules:
at constant density == at constant specific volume
ddx/dyx = -d*d*dvx/dyx with y,x any of T,p,u,h,s,f,g
dyx/ddx = -1/(d*d)dyx/dvx with y,x any of T,p,u,h,s,f,g
Usage example assuming water as the medium:
model BridgmansTablesForWater
extends ThermoFluid.BaseClasses.MediumModels.Water.WaterSteamMedium_ph;
Real derOfsByTAtConstantv "derivative of sp. entropy by temperature at constant sp. volume"
ThermoFluid.BaseClasses.MediumModels.Common.ExtraDerivatives dpro;
ThermoFluid.BaseClasses.MediumModels.Common.BridgmansTables bt;
equation
dpro = ThermoFluid.BaseClasses.MediumModels.SteamIF97.extraDerivs_pT(p[1],T[1]);
bt.p = p[1];
bt.T = T[1];
bt.v = 1/pro[1].d;
bt.s = pro[1].s;
bt.cp = pro[1].cp;
bt.alpha = dpro.alpha;
bt.gamma = dpro.gamma;
derOfsByTAtConstantv =  bt.dsv/bt.dTv;
                ...
end BridgmansTablesForWater;
                
                

Extends from Modelica.Icons.Record (Icon for records).

Modelica definition

record BridgmansTables 
  "Calculates all entries in Bridgmans tables if first seven variables given"
  extends Modelica.Icons.Record;
  // the first 7 need to calculated in a function!
  SI.SpecificVolume v "specific volume";
  SI.Pressure p "pressure";
  SI.Temperature T "temperature";
  SI.SpecificEntropy s "specific entropy";
  SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  IsobaricVolumeExpansionCoefficient alpha 
    "isobaric volume expansion coefficient";
  // beta in Bejan
  IsothermalCompressibility gamma "isothermal compressibility";
  // kappa in Bejan
  // Derivatives at constant pressure
  Real dTp=1 "coefficient in Bridgmans table, see info for usage";
  Real dpT=-dTp "coefficient in Bridgmans table, see info for usage";
  Real dvp=alpha*v "coefficient in Bridgmans table, see info for usage";
  Real dpv=-dvp "coefficient in Bridgmans table, see info for usage";
  Real dsp=cp/T "coefficient in Bridgmans table, see info for usage";
  Real dps=-dsp "coefficient in Bridgmans table, see info for usage";
  Real dup=cp - alpha*p*v "coefficient in Bridgmans table, see info for usage";
  Real dpu=-dup "coefficient in Bridgmans table, see info for usage";
  Real dhp=cp "coefficient in Bridgmans table, see info for usage";
  Real dph=-dhp "coefficient in Bridgmans table, see info for usage";
  Real dfp=-s - alpha*p*v "coefficient in Bridgmans table, see info for usage";
  Real dpf=-dfp "coefficient in Bridgmans table, see info for usage";
  Real dgp=-s "coefficient in Bridgmans table, see info for usage";
  Real dpg=-dgp "coefficient in Bridgmans table, see info for usage";
  // Derivatives at constant Temperature
  Real dvT=gamma*v "coefficient in Bridgmans table, see info for usage";
  Real dTv=-dvT "coefficient in Bridgmans table, see info for usage";
  Real dsT=alpha*v "coefficient in Bridgmans table, see info for usage";
  Real dTs=-dsT "coefficient in Bridgmans table, see info for usage";
  Real duT=alpha*T*v - gamma*p*v 
    "coefficient in Bridgmans table, see info for usage";
  Real dTu=-duT "coefficient in Bridgmans table, see info for usage";
  Real dhT=-v + alpha*T*v "coefficient in Bridgmans table, see info for usage";
  Real dTh=-dhT "coefficient in Bridgmans table, see info for usage";
  Real dfT=-gamma*p*v "coefficient in Bridgmans table, see info for usage";
  Real dTf=-dfT "coefficient in Bridgmans table, see info for usage";
  Real dgT=-v "coefficient in Bridgmans table, see info for usage";
  Real dTg=-dgT "coefficient in Bridgmans table, see info for usage";
  // Derivatives at constant v
  Real dsv=alpha*alpha*v*v - gamma*v*cp/T 
    "coefficient in Bridgmans table, see info for usage";
  Real dvs=-dsv "coefficient in Bridgmans table, see info for usage";
  Real duv=T*alpha*alpha*v*v - gamma*v*cp 
    "coefficient in Bridgmans table, see info for usage";
  Real dvu=-duv "coefficient in Bridgmans table, see info for usage";
  Real dhv=T*alpha*alpha*v*v - alpha*v*v - gamma*v*cp 
    "coefficient in Bridgmans table, see info for usage";
  Real dvh=-dhv "coefficient in Bridgmans table, see info for usage";
  Real dfv=gamma*v*s "coefficient in Bridgmans table, see info for usage";
  Real dvf=-dfv "coefficient in Bridgmans table, see info for usage";
  Real dgv=gamma*v*s - alpha*v*v 
    "coefficient in Bridgmans table, see info for usage";
  Real dvg=-dgv "coefficient in Bridgmans table, see info for usage";
  // Derivatives at constant s
  Real dus=dsv*p "coefficient in Bridgmans table, see info for usage";
  Real dsu=-dus "coefficient in Bridgmans table, see info for usage";
  Real dhs=-v*cp/T "coefficient in Bridgmans table, see info for usage";
  Real dsh=-dhs "coefficient in Bridgmans table, see info for usage";
  Real dfs=alpha*v*s + dus "coefficient in Bridgmans table, see info for usage";
  Real dsf=-dfs "coefficient in Bridgmans table, see info for usage";
  Real dgs=alpha*v*s - v*cp/T 
    "coefficient in Bridgmans table, see info for usage";
  Real dsg=-dgs "coefficient in Bridgmans table, see info for usage";
  // Derivatives at constant u
  Real dhu=p*alpha*v*v + gamma*v*cp*p - v*cp - p*T*alpha*alpha*v*v 
    "coefficient in Bridgmans table, see info for usage";
  Real duh=-dhu "coefficient in Bridgmans table, see info for usage";
  Real dfu=s*T*alpha*v - gamma*v*cp*p - gamma*v*s*p + p*T*alpha*alpha*v*v 
    "coefficient in Bridgmans table, see info for usage";
  Real duf=-dfu "coefficient in Bridgmans table, see info for usage";
  Real dgu=alpha*v*v*p + alpha*v*s*T - v*cp - gamma*v*s*p 
    "coefficient in Bridgmans table, see info for usage";
  Real dug=-dgu "coefficient in Bridgmans table, see info for usage";
  //  Derivatives at constant h
  Real dfh=(s - v*alpha*p)*(v - v*alpha*T) - gamma*v*cp*p 
    "coefficient in Bridgmans table, see info for usage";
  Real dhf=-dfh "coefficient in Bridgmans table, see info for usage";
  Real dgh=alpha*v*s*T - v*(s + cp) 
    "coefficient in Bridgmans table, see info for usage";
  Real dhg=-dgh "coefficient in Bridgmans table, see info for usage";
  // Derivatives at constant g
  Real dfg=gamma*v*s*p - v*s - alpha*v*v*p 
    "coefficient in Bridgmans table, see info for usage";
  Real dgf=-dfg "coefficient in Bridgmans table, see info for usage";
end BridgmansTables;

Modelica.Media.Common.gibbsToBridgmansTables Modelica.Media.Common.gibbsToBridgmansTables

calculates base coefficients for bridgemans tables from gibbs enthalpy

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
GibbsDerivsg dimensionless derivatives of Gibbs function

Outputs

TypeNameDescription
SpecificVolumevspecific volume [m3/kg]
Pressureppressure [Pa]
TemperatureTtemperature [K]
SpecificEntropysspecific entropy [J/(kg.K)]
SpecificHeatCapacitycpheat capacity at constant pressure [J/(kg.K)]
IsobaricVolumeExpansionCoefficientalphaisobaric volume expansion coefficient [1/K]
IsothermalCompressibilitygammaisothermal compressibility [1/Pa]

Modelica definition

function gibbsToBridgmansTables 
  "calculates base coefficients for bridgemans tables from gibbs enthalpy"

  extends Modelica.Icons.Function;
  input GibbsDerivs g "dimensionless derivatives of Gibbs function";
  output SI.SpecificVolume v "specific volume";
  output SI.Pressure p=g.p "pressure";
  output SI.Temperature T=g.T "temperature";
  output SI.SpecificEntropy s "specific entropy";
  output SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  output IsobaricVolumeExpansionCoefficient alpha 
    "isobaric volume expansion coefficient";
  // beta in Bejan
  output IsothermalCompressibility gamma "isothermal compressibility";
  // kappa in Bejan
protected 
  Real vt(unit="m3/(kg.K)") "derivative of specific volume w.r.t. temperature";
  Real vp(unit="m4.kg-2.s2") "derivative of specific volume w.r.t. pressure";
algorithm 
  vt := g.R/g.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
  vp := g.R*g.T/(g.p*g.p)*g.pi*g.pi*g.gpipi;
  v := (g.R*g.T*g.pi*g.gpi)/g.p;
  s := g.R*(g.tau*g.gtau - g.g);
  cp := -g.R*g.tau*g.tau*g.gtautau;
  alpha := vt/v;
  gamma := -vp/v;
end gibbsToBridgmansTables;

Modelica.Media.Common.helmholtzToBridgmansTables Modelica.Media.Common.helmholtzToBridgmansTables

calculates base coefficients for Bridgmans tables from helmholtz energy

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
SpecificVolumevspecific volume [m3/kg]
Pressureppressure [Pa]
TemperatureTtemperature [K]
SpecificEntropysspecific entropy [J/(kg.K)]
SpecificHeatCapacitycpheat capacity at constant pressure [J/(kg.K)]
IsobaricVolumeExpansionCoefficientalphaisobaric volume expansion coefficient [1/K]
IsothermalCompressibilitygammaisothermal compressibility [1/Pa]

Modelica definition

function helmholtzToBridgmansTables 
  "calculates base coefficients for Bridgmans tables from helmholtz energy"
  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output SI.SpecificVolume v=1/f.d "specific volume";
  output SI.Pressure p "pressure";
  output SI.Temperature T=f.T "temperature";
  output SI.SpecificEntropy s "specific entropy";
  output SI.SpecificHeatCapacity cp "heat capacity at constant pressure";
  output IsobaricVolumeExpansionCoefficient alpha 
    "isobaric volume expansion coefficient";
  // beta in Bejan
  output IsothermalCompressibility gamma "isothermal compressibility";
  // kappa in Bejan
protected 
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  DerPressureBySpecificVolume pv 
    "derivative of pressure w.r.t. specific volume ";
  SI.SpecificHeatCapacity cv "isochoric specific heat capacity";
algorithm 
  p := f.R*f.d*f.T*f.delta*f.fdelta;
  pv := -(f.d*f.d)*f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
  pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
  s := f.R*(f.tau*f.ftau - f.f);
  alpha := -f.d*pt/pv;
  gamma := -f.d/pv;
  cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau*f.
    fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
end helmholtzToBridgmansTables;

Modelica.Media.Common.gibbsToBoundaryProps Modelica.Media.Common.gibbsToBoundaryProps

calulate phase boundary property record from dimensionless Gibbs function

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
GibbsDerivsg dimensionless derivatives of Gibbs function

Outputs

TypeNameDescription
PhaseBoundaryPropertiessatphase boundary properties

Modelica definition

function gibbsToBoundaryProps 
  "calulate phase boundary property record from dimensionless Gibbs function"

  extends Modelica.Icons.Function;
  input GibbsDerivs g "dimensionless derivatives of Gibbs function";
  output PhaseBoundaryProperties sat "phase boundary properties";
protected 
  Real vt "derivative of specific volume w.r.t. temperature";
  Real vp "derivative of specific volume w.r.t. pressure";
algorithm 
  sat.d := g.p/(g.R*g.T*g.pi*g.gpi);
  sat.h := g.R*g.T*g.tau*g.gtau;
  sat.u := g.T*g.R*(g.tau*g.gtau - g.pi*g.gpi);
  sat.s := g.R*(g.tau*g.gtau - g.g);
  sat.cp := -g.R*g.tau*g.tau*g.gtautau;
  sat.cv := g.R*(-g.tau*g.tau*g.gtautau + (g.gpi - g.tau*g.gtaupi)*(g.gpi - g.
     tau*g.gtaupi)/(g.gpipi));
  vt := g.R/g.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
  vp := g.R*g.T/(g.p*g.p)*g.pi*g.pi*g.gpipi;
  // sat.kappa := -1/(sat.d*g.p)*sat.cp/(vp*sat.cp + vt*vt*g.T);
  sat.pt := -g.p/g.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
  sat.pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
end gibbsToBoundaryProps;

Modelica.Media.Common.helmholtzToBoundaryProps Modelica.Media.Common.helmholtzToBoundaryProps

calulate phase boundary property record from dimensionless Helmholtz function

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
PhaseBoundaryPropertiessatphase boundary property record

Modelica definition

function helmholtzToBoundaryProps 
  "calulate phase boundary property record from dimensionless Helmholtz function"

  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output PhaseBoundaryProperties sat "phase boundary property record";
protected 
  SI.Pressure p "pressure";
algorithm 
  p := f.R*f.d*f.T*f.delta*f.fdelta;
  sat.d := f.d;
  sat.h := f.R*f.T*(f.tau*f.ftau + f.delta*f.fdelta);
  sat.s := f.R*(f.tau*f.ftau - f.f);
  sat.u := f.R*f.T*f.tau*f.ftau;
  sat.cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau*f.
     fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
  sat.cv := f.R*(-f.tau*f.tau*f.ftautau);
  sat.pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
  sat.pd := f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
end helmholtzToBoundaryProps;

Modelica.Media.Common.cv2Phase Modelica.Media.Common.cv2Phase

compute isochoric specific heat capacity inside the two-phase region

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PhaseBoundaryPropertiesliq properties on the boiling curve
PhaseBoundaryPropertiesvap properties on the condensation curve
MassFractionx vapour mass fraction [1]
TemperatureT temperature [K]
Pressurep preoperties [Pa]

Outputs

TypeNameDescription
SpecificHeatCapacitycvisochoric specific heat capacity [J/(kg.K)]

Modelica definition

function cv2Phase 
  "compute isochoric specific heat capacity inside the two-phase region"

  extends Modelica.Icons.Function;
  input PhaseBoundaryProperties liq "properties on the boiling curve";
  input PhaseBoundaryProperties vap "properties on the condensation curve";
  input SI.MassFraction x "vapour mass fraction";
  input SI.Temperature T "temperature";
  input SI.Pressure p "preoperties";
  output SI.SpecificHeatCapacity cv "isochoric specific heat capacity";
protected 
  Real dpT "derivative of pressure w.r.t. temperature";
  Real dxv "derivative of vapour mass fraction w.r.t. specific volume";
  Real dvTl "derivative of liquid specific volume w.r.t. temperature";
  Real dvTv "derivative of vapour specific volume w.r.t. temperature";
  Real duTl "derivative of liquid specific inner energy w.r.t. temperature";
  Real duTv "derivative of vapour specific inner energy w.r.t. temperature";
  Real dxt "derivative of vapour mass fraction w.r.t. temperature";
algorithm 
  dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d - vap.d) else 0.0;
  dpT := (vap.s - liq.s)*dxv;
  // wrong at critical point
  dvTl := (liq.pt - dpT)/liq.pd/liq.d/liq.d;
  dvTv := (vap.pt - dpT)/vap.pd/vap.d/vap.d;
  dxt := -dxv*(dvTl + x*(dvTv - dvTl));
  duTl := liq.cv + (T*liq.pt - p)*dvTl;
  duTv := vap.cv + (T*vap.pt - p)*dvTv;
  cv := duTl + x*(duTv - duTl) + dxt*(vap.u - liq.u);
end cv2Phase;

Modelica.Media.Common.cvdpT2Phase Modelica.Media.Common.cvdpT2Phase

compute isochoric specific heat capacity inside the two-phase region and derivative of pressure w.r.t. temperature

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
PhaseBoundaryPropertiesliq properties on the boiling curve
PhaseBoundaryPropertiesvap properties on the condensation curve
MassFractionx vapour mass fraction [1]
TemperatureT temperature [K]
Pressurep preoperties [Pa]

Outputs

TypeNameDescription
SpecificHeatCapacitycvisochoric specific heat capacity [J/(kg.K)]
RealdpTderivative of pressure w.r.t. temperature

Modelica definition

function cvdpT2Phase 
  "compute isochoric specific heat capacity inside the two-phase region and derivative of pressure w.r.t. temperature"

  extends Modelica.Icons.Function;
  input PhaseBoundaryProperties liq "properties on the boiling curve";
  input PhaseBoundaryProperties vap "properties on the condensation curve";
  input SI.MassFraction x "vapour mass fraction";
  input SI.Temperature T "temperature";
  input SI.Pressure p "preoperties";
  output SI.SpecificHeatCapacity cv "isochoric specific heat capacity";
  output Real dpT "derivative of pressure w.r.t. temperature";
protected 
  Real dxv "derivative of vapour mass fraction w.r.t. specific volume";
  Real dvTl "derivative of liquid specific volume w.r.t. temperature";
  Real dvTv "derivative of vapour specific volume w.r.t. temperature";
  Real duTl "derivative of liquid specific inner energy w.r.t. temperature";
  Real duTv "derivative of vapour specific inner energy w.r.t. temperature";
  Real dxt "derivative of vapour mass fraction w.r.t. temperature";
algorithm 
  dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d - vap.d) else 0.0;
  dpT := (vap.s - liq.s)*dxv;
  // wrong at critical point
  dvTl := (liq.pt - dpT)/liq.pd/liq.d/liq.d;
  dvTv := (vap.pt - dpT)/vap.pd/vap.d/vap.d;
  dxt := -dxv*(dvTl + x*(dvTv - dvTl));
  duTl := liq.cv + (T*liq.pt - p)*dvTl;
  duTv := vap.cv + (T*vap.pt - p)*dvTv;
  cv := duTl + x*(duTv - duTl) + dxt*(vap.u - liq.u);
end cvdpT2Phase;

Modelica.Media.Common.gibbsToExtraDerivs Modelica.Media.Common.gibbsToExtraDerivs

compute additional thermodynamic derivatives from dimensionless Gibbs function

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
GibbsDerivsg dimensionless derivatives of Gibbs function

Outputs

TypeNameDescription
ExtraDerivativesdproadditional property derivatives

Modelica definition

function gibbsToExtraDerivs 
  "compute additional thermodynamic derivatives from dimensionless Gibbs function"

  extends Modelica.Icons.Function;
  input GibbsDerivs g "dimensionless derivatives of Gibbs function";
  output ExtraDerivatives dpro "additional property derivatives";
protected 
  Real vt "derivative of specific volume w.r.t. temperature";
  Real vp "derivative of specific volume w.r.t. pressure";
  SI.Density d "density";
  SI.SpecificVolume v "specific volume";
  SI.SpecificHeatCapacity cv "isochoric heat capacity";
  SI.SpecificHeatCapacity cp "isobaric heat capacity";
algorithm 
  d := g.p/(g.R*g.T*g.pi*g.gpi);
  v := 1/d;
  vt := g.R/g.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
  vp := g.R*g.T/(g.p*g.p)*g.pi*g.pi*g.gpipi;
  cp := -g.R*g.tau*g.tau*g.gtautau;
  cv := g.R*(-g.tau*g.tau*g.gtautau + (g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau
    *g.gtaupi)/g.gpipi);
  dpro.kappa := -1/(d*g.p)*cp/(vp*cp + vt*vt*g.T);
  dpro.theta := cp/(d*g.p*(-vp*cp + vt*v - g.T*vt*vt));
  dpro.alpha := d*vt;
  dpro.beta := -vt/(g.p*vp);
  dpro.gamma := -d*vp;
  dpro.mu := -(v - g.T*vt)/cp;
end gibbsToExtraDerivs;

Modelica.Media.Common.helmholtzToExtraDerivs Modelica.Media.Common.helmholtzToExtraDerivs

compute additional thermodynamic derivatives from dimensionless Helmholtz function

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
ExtraDerivativesdproadditional property derivatives

Modelica definition

function helmholtzToExtraDerivs 
  "compute additional thermodynamic derivatives from dimensionless Helmholtz function"

  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output ExtraDerivatives dpro "additional property derivatives";
protected 
  SI.Pressure p "pressure";
  SI.SpecificVolume v "specific volume";
  DerPressureByTemperature pt "derivative of pressure w.r.t. temperature";
  DerPressureBySpecificVolume pv 
    "derivative of pressure w.r.t. specific volume";
  SI.SpecificHeatCapacity cv "isochoric specific heat capacity";
algorithm 
  v := 1/f.d;
  p := f.R*f.d*f.T*f.delta*f.fdelta;
  pv := -(f.d*f.d)*f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
  pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
  cv := f.R*(-f.tau*f.tau*f.ftautau);
  dpro.kappa := 1/(f.d*p)*((-pv*cv + pt*pt*f.T)/(cv));
  dpro.theta := -1/(f.d*p)*((-pv*cv + f.T*pt*pt)/(cv + pt*v));
  dpro.alpha := -f.d*pt/pv;
  dpro.beta := pt/p;
  dpro.gamma := -f.d/pv;
  dpro.mu := (v*pv + f.T*pt)/(pt*pt*f.T - pv*cv);
end helmholtzToExtraDerivs;

Modelica.Media.Common.Helmholtz_ph Modelica.Media.Common.Helmholtz_ph

function to calculate analytic derivatives for computing d and t given p and h

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
NewtonDerivatives_phnderivsderivatives for Newton iteration to calculate d and t from p and h

Modelica definition

function Helmholtz_ph 
  "function to calculate analytic derivatives for computing d and t given p and h"
  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output NewtonDerivatives_ph nderivs 
    "derivatives for Newton iteration to calculate d and t from p and h";
protected 
  SI.SpecificHeatCapacity cv "isochoric heat capacity";
algorithm 
  cv := -f.R*(f.tau*f.tau*f.ftautau);
  nderivs.p := f.d*f.R*f.T*f.delta*f.fdelta;
  nderivs.h := f.R*f.T*(f.tau*f.ftau + f.delta*f.fdelta);
  nderivs.pd := f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
  nderivs.pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
  nderivs.ht := cv + nderivs.pt/f.d;
  nderivs.hd := (nderivs.pd - f.T*nderivs.pt/f.d)/f.d;
end Helmholtz_ph;

Modelica.Media.Common.Helmholtz_pT Modelica.Media.Common.Helmholtz_pT

function to calculate analytic derivatives for computing d and t given p and t

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
NewtonDerivatives_pTnderivsderivatives for Newton iteration to compute d and t from p and t

Modelica definition

function Helmholtz_pT 
  "function to calculate analytic derivatives for computing d and t given p and t"

  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output NewtonDerivatives_pT nderivs 
    "derivatives for Newton iteration to compute d and t from p and t";
algorithm 
  nderivs.p := f.d*f.R*f.T*f.delta*f.fdelta;
  nderivs.pd := f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
end Helmholtz_pT;

Modelica.Media.Common.Helmholtz_ps Modelica.Media.Common.Helmholtz_ps

function to calculate analytic derivatives for computing d and t given p and s

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
HelmholtzDerivsf dimensionless derivatives of Helmholtz function

Outputs

TypeNameDescription
NewtonDerivatives_psnderivsderivatives for Newton iteration to compute d and t from p and s

Modelica definition

function Helmholtz_ps 
  "function to calculate analytic derivatives for computing d and t given p and s"

  extends Modelica.Icons.Function;
  input HelmholtzDerivs f "dimensionless derivatives of Helmholtz function";
  output NewtonDerivatives_ps nderivs 
    "derivatives for Newton iteration to compute d and t from p and s";
protected 
  SI.SpecificHeatCapacity cv "isochoric heat capacity";
algorithm 
  cv := -f.R*(f.tau*f.tau*f.ftautau);
  nderivs.p := f.d*f.R*f.T*f.delta*f.fdelta;
  nderivs.s := f.R*(f.tau*f.ftau - f.f);
  nderivs.pd := f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
  nderivs.pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
  nderivs.st := cv/f.T;
  nderivs.sd := -nderivs.pt/(f.d*f.d);
end Helmholtz_ps;

Modelica.Media.Common.smoothStep Modelica.Media.Common.smoothStep

Approximation of a general step, such that the characteristic is continuous and differentiable

Information


This function is used to approximate the equation

    y = if x > 0 then y1 else y2;

by a smooth characteristic, so that the expression is continuous and differentiable:

   y = smooth(1, if x >  x_small then y1 else
                 if x < -x_small then y2 else f(y1, y2));

In the region -x_small < x < x_small a 2nd order polynomial is used for a smooth transition from y1 to y2.

If mass fractions X[:] are approximated with this function then this can be performed for all nX mass fractions, instead of applying it for nX-1 mass fractions and computing the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the property that sum(X) = 1, provided sum(X_a) = sum(X_b) = 1 (and y1=X_a[i], y2=X_b[i]). This can be shown by evaluating the approximating function in the abs(x) < x_small region (otherwise X is either X_a or X_b):

    X[1]  = smoothStep(x, X_a[1] , X_b[1] , x_small);
    X[2]  = smoothStep(x, X_a[2] , X_b[2] , x_small);
       ...
    X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);

or

    X[1]  = c*(X_a[1]  - X_b[1])  + (X_a[1]  + X_b[1])/2
    X[2]  = c*(X_a[2]  - X_b[2])  + (X_a[2]  + X_b[2])/2;
       ...
    X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2;
    c     = (x/x_small)*((x/x_small)^2 - 3)/4

Summing all mass fractions together results in

    sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2
           = c*(1 - 1) + (1 + 1)/2
           = 1

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Realx Abszissa value
Realy1 Ordinate value for x > 0
Realy2 Ordinate value for x < 0
Realx_small1e-5Approximation of step for -x_small <= x <= x_small; x_small > 0 required

Outputs

TypeNameDescription
RealyOrdinate value to approximate y = if x > 0 then y1 else y2

Modelica definition

function smoothStep 
  "Approximation of a general step, such that the characteristic is continuous and differentiable"
  extends Modelica.Icons.Function;
  input Real x "Abszissa value";
  input Real y1 "Ordinate value for x > 0";
  input Real y2 "Ordinate value for x < 0";
  input Real x_small(min=0) = 1e-5 
    "Approximation of step for -x_small <= x <= x_small; x_small > 0 required";
  output Real y "Ordinate value to approximate y = if x > 0 then y1 else y2";
algorithm 
  y := smooth(1, if x >  x_small then y1 else 
                 if x < -x_small then y2 else 
                 if abs(x_small)>0 then (x/x_small)*((x/x_small)^2 - 3)*(y2-y1)/4 + (y1+y2)/2 else (y1+y2)/2);

end smoothStep;

Automatically generated Fri Nov 12 16:31:30 2010.