Representing ideal gases

Pure (single-component) gases

IdealGases.jl exports the species type which stores relevant thermodynamic information about a single element/compound. See readThermo.

IdealGases.speciesType
species <: AbstractSpecies

species is a structure that holds the NASA 9 polynomial coefficients alow and ahigh for the two temprature regions separated by Tmid (here we only work with temperature less than 6000 K so typically only 2 T intervals required) the molecular weight MW and the heat of formation Hf (J/mol) for a given chemical species (at 298.15 K).

See here for typical data format

source

Composite species

IdealGases.composite_speciesType
composite_species <: AbstractSpecies

Represents a gas mixture of multiple components as a psuedo-species by calculating an equivalent set of polynomials defining $c_p$, $h$, and $s$.

See here for a more detailed explanation.

source

Gas mixtures

IdealGases.jl exports the Gas type which stores relevant thermodynamic information about the gas mixture.

IdealGases.GasType
Gas{N}

A type that represents an ideal gas that is calorically perfect i.e. $c_p(T)$, $h(T)$, $\phi(T)$ and $s(T,P)$.

source
IdealGases.GasMethod
Gas()

Constructor that returns a Gas type representing Air at standard conditions

See also Gas.

Examples

julia> Gas()
Ideal Gas at
  T =  298.150 K
  P =  101.325 kPa
 cp =   29.102 J/K/mol
  h =   -0.126 kJ/mol
  s =    0.199 kJ/K/mol

with composition:
-----------------------------
 Species        Yᵢ  MW[g/mol]
-----------------------------
     Air     1.000     28.965
-----------------------------
     ΣYᵢ     1.000     28.965
source

Single component gases

Gas1D type objects are a subtype of AbstractGas which allows us to use most of the functions that work with Gas. Gas1D types additionally store a representation of the composite species (composite_species). See here for the theory of representing fixed composition multi-component mixtures as single component mixtures.

IdealGases.Gas1DMethod
Gas1D()

Constructor that returns a Gas1D type representing Dry Air at standard conditions

See also Gas1D.

source
IdealGases.Gas1DMethod
Gas1D(sp::composite_species)

Constructor that returns a Gas type representing Dry Air at standard conditions

See also Gas1D.

source

Setting the thermodynamic state of the gas

The following functions let you set the thermodynamic state of the gas. These functions change the state of the gas in place i.e., the gas object is modified and no new copy is created.

IdealGases.set_h!Function
set_h!(gas::AbstractGas, hspec::Float64)

Calculates gas temperature for a specified enthalpy via a non-linear Newton-Raphson method.

Examples

julia> gas = Gas();
julia> set_h!(gas, 0.0)
Ideal Gas at
  T =  302.463 K
  P =  101.325 kPa
 cp =   29.108 J/K/mol
  h =    0.000 kJ/mol
  s =    0.199 kJ/K/mol

with composition:
-----------------------------
 Species        Yᵢ  MW[g/mol]
-----------------------------
     Air     1.000     28.965
-----------------------------
     ΣYᵢ     1.000     28.965
source
IdealGases.set_hP!Function
set_hP!(gas::AbstractGas, hspec::Float64, P::Float64)

Calculates state of the gas given enthalpy and pressure (h,P)

source
IdealGases.set_TP!Function
set_TP!(gas::AbstractGas, T::Float64, P::Float64)

Calculates state of the gas given Temperature and pressure (T,P) in K and Pa respectively.

Examples

julia> gas = Gas(); # Create an ideal gas consisting of air at std. conditions
julia> set_TP!(gas, 298.15*2, 101325.0*2)
Ideal Gas at
  T =  596.300 K
  P =  202.650 kPa
 cp =   30.418 J/K/mol
  h =    8.706 kJ/mol
  s =    0.214 kJ/K/mol

with composition:
-----------------------------
 Species        Yᵢ  MW[g/mol]
-----------------------------
     Air     1.000     28.965
-----------------------------
     ΣYᵢ     1.000     28.965
source
IdealGases.set_Δh!Function
set_Δh!(gas::AbstractGas, Δhspec::Float64, ηp::Float64 = 1.0)

Sets the gas state based on a specified change in enthalpy (Δh) [J/mol], and a given polytropic efficiency. This represents adding or removing some work from the gas.

source