Skip to content

Commit

Permalink
Merge aabf82e into 1c55225
Browse files Browse the repository at this point in the history
  • Loading branch information
planes committed Sep 22, 2017
2 parents 1c55225 + aabf82e commit 9a2ce68
Show file tree
Hide file tree
Showing 14 changed files with 1,159 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Contributing Developers
* Michael Colonno
* Michael Kruger
* Michael Vegh
* Pedro Gonçalves
* Rick Fenrich
* Tarik Orra
* Tim MacDonald
Expand Down
228 changes: 228 additions & 0 deletions regression/scripts/ramjet_network/ramjet_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# ramjet_network.py
#
# Created: P. Goncalves, Sep 2017
# Modified:
#

""" create and evaluate a ramjet network
"""

# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------

import SUAVE
from SUAVE.Core import Units, Data

import numpy as np

from SUAVE.Components.Energy.Networks.Ramjet import Ramjet
from SUAVE.Methods.Propulsion.ramjet_sizing import ramjet_sizing

# ----------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------

def main():

# call the network function
energy_network()

return

# ----------------------------------------------------------------------
# Energy Network
# ----------------------------------------------------------------------

def energy_network():

# ------------------------------------------------------------------
# Evaluation Conditions
# ------------------------------------------------------------------

# --- Conditions
ones_1col = np.ones([1,1])

# setup conditions
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()

# freestream conditions
conditions.freestream.mach_number = ones_1col*0.8
conditions.freestream.pressure = ones_1col*20000.
conditions.freestream.temperature = ones_1col*215.
conditions.freestream.density = ones_1col*0.8
conditions.freestream.dynamic_viscosity = ones_1col* 0.000001475
conditions.freestream.altitude = ones_1col* 10.
conditions.freestream.gravity = ones_1col*9.81
conditions.freestream.gamma = ones_1col*1.4
conditions.freestream.Cp = 1.4*287.87/(1.4-1)
conditions.freestream.R = 287.87
conditions.M = conditions.freestream.mach_number
conditions.T = conditions.freestream.temperature
conditions.p = conditions.freestream.pressure
conditions.freestream.speed_of_sound = ones_1col* np.sqrt(conditions.freestream.Cp/(conditions.freestream.Cp-conditions.freestream.R)*conditions.freestream.R*conditions.freestream.temperature) #300.
conditions.freestream.velocity = conditions.M * conditions.freestream.speed_of_sound
conditions.velocity = conditions.M * conditions.freestream.speed_of_sound
conditions.q = 0.5*conditions.freestream.density*conditions.velocity**2
conditions.g0 = conditions.freestream.gravity

# propulsion conditions
conditions.propulsion.throttle = ones_1col*1.0

# ------------------------------------------------------------------
# Design/sizing conditions
# ------------------------------------------------------------------

# --- Conditions
ones_1col = np.ones([1,1])

# setup conditions
conditions_sizing = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()


# freestream conditions
conditions_sizing.freestream.mach_number = ones_1col*2.5
conditions_sizing.freestream.pressure = ones_1col*26499.73156529
conditions_sizing.freestream.temperature = ones_1col*223.25186491
conditions_sizing.freestream.density = ones_1col*0.41350854
conditions_sizing.freestream.dynamic_viscosity = ones_1col* 1.45766126e-05 #*1.789*10**(-5)
conditions_sizing.freestream.altitude = ones_1col* 10000. #* 0.5
conditions_sizing.freestream.gravity = ones_1col*9.81
conditions_sizing.freestream.gamma = ones_1col*1.4
conditions_sizing.freestream.Cp = 1.4*287.87/(1.4-1)
conditions_sizing.freestream.R = 287.87
conditions_sizing.freestream.speed_of_sound = 299.96
conditions_sizing.freestream.velocity = conditions_sizing.freestream.mach_number * conditions_sizing.freestream.speed_of_sound

