iapws.humidAir module

Module with Air-water mixture properties and related properties. The module include:

  • _virial(): Virial equations for humid air
  • _fugacity(): Fugacity equation for humid air
  • MEoSBlend: Special MEoS subclass to implement pseudocomponent blend with ancillary dew and bubble point
  • Air: Multiparameter equation of state for Air as pseudocomponent
  • HumidAir: Humid air mixture with complete functionality
iapws.humidAir._virial(T)[source]

Virial equations for humid air

Parameters:T (float) – Temperature [K]
Returns:prop

Dictionary with critical coefficient:

  • Baa: Second virial coefficient of dry air, [m³/mol]
  • Baw: Second air-water cross virial coefficient, [m³/mol]
  • Bww: Second virial coefficient of water, [m³/mol]
  • Caaa: Third virial coefficient of dry air, [m⁶/mol]
  • Caaw: Third air-water cross virial coefficient, [m⁶/mol]
  • Caww: Third air-water cross virial coefficient, [m⁶/mol]
  • Cwww: Third virial coefficient of dry air, [m⁶/mol]
  • Bawt: dBaw/dT, [m³/molK]
  • Bawtt: d²Baw/dT², [m³/molK²]
  • Caawt: dCaaw/dT, [m⁶/molK]
  • Caawtt: d²Caaw/dT², [m⁶/molK²]
  • Cawwt: dCaww/dT, [m⁶/molK]
  • Cawwtt: d²Caww/dT², [m⁶/molK²]
Return type:dict

Notes

Raise Warning if T isn’t in range of validity:

  • Baa: 60 ≤ T ≤ 2000
  • Baw: 130 ≤ T ≤ 2000
  • Bww: 130 ≤ T ≤ 1273
  • Caaa: 60 ≤ T ≤ 2000
  • Caaw: 193 ≤ T ≤ 493
  • Caww: 173 ≤ T ≤ 473
  • Cwww: 130 ≤ T ≤ 1273

Examples

>>> _virial(200)["Baa"]
-3.92722567e-5

References

IAPWS, Guideline on a Virial Equation for the Fugacity of H2O in Humid Air, http://www.iapws.org/relguide/VirialFugacity.html

IAPWS, Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, Table 10, http://www.iapws.org/relguide/SeaAir.html

iapws.humidAir._fugacity(T, P, x)[source]

Fugacity equation for humid air

Parameters:
  • T (float) – Temperature, [K]
  • P (float) – Pressure, [MPa]
  • x (float) – Mole fraction of water-vapor, [-]
Returns:

fv – fugacity coefficient, [MPa]

Return type:

float

Notes

Raise NotImplementedError if input isn’t in range of validity:

  • 193 ≤ T ≤ 473
  • 0 ≤ P ≤ 5
  • 0 ≤ x ≤ 1

Really the xmax is the xsaturation but isn’t implemented

Examples

>>> _fugacity(300, 1, 0.1)
0.0884061686

References

IAPWS, Guideline on a Virial Equation for the Fugacity of H2O in Humid Air, http://www.iapws.org/relguide/VirialFugacity.html

class iapws.humidAir.MEoSBlend(**kwargs)[source]

Special meos class to implement pseudocomponent blend and defining its ancillary dew and bubble point

Attributes:
CP
Gruneisen
IntP
Ks
Kt
Prandt
Z
Z_rho
a
alfa
alfap
alfav
betap
betas
calculable

Check if inputs are enough to define state

cp
cp_cv
cv
dhdP_T
dhdP_rho
dhdT_P
dhdT_rho
dhdrho_P
dhdrho_T
dpdT_rho
dpdrho_T
drhodP_T
drhodT_P
epsilon
f
fi
g
gamma
h
hInput
joule
k
kappa
ks
kt
mu
n
nu
rho
s
u
v
w

Methods

__call__(**kwargs) Make instance callable to can add input parameter one to one
calculo() Calculate procedure
derivative(z, x, y, fase) Wrapper derivative for custom derived properties where x, y, z can be: P, T, v, rho, u, h, s, g, a
fill(fase, estado) Fill phase properties
classmethod _dewP(T)[source]

