This model calculates the medium properties for single component ideal gases.
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. It has been developed by Hubertus Tummescheit.
Extends from Modelica.Media.Interfaces.PartialMixtureMedium (Base class for pure substances of several chemical substances).
Name | Description |
---|---|
ThermodynamicState | thermodynamic state variables |
FluidConstants | fluid constants |
data | Data records of ideal gas substances |
excludeEnthalpyOfFormation=true | If true, enthalpy of formation Hf is not included in specific enthalpy h |
referenceChoice=ReferenceEnthalpy.ZeroAt0K | Choice of reference enthalpy |
h_offset=0.0 | User defined offset for reference enthalpy, if referenceChoice = UserDefined |
MMX=data[:].MM | molar masses of components |
BaseProperties | Base properties (p, d, T, h, u, R, MM, X, and Xi of NASA mixture gas |
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 |
h_TX | Return specific enthalpy |
h_TX_der | Return specific enthalpy derivative |
gasConstant | Return gasConstant |
specificHeatCapacityCp | Return specific heat capacity at constant pressure |
specificHeatCapacityCv | Return specific heat capacity at constant volume from temperature and gas data |
MixEntropy | Return mixing entropy of ideal gases / R |
s_TX | Return temperature dependent part of the entropy, expects full entropy vector |
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 |
gasMixtureViscosity | Return viscosities of gas mixtures at low pressures (Wilke method) |
dynamicViscosity | Return mixture dynamic viscosity |
mixtureViscosityChung | Return the viscosity of gas mixtures without access to component viscosities (Chung, et. al. rules) |
lowPressureThermalConductivity | Return thermal conductivites of low-pressure gas mixtures (Mason and Saxena Modification) |
thermalConductivity | Return thermal conductivity for low pressure gas mixtures |
isobaricExpansionCoefficient | Return isobaric expansion coefficient beta |
isothermalCompressibility | Return isothermal compressibility factor |
density_derp_T | Return density derivative by pressure at constant temperature |
density_derT_p | Return density derivative by temperature at constant pressure |
density_derX | Return density derivative by mass fraction |
molarMass | Return molar mass of mixture |
T_hX | Return temperature from specific enthalpy and mass fraction |
T_psX | Return temperature from pressure, specific entropy and mass fraction |
Inherited | |
fluidConstants | constant data for the fluid |
moleToMassFractions | Return mass fractions X from mole fractions |
massToMoleFractions | Return mole fractions from mass fractions X |
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 Modelica.Media.IdealGases.Common.DataRecord[:] data "Data records of ideal gas substances";
constant Boolean excludeEnthalpyOfFormation=true "If true, enthalpy of formation Hf is not included in specific enthalpy h";
constant ReferenceEnthalpy referenceChoice=ReferenceEnthalpy.ZeroAt0K "Choice of reference enthalpy";
constant SpecificEnthalpy h_offset=0.0 "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
constant MolarMass[nX] MMX=data[:].MM "molar masses of components";
redeclare record extends ThermodynamicState "thermodynamic state variables" end ThermodynamicState;
redeclare record extends FluidConstants "fluid constants" 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 replaceable model extends BaseProperties( T(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default), p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default), Xi(each stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default), redeclare final constant Boolean standardOrderComponents=true) "Base properties (p, d, T, h, u, R, MM, X, and Xi of NASA mixture gas" import Modelica.Media.IdealGases.Common.SingleGasNasa; // SpecificEnthalpy h_component[nX]; equation assert(T >= 200 and T <= 6000, " Temperature T (=" + String(T) + " K = 200 K) is not in the allowed range 200 K <= T <= 6000 K required from medium model \"" + mediumName + "\"."); MM = molarMass(state); h = h_TX(T, X); R = data.R*X; u = h - R*T; d = p/(R*T); // connect state with BaseProperties state.T = T; state.p = p; state.X = if fixedX then reference_X else X; 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 := if size(X,1) == nX then ThermodynamicState(p=p,T=T, X=X) else ThermodynamicState(p=p,T=T, X=cat(1,X,{1-sum(X)})); 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 := if size(X,1) == nX then ThermodynamicState(p=p,T=T_hX(h,X),X=X) else ThermodynamicState(p=p,T=T_hX(h,X), X=cat(1,X,{1-sum(X)})); 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 := if size(X,1) == nX then ThermodynamicState(p=p,T=T_psX(p,s,X),X=X) else ThermodynamicState(p=p,T=T_psX(p,s,X), X=cat(1,X,{1-sum(X)})); 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 := if size(X,1) == nX then ThermodynamicState(p=d*(data.R*X)*T,T=T,X=X) else ThermodynamicState(p=d*(data.R*cat(1,X,{1-sum(X)}))*T,T=T, X=cat(1,X,{1-sum(X)})); 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), X=Media.Common.smoothStep(x, state_a.X, state_b.X, 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/((state.X*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_TX(state.T,state.X); 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_TX(state.T,state.X) - gasConstant(state)*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" protected Real[nX] Y(unit="mol/mol")=massToMoleFractions(state.X, data.MM) "Molar fractions"; algorithm s := s_TX(state.T, state.X) - sum(state.X[i]*Modelica.Constants.R/MMX[i]* (if state.X[i]<Modelica.Constants.eps then Y[i] else Modelica.Math.log(Y[i]*state.p/reference_p)) for i in 1:nX); 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_TX(state.T,state.X) - 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_TX(state.T,state.X) - gasConstant(state)*state.T - state.T*specificEntropy(state); end specificHelmholtzEnergy;
Type | Name | Default | Description |
---|---|---|---|
Temperature | T | Temperature [K] | |
MassFraction | X[:] | reference_X | Independent Mass fractions of gas mixture [kg/kg] |
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_TX "Return specific enthalpy" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input SI.Temperature T "Temperature"; input MassFraction X[:]=reference_X "Independent Mass fractions of gas mixture"; 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"; algorithm h :=(if fixedX then reference_X else X)* {SingleGasNasa.h_T(data[i], T, exclEnthForm, refChoice, h_off) for i in 1:nX};end h_TX;
Type | Name | Default | Description |
---|---|---|---|
Temperature | T | Temperature [K] | |
MassFraction | X[nX] | Independent Mass fractions of gas mixture [kg/kg] | |
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 | |
Real | dX[nX] | independent mass fraction derivative |
Type | Name | Description |
---|---|---|
Real | h_der | Specific enthalpy at temperature T |
function h_TX_der "Return specific enthalpy derivative" import Modelica.Media.Interfaces.PartialMedium.Choices; extends Modelica.Icons.Function; input SI.Temperature T "Temperature"; input MassFraction X[nX] "Independent Mass fractions of gas mixture"; 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"; input Real dX[nX] "independent mass fraction derivative"; output Real h_der "Specific enthalpy at temperature T"; algorithm h_der := if fixedX then dT*sum((SingleGasNasa.cp_T(data[i], T)*reference_X[i]) for i in 1:nX) else dT*sum((SingleGasNasa.cp_T(data[i], T)*X[i]) for i in 1:nX)+ sum((SingleGasNasa.h_T(data[i], T)*dX[i]) for i in 1:nX);end h_TX_der;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state |
Type | Name | Description |
---|---|---|
SpecificHeatCapacity | R | mixture gas constant [J/(kg.K)] |
redeclare function extends gasConstant "Return gasConstant" algorithm R := data.R*state.X;end gasConstant;
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 := {SingleGasNasa.cp_T(data[i], state.T) for i in 1:nX}*state.X; 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 "Return specific heat capacity at constant volume from temperature and gas data" algorithm cv := {SingleGasNasa.cp_T(data[i], state.T) for i in 1:nX}*state.X -data.R*state.X;end specificHeatCapacityCv;
Type | Name | Default | Description |
---|---|---|---|
MoleFraction | x[:] | mole fraction of mixture [1] |
Type | Name | Description |
---|---|---|
Real | smix | mixing entropy contribution, divided by gas constant |
function MixEntropy "Return mixing entropy of ideal gases / R" extends Modelica.Icons.Function; input SI.MoleFraction x[:] "mole fraction of mixture"; output Real smix "mixing entropy contribution, divided by gas constant"; algorithm smix := sum(if x[i] > Modelica.Constants.eps then -x[i]*Modelica.Math.log(x[i]) else x[i] for i in 1:size(x,1)); end MixEntropy;
Type | Name | Default | Description |
---|---|---|---|
Temperature | T | temperature [K] | |
MassFraction | X[nX] | mass fraction [kg/kg] |
Type | Name | Description |
---|---|---|
SpecificEntropy | s | specific entropy [J/(kg.K)] |
function s_TX "Return temperature dependent part of the entropy, expects full entropy vector" input Temperature T "temperature"; input MassFraction[nX] X "mass fraction"; output SpecificEntropy s "specific entropy"; algorithm s := sum(SingleGasNasa.s0_T(data[i], T)*X[i] for i in 1:size(X,1)); end s_TX;
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 | properties at upstream location |
Type | Name | Description |
---|---|---|
VelocityOfSound | a | Velocity of sound [m/s] |
redeclare function extends velocityOfSound "Return velocity of sound" extends Modelica.Icons.Function; input ThermodynamicState state "properties at upstream location"; algorithm a := sqrt(max(0,gasConstant(state)*state.T*specificHeatCapacityCp(state)/specificHeatCapacityCv(state))); end velocityOfSound;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p2 | downstream pressure [Pa] | |
ThermodynamicState | state | thermodynamic state at upstream location |
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 AbsolutePressure p2 "downstream pressure"; input ThermodynamicState state "thermodynamic state at upstream location"; output SpecificEnthalpy h_is "isentropic enthalpy"; protected SpecificEnthalpy h "specific enthalpy at upstream location"; SpecificEnthalpy h_component[nX] "specific enthalpy at upstream location"; IsentropicExponent gamma = isentropicExponent(state) "Isentropic exponent"; protected MassFraction[nX] X "complete X-vector"; algorithm X := if reducedX then cat(1,state.X,{1-sum(state.X)}) else state.X; h_component :={SingleGasNasa.h_T(data[i], state.T, excludeEnthalpyOfFormation, referenceChoice, h_offset) for i in 1:nX}; h :=h_component*X; h_is := h + gamma/(gamma - 1.0)*(state.T*gasConstant(state))* ((p2/state.p)^((gamma - 1)/gamma) - 1.0); end isentropicEnthalpyApproximation;
Type | Name | Default | Description |
---|---|---|---|
Boolean | exact | false | flag wether exact or approximate version should be used |
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 exact = false "flag wether exact or approximate version should be used"; algorithm h_is := if exact then specificEnthalpy_psX(p_downstream,specificEntropy(refState),refState.X) else isentropicEnthalpyApproximation(p_downstream,refState); end isentropicEnthalpy;
Simplification of the kinetic theory (Chapman and Enskog theory)
approach neglecting the second-order effects.
This equation has been extensively tested (Amdur and Mason, 1958;
Bromley and Wilke, 1951; Cheung, 1958; Dahler, 1959; Gandhi and Saxena,
1964; Ranz and Brodowsky, 1962; Saxena and Gambhir, 1963a; Strunk, et
al., 1964; Vanderslice, et al. 1962; Wright and Gray, 1962). In most
cases, only nonpolar mixtures were compared, and very good results
obtained. For some systems containing hidrogen as one component, less
satisfactory agreement was noted. Wilke's method predicted mixture
viscosities that were larger than experimental for the H2-N2 system,
but for H2-NH3, it underestimated the viscosities.
Gururaja, et al. (1967) found that this method also overpredicted in
the H2-O2 case but was quite accurate for the H2-CO2 system.
Wilke's approximation has proved reliable even for polar-polar gas
mixtures of aliphatic alcohols (Reid and Belenyessy, 1960). The
principal reservation appears to lie in those cases where Mi>>Mj
and etai>>etaj.
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
MoleFraction | yi[:] | Mole fractions [mol/mol] | |
MolarMass | M[:] | Mole masses [kg/mol] | |
DynamicViscosity | eta[:] | Pure component viscosities [Pa.s] |
Type | Name | Description |
---|---|---|
DynamicViscosity | etam | Viscosity of the mixture [Pa.s] |
function gasMixtureViscosity "Return viscosities of gas mixtures at low pressures (Wilke method)" extends Modelica.Icons.Function; input MoleFraction[:] yi "Mole fractions"; input MolarMass[:] M "Mole masses"; input DynamicViscosity[:] eta "Pure component viscosities"; output DynamicViscosity etam "Viscosity of the mixture"; protected Real fi[size(yi,1),size(yi,1)]; algorithm for i in 1:size(eta,1) loop assert(fluidConstants[i].hasDipoleMoment,"Dipole moment for " + fluidConstants[i].chemicalFormula + " not known. Can not compute viscosity."); assert(fluidConstants[i].hasCriticalData, "Critical data for "+ fluidConstants[i].chemicalFormula + " not known. Can not compute viscosity."); for j in 1:size(eta,1) loop if i==1 then fi[i,j] := (1 + (eta[i]/eta[j])^(1/2)*(M[j]/M[i])^(1/4))^2/(8*(1 + M[i]/M[j]))^(1/2); elseif j<i then fi[i,j] := eta[i]/eta[j]*M[j]/M[i]*fi[j,i]; else fi[i,j] := (1 + (eta[i]/eta[j])^(1/2)*(M[j]/M[i])^(1/4))^2/(8*(1 + M[i]/M[j]))^(1/2); end if; end for; end for; etam := sum(yi[i]*eta[i]/sum(yi[j]*fi[i,j] for j in 1:size(eta,1)) for i in 1:size(eta,1)); equationend gasMixtureViscosity;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
DynamicViscosity | eta | Dynamic viscosity [Pa.s] |
redeclare replaceable function extends dynamicViscosity "Return mixture dynamic viscosity" protected DynamicViscosity[nX] etaX "component dynamic viscosities"; algorithm for i in 1:nX loop etaX[i] := SingleGasNasa.dynamicViscosityLowPressure(state.T, fluidConstants[i].criticalTemperature, fluidConstants[i].molarMass, fluidConstants[i].criticalMolarVolume, fluidConstants[i].acentricFactor, fluidConstants[i].dipoleMoment); end for; eta := gasMixtureViscosity(massToMoleFractions(state.X, fluidConstants[:].molarMass), fluidConstants[:].molarMass, etaX);end dynamicViscosity;
Equation to estimate the viscosity of gas mixtures at low pressures.
It is a simplification of an extension of the rigorous kinetic theory
of Chapman and Enskog to determine the viscosity of multicomponent
mixtures, at low pressures and with a factor to correct for molecule
shape and polarity.
The input argument Kappa is a special correction for highly polar substances such as
alcohols and acids.
Values of kappa for a few such materials:
Compound |
Kappa |
Compound |
Kappa |
Methanol |
0.215 |
n-Pentanol |
0.122 |
Ethanol |
0.175 |
n-Hexanol |
0.114 |
n-Propanol |
0.143 |
n-Heptanol |
0.109 |
i-Propanol |
0.143 |
Acetic Acid |
0.0916 |
n-Butanol |
0.132 |
Water |
0.076 |
i-Butanol |
0.132 |
Chung, et al. (1984) suggest that for other alcohols not shown in the
table:
kappa = 0.0682 + 4.704*[(number of -OH
groups)]/[molecular weight]
S.I. units relation for the
debyes:
1 debye = 3.162e-25 (J.m^3)^(1/2)
[1] THE PROPERTIES OF GASES AND LIQUIDS, Fifth Edition,
Bruce E. Poling, John M.
Prausnitz, John P. O'Connell.
[2] Chung, T.-H., M. Ajlan, L. L. Lee, and K. E. Starling: Ind. Eng.
Chem. Res., 27: 671 (1988).
[3] Chung, T.-H., L. L. Lee, and K. E. Starling; Ing. Eng. Chem.
Fundam., 23: 3 ()1984).
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
Temperature | T | Temperature [K] | |
Temperature | Tc[:] | Critical temperatures [K] | |
MolarVolume | Vcrit[:] | Critical volumes (m3/mol) [m3/mol] | |
Real | w[:] | Acentric factors | |
Real | mu[:] | Dipole moments (debyes) | |
MolarMass | MolecularWeights[:] | Molecular weights (kg/mol) [kg/mol] | |
MoleFraction | y[:] | Molar Fractions [mol/mol] | |
Real | kappa[:] | zeros(nX) | Association Factors |
Type | Name | Description |
---|---|---|
DynamicViscosity | etaMixture | Mixture viscosity (Pa.s) [Pa.s] |
function mixtureViscosityChung "Return the viscosity of gas mixtures without access to component viscosities (Chung, et. al. rules)" extends Modelica.Icons.Function; import SI = Modelica.SIunits; input Temperature T "Temperature"; input Temperature[:] Tc "Critical temperatures"; input MolarVolume[:] Vcrit "Critical volumes (m3/mol)"; input Real[:] w "Acentric factors"; input Real[:] mu "Dipole moments (debyes)"; input MolarMass[:] MolecularWeights "Molecular weights (kg/mol)"; input MoleFraction[:] y "Molar Fractions"; input Real[:] kappa = zeros(nX) "Association Factors"; output DynamicViscosity etaMixture "Mixture viscosity (Pa.s)"; protected constant Real[size(y,1)] Vc = Vcrit*1000000 "Critical volumes (cm3/mol)"; constant Real[size(y,1)] M = MolecularWeights*1000 "Molecular weights (g/mol)"; Integer n = size(y,1) "Number of mixed elements"; Real sigmam3 "Mixture sigma^3 in Angstrom"; Real sigma[size(y,1),size(y,1)]; Real edivkm; Real edivk[size(y,1),size(y,1)]; Real Mm; Real Mij[size(y,1),size(y,1)]; Real wm "accentric factor"; Real wij[size(y,1),size(y,1)]; Real kappam "Correlation for highly polar substances such as alcohols and acids"; Real kappaij[size(y,1),size(y,1)]; Real mum; Real Vcm; Real Tcm; Real murm "Dimensionless dipole moment of the mixture"; Real Fcm "Factor to correct for shape and polarity"; Real omegav; Real Tmstar; Real etam "Mixture viscosity in microP"; algorithm //combining rules for i in 1:n loop for j in 1:n loop Mij[i,j] := 2*M[i]*M[j]/(M[i]+M[j]); if i==j then sigma[i,j] := 0.809*Vc[i]^(1/3); edivk[i,j] := Tc[i]/1.2593; wij[i,j] := w[i]; kappaij[i,j] := kappa[i]; else sigma[i,j] := (0.809*Vc[i]^(1/3)*0.809*Vc[j]^(1/3))^(1/2); edivk[i,j] := (Tc[i]/1.2593*Tc[j]/1.2593)^(1/2); wij[i,j] := (w[i] + w[j])/2; kappaij[i,j] := (kappa[i]*kappa[j])^(1/2); end if; end for; end for; //mixing rules sigmam3 := (sum(sum(y[i]*y[j]*sigma[i,j]^3 for j in 1:n) for i in 1:n)); //(epsilon/k)m edivkm := (sum(sum(y[i]*y[j]*edivk[i,j]*sigma[i,j]^3 for j in 1:n) for i in 1:n))/sigmam3; Mm := ((sum(sum(y[i]*y[j]*edivk[i,j]*sigma[i,j]^2*Mij[i,j]^(1/2) for j in 1:n) for i in 1:n))/(edivkm*sigmam3^(2/3)))^2; wm := (sum(sum(y[i]*y[j]*wij[i,j]*sigma[i,j]^3 for j in 1:n) for i in 1:n))/sigmam3; mum := (sigmam3*(sum(sum(y[i]*y[j]*mu[i]^2*mu[j]^2/sigma[i,j]^3 for j in 1:n) for i in 1:n)))^(1/4); Vcm := sigmam3/(0.809)^3; Tcm := 1.2593*edivkm; murm := 131.3*mum/(Vcm*Tcm)^(1/2); kappam := (sigmam3*(sum(sum(y[i]*y[j]*kappaij[i,j] for j in 1:n) for i in 1:n))); Fcm := 1 - 0.275*wm + 0.059035*murm^4 + kappam; Tmstar := T/edivkm; omegav := 1.16145*(Tmstar)^(-0.14874) + 0.52487*Math.exp(-0.77320*Tmstar) + 2.16178*Math.exp(-2.43787*Tmstar); etam := 26.69*Fcm*(Mm*T)^(1/2)/(sigmam3^(2/3)*omegav); etaMixture := etam*1e7; equationend mixtureViscosityChung;
This function applies the Masson and Saxena modification of the Wassiljewa Equation for the thermal conductivity for gas mixtures of n elements at low pressure.
For nonpolar gas mixtures errors will generally be less than 3 to 4%. For mixtures of nonpolar-polar and polar-polar gases, errors greater than 5 to 8% may be expected. For mixtures in which the sizes and polarities of the constituent molecules are not greatly different, the thermal conductivity can be estimated satisfactorily by a mole fraction average of the pure component conductivities.
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
MoleFraction | y[:] | Mole fraction of the components in the gass mixture [mol/mol] | |
Temperature | T | Temperature [K] | |
Temperature | Tc[:] | Critical temperatures [K] | |
AbsolutePressure | Pc[:] | Critical pressures [Pa] | |
MolarMass | M[:] | Molecular weights [kg/mol] | |
ThermalConductivity | lambda[:] | Thermal conductivities of the pure gases [W/(m.K)] |
Type | Name | Description |
---|---|---|
ThermalConductivity | lambdam | Thermal conductivity of the gas mixture [W/(m.K)] |
function lowPressureThermalConductivity "Return thermal conductivites of low-pressure gas mixtures (Mason and Saxena Modification)" extends Modelica.Icons.Function; input MoleFraction[:] y "Mole fraction of the components in the gass mixture"; input Temperature T "Temperature"; input Temperature[:] Tc "Critical temperatures"; input AbsolutePressure[:] Pc "Critical pressures"; input MolarMass[:] M "Molecular weights"; input ThermalConductivity[:] lambda "Thermal conductivities of the pure gases"; output ThermalConductivity lambdam "Thermal conductivity of the gas mixture"; protected MolarMass[size(y,1)] gamma; Real[size(y,1)] Tr "Reduced temperature"; Real[size(y,1),size(y,1)] A "Mason and Saxena Modification"; constant Real epsilon = 1.0 "Numerical constant near unity"; algorithm for i in 1:size(y,1) loop gamma[i] := 210*(Tc[i]*M[i]^3/Pc[i]^4)^(1/6); Tr[i] := T/Tc[i]; end for; for i in 1:size(y,1) loop for j in 1:size(y,1) loop A[i,j] := epsilon*(1 + (gamma[j]*(Math.exp(0.0464*Tr[i]) - Math.exp(-0.2412*Tr[i]))/ (gamma[i]*(Math.exp(0.0464*Tr[j]) - Math.exp(-0.2412*Tr[j]))))^(1/2)*(M[i]/M[j])^(1/4))^2/ (8*(1 + M[i]/M[j]))^(1/2); end for; end for; lambdam := sum(y[i]*lambda[i]/(sum(y[j]*A[i,j] for j in 1:size(y,1))) for i in 1:size(y,1)); equationend lowPressureThermalConductivity;
Type | Name | Default | Description |
---|---|---|---|
Integer | method | 1 | method to compute single component thermal conductivity |
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
ThermalConductivity | lambda | Thermal conductivity [W/(m.K)] |
redeclare replaceable function extends thermalConductivity "Return thermal conductivity for low pressure gas mixtures" input Integer method=1 "method to compute single component thermal conductivity"; protected ThermalConductivity[nX] lambdaX "component thermal conductivities"; DynamicViscosity[nX] eta "component thermal dynamic viscosities"; SpecificHeatCapacity[nX] cp "component heat capacity"; algorithm for i in 1:nX loop assert(fluidConstants[i].hasCriticalData, "Critical data for "+ fluidConstants[i].chemicalFormula + " not known. Can not compute thermal conductivity."); eta[i] := SingleGasNasa.dynamicViscosityLowPressure(state.T, fluidConstants[i].criticalTemperature, fluidConstants[i].molarMass, fluidConstants[i].criticalMolarVolume, fluidConstants[i].acentricFactor, fluidConstants[i].dipoleMoment); cp[i] := SingleGasNasa.cp_T(data[i],state.T); lambdaX[i] :=SingleGasNasa.thermalConductivityEstimate(Cp=cp[i], eta= eta[i], method=method); end for; lambda := lowPressureThermalConductivity(massToMoleFractions(state.X, fluidConstants[:].molarMass), state.T, fluidConstants[:].criticalTemperature, fluidConstants[:].criticalPressure, fluidConstants[:].molarMass, lambdaX);end thermalConductivity;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
IsobaricExpansionCoefficient | beta | Isobaric expansion coefficient [1/K] |
redeclare function extends isobaricExpansionCoefficient "Return 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 "Return 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 "Return density derivative by pressure at constant temperature" algorithm ddpT := 1/(state.T*gasConstant(state)); 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 "Return density derivative by temperature at constant pressure" algorithm ddTp := -state.p/(state.T*state.T*gasConstant(state)); 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 density_derX "Return density derivative by mass fraction" extends Modelica.Icons.Function; input ThermodynamicState state "thermodynamic state record"; output Density[nX] dddX "Derivative of density w.r.t. mass fraction"; algorithm dddX := {-state.p/(state.T*gasConstant(state))*molarMass(state)/data[ i].MM for i in 1:nX}; end density_derX;
Type | Name | Default | Description |
---|---|---|---|
ThermodynamicState | state | thermodynamic state record |
Type | Name | Description |
---|---|---|
MolarMass | MM | Mixture molar mass [kg/mol] |
redeclare function extends molarMass "Return molar mass of mixture" algorithm MM := 1/sum(state.X[j]/data[j].MM for j in 1:size(state.X, 1)); end molarMass;
Type | Name | Default | Description |
---|---|---|---|
SpecificEnthalpy | h | specific enthalpy [J/kg] | |
MassFraction | X[:] | mass fractions of composition [kg/kg] | |
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 |
---|---|---|
Temperature | T | temperature [K] |
function T_hX "Return temperature from specific enthalpy and mass fraction" input SpecificEnthalpy h "specific enthalpy"; input MassFraction[:] X "mass fractions of composition"; 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 Temperature T "temperature"; protected MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)});package 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_TX(x,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, Xfull, data[1]);end T_hX;
Type | Name | Default | Description |
---|---|---|---|
AbsolutePressure | p | pressure [Pa] | |
SpecificEntropy | s | specific entropy [J/(kg.K)] | |
MassFraction | X[:] | mass fractions of composition [kg/kg] |
Type | Name | Description |
---|---|---|
Temperature | T | temperature [K] |
function T_psX "Return temperature from pressure, specific entropy and mass fraction" input AbsolutePressure p "pressure"; input SpecificEntropy s "specific entropy"; input MassFraction[:] X "mass fractions of composition"; output Temperature T "temperature"; protected MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)});package 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 "note that this function always sees the complete mass fraction vector" protected MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)}); Real[nX] Y(unit="mol/mol")=massToMoleFractions(if size(X,1) == nX then X else cat(1,X,{1-sum(X)}), data.MM) "Molar fractions"; algorithm y := s_TX(x,Xfull) - sum(Xfull[i]*Modelica.Constants.R/MMX[i]* (if Xfull[i]<Modelica.Constants.eps then Y[i] else Modelica.Math.log(Y[i]*p/reference_p)) for i in 1:nX); // s_TX(x,X)- data[:].R*X*(Modelica.Math.log(p/reference_p) // + MixEntropy(massToMoleFractions(X,data[:].MM))); 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, Xfull, data[1]); end T_psX;