Ejemplo n.º 1
0
Gas Mixture tests

M Rodriguez. 2020
"""

import sys
from sys import path
from os.path import dirname as dir
sys.path.append(dir(sys.path[0]))

import pyturb.utils.constants as cts
from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas
from pyturb.gas_models.gas_mixture import GasMixture
import numpy as np

air = PerfectIdealGas('Air')
gm = GasMixture(gas_model='Perfect')

gm.add_gas('O2', 0.209476)
gm.add_gas('N2', 0.78084)
gm.add_gas('Ar', 0.009365)
gm.add_gas('CO2', 0.000319)

print(
    '--------------------------------------------------------------------------------------------------------------'
)
print(gm.mixture_gases)
print(
    '--------------------------------------------------------------------------------------------------------------'
)
Ejemplo n.º 2
0
import numpy as np
import pyturb.utils.constants as cts
import pyturb.utils.units as units
from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas
from pyturb.gas_models.thermo_properties import ThermoProperties
print('tests_1')
print('-----------------')
#print(cts.Ru, units.m_to_nm)
#print()
#tp = ThermoProperties('O2')
#print(tp)

pig = PerfectIdealGas('Air')
print(pig.Ru)
print(pig.Rg)
Ejemplo n.º 3
0
M Rodriguez. 2020
"""

import sys
from sys import path
from os.path import dirname as dir
sys.path.append(dir(sys.path[0]))

from pyturb.gas_models.isentropic_flow import IsentropicFlow
from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas
from pyturb.power_plant.nozzle import Nozzle
import pyturb.gas_models.isa as isa
import numpy as np

air = PerfectIdealGas('Air')
isent_flow = IsentropicFlow(air)

h0 = 0.0
p0 = isa.pressure_isa(h0)
T0 = isa.temperature_isa(h0)
phi_1 = 1  # m
Ae = np.pi * phi_1**2 / 4
v0 = 300
G0 = p0 / T0 / air.Rg * Ae * v0
M0 = isent_flow.mach_number(v0, T0)
p0t = isent_flow.stag_pressure_from_mach(M0, p0, T0)
T0t = isent_flow.stag_temp_from_mach(M0, T0)

nozzle = Nozzle(air)
nozzle.initialize_nozzle(G0, p0t, T0t, Ae=Ae)
Ejemplo n.º 4
0
"""
pyturb
Combustion thermodynamics tests

M Rodriguez. 2020
"""
import sys
from sys import path
from os.path import dirname as dir
sys.path.append(dir(sys.path[0]))

from pyturb.gas_models.gas_mixture import GasMixture
from pyturb.combustion.combustion_thermodynamics import Combustion
from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas

air = PerfectIdealGas('Air')
fuel = PerfectIdealGas('C8H18,isooctane')

print(fuel.thermo_prop.chemical_formula)
print(air.thermo_prop.chemical_formula)

comb = Combustion(fuel, air)

comb.combustion_stoichiometry()
print(comb.stoichiometric_reaction)

print(comb.stoich_far)
print(comb.alpha)
print(comb.beta)
print(comb.gamma)
Ejemplo n.º 5
0
print(tp)

MO2 = 31.9988000 #g/mol
MN2 = 28.0134800 #g/mol
MAr = 39.9474514 #g/mol
MCO2 = 44.0095000 #g/mol
Ma = (78.084*MN2 + 20.9476*MO2 + 0.9365*MAr + 0.0319*MCO2 ) / 100

Ra = cts.Ru/Ma*1e3 # J/kg/K
print(Ra, Ma)

gamma_a = 1.4
cv = Ra/(gamma_a - 1)
cp = cv + Ra

pig = PerfectIdealGas(gas)
print(pig.gamma())
np.testing.assert_almost_equal(tp.Mg, Ma, decimal=4)
np.testing.assert_almost_equal(pig.Rg, Ra, decimal=4)
np.testing.assert_almost_equal(pig.cp(), cp, decimal=0)

spig = SemiperfectIdealGas(gas)

print(cv, spig.cv(cts.T_ref))

print(spig.cp(cts.T_ref), pig.cp())
print(spig.cv(cts.T_ref)*cts.T_ref, cv*cts.T_ref)
print(spig.gamma(cts.T_ref))

temp = 500 #K
h0 = cp*temp