[][src]Struct lmb_engine_simulator::reaction::gas::Gas

pub struct Gas { /* fields omitted */ }

Struct of an ideal gas

Implementations

impl Gas[src]

pub fn new(gas_file: &str) -> Gas[src]

Creates a Gas object from a file .json file

pub fn TP<'a>(&'a mut self, temp: f64, press: f64) -> &'a mut Self[src]

Set temperature and pressure. Thermo properties are recalculated

Examples

let temp = 350;
let press = 2e5;
gas.TP(temp, press);
assert_eq!(350, gas.T());
assert_eq!(2e5, gas.P());

pub fn TPX<'a>(
    &'a mut self,
    temp: f64,
    press: f64,
    mol_frac: &str
) -> &'a mut Self
[src]

Set temperature, pressure, and mole fraction of species. Thermo properties are recalculated

Examples

let temp = 350;
let press = 2e5;
let mole_frac = "O2:0.21, N2:0.79";
gas.TPX(temp, press, mol_frac);
assert_eq!(350, gas.T());
assert_eq!(2e5, gas.P());
assert_eq!(0.21, gas.mol_frac_of("O2"));

pub fn X<'a>(&'a mut self, mole_frac: &str) -> &'a mut Self[src]

Set mole fraction of species from &str. Thermo properties are recalculated

Examples

let mole_frac = "O2:0.21, N2:0.79";
gas.X(mol_frac);
assert_eq!(0.21, gas.mol_frac_of("O2"));
assert_eq!(0.79, gas.mol_frac_of("N2"));

pub fn X_array<'a>(&'a mut self, mol_frac: &Array1<f64>) -> &'a mut Self[src]

Set mole fraction of species from ndarray::Array1, must be the same size. Thermo properties are recalculated

pub fn TPX_array<'a>(
    &'a mut self,
    temp: f64,
    press: f64,
    mol_frac: &Array1<f64>
) -> &'a mut Self
[src]

pub fn if_mixed_with(&self, mass: f64, add_gas: Vec<(f64, &str)>) -> Array1<f64>[src]

Returns the equivalent mole fraction, if a mass, in kg, of self were mixed with other gases in add_gas<(mass, composition)>

Examples

gas.X("O2:1.0");
let additional_gas = vec![(0.329337487, "N2:1.0")];
let mix_mole_frac: Array1<f64> = gas.if_mixed_with(0.100, additional_gas);
//mix_mole_frac has: O2:0.21, N2:0.79

pub fn name(&self) -> String[src]

gas name

pub fn species(&self) -> &Vec<String>[src]

Vec with all species

pub fn mole_frac(&self) -> &Array1<f64>[src]

array of species mole fraction

pub fn mole_weight(&self) -> &Array1<f64>[src]

array of all species molar weight [kg/kmol]

pub fn T(&self) -> f64[src]

temperature [K]

pub fn P(&self) -> f64[src]

pressure [Pa]

pub fn rho(&self) -> f64[src]

density [kg/m³]

pub fn cp(&self) -> f64[src]

specific heat at constant pressure [J/kg.K]

pub fn cv(&self) -> f64[src]

specific heat at constant volume [J/kg.K]

pub fn R(&self) -> f64[src]

ideal gas constant [J/kg.K]

pub fn k(&self) -> f64[src]

specific heat ratio (cp/cv)

pub fn M(&self) -> f64[src]

molar mass [kg/kmol]

pub fn e(&self) -> f64[src]

internal energy [J]

pub fn h(&self) -> f64[src]

enthalpy [J/kg]

pub fn s(&self) -> f64[src]

entropy [J/kg.K]

pub fn a(&self) -> f64[src]

sound speed [m/s]

pub fn mu(&self) -> f64[src]

viscosity [m²/s]

pub fn num_species(&self) -> usize[src]

return the number os species

pub fn contains_specie(&self, specie: &str) -> bool[src]

check if specie contains in species vector

pub fn get_specie_index(&self, specie: &str) -> usize[src]

get the index of specie

pub fn mole_frac_of(&self, specie: &str) -> f64[src]

return the mole fraction of specie

pub fn mole_weight_of(&self, specie: &str) -> f64[src]

return the mole weight of specie

pub fn atoms_of(&self, specie: &str) -> &HashMap<String, f64>[src]

return a &HashMap containing the atoms_name and num_of_atoms of specie

Trait Implementations

impl Clone for Gas[src]

impl Debug for Gas[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.