Using ancillary equation return the pressure of dew point

classmethod _bubbleP(T)[source]

Using ancillary equation return the pressure of bubble point

class iapws.humidAir.Air(**kwargs)[source]

Multiparameter equation of state for Air as pseudocomponent for internal procedures, see MEoS base class

Parameters:
  • T (float) – Temperature, [K]
  • P (float) – Pressure, [MPa]
  • rho (float) – Density, [kg/m³]
  • v (float) – Specific volume, [m³/kg]
  • h (float) – Specific enthalpy, [kJ/kg]
  • s (float) – Specific entropy, [kJ/kgK]
  • u (float) – Specific internal energy, [kJ/kg]
  • x (float) – Vapor quality, [-]
  • l (float, optional) – Wavelength of light, for refractive index, [nm]
  • rho0 (float, optional) – Initial value of density, to improve iteration, [kg/m³]
  • T0 (float, optional) – Initial value of temperature, to improve iteration, [K]
  • x0 (Initial value of vapor quality, necessary in bad input pair definition) – where there are two valid solution (T-h, T-s)

Notes

  • It needs two incoming properties of T, P, rho, h, s, u.
  • v as a alternate input parameter to rho
  • T-x, P-x, preferred input pair to specified a point in two phases region

The calculated instance has the following properties:

  • P: Pressure, [MPa]
  • T: Temperature, [K]
  • x: Vapor quality, [-]
  • g: Specific Gibbs free energy, [kJ/kg]
  • a: Specific Helmholtz free energy, [kJ/kg]
  • v: Specific volume, [m³/kg]
  • r: Density, [kg/m³]
  • h: Specific enthalpy, [kJ/kg]
  • u: Specific internal energy, [kJ/kg]
  • s: Specific entropy, [kJ/kg·K]
  • cp: Specific isobaric heat capacity, [kJ/kg·K]
  • cv: Specific isochoric heat capacity, [kJ/kg·K]
  • cp_cv: Heat capacity ratio, [-]
  • Z: Compression factor, [-]
  • fi: Fugacity coefficient, [-]
  • f: Fugacity, [MPa]
  • gamma: Isoentropic exponent, [-]
  • alfav: Isobaric cubic expansion coefficient, [1/K]
  • kappa: Isothermal compressibility, [1/MPa]
  • kappas: Adiabatic compresibility, [1/MPa]
  • alfap: Relative pressure coefficient, [1/K]
  • betap: Isothermal stress coefficient, [kg/m³]
  • joule: Joule-Thomson coefficient, [K/MPa]
  • betas: Isoentropic temperature-pressure coefficient, [-]
  • Gruneisen: Gruneisen parameter, [-]
  • virialB: Second virial coefficient, [m³/kg]
  • virialC: Third virial coefficient, [m⁶/kg²]
  • dpdT_rho: Derivatives, dp/dT at constant rho, [MPa/K]
  • dpdrho_T: Derivatives, dp/drho at constant T, [MPa·m³/kg]
  • drhodT_P: Derivatives, drho/dT at constant P, [kg/m³·K]
  • drhodP_T: Derivatives, drho/dP at constant T, [kg/m³·MPa]
  • dhdT_rho: Derivatives, dh/dT at constant rho, [kJ/kg·K]
  • dhdP_T: Isothermal throttling coefficient, [kJ/kg·MPa]
  • dhdT_P: Derivatives, dh/dT at constant P, [kJ/kg·K]
  • dhdrho_T: Derivatives, dh/drho at constant T, [kJ·m³/kg²]
  • dhdrho_P: Derivatives, dh/drho at constant P, [kJ·m³/kg²]
  • dhdP_rho: Derivatives, dh/dP at constant rho, [kJ/kg·MPa]
  • kt: Isothermal Expansion Coefficient, [-]
  • ks: Adiabatic Compressibility, [1/MPa]
  • Ks: Adiabatic bulk modulus, [MPa]
  • Kt: Isothermal bulk modulus, [MPa]
  • v0: Ideal specific volume, [m³/kg]
  • rho0: Ideal gas density, [kg/m³]
  • u0: Ideal specific internal energy, [kJ/kg]
  • h0: Ideal specific enthalpy, [kJ/kg]
  • s0: Ideal specific entropy, [kJ/kg·K]
  • a0: Ideal specific Helmholtz free energy, [kJ/kg]
  • g0: Ideal specific Gibbs free energy, [kJ/kg]
  • cp0: Ideal specific isobaric heat capacity, [kJ/kg·K]
  • cv0: Ideal specific isochoric heat capacity, [kJ/kg·K]
  • w0: Ideal speed of sound, [m/s]
  • gamma0: Ideal isoentropic exponent, [-]
  • w: Speed of sound, [m/s]
  • mu: Dynamic viscosity, [Pa·s]
  • nu: Kinematic viscosity, [m²/s]
  • k: Thermal conductivity, [W/m·K]
  • alfa: Thermal diffusivity, [m²/s]
  • sigma: Surface tension, [N/m]
  • epsilon: Dielectric constant, [-]
  • n: Refractive index, [-]
  • Prandt: Prandtl number, [-]
  • Pr: Reduced Pressure, [-]
  • Tr: Reduced Temperature, [-]
  • Hvap: Vaporization heat, [kJ/kg]
  • Svap: Vaporization entropy, [kJ/kg·K]
  • Z_rho: \((Z-1)/\rho\), [m³/kg]
  • IntP: Internal pressure, [MPa]
  • invT: Negative reciprocal temperature, [1/K]
  • hInput: Specific heat input, [kJ/kg]