# propulsion conditions
conditions_sizing.propulsion.throttle = ones_1col*1.0

state_sizing = Data()
state_sizing.numerics = Data()
state_sizing.conditions = conditions_sizing
state_off_design=Data()
state_off_design.numerics=Data()
state_off_design.conditions=conditions

# ------------------------------------------------------------------
# Ramjet Network
# ------------------------------------------------------------------

# instantiate the gas turbine network
ramjet = SUAVE.Components.Energy.Networks.Ramjet()
ramjet.tag = 'ramjet'

# setup
ramjet.number_of_engines = 2.0
ramjet.engine_length = 12.0
ramjet.nacelle_diameter = 1.3 * Units.meter
ramjet.inlet_diameter = 1.1 * Units.meter

# working fluid
ramjet.working_fluid = SUAVE.Attributes.Gases.Air()

# ------------------------------------------------------------------
# Component 1 - Ram

# to convert freestream static to stagnation quantities

# instantiate
ram = SUAVE.Components.Energy.Converters.Ram()
ram.tag = 'ram'

# add to the network
ramjet.append(ram)

# ------------------------------------------------------------------
# Component 2 - Inlet Nozzle

# instantiate
inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle()
inlet_nozzle.tag = 'inlet_nozzle'

# setup
inlet_nozzle.polytropic_efficiency = 1.0
inlet_nozzle.pressure_ratio = 1.0
inlet_nozzle.compressibility_effects = True

# add to network
ramjet.append(inlet_nozzle)

# ------------------------------------------------------------------
# Component 3 - Combustor

# instantiate
combustor = SUAVE.Components.Energy.Converters.Combustor()
combustor.tag = 'combustor'

# setup
combustor.efficiency = 1.0
combustor.turbine_inlet_temperature = 2400.
combustor.pressure_ratio = 1.0
combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A()
combustor.rayleigh_analyses = True

# add to network
ramjet.append(combustor)

# ------------------------------------------------------------------
# Component 4 - Core Nozzle

# instantiate
nozzle = SUAVE.Components.Energy.Converters.Supersonic_Nozzle()
nozzle.tag = 'core_nozzle'

# setup
nozzle.polytropic_efficiency = 1.0
nozzle.pressure_ratio = 1.0

# add to network
ramjet.append(nozzle)

# ------------------------------------------------------------------
# Component 5 - Thrust

# instantiate
thrust = SUAVE.Components.Energy.Processes.Thrust()
thrust.tag ='thrust'

# setup
thrust.total_design = ramjet.number_of_engines*169370.4652 * Units.N

# add to network
ramjet.thrust = thrust

#size the ramjet
ramjet_sizing(ramjet,0.8,10000.0)

print "Design thrust ",ramjet.design_thrust
print "Sealevel static thrust ",ramjet.sealevel_static_thrust

results_design = ramjet(state_sizing)
results_off_design = ramjet(state_off_design)
F = results_design.thrust_force_vector
mdot = results_design.vehicle_mass_rate
F_off_design = results_off_design.thrust_force_vector
mdot_off_design = results_off_design.vehicle_mass_rate

#Specify the expected values
expected = Data()

expected.thrust = 3399690.0050419518
expected.mdot = 203.11136550916788

#error data function
error = Data()

error.thrust_error = (F[0][0] - expected.thrust)/expected.thrust
error.mdot_error = (mdot[0][0] - expected.mdot)/expected.mdot
print error

for k,v in error.items():
assert(np.abs(v)<1e-4)

return

if __name__ == '__main__':

main()
62 changes: 55 additions & 7 deletions trunk/SUAVE/Components/Energy/Converters/Combustor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
# ----------------------------------------------------------------------

import SUAVE

import numpy as np
from scipy.optimize import fsolve

from SUAVE.Core import Data
from SUAVE.Components.Energy.Energy_Component import Energy_Component

from SUAVE.Methods.Propulsion.rayleigh import rayleigh
from SUAVE.Methods.Propulsion.fm_solver import fm_solver

