Representing ideal gases
Pure (single-component) gases
IdealGasThermo.jl
exports the species
type which stores relevant thermodynamic information about a single element/compound. See readThermo
.
IdealGasThermo.species
— Typespecies <: 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
Composite species
IdealGasThermo.composite_species
— Typecomposite_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.
Gas mixtures
IdealGasThermo.jl
exports the Gas
type which stores relevant thermodynamic information about the gas mixture.
IdealGasThermo.Gas
— TypeGas{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)$.
IdealGasThermo.Gas
— MethodGas()
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
Base.setproperty!
— MethodBase.setproperty!(gas::Gas, s::Symbol, val)
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.
IdealGasThermo.Gas1D
— TypeGas1D
Type that represents single component gases.
IdealGasThermo.Gas1D
— MethodGas1D()
Constructor that returns a Gas1D
type representing Dry Air at standard conditions
See also Gas1D
.
IdealGasThermo.Gas1D
— MethodGas1D(sp::composite_species)
Constructor that returns a Gas
type representing Dry Air at standard conditions
See also Gas1D
.
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.
IdealGasThermo.set_h!
— Functionset_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
IdealGasThermo.set_hP!
— Functionset_hP!(gas::AbstractGas, hspec::Float64, P::Float64)
Calculates state of the gas given enthalpy and pressure (h,P)
IdealGasThermo.set_TP!
— Functionset_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
IdealGasThermo.set_Δh!
— Functionset_Δ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.