References

Lemmon, E.W., Jacobsen, R.T, Penoncello, S.G., Friend, D.G.; Thermodynamic Properties of Air and Mixtures of Nitrogen, Argon, and Oxygen From 60 to 2000 K at Pressures to 2000 MPa. J. Phys. Chem. Ref. Data 29, 331 (2000). http://dx.doi.org/10.1063/1.1285884

Attributes:
CP
Gruneisen
IntP
Ks
Kt
Prandt
Z
Z_rho
a
alfa
alfap
alfav
betap
betas
calculable

Check if inputs are enough to define state

cp
cp_cv
cv
dhdP_T
dhdP_rho
dhdT_P
dhdT_rho
dhdrho_P
dhdrho_T
dpdT_rho
dpdrho_T
drhodP_T
drhodT_P
epsilon
f
fi
g
gamma
h
hInput
joule
k
kappa
ks
kt
mu
n
nu
rho
s
u
v
w

Methods

__call__(**kwargs) Make instance callable to can add input parameter one to one
calculo() Calculate procedure
derivative(z, x, y, fase) Wrapper derivative for custom derived properties where x, y, z can be: P, T, v, rho, u, h, s, g, a
fill(fase, estado) Fill phase properties
name = 'air'
CASNumber = '1'
formula = 'N2+Ar+O2'
synonym = 'R-729'
rhoc = 302.622436442
Tc = 132.6306
Pc = 3.786
M = 28.96546
Tt = 59.75
Tb = 78.903
f_acent = 0.0335
momentoDipolar = 0.0
Fi0 = {'ao_exp': [0.791309509, 0.212236768], 'ao_exp2': [-0.197938904], 'ao_log': [1, 2.490888032], 'ao_pow': [6.057194e-08, -2.10274769e-05, -0.000158860716, 9.7450251743948, 10.0986147428912, -0.00019536342], 'pow': [-3, -2, -1, 0, 1, 1.5], 'sum2': [0.6666666666666666], 'titao': [25.36365, 16.90741], 'titao2': [87.31279]}
_constants = {'R': 8.31451, 'Tref': 132.6312, 'c2': [1, 1, 1, 1, 2, 2, 2, 3, 3], 'd1': [1, 1, 1, 2, 3, 3, 4, 4, 4, 6], 'd2': [1, 3, 5, 6, 1, 3, 11, 1, 3], 'gamma2': [1, 1, 1, 1, 1, 1, 1, 1, 1], 'nr1': [0.118160747229, 0.713116392079, -1.61824192067, 0.0714140178971, -0.0865421396646, 0.134211176704, 0.0112626704218, -0.0420533228842, 0.0349008431982, 0.000164957183186], 'nr2': [-0.101365037912, -0.17381369097, -0.0472103183731, -0.0122523554253, -0.146629609713, -0.0316055879821, 0.000233594806142, 0.0148287891978, -0.00938782884667], 'rhoref': 302.622436442, 't1': [0, 0.33, 1.01, 0, 0, 0.15, 0, 0.2, 0.35, 1.35], 't2': [1.6, 0.8, 0.95, 1.25, 3.6, 6, 3.25, 3.5, 15]}
_blend = {'Pj': 3.78502, 'Tj': 132.6312, 'bubble': {'i': [1, 2, 3, 4, 5, 6], 'n': [0.2260724, -7.080499, 5.700283, -12.44017, 17.81926, -10.81364]}, 'dew': {'i': [1, 2, 5, 8], 'n': [-0.1567266, -5.539635, 0.7567212, -3.514322]}}
_melting = {'Pref': 5.265, 'Tmax': 2000.0, 'Tmin': 59.75, 'Tref': 78.903, 'a1': [1, 35493.5, -35493.5], 'a2': [], 'a3': [], 'eq': 1, 'exp1': [0, 1.78963, 0], 'exp2': [], 'exp3': []}
_surf = {'exp': [1.28], 'sigma': [0.03046]}
_rhoG = {'ao': [-2.0466, -4.752, -13.259, -47.652], 'eq': 3, 'exp': [0.41, 1, 2.8, 6.5]}
_Pv = {'ao': [-0.1567266, -5.539635, 0.7567212, -3.514322], 'exp': [0.5, 1, 2.5, 4]}
classmethod _Liquid_Density(T)[source]

