pyaga8.Gerg2008

class pyaga8.Gerg2008

GERG-2008 equation of state, AGA Report No. 8, Part 2, First Edition, April 2017.

Wrapper around aga8::gerg2008::Gerg2008 in the Rust crate aga8 0.6.1. The units are those of the aga8 crate (https://docs.rs/aga8/0.6.1/aga8/gerg2008/struct.Gerg2008.html):

  • temperature: K

  • pressure: kPa

  • d (molar concentration): mol/l

  • mm (molar mass): g/mol

  • u, h, g (internal energy, enthalpy, Gibbs energy): J/mol

  • s, cv, cp (entropy, isochoric and isobaric heat capacity): J/(mol-K)

  • w (speed of sound): m/s

  • jt (Joule-Thomson coefficient): K/kPa

  • z (compressibility factor) and kappa (isentropic exponent): dimensionless

The object holds the state. Set the composition with set_composition, set temperature and pressure, call calc_density and then calc_properties, and read the results from the properties of this object. No unit conversion is done.

__init__()

Methods

__init__()

calc_density(flag)

Calculate the molar density d (mol/l) from temperature (K) and pressure (kPa).

calc_molar_mass()

Calculate the molar mass of the current composition.

calc_pressure()

Calculate the pressure from temperature (K) and d (mol/l).

calc_properties()

Calculate the thermodynamic properties from temperature (K) and d (mol/l).

set_composition(comp)

Check and set the gas composition.

Attributes

cp

Isobaric heat capacity in J/(mol-K).

cv

Isochoric heat capacity in J/(mol-K).

d

Molar concentration (molar density) in mol/l.

d2p_dd2

Second derivative of pressure with respect to density at constant temperature in kPa/(mol/l)^2.

d2p_dtd

Second derivative of pressure with respect to temperature and density in kPa/(mol/l)/K.

dp_dd

First derivative of pressure with respect to density at constant temperature in kPa/(mol/l).

dp_dt

First derivative of pressure with respect to temperature at constant density in kPa/K.

g

Gibbs energy in J/mol.

h

Enthalpy in J/mol.

jt

Joule-Thomson coefficient in K/kPa.

kappa

Isentropic exponent (dimensionless).

mm

Molar mass in g/mol.

pressure

Pressure in kPa.

s

Entropy in J/(mol-K).

temperature

Temperature in K.

u

Internal energy in J/mol.

w

Speed of sound in m/s.

z

Compressibility factor (dimensionless).

calc_density(flag)

Calculate the molar density d (mol/l) from temperature (K) and pressure (kPa).

Iterative solution of the GERG-2008 equation of state. Updates d and z; for flag > 0 the 2-phase check also runs calc_properties. Call calc_properties afterwards to get all the other properties at the converged state.

Parameters:

flag (int) – Passed to aga8::gerg2008::Gerg2008::density(iflag). In aga8 0.6.1 the iteration starts from the ideal-gas density, or for flag == 2 from three times the pseudo-critical density (liquid region). If d is negative before the call, abs(d) is used as the start value instead. For flag > 0 the converged state is also checked for a possible 2-phase state, and the calculation fails if the check fails. Use 0 for no check.

Raises:

RuntimeError – If the calculation fails to converge, or the 2-phase check fails. d then holds the ideal-gas density.

calc_molar_mass()

Calculate the molar mass of the current composition.

The result is stored in mm (g/mol). Returns None.

calc_pressure()

Calculate the pressure from temperature (K) and d (mol/l).

Also updates z. The pressure property is not changed.

Returns:

Pressure in kPa.

Return type:

float

calc_properties()

Calculate the thermodynamic properties from temperature (K) and d (mol/l).

Updates mm, z, dp_dd, d2p_dd2, d2p_dtd, dp_dt, u, h, s, cv, cp, w, g, jt and kappa. If d is not known, call calc_density first. Returns None.

cp

Isobaric heat capacity in J/(mol-K).

cv

Isochoric heat capacity in J/(mol-K).

d

Molar concentration (molar density) in mol/l.

Result of calc_density; input to calc_pressure and calc_properties.

d2p_dd2

Second derivative of pressure with respect to density at constant temperature in kPa/(mol/l)^2.

d2p_dtd

Second derivative of pressure with respect to temperature and density in kPa/(mol/l)/K.

dp_dd

First derivative of pressure with respect to density at constant temperature in kPa/(mol/l).

dp_dt

First derivative of pressure with respect to temperature at constant density in kPa/K.

g

Gibbs energy in J/mol.

h

Enthalpy in J/mol.

jt

Joule-Thomson coefficient in K/kPa.

kappa

Isentropic exponent (dimensionless).

mm

Molar mass in g/mol.

pressure

Pressure in kPa.

Input to calc_density.

s

Entropy in J/(mol-K).

set_composition(comp)

Check and set the gas composition.

The mole fractions are copied from comp. Later changes to comp have no effect until set_composition is called again.

Parameters:

comp (Composition) – Gas composition in mole fractions.

Raises:

ValueError – If the composition is empty (sum of the mole fractions is zero), or if the sum of the mole fractions differs from 1.0 by more than 0.01.

temperature

Temperature in K.

u

Internal energy in J/mol.

w

Speed of sound in m/s.

z

Compressibility factor (dimensionless).