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).Name | Description |
---|---|
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-9 | Minimal value for physical variables which are always > 0.0 |
AMIN=MINPOS | Minimal init area |
AMAX=1.0e5 | Maximal init area |
ANOM=1.0 | Nominal init area |
MOLMIN=-1.0*MINPOS | Minimal Mole Number |
MOLMAX=1.0e8 | Maximal Mole Number |
MOLNOM=1.0 | Nominal Mole Number |
DMIN=1e-6 | Minimal init density |
DMAX=30.0e3 | Maximal init density |
DNOM=1.0 | Nominal init density |
LAMMIN=MINPOS | Minimal thermal conductivity |
LAMNOM=1.0 | Nominal thermal conductivity |
LAMMAX=1000.0 | Maximal thermal conductivity |
ETAMIN=MINPOS | Minimal init dynamic viscosity |
ETAMAX=1.0e8 | Maximal init dynamic viscosity |
ETANOM=100.0 | Nominal init dynamic viscosity |
EMIN=-1.0e10 | Minimal init energy |
EMAX=1.0e10 | Maximal init energy |
ENOM=1.0e3 | Nominal init energy |
SMIN=-1.0e6 | Minimal init entropy |
SMAX=1.0e6 | Maximal init entropy |
SNOM=1.0e3 | Nominal init entropy |
MDOTMIN=-1.0e5 | Minimal init mass flow rate |
MDOTMAX=1.0e5 | Maximal init mass flow rate |
MDOTNOM=1.0 | Nominal init mass flow rate |
MASSXMIN=-1.0*MINPOS | Minimal init mass fraction |
MASSXMAX=1.0 | Maximal init mass fraction |
MASSXNOM=0.1 | Nominal init mass fraction |
MMIN=-1.0*MINPOS | Minimal init mass |
MMAX=1.0e8 | Maximal init mass |
MNOM=1.0 | Nominal init mass |
MMMIN=0.001 | Minimal initial molar mass |
MMMAX=250.0 | Maximal initial molar mass |
MMNOM=0.2 | Nominal initial molar mass |
MOLEYMIN=-1.0*MINPOS | Minimal init mole fraction |
MOLEYMAX=1.0 | Maximal init mole fraction |
MOLEYNOM=0.1 | Nominal init mole fraction |
GMIN=-1.0e8 | Minimal init momentum flux |
GMAX=1.0e8 | Maximal init momentum flux |
GNOM=1.0 | Nominal init momentum flux |
POWMIN=-1.0e8 | Minimal init power or heat |
POWMAX=1.0e8 | Maximal init power or heat |
POWNOM=1.0e3 | Nominal init power or heat |
PMIN=1.0e4 | Minimal init pressure |
PMAX=1.0e8 | Maximal init pressure |
PNOM=1.0e5 | Nominal init pressure |
COMPPMIN=-1.0*MINPOS | Minimal init pressure |
COMPPMAX=1.0e8 | Maximal init pressure |
COMPPNOM=1.0e5 | Nominal init pressure |
KAPPAMIN=1.0 | Minimal init isentropic exponent |
KAPPAMAX=1.7 | Maximal init isentropic exponent |
KAPPANOM=1.2 | Nominal init isentropic exponent |
SEMIN=-1.0e8 | Minimal init specific energy |
SEMAX=1.0e8 | Maximal init specific energy |
SENOM=1.0e6 | Nominal init specific energy |
SHMIN=-1.0e8 | Minimal init specific enthalpy |
SHMAX=1.0e8 | Maximal init specific enthalpy |
SHNOM=1.0e6 | Nominal init specific enthalpy |
SSMIN=-1.0e6 | Minimal init specific entropy |
SSMAX=1.0e6 | Maximal init specific entropy |
SSNOM=1.0e3 | Nominal init specific entropy |
CPMIN=MINPOS | Minimal init specific heat capacity |
CPMAX=1.0e6 | Maximal init specific heat capacity |
CPNOM=1.0e3 | Nominal init specific heat capacity |
TMIN=1.0 | Minimal init temperature |
TMAX=6000.0 | Maximal init temperature |
TNOM=320.0 | Nominal init temperature |
LMIN=MINPOS | Minimal init thermal conductivity |
LMAX=500.0 | Maximal init thermal conductivity |
LNOM=1.0 | Nominal init thermal conductivity |
VELMIN=-1.0e5 | Minimal init speed |
VELMAX=1.0e5 | Maximal init speed |
VELNOM=1.0 | Nominal init speed |
VMIN=0.0 | Minimal init volume |
VMAX=1.0e5 | Maximal init volume |
VNOM=1.0e-3 | Nominal init volume |
ThermoFluidSpecial | Property records used by the ThermoFluid library |
SaturationProperties | Properties in the two phase region |
SaturationBoundaryProperties | Properties on both phase boundaries, including some derivatives |
IF97BaseTwoPhase | Intermediate property data record for IF 97 |
IF97PhaseBoundaryProperties | Thermodynamic base properties on the phase boundary for IF97 steam tables |
GibbsDerivs | Derivatives of dimensionless Gibbs-function w.r.t. dimensionless pressure and temperature |
HelmholtzDerivs | Derivatives of dimensionless Helmholtz-function w.r.t. dimensionless pressure, density and temperature |
TwoPhaseTransportProps | Defines properties on both phase boundaries, needed in the two phase region |
PhaseBoundaryProperties | Thermodynamic base properties on the phase boundary |
NewtonDerivatives_ph | Derivatives for fast inverse calculations of Helmholtz functions: p & h |
NewtonDerivatives_ps | Derivatives for fast inverse calculation of Helmholtz functions: p & s |
NewtonDerivatives_pT | Derivatives for fast inverse calculations of Helmholtz functions:p & T |
ExtraDerivatives | Additional thermodynamic derivatives |
BridgmansTables | Calculates all entries in Bridgmans tables if first seven variables given |
FundamentalConstants | Constants of the medium |
AuxiliaryProperties | Intermediate property data record |
GibbsDerivs2 | Derivatives of Gibbs function w.r.t. pressure and temperature |
NewtonDerivatives_dT | Derivatives for fast inverse calculations of Gibbs function |
gibbsToBridgmansTables | Calculates base coefficients for Bridgman's tables from gibbs enthalpy |
helmholtzToBridgmansTables | Calculates base coefficients for Bridgmans tables from Helmholtz energy |
gibbsToBoundaryProps | Calculate phase boundary property record from dimensionless Gibbs function |
helmholtzToBoundaryProps | Calculate phase boundary property record from dimensionless Helmholtz function |
cv2Phase | Compute isochoric specific heat capacity inside the two-phase region |
cvdpT2Phase | Compute isochoric specific heat capacity inside the two-phase region and derivative of pressure w.r.t. temperature |
gibbsToExtraDerivs | Compute additional thermodynamic derivatives from dimensionless Gibbs function |
helmholtzToExtraDerivs | Compute additional thermodynamic derivatives from dimensionless Helmholtz function |
Helmholtz_ph | Function to calculate analytic derivatives for computing d and t given p and h |
Helmholtz_pT | Function to calculate analytic derivatives for computing d and t given p and t |
Helmholtz_ps | Function to calculate analytic derivatives for computing d and t given p and s |
smoothStep | Approximation of a general step, such that the characteristic is continuous and differentiable |
Gibbs2_ph | Function to calculate analytic derivatives for computing T given p and h |
Gibbs2_dT | Function to calculate analytic derivatives for computing p given d and T |
Gibbs2_ps | Function to calculate analytic derivatives for computing d and t given p and s |
OneNonLinearEquation | Determine solution of a non-linear algebraic equation in one unknown without derivatives in a reliable and efficient way |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Name | Description |
---|---|
quantity | |
unit |
Important: the phase equilibrium conditions are not yet considered. this means that Bridgman's tables do not yet work in the two phase region. Some derivatives are 0 or infinity anyways. Idea: Do not 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 always a d to remind of differentiation.
Example 1: Get the derivative of specific entropy s w.r.t. Temperature at constant specific volume (between 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).
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
v | Specific volume [m3/kg] |
p | Pressure [Pa] |
T | Temperature [K] |
s | Specific entropy [J/(kg.K)] |
cp | Heat capacity at constant pressure [J/(kg.K)] |
alpha | Isobaric volume expansion coefficient [1/K] |
gamma | Isothermal compressibility [1/Pa] |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
v | Specific volume [m3/kg] |
p | Pressure [Pa] |
T | Temperature [K] |
s | Specific entropy [J/(kg.K)] |
cp | Heat capacity at constant pressure [J/(kg.K)] |
alpha | Isobaric volume expansion coefficient [1/K] |
gamma | Isothermal compressibility [1/Pa] |
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
sat | Phase boundary properties |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
sat | Phase boundary property record |
Name | Description |
---|---|
liq | Properties on the boiling curve |
vap | Properties on the condensation curve |
x | Vapour mass fraction [1] |
T | Temperature [K] |
p | Properties [Pa] |
Name | Description |
---|---|
cv | Isochoric specific heat capacity [J/(kg.K)] |
Name | Description |
---|---|
liq | Properties on the boiling curve |
vap | Properties on the condensation curve |
x | Vapour mass fraction [1] |
T | Temperature [K] |
p | Properties [Pa] |
Name | Description |
---|---|
cv | Isochoric specific heat capacity [J/(kg.K)] |
dpT | Derivative of pressure w.r.t. temperature |
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
dpro | Additional property derivatives |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
dpro | Additional property derivatives |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to calculate d and t from p and h |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to compute d and t from p and t |
Name | Description |
---|---|
f | Dimensionless derivatives of Helmholtz function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to compute d and t from p and s |
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 = 1Extends from Modelica.Icons.Function (Icon for functions).
Name | Description |
---|---|
x | Abscissa value |
y1 | Ordinate value for x > 0 |
y2 | Ordinate value for x < 0 |
x_small | Approximation of step for -x_small <= x <= x_small; x_small > 0 required |
Name | Description |
---|---|
y | Ordinate value to approximate y = if x > 0 then y1 else y2 |
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to calculate d and t from p and h |
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to compute p from d and T |
Name | Description |
---|---|
g | Dimensionless derivatives of Gibbs function |
Name | Description |
---|---|
nderivs | Derivatives for Newton iteration to compute T from p and s |