Auxiliary equation for the density or saturated liquid

Parameters:T (float) – Temperature [K]
Returns:rho – Saturated liquid density [kg/m³]
Return type:float
static _visco(rho, T, fase=None)[source]

Equation for the Viscosity

Parameters:
  • rho (float) – Density, [kg/m³]
  • T (float) – Temperature, [K]
Returns:

μ – Viscosity, [Pa·s]

Return type:

float

References

Lemmon, E.W., Jacobsen, R.T. Viscosity and Thermal Conductivity Equations for Nitrogen, Oxygen, Argon, and Air. Int. J. Thermophys. 25 (1) (2004) 21-69. http://dx.doi.org/10.1023/B:IJOT.0000022327.04529.f3

_thermo(rho, T, fase=None)[source]

Equation for the thermal conductivity

Parameters:
  • rho (float) – Density, [kg/m³]
  • T (float) – Temperature, [K]
  • fase (dict) – phase properties
Returns:

k – Thermal conductivity, [W/mK]

Return type:

float

References

Lemmon, E.W., Jacobsen, R.T. Viscosity and Thermal Conductivity Equations for Nitrogen, Oxygen, Argon, and Air. Int. J. Thermophys. 25 (1) (2004) 21-69. http://dx.doi.org/10.1023/B:IJOT.0000022327.04529.f3

class iapws.humidAir.HumidAir(**kwargs)[source]

Humid air class with complete functionality

Parameters:
  • T (float) – Temperature, [K]
  • P (float) – Pressure, [MPa]
  • rho (float) – Density, [kg/m³]
  • v (float) – Specific volume, [m³/kg]
  • A (float) – Mass fraction of dry air in humid air, [kg/kg]
  • xa (float) – Mole fraction of dry air in humid air, [-]
  • W (float) – Mass fraction of water in humid air, [kg/kg]
  • xw (float) – Mole fraction of water in humid air, [-]

