This model calculates medium properties for an ideal gas of a single substance, or for an ideal gas consisting of several substances where the mass fractions are fixed. Independent variables are temperature T and pressure p. Only density is a function of T and p. All other quantities are solely a function of T. The properties are valid in the range:
200 K ≤ T ≤ 6000 K
The following quantities are always computed:
Variable | Unit | Description |
h | J/kg | specific enthalpy h = h(T) |
u | J/kg | specific internal energy u = u(T) |
d | kg/m^3 | density d = d(p,T) |
For the other variables, see the functions in Modelica.Media.IdealGases.Common.SingleGasNasa. Note, dynamic viscosity and thermal conductivity are only provided for gases that use a data record from Modelica.Media.IdealGases.FluidData. Currently these are the following gases:
Ar C2H2_vinylidene C2H4 C2H5OH C2H6 C3H6_propylene C3H7OH C3H8 C4H8_1_butene C4H9OH C4H10_n_butane C5H10_1_pentene C5H12_n_pentane C6H6 C6H12_1_hexene C6H14_n_heptane C7H14_1_heptene C8H10_ethylbenz CH3OH CH4 CL2 CO CO2 F2 H2 H2O He N2 N2O NH3 NO O2 SO2 SO3
Sources for model and literature:
Original Data: Computer program for calculation of complex chemical
equilibrium compositions and applications. Part 1: Analysis
Document ID: 19950013764 N (95N20180) File Series: NASA Technical Reports
Report Number: NASA-RP-1311 E-8017 NAS 1.61:1311
Authors: Gordon, Sanford (NASA Lewis Research Center)
Mcbride, Bonnie J. (NASA Lewis Research Center)
Published: Oct 01, 1994.
Known limits of validity: The data is valid for temperatures between 200 K and 6000 K. A few of the data sets for monatomic gases have a discontinuous 1st derivative at 1000 K, but this never caused problems so far.
This model has been copied from the ThermoFluid library and adapted to the Modelica.Media package.
Extends from Interfaces.PartialPureSubstance (base class for pure substances of one chemical substance).
Name | Description |
---|---|
ThermodynamicState | thermodynamic state variables for ideal gases |
FluidConstants | Extended fluid constants |
excludeEnthalpyOfFormation=true | If true, enthalpy of formation Hf is not included in specific enthalpy h |
referenceChoice=Choices.ReferenceEnthalpy.ZeroAt0K | Choice of reference enthalpy |
h_offset=0.0 | User defined offset for reference enthalpy, if referenceChoice = UserDefined |
data | Data record of ideal gas substance |
fluidConstants | constant data for the fluid |
BaseProperties | Base properties of ideal gas medium |
setState_pTX | Return thermodynamic state as function of p, T and composition X |
setState_phX | Return thermodynamic state as function of p, h and composition X |
setState_psX | Return thermodynamic state as function of p, s and composition X |
setState_dTX | Return thermodynamic state as function of d, T and composition X |
setSmoothState | Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b |
pressure | return pressure of ideal gas |
temperature | return temperature of ideal gas |
density | return density of ideal gas |
specificEnthalpy | Return specific enthalpy |
specificInternalEnergy | Return specific internal energy |
specificEntropy | Return specific entropy |
specificGibbsEnergy | Return specific Gibbs energy |
specificHelmholtzEnergy | Return specific Helmholtz energy |
specificHeatCapacityCp | Return specific heat capacity at constant pressure |
specificHeatCapacityCv | Compute specific heat capacity at constant volume from temperature and gas data |
isentropicExponent | Return isentropic exponent |
velocityOfSound | Return velocity of sound |
isentropicEnthalpyApproximation | approximate method of calculating h_is from upstream properties and downstream pressure |
isentropicEnthalpy | Return isentropic enthalpy |
isobaricExpansionCoefficient | Returns overall the isobaric expansion coefficient beta |
isothermalCompressibility | Returns overall the isothermal compressibility factor |
density_derp_T | Returns the partial derivative of density with respect to pressure at constant temperature |
density_derT_p | Returns the partial derivative of density with respect to temperature at constant pressure |
density_derX | Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature |
cp_T | Compute specific heat capacity at constant pressure from temperature and gas data |
cp_Tlow | Compute specific heat capacity at constant pressure, low T region |
cp_Tlow_der | Compute specific heat capacity at constant pressure, low T region |
h_T | Compute specific enthalpy from temperature and gas data; reference is decided by the refChoice input, or by the referenceChoice package constant by default |
h_T_der | derivative function for h_T |
h_Tlow | Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default |
h_Tlow_der | Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default |
s0_T | Compute specific entropy from temperature and gas data |
s0_Tlow | Compute specific entropy, low T region |
dynamicViscosityLowPressure | Dynamic viscosity of low pressure gases |
dynamicViscosity | dynamic viscosity |
thermalConductivityEstimate | Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation) |
thermalConductivity | thermal conductivity of gas |
molarMass | return the molar mass of the medium |
T_h | Compute temperature from specific enthalpy |
T_ps | Compute temperature from pressure and specific entropy |
Inherited | |
setState_pT | Return thermodynamic state from p and T |
setState_ph | Return thermodynamic state from p and h |
setState_ps | Return thermodynamic state from p and s |
setState_dT | Return thermodynamic state from d and T |
density_ph | Return density from p and h |
temperature_ph | Return temperature from p and h |
pressure_dT | Return pressure from d and T |
specificEnthalpy_dT | Return specific enthalpy from d and T |
specificEnthalpy_ps | Return specific enthalpy from p and s |
temperature_ps | Return temperature from p and s |
density_ps | Return density from p and s |
specificEnthalpy_pT | Return specific enthalpy from p and T |
density_pT | Return density from p and T |
ThermoStates | Enumeration type for independent variables |
mediumName="unusablePartialMedium" | Name of the medium |
substanceNames={mediumName} | Names of the mixture substances. Set substanceNames={mediumName} if only one substance. |
extraPropertiesNames=fill("", 0) | Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused |
singleState | = true, if u and d are not a function of pressure |
reducedX=true | = true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details) |
fixedX=false | = true if medium contains the equation X = reference_X |
reference_p=101325 | Reference pressure of Medium: default 1 atmosphere |
reference_T=298.15 | Reference temperature of Medium: default 25 deg Celsius |
reference_X=fill(1/nX, nX) | Default mass fractions of medium |
p_default=101325 | Default value for pressure of medium (for initialization) |
T_default=Modelica.SIunits.Conversions.from_degC(20) | Default value for temperature of medium (for initialization) |
h_default=specificEnthalpy_pTX(p_default, T_default, X_default) | Default value for specific enthalpy of medium (for initialization) |
X_default=reference_X | Default value for mass fractions of medium (for initialization) |
nS=size(substanceNames, 1) | Number of substances |
nX=nS | Number of mass fractions |
nXi=if fixedX then 0 else if reducedX then nS - 1 else nS | Number of structurally independent mass fractions (see docu for details) |
nC=size(extraPropertiesNames, 1) | Number of extra (outside of standard mass-balance) transported properties |
C_nominal=1.0e-6*ones(nC) | Default for the nominal values for the extra properties |
prandtlNumber | Return the Prandtl number |
heatCapacity_cp | alias for deprecated name |
heatCapacity_cv | alias for deprecated name |
beta | alias for isobaricExpansionCoefficient for user convenience |
kappa | alias of isothermalCompressibility for user convenience |
density_derp_h | Return density derivative w.r.t. pressure at const specific enthalpy |
density_derh_p | Return density derivative w.r.t. specific enthalpy at constant pressure |
specificEnthalpy_pTX | Return specific enthalpy from p, T, and X or Xi |
specificEntropy_pTX | Return specific enthalpy from p, T, and X or Xi |
density_pTX | Return density from p, T, and X or Xi |
temperature_phX | Return temperature from p, h, and X or Xi |
density_phX | Return density from p, h, and X or Xi |
temperature_psX | Return temperature from p,s, and X or Xi |
density_psX | Return density from p, s, and X or Xi |
specificEnthalpy_psX | Return specific enthalpy from p, s, and X or Xi |
AbsolutePressure | Type for absolute pressure with medium specific attributes |
Density | Type for density with medium specific attributes |
DynamicViscosity | Type for dynamic viscosity with medium specific attributes |
EnthalpyFlowRate | Type for enthalpy flow rate with medium specific attributes |
MassFlowRate | Type for mass flow rate with medium specific attributes |
MassFraction | Type for mass fraction with medium specific attributes |
MoleFraction | Type for mole fraction with medium specific attributes |
MolarMass | Type for molar mass with medium specific attributes |
MolarVolume | Type for molar volume with medium specific attributes |
IsentropicExponent | Type for isentropic exponent with medium specific attributes |
SpecificEnergy | Type for specific energy with medium specific attributes |
SpecificInternalEnergy | Type for specific internal energy with medium specific attributes |
SpecificEnthalpy | Type for specific enthalpy with medium specific attributes |
SpecificEntropy | Type for specific entropy with medium specific attributes |
SpecificHeatCapacity | Type for specific heat capacity with medium specific attributes |
SurfaceTension | Type for surface tension with medium specific attributes |
Temperature | Type for temperature with medium specific attributes |
ThermalConductivity | Type for thermal conductivity with medium specific attributes |
PrandtlNumber | Type for Prandtl number with medium specific attributes |
VelocityOfSound | Type for velocity of sound with medium specific attributes |
ExtraProperty | Type for unspecified, mass-specific property transported by flow |
CumulativeExtraProperty | Type for conserved integral of unspecified, mass specific property |
ExtraPropertyFlowRate | Type for flow rate of unspecified, mass-specific property |
IsobaricExpansionCoefficient | Type for isobaric expansion coefficient with medium specific attributes |
DipoleMoment | Type for dipole moment with medium specific attributes |
DerDensityByPressure | Type for partial derivative of density with resect to pressure with medium specific attributes |
DerDensityByEnthalpy | Type for partial derivative of density with resect to enthalpy with medium specific attributes |
DerEnthalpyByPressure | Type for partial derivative of enthalpy with resect to pressure with medium specific attributes |
DerDensityByTemperature | Type for partial derivative of density with resect to temperature with medium specific attributes |
Choices | Types, constants to define menu choices |
constant Boolean excludeEnthalpyOfFormation=true "If true, enthalpy of formation Hf is not included in specific enthalpy h";
constant ReferenceEnthalpy referenceChoice=Choices. ReferenceEnthalpy.ZeroAt0K "Choice of reference enthalpy";
constant SpecificEnthalpy h_offset=0.0 "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
constant IdealGases.Common.DataRecord data "Data record of ideal gas substance";
constant FluidConstants[nS] fluidConstants "constant data for the fluid";
redeclare record extends ThermodynamicState "thermodynamic state variables for ideal gases" AbsolutePressure p "Absolute pressure of medium"; Temperature T "Temperature of medium"; end ThermodynamicState;
redeclare record extends FluidConstants "Extended fluid constants" Temperature criticalTemperature "critical temperature"; AbsolutePressure criticalPressure "critical pressure"; MolarVolume criticalMolarVolume "critical molar Volume"; Real acentricFactor "Pitzer acentric factor"; Temperature triplePointTemperature "triple point temperature"; AbsolutePressure triplePointPressure "triple point pressure"; Temperature meltingPoint "melting point at 101325 Pa"; Temperature normalBoilingPoint "normal boiling point (at 101325 Pa)"; DipoleMoment dipoleMoment "dipole moment of molecule in Debye (1 debye = 3.33564e10-30 C.m)"; Boolean hasIdealGasHeatCapacity=false "true if ideal gas heat capacity is available"; Boolean hasCriticalData=false "true if critical data are known"; Boolean hasDipoleMoment=false "true if a dipole moment known"; Boolean hasFundamentalEquation=false "true if a fundamental equation"; Boolean hasLiquidHeatCapacity=false "true if liquid heat capacity is available"; Boolean hasSolidHeatCapacity=false "true if solid heat capacity is available"; Boolean hasAccurateViscosityData=false "true if accurate data for a viscosity function is available"; Boolean hasAccurateConductivityData=false "true if accurate data for thermal conductivity is available"; Boolean hasVapourPressureCurve=false "true if vapour pressure data, e.g., Antoine coefficents are known"; Boolean hasAcentricFactor=false "true if Pitzer accentric factor is known"; SpecificEnthalpy HCRIT0=0.0 "Critical specific enthalpy of the fundamental equation"; SpecificEntropy SCRIT0=0.0 "Critical specific entropy of the fundamental equation"; SpecificEnthalpy deltah=0.0 "Difference between specific enthalpy model (h_m) and f.eq. (h_f) (h_m - h_f)"; SpecificEntropy deltas=0.0 "Difference between specific enthalpy model (s_m) and f.eq. (s_f) (s_m - s_f)"; end FluidConstants;
Type | Name | Default | Description |
---|---|---|---|
Advanced | |||
Boolean | preferredMediumStates | false | = true if StateSelect.prefer shall be used for the independent property variables of the medium |
redeclare model extends BaseProperties( T(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default), p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)) "Base properties of ideal gas medium" equation assert(T >= 200 and T <= 6000, " Temperature T (= " + String(T) + " K) is not in the allowed range 200 K <= T <= 6000 K required from medium model \"" + mediumName + "\". "); MM = data.MM; R = data.R; h = h_T(data, T, excludeEnthalpyOfFormation, referenceChoice, h_offset); u = h - R*T; // Has to be written in the form d=f(p,T) in order that static // state selection for p and T is possible d = p/(R*T); // connect state with BaseProperties state.T = T; state.p = p; end BaseProperties;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p | Pressure [Pa] | |
Temperature | T | Temperature [K] | |
MassFraction | X[:] | reference_X | Mass fractions [kg/kg] |
Type | Name | Description |
---|---|---|
ThermodynamicState | state |
redeclare function setState_pTX "Return thermodynamic state as function of p, T and composition X" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input Temperature T "Temperature"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state; algorithm state := ThermodynamicState(p=p,T=T); end setState_pTX;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p | Pressure [Pa] | |
SpecificEnthalpy | h | Specific enthalpy [J/kg] | |
MassFraction | X[:] | reference_X | Mass fractions [kg/kg] |
Type | Name | Description |
---|---|---|
ThermodynamicState | state |
redeclare function setState_phX "Return thermodynamic state as function of p, h and composition X" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEnthalpy h "Specific enthalpy"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state; algorithm state := ThermodynamicState(p=p,T=T_h(h)); end setState_phX;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p | Pressure [Pa] | |
SpecificEntropy | s | Specific entropy [J/(kg.K)] | |
MassFraction | X[:] | reference_X | Mass fractions [kg/kg] |
Type | Name | Description |
---|---|---|
ThermodynamicState | state |
redeclare function setState_psX "Return thermodynamic state as function of p, s and composition X" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEntropy s "Specific entropy"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state; algorithm state := ThermodynamicState(p=p,T=T_ps(p,s)); end setState_psX;
Type | Name | Default | Description |
---|---|---|---|
Density | d | density [kg/m3] | |
Temperature | T | Temperature [K] | |
MassFraction | X[:] | reference_X | Mass fractions [kg/kg] |
Type | Name | Description |
---|---|---|
ThermodynamicState | state |
redeclare function setState_dTX "Return thermodynamic state as function of d, T and composition X" extends Modelica.Icons.Function; input Density d "density"; input Temperature T "Temperature"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state; algorithm state := ThermodynamicState(p=d*data.R*T,T=T); end setState_dTX;
Type | Name | Default | Description |
---|---|---|---|
Real | x | m_flow or dp | |
ThermodynamicState | state_a | Thermodynamic state if x > 0 | |
ThermodynamicState | state_b | Thermodynamic state if x < 0 | |
Real | x_small | Smooth transition in the region -x_small < x < x_small |
Type | Name | Description |
---|---|---|
ThermodynamicState | state | Smooth thermodynamic state for all x (continuous and differentiable) |
redeclare function extends setSmoothState "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" algorithm state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small)); end setSmoothState;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
AbsolutePressure | p | Pressure [Pa] |
redeclare function extends pressure "return pressure of ideal gas" algorithm p := state.p; end pressure;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
Temperature | T | Temperature [K] |
redeclare function extends temperature "return temperature of ideal gas" algorithm T := state.T; end temperature;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
Density | d | Density [kg/m3] |
redeclare function extends density "return density of ideal gas" algorithm d := state.p/(data.R*state.T); end density;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificEnthalpy | h | Specific enthalpy [J/kg] |
redeclare function extends specificEnthalpy "Return specific enthalpy" extends Modelica.Icons.Function; algorithm h := h_T(data,state.T); end specificEnthalpy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificEnergy | u | Specific internal energy [J/kg] |
redeclare function extends specificInternalEnergy "Return specific internal energy" extends Modelica.Icons.Function; algorithm u := h_T(data,state.T) - data.R*state.T; end specificInternalEnergy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificEntropy | s | Specific entropy [J/(kg.K)] |
redeclare function extends specificEntropy "Return specific entropy" extends Modelica.Icons.Function; algorithm s := s0_T(data, state.T) - data.R*Modelica.Math.log(state.p/reference_p); end specificEntropy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificEnergy | g | Specific Gibbs energy [J/kg] |
redeclare function extends specificGibbsEnergy "Return specific Gibbs energy" extends Modelica.Icons.Function; algorithm g := h_T(data,state.T) - state.T*specificEntropy(state); end specificGibbsEnergy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificEnergy | f | Specific Helmholtz energy [J/kg] |
redeclare function extends specificHelmholtzEnergy "Return specific Helmholtz energy" extends Modelica.Icons.Function; algorithm f := h_T(data,state.T) - data.R*state.T - state.T*specificEntropy(state); end specificHelmholtzEnergy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificHeatCapacity | cp | Specific heat capacity at constant pressure [J/(kg.K)] |
redeclare function extends specificHeatCapacityCp "Return specific heat capacity at constant pressure" algorithm cp := cp_T(data, state.T); end specificHeatCapacityCp;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
SpecificHeatCapacity | cv | Specific heat capacity at constant volume [J/(kg.K)] |
redeclare function extends specificHeatCapacityCv "Compute specific heat capacity at constant volume from temperature and gas data" algorithm cv := cp_T(data, state.T) - data.R; end specificHeatCapacityCv;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
IsentropicExponent | gamma | Isentropic exponent [1] |
redeclare function extends isentropicExponent "Return isentropic exponent" algorithm gamma := specificHeatCapacityCp(state)/specificHeatCapacityCv(state); end isentropicExponent;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
VelocityOfSound | a | Velocity of sound [m/s] |
redeclare function extends velocityOfSound "Return velocity of sound" extends Modelica.Icons.Function; algorithm a := sqrt(max(0,data.R*state.T*cp_T(data, state.T)/specificHeatCapacityCv(state))); end velocityOfSound;
Type | Name | Default | Description |
---|---|---|---|
Pressure | p2 | downstream pressure [Pa] | |
ThermodynamicState | state | properties at upstream location | |
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
Type | Name | Description |
---|---|---|
SpecificEnthalpy | h_is | isentropic enthalpy [J/kg] |
function isentropicEnthalpyApproximation "approximate method of calculating h_is from upstream properties and downstream pressure" extends Modelica.Icons.Function; input SI.Pressure p2 "downstream pressure"; input ThermodynamicState state "properties at upstream location"; input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; output SI.SpecificEnthalpy h_is "isentropic enthalpy"; protected IsentropicExponent gamma = isentropicExponent(state) "Isentropic exponent"; algorithm h_is := h_T(data,state.T,exclEnthForm,refChoice,h_off) + gamma/(gamma - 1.0)*state.p/density(state)*((p2/state.p)^((gamma - 1)/gamma) - 1.0); end isentropicEnthalpyApproximation;
Type | Name | Default | Description |
---|---|---|---|
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
AbsolutePressure | p_downstream | downstream pressure [Pa] | |
ThermodynamicState | refState | reference state for entropy |
Type | Name | Description |
---|---|---|
SpecificEnthalpy | h_is | Isentropic enthalpy [J/kg] |
redeclare function extends isentropicEnthalpy "Return isentropic enthalpy" input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; algorithm h_is := isentropicEnthalpyApproximation(p_downstream,refState,exclEnthForm,refChoice,h_off); end isentropicEnthalpy;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
IsobaricExpansionCoefficient | beta | Isobaric expansion coefficient [1/K] |
redeclare function extends isobaricExpansionCoefficient "Returns overall the isobaric expansion coefficient beta" algorithm beta := 1/state.T; end isobaricExpansionCoefficient;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
IsothermalCompressibility | kappa | Isothermal compressibility [1/Pa] |
redeclare function extends isothermalCompressibility "Returns overall the isothermal compressibility factor" algorithm kappa := 1.0/state.p; end isothermalCompressibility;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
DerDensityByPressure | ddpT | Density derivative w.r.t. pressure [s2/m2] |
redeclare function extends density_derp_T "Returns the partial derivative of density with respect to pressure at constant temperature" algorithm ddpT := 1/(state.T*data.R); end density_derp_T;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
DerDensityByTemperature | ddTp | Density derivative w.r.t. temperature [kg/(m3.K)] |
redeclare function extends density_derT_p "Returns the partial derivative of density with respect to temperature at constant pressure" algorithm ddTp := -state.p/(state.T*state.T*data.R); end density_derT_p;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
Density | dddX[nX] | Derivative of density w.r.t. mass fraction [kg/m3] |
redeclare function extends density_derX "Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature" algorithm dddX := fill(0,nX); end density_derX;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] |
Type | Name | Description |
---|---|---|
SpecificHeatCapacity | cp | Specific heat capacity at temperature T [J/(kg.K)] |
function cp_T "Compute specific heat capacity at constant pressure from temperature and gas data" extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; output SI.SpecificHeatCapacity cp "Specific heat capacity at temperature T"; algorithm cp := smooth(0,if T < data.Tlimit then data.R*(1/(T*T)*(data.alow[1] + T*( data.alow[2] + T*(1.*data.alow[3] + T*(data.alow[4] + T*(data.alow[5] + T *(data.alow[6] + data.alow[7]*T))))))) else data.R*(1/(T*T)*(data.ahigh[1] + T*(data.ahigh[2] + T*(1.*data.ahigh[3] + T*(data.ahigh[4] + T*(data. ahigh[5] + T*(data.ahigh[6] + data.ahigh[7]*T))))))));end cp_T;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] |
Type | Name | Description |
---|---|---|
SpecificHeatCapacity | cp | Specific heat capacity at temperature T [J/(kg.K)] |
function cp_Tlow "Compute specific heat capacity at constant pressure, low T region" annotation(derivative=cp_Tlow_der); extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; output SI.SpecificHeatCapacity cp "Specific heat capacity at temperature T"; algorithm cp := data.R*(1/(T*T)*(data.alow[1] + T*( data.alow[2] + T*(1.*data.alow[3] + T*(data.alow[4] + T*(data.alow[5] + T *(data.alow[6] + data.alow[7]*T)))))));end cp_Tlow;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] | |
Real | dT | Temperature derivative |
Type | Name | Description |
---|---|---|
Real | cp_der | Derivative of specific heat capacity |
function cp_Tlow_der "Compute specific heat capacity at constant pressure, low T region" extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; input Real dT "Temperature derivative"; output Real cp_der "Derivative of specific heat capacity"; algorithm cp_der := dT*data.R/(T*T*T)*(-2*data.alow[1] + T*( -data.alow[2] + T*T*(data.alow[4] + T*(2.*data.alow[5] + T *(3.*data.alow[6] + 4.*data.alow[7]*T))))); end cp_Tlow_der;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] | |
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
Type | Name | Description |
---|---|---|
SpecificEnthalpy | h | Specific enthalpy at temperature T [J/kg] |
function h_T "Compute specific enthalpy from temperature and gas data; reference is decided by the refChoice input, or by the referenceChoice package constant by default" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input Choices.ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SI.SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; output SI.SpecificEnthalpy h "Specific enthalpy at temperature T"; // annotation (InlineNoEvent=false, Inline=false, // derivative(zeroDerivative=data, // zeroDerivative=exclEnthForm, // zeroDerivative=refChoice, // zeroDerivative=h_off) = h_T_der); algorithm h := smooth(0,(if T < data.Tlimit then data.R*((-data.alow[1] + T*(data. blow[1] + data.alow[2]*Math.log(T) + T*(1.*data.alow[3] + T*(0.5*data. alow[4] + T*(1/3*data.alow[5] + T*(0.25*data.alow[6] + 0.2*data.alow[7]*T)))))) /T) else data.R*((-data.ahigh[1] + T*(data.bhigh[1] + data.ahigh[2]* Math.log(T) + T*(1.*data.ahigh[3] + T*(0.5*data.ahigh[4] + T*(1/3*data. ahigh[5] + T*(0.25*data.ahigh[6] + 0.2*data.ahigh[7]*T))))))/T)) + (if exclEnthForm then -data.Hf else 0.0) + (if (refChoice == Choices.ReferenceEnthalpy.ZeroAt0K) then data.H0 else 0.0) + (if refChoice == Choices.ReferenceEnthalpy.UserDefined then h_off else 0.0));end h_T;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] | |
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
Real | dT | Temperature derivative |
Type | Name | Description |
---|---|---|
Real | h_der | Specific enthalpy at temperature T |
function h_T_der "derivative function for h_T" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input Choices.ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SI.SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; input Real dT "Temperature derivative"; output Real h_der "Specific enthalpy at temperature T"; algorithm h_der := dT*cp_T(data,T); end h_T_der;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] | |
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
Type | Name | Description |
---|---|---|
SpecificEnthalpy | h | Specific enthalpy at temperature T [J/kg] |
function h_Tlow "Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input Choices.ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SI.SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; output SI.SpecificEnthalpy h "Specific enthalpy at temperature T"; // annotation (Inline=false,InlineNoEvent=false, derivative(zeroDerivative=data, // zeroDerivative=exclEnthForm, // zeroDerivative=refChoice, // zeroDerivative=h_off) = h_Tlow_der); algorithm h := data.R*((-data.alow[1] + T*(data. blow[1] + data.alow[2]*Math.log(T) + T*(1.*data.alow[3] + T*(0.5*data. alow[4] + T*(1/3*data.alow[5] + T*(0.25*data.alow[6] + 0.2*data.alow[7]*T)))))) /T) + (if exclEnthForm then -data.Hf else 0.0) + (if (refChoice == Choices.ReferenceEnthalpy.ZeroAt0K) then data.H0 else 0.0) + (if refChoice == Choices.ReferenceEnthalpy.UserDefined then h_off else 0.0);end h_Tlow;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] | |
Boolean | exclEnthForm | excludeEnthalpyOfFormation | If true, enthalpy of formation Hf is not included in specific enthalpy h |
ReferenceEnthalpy | refChoice | referenceChoice | Choice of reference enthalpy |
SpecificEnthalpy | h_off | h_offset | User defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg] |
Real | dT | Temperature derivative [K/s] |
Type | Name | Description |
---|---|---|
Real | h_der | Derivative of specific enthalpy at temperature T [J/(kg.s)] |
function h_Tlow_der "Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; input Boolean exclEnthForm=excludeEnthalpyOfFormation "If true, enthalpy of formation Hf is not included in specific enthalpy h"; input Choices.ReferenceEnthalpy refChoice=referenceChoice "Choice of reference enthalpy"; input SI.SpecificEnthalpy h_off=h_offset "User defined offset for reference enthalpy, if referenceChoice = UserDefined"; input Real dT(unit="K/s") "Temperature derivative"; output Real h_der(unit="J/(kg.s)") "Derivative of specific enthalpy at temperature T"; algorithm h_der := dT*cp_Tlow(data,T); end h_Tlow_der;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] |
Type | Name | Description |
---|---|---|
SpecificEntropy | s | Specific entropy at temperature T [J/(kg.K)] |
function s0_T "Compute specific entropy from temperature and gas data" extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; output SI.SpecificEntropy s "Specific entropy at temperature T"; algorithm s := noEvent(if T < data.Tlimit then data.R*(data.blow[2] - 0.5*data.alow[ 1]/(T*T) - data.alow[2]/T + data.alow[3]*Math.log(T) + T*( data.alow[4] + T*(0.5*data.alow[5] + T*(1/3*data.alow[6] + 0.25*data.alow[ 7]*T)))) else data.R*(data.bhigh[2] - 0.5*data.ahigh[1]/(T*T) - data. ahigh[2]/T + data.ahigh[3]*Math.log(T) + T*(data.ahigh[4] + T*(0.5*data.ahigh[5] + T*(1/3*data.ahigh[6] + 0.25*data.ahigh[7]*T)))));end s0_T;
Type | Name | Default | Description |
---|---|---|---|
DataRecord | data | Ideal gas data | |
Temperature | T | Temperature [K] |
Type | Name | Description |
---|---|---|
SpecificEntropy | s | Specific entropy at temperature T [J/(kg.K)] |
function s0_Tlow "Compute specific entropy, low T region" extends Modelica.Icons.Function; input IdealGases.Common.DataRecord data "Ideal gas data"; input SI.Temperature T "Temperature"; output SI.SpecificEntropy s "Specific entropy at temperature T"; algorithm s := data.R*(data.blow[2] - 0.5*data.alow[ 1]/(T*T) - data.alow[2]/T + data.alow[3]*Math.log(T) + T*( data.alow[4] + T*(0.5*data.alow[5] + T*(1/3*data.alow[6] + 0.25*data.alow[ 7]*T))));end s0_Tlow;
The used formula are based on the method of Chung et al (1984, 1988) referred to in ref [1] chapter 9. The formula 9-4.10 is the one being used. The Formula is given in non-SI units, the follwong onversion constants were used to transform the formula to SI units:
[1] Bruce E. Poling, John E. Prausnitz, John P. O'Connell, "The Properties of Gases and Liquids" 5th Ed. Mc Graw Hill.
T. Skoglund, Lund, Sweden, 2004-08-31
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
Temp_K | T | Gas temperature [K] | |
Temp_K | Tc | Critical temperature of gas [K] | |
MolarMass | M | Molar mass of gas [kg/mol] | |
MolarVolume | Vc | Critical molar volume of gas [m3/mol] | |
Real | w | Acentric factor of gas | |
DipoleMoment | mu | Dipole moment of gas molecule [debye] | |
Real | k | 0.0 | Special correction for highly polar substances |
Type | Name | Description |
---|---|---|
DynamicViscosity | eta | Dynamic viscosity of gas [Pa.s] |
function dynamicViscosityLowPressure "Dynamic viscosity of low pressure gases" extends Modelica.Icons.Function; input SI.Temp_K T "Gas temperature"; input SI.Temp_K Tc "Critical temperature of gas"; input SI.MolarMass M "Molar mass of gas"; input SI.MolarVolume Vc "Critical molar volume of gas"; input Real w "Acentric factor of gas"; input DipoleMoment mu "Dipole moment of gas molecule"; input Real k = 0.0 "Special correction for highly polar substances"; output SI.DynamicViscosity eta "Dynamic viscosity of gas"; protected parameter Real Const1_SI=40.785*10^(-9.5) "Constant in formula for eta converted to SI units"; parameter Real Const2_SI=131.3/1000.0 "Constant in formula for mur converted to SI units"; Real mur=Const2_SI*mu/sqrt(Vc*Tc) "Dimensionless dipole moment of gas molecule"; Real Fc=1 - 0.2756*w + 0.059035*mur^4 + k "Factor to account for molecular shape and polarities of gas"; Real Tstar "Dimensionless temperature defined by equation below"; Real Ov "Viscosity collision integral for the gas"; algorithm Tstar := 1.2593*T/Tc; Ov := 1.16145*Tstar^(-0.14874) + 0.52487*exp(-0.7732*Tstar) + 2.16178*exp(-2.43787 *Tstar); eta := Const1_SI*Fc*sqrt(M*T)/(Vc^(2/3)*Ov);end dynamicViscosityLowPressure;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
DynamicViscosity | eta | Dynamic viscosity [Pa.s] |
redeclare replaceable function extends dynamicViscosity "dynamic viscosity" algorithm assert(fluidConstants[1].hasCriticalData, "Failed to compute dynamicViscosity: For the species \"" + mediumName + "\" no critical data is available."); assert(fluidConstants[1].hasDipoleMoment, "Failed to compute dynamicViscosity: For the species \"" + mediumName + "\" no critical data is available."); eta := dynamicViscosityLowPressure(state.T, fluidConstants[1].criticalTemperature, fluidConstants[1].molarMass, fluidConstants[1].criticalMolarVolume, fluidConstants[1].acentricFactor, fluidConstants[1].dipoleMoment);end dynamicViscosity;
This function provides two similar methods for estimating the
thermal conductivity of polyatomic gases.
The Eucken method (input method == 1) gives good results for low temperatures,
but it tends to give an underestimated value of the thermal conductivity
(lambda) at higher temperatures.
The Modified Eucken method (input method == 2) gives good results for
high-temperatures, but it tends to give an overestimated value of the
thermal conductivity (lambda) at low temperatures.
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
SpecificHeatCapacity | Cp | Constant pressure heat capacity [J/(kg.K)] | |
DynamicViscosity | eta | Dynamic viscosity [Pa.s] | |
Integer | method | 1 | 1: Eucken Method, 2: Modified Eucken Method |
Type | Name | Description |
---|---|---|
ThermalConductivity | lambda | Thermal conductivity [W/(m.k)] [W/(m.K)] |
function thermalConductivityEstimate "Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation)" extends Modelica.Icons.Function; input SpecificHeatCapacity Cp "Constant pressure heat capacity"; input DynamicViscosity eta "Dynamic viscosity"; input Integer method(min=1,max=2)=1 "1: Eucken Method, 2: Modified Eucken Method"; output ThermalConductivity lambda "Thermal conductivity [W/(m.k)]"; algorithm lambda := if method == 1 then eta*(Cp - data.R + (9/4)*data.R) else eta*(Cp - data.R)*(1.32 + 1.77/((Cp/Modelica.Constants.R) - 1.0));end thermalConductivityEstimate;
Type | Name | Default | Description |
---|---|---|---|
Integer | method | 1 | 1: Eucken Method, 2: Modified Eucken Method |
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
ThermalConductivity | lambda | Thermal conductivity [W/(m.K)] |
redeclare replaceable function extends thermalConductivity "thermal conductivity of gas" input Integer method=1 "1: Eucken Method, 2: Modified Eucken Method"; algorithm assert(fluidConstants[1].hasCriticalData, "Failed to compute thermalConductivity: For the species \"" + mediumName + "\" no critical data is available."); lambda := thermalConductivityEstimate(specificHeatCapacityCp(state), dynamicViscosity(state), method=method);end thermalConductivity;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
MolarMass | MM | Mixture molar mass [kg/mol] |
redeclare function extends molarMass "return the molar mass of the medium" algorithm MM := data.MM; end molarMass;
Type | Name | Default | Description |
---|---|---|---|
SpecificEnthalpy | h | Specific enthalpy [J/kg] |
Type | Name | Description |
---|---|---|
Temperature | T | Temperature [K] |
function T_h "Compute temperature from specific enthalpy" input SpecificEnthalpy h "Specific enthalpy"; output Temperature T "Temperature"; protectedpackage Internal "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)" extends Modelica.Media.Common.OneNonLinearEquation; redeclare record extends f_nonlinear_Data "Data to be passed to non-linear function" extends Modelica.Media.IdealGases.Common.DataRecord; end f_nonlinear_Data; redeclare function extends f_nonlinear algorithm y := h_T(f_nonlinear_data,x); end f_nonlinear; // Dummy definition has to be added for current Dymola redeclare function extends solve end solve; end Internal ; algorithm T := Internal.solve(h, 200, 6000, 1.0e5, {1}, data); end T_h;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p | Pressure [Pa] | |
SpecificEntropy | s | Specific entropy [J/(kg.K)] |
Type | Name | Description |
---|---|---|
Temperature | T | Temperature [K] |
function T_ps "Compute temperature from pressure and specific entropy" input AbsolutePressure p "Pressure"; input SpecificEntropy s "Specific entropy"; output Temperature T "Temperature"; protectedpackage Internal "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)" extends Modelica.Media.Common.OneNonLinearEquation; redeclare record extends f_nonlinear_Data "Data to be passed to non-linear function" extends Modelica.Media.IdealGases.Common.DataRecord; end f_nonlinear_Data; redeclare function extends f_nonlinear algorithm y := s0_T(f_nonlinear_data,x)- data.R*Modelica.Math.log(p/reference_p); end f_nonlinear; // Dummy definition has to be added for current Dymola redeclare function extends solve end solve; end Internal ; algorithm T := Internal.solve(s, 200, 6000, p, {1}, data); end T_ps;