# ----------------------------------------------------------------------
# Combustor Component
Expand Down Expand Up @@ -55,13 +60,16 @@ def __defaults__(self):
self.turbine_inlet_temperature = 1.0
self.inputs.stagnation_temperature = 1.0
self.inputs.stagnation_pressure = 1.0
self.inputs.static_pressure = 1.0
self.inputs.mach_number = 0.1
self.outputs.stagnation_temperature = 1.0
self.outputs.stagnation_pressure = 1.0
self.outputs.static_pressure = 1.0
self.outputs.stagnation_enthalpy = 1.0
self.outputs.fuel_to_air_ratio = 1.0
self.fuel_data = Data()


self.rayleigh_analyses = False
self.area_ratio = 1.9

def compute(self,conditions):
""" This computes the output values from the input values according to
Expand Down Expand Up @@ -95,9 +103,10 @@ def compute(self,conditions):
turbine_inlet_temperature [K]
pressure_ratio [-]
efficiency [-]
area_ratio [-]
"""
# unpack the values

# unpacking the values from conditions
gamma = conditions.freestream.isentropic_expansion_factor
Cp = conditions.freestream.specific_heat_at_constant_pressure
Expand All @@ -107,26 +116,64 @@ def compute(self,conditions):
# unpacking the values form inputs
Tt_in = self.inputs.stagnation_temperature
Pt_in = self.inputs.stagnation_pressure
Mach = self.inputs.mach_number
Tt4 = self.turbine_inlet_temperature
pib = self.pressure_ratio
eta_b = self.efficiency

# unpacking values from self
htf = self.fuel_data.specific_energy
htf = self.fuel_data.specific_energy
ray_analysis = self.rayleigh_analyses
ar = self.area_ratio

# Rayleigh flow analysis, constant pressure burner
if ray_analysis:

# Initialize arrays
M_out = 1*Pt_in/Pt_in
Ptr = 1*Pt_in/Pt_in

# Make i_rayleigh the size of output arrays
i_rayleigh = Pt_in < 2*Pt_in

# Isentropic decceleration through divergent nozzle
Mach[i_rayleigh] = fm_solver(ar,Mach[i_rayleigh],gamma)

# Determine max stagnation temperature to thermally choke flow
Tt4_ray = Tt_in*(1+gamma*Mach**2)**2/((2*(1+gamma)*Mach**2)*(1+(gamma-1)/2*Mach**2))

# Checking if Tt4 is limited by Rayleigh
i_low = Tt4_ray <= Tt4
i_high = Tt4_ray > Tt4

# Choose Tt4 for fuel calculations

# --Material limitations define Tt4
Tt4 = Tt4*Tt4_ray/Tt4_ray

# --Rayleigh limitations define Tt4
Tt4[i_low] = Tt4_ray[i_low]

#Rayleigh calculations
M_out[i_rayleigh], Ptr[i_rayleigh] = rayleigh(gamma,Mach[i_rayleigh],Tt4[i_rayleigh]/Tt_in[i_rayleigh])
Pt_out = Ptr*Pt_in

else:
Pt_out = Pt_in*pib


# method to compute combustor properties

# method - computing the stagnation enthalpies from stagnation temperatures
ht4 = Cp*Tt4
ho = Cp*To
ht_in = Cp*Tt_in

# Using the Turbine exit temperature, the fuel properties and freestream temperature to compute the fuel to air ratio f
f = (ht4 - ht_in)/(eta_b*htf-ht4)

# Computing the exit static and stagnation conditions
ht_out = Cp*Tt4
Pt_out = Pt_in*pib

# pack computed quantities into outputs
self.outputs.stagnation_temperature = Tt4
Expand All @@ -137,3 +184,4 @@ def compute(self,conditions):


__call__ = compute

Loading

0 comments on commit 9a2ce68

Please sign in to comment.