Notes

  • It needs two incoming properties of T, P, rho.
  • v as a alternate input parameter to rho
  • For composition need one of A, xa, W, xw.

The calculated instance has the following properties:

  • P: Pressure, [MPa]
  • T: Temperature, [K]
  • g: Specific Gibbs free energy, [kJ/kg]
  • a: Specific Helmholtz free energy, [kJ/kg]
  • v: Specific volume, [m³/kg]
  • rho: Density, [kg/m³]
  • h: Specific enthalpy, [kJ/kg]
  • u: Specific internal energy, [kJ/kg]
  • s: Specific entropy, [kJ/kg·K]
  • cp: Specific isobaric heat capacity, [kJ/kg·K]
  • w: Speed of sound, [m/s]
  • alfav: Isobaric cubic expansion coefficient, [1/K]
  • betas: Isoentropic temperature-pressure coefficient, [-]
  • xkappa: Isothermal Expansion Coefficient, [-]
  • ks: Adiabatic Compressibility, [1/MPa]
  • A: Mass fraction of dry air in humid air, [kg/kg]
  • W: Mass fraction of water in humid air, [kg/kg]
  • xa: Mole fraction of dry air, [-]
  • xw: Mole fraction of water, [-]
  • xa_sat: Mole fraction of dry air at saturation state, [-]
  • mu: Relative chemical potential, [kJ/kg]
  • muw: Chemical potential of water, [kJ/kg]
  • M: Molar mass of humid air, [g/mol]
  • HR: Humidity ratio, [-]
  • RH: Relative humidity, [-]
Attributes:
calculable

Check if inputs are enough to define state

Methods

__call__(**kwargs) Make instance callable to can add input parameter one to one
calculo() Calculate procedure
derivative(z, x, y) Wrapper derivative for custom derived properties where x, y, z can be: P, T, v, rho, u, h, s, g, a
status = 0
msg = 'Undefined'
kwargs = {'A': None, 'P': 0.0, 'T': 0.0, 'W': None, 'rho': 0.0, 'v': 0.0, 'xa': None, 'xw': None}
calculable

Check if inputs are enough to define state

calculo()[source]

Calculate procedure

derivative(z, x, y)[source]

Wrapper derivative for custom derived properties where x, y, z can be: P, T, v, rho, u, h, s, g, a

_eq(T, P)[source]

Procedure for calculate the composition in saturation state

Parameters:
  • T (float) – Temperature [K]
  • P (float) – Pressure [MPa]
Returns:

Asat – Saturation mass fraction of dry air in humid air [kg/kg]

Return type:

float

_prop(T, rho, fav)[source]

Thermodynamic properties of humid air

Parameters:
  • T (float) – Temperature, [K]
  • rho (float) – Density, [kg/m³]
  • fav (dict) – dictionary with helmholtz energy and derivatives
Returns:

prop

Dictionary with thermodynamic properties of humid air:

  • P: Pressure, [MPa]
  • s: Specific entropy, [kJ/kgK]
  • cp: Specific isobaric heat capacity, [kJ/kgK]
  • h: Specific enthalpy, [kJ/kg]
  • g: Specific gibbs energy, [kJ/kg]
  • alfav: Thermal expansion coefficient, [1/K]
  • betas: Isentropic T-P coefficient, [K/MPa]
  • xkappa: Isothermal compressibility, [1/MPa]
  • ks: Isentropic compressibility, [1/MPa]
  • w: Speed of sound, [m/s]

Return type:

dict

References

IAPWS, Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, Table 5, http://www.iapws.org/relguide/SeaAir.html

_coligative(rho, A, fav)[source]

Miscelaneous properties of humid air

Parameters:
  • rho (float) – Density, [kg/m³]
  • A (float) – Mass fraction of dry air in humid air, [kg/kg]
  • fav (dict) – dictionary with helmholtz energy and derivatives
Returns:

prop

Dictionary with calculated properties:

  • mu: Relative chemical potential, [kJ/kg]
  • muw: Chemical potential of water, [kJ/kg]
  • M: Molar mass of humid air, [g/mol]
  • HR: Humidity ratio, [-]
  • xa: Mole fraction of dry air, [-]
  • xw: Mole fraction of water, [-]

