print('v=', isent.vel_from_stag_temp(isent.stag_temp_from_mach(M, T), T))
print('v=', isent.vel_from_mach(M, T))
print('rho=', rho, 'rhot=', isent.stag_density_from_mach(M, rho))
print('T=', isent.stat_temp_from_mach(M, isent.stag_temp_from_mach(M, T)))
print('p=',
      isent.stat_pressure_from_mach(M, isent.stag_pressure_from_mach(M, p)))

## Semiperfect gas
print('--------------------------SemiperfectGas--------------------------')
air = SemiperfectIdealGas('Air')
isent = IsentropicFlow(air)

##
h = 15000
T = isa.temperature_isa(h)
p = isa.pressure_isa(h)
rho = p / air.Rg / T
v = 500  # m/s

a = isent.sound_speed(T)
M = isent.mach_number(v, T)
print('M=', M, 'a=', a, 'T=', T, 'p=', p)

Tt_T = isent.stagnation_static_rel(M, T)
Tt = isent.stag_temp_from_mach(M, T)
pt = isent.stag_pressure_from_mach(M, p, T)
print('Tt_T=', Tt_T)
print('Tt=', Tt)
print('Tt=', isent.stag_temp_from_vel(v, T))
print('pt=', pt)
print('qi=', isent.impact_pressure_from_mach(M, p, T))
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)
nozzle.solve_from_static_exit_pressure(ps=p0, As=0.85)

print(
    '--- ADAPTED NOZZLE ----------------------------------------------------------------------'
Esempio n. 3
0
"""

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

import numpy as np
import pyturb.gas_models.isa  as isa

isa.temperature_isa([0, 1000, 2000])


h = np.linspace(0,85000,100)
T = isa.temperature_isa(h)
p = isa.pressure_isa(h)
d = isa.density_state_eq(h)


h = isa.height_from_temperature_isa(288.15)
h2 = isa.height_from_pressure_isa(85000)
hh = isa.height_from_pressure_isa([50000, 22000, 1500])
print(h, h2)
isa.height_from_temperature_isa(270)
isa.height_from_temperature_isa([220, 250])


np.testing.assert_almost_equal(isa.temperature_isa(0), [15+273.15])
np.testing.assert_almost_equal(isa.pressure_isa(0),[101325])
np.testing.assert_almost_equal(isa.temperature_isa(11000), [216.65])
np.testing.assert_almost_equal(isa.pressure_isa(11000), 22700.0, decimal=-2)