Return type:

dict

References

IAPWS, Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, Table 12, http://www.iapws.org/relguide/SeaAir.html

_fav(T, rho, A)[source]

Specific Helmholtz energy of humid air and derivatives

Parameters:
  • T (float) – Temperature, [K]
  • rho (float) – Density, [kg/m³]
  • A (float) – Mass fraction of dry air in humid air, [kg/kg]
Returns:

prop

Dictionary with helmholtz energy and derivatives:

  • fir, [kJ/kg]
  • fira: \(\left.\frac{\partial f_{av}}{\partial A}\right|_{T,\rho}\), [kJ/kg]
  • firt: \(\left.\frac{\partial f_{av}}{\partial T}\right|_{A,\rho}\), [kJ/kgK]
  • fird: \(\left.\frac{\partial f_{av}}{\partial \rho}\right|_{A,T}\), [kJ/m³kg²]
  • firaa: \(\left.\frac{\partial^2 f_{av}}{\partial A^2}\right|_{T, \rho}\), [kJ/kg]
  • firat: \(\left.\frac{\partial^2 f_{av}}{\partial A \partial T}\right|_{\rho}\), [kJ/kgK]
  • firad: \(\left.\frac{\partial^2 f_{av}}{\partial A \partial \rho}\right|_T\), [kJ/m³kg²]
  • firtt: \(\left.\frac{\partial^2 f_{av}}{\partial T^2}\right|_{A, \rho}\), [kJ/kgK²]
  • firdt: \(\left.\frac{\partial^2 f_{av}}{\partial \rho \partial T}\right|_A\), [kJ/m³kg²K]
  • firdd: \(\left.\frac{\partial^2 f_{av}}{\partial \rho^2}\right|_{A, T}\), [kJ/m⁶kg³]

Return type:

dict

References

IAPWS, Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, Table 6, http://www.iapws.org/relguide/SeaAir.html

_fmix(T, rho, A)[source]

Specific Helmholtz energy of air-water interaction

Parameters:
  • T (float) – Temperature, [K]
  • rho (float) – Density, [kg/m³]
  • A (float) – Mass fraction of dry air in humid air, [kg/kg]
Returns:

prop

Dictionary with helmholtz energy and derivatives:

  • fir, [kJ/kg]
  • fira: \(\left.\frac{\partial f_{mix}}{\partial A}\right|_{T,\rho}\), [kJ/kg]
  • firt: \(\left.\frac{\partial f_{mix}}{\partial T}\right|_{A,\rho}\), [kJ/kgK]
  • fird: \(\left.\frac{\partial f_{mix}}{\partial \rho}\right|_{A,T}\), [kJ/m³kg²]
  • firaa: \(\left.\frac{\partial^2 f_{mix}}{\partial A^2}\right|_{T, \rho}\), [kJ/kg]
  • firat: \(\left.\frac{\partial^2 f_{mix}}{\partial A \partial T}\right|_{\rho}\), [kJ/kgK]
  • firad: \(\left.\frac{\partial^2 f_{mix}}{\partial A \partial \rho}\right|_T\), [kJ/m³kg²]
  • firtt: \(\left.\frac{\partial^2 f_{mix}}{\partial T^2}\right|_{A, \rho}\), [kJ/kgK²]
  • firdt: \(\left.\frac{\partial^2 f_{mix}}{\partial \rho \partial T}\right|_A\), [kJ/m³kg²K]
  • firdd: \(\left.\frac{\partial^2 f_{mix}}{\partial \rho^2}\right|_{A, T}\), [kJ/m⁶kg³]

Return type:

dict

References

IAPWS, Guideline on an Equation of State for Humid Air in Contact with Seawater and Ice, Consistent with the IAPWS Formulation 2008 for the Thermodynamic Properties of Seawater, Table 10, http://www.iapws.org/relguide/SeaAir.html