-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombustion_chamber.py
71 lines (50 loc) · 2.55 KB
/
combustion_chamber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import sys
import os
sys.path.insert(0,"/home/chinahg/GCresearch/cantera/build/python")
import cantera as ct
ct.add_directory('/user/chinahg')
ct.__file__
import numpy as np
import time
import math as math
import matplotlib.pyplot as plt
import scipy as sp
import scipy.optimize
def combustion_chamber(P_CC0, V_CC, mdot_ox, mdot_f):
#WSR
#Create Gas Mixture
gasExhaust = ct.Solution('h2o2.yaml')
gasExhaust.TPY = 300, P_CC0, 'O2: 6, H2:1'
gasExhaust.equilibrate('HP')
gasFuel = ct.Solution('h2o2.yaml') #ct.Hydrogen()
gasFuel.TPX = 20.15, 227527, 'H2:1' #https://science.ksc.nasa.gov/shuttle/technology/sts-newsref/et.html#:~:text=LIQUID%20HYDROGEN%20TANK,-The%20liquid%20hydrogen&text=Its%20operating%20pressure%20range%20is,to%20the%20left%20aft%20umbilical.
gasOx = ct.Solution('h2o2.yaml') #ct.Oxygen()
gasOx.TPX = 90.15, 140000, 'O2:1'
#Fuel and ox through low pressure turbopump and heat exchanger
gasFuel.TP = 533.15, P_CC0 #1000000
gasOx.TP = 145.9, 2900000 #weighted average of inlet ox temps
#Create Reactor Infrastructure
tankFuel = ct.Reservoir(gasFuel)
tankOx = ct.Reservoir(gasOx)
CC_exhaust1 = ct.Reservoir(gasExhaust)
CC_reactor = ct.IdealGasReactor(gasExhaust) #create CC with random gas initially filling it
#Connect tanks to CC
flow_controller_fuel = ct.MassFlowController(upstream=tankFuel,downstream=CC_reactor,mdot=mdot_f)
flow_controller_ox = ct.MassFlowController(upstream=tankOx,downstream=CC_reactor,mdot=mdot_ox)
#flow_controller_fuel2 = ct.MassFlowController(upstream=CC_reactor,downstream=CC_exhaust1,mdot=mdot_f+mdot_ox)
#flow_controller_ox2 = ct.MassFlowController(upstream=CC_reactor,downstream=CC_exhaust1,mdot=mdot_ox)
#Connect CC to exhaust reservoir
press_controller_ox = ct.PressureController(upstream=CC_reactor, downstream=CC_exhaust1, master=flow_controller_ox, K=0.001)
press_controller_fuel = ct.PressureController(CC_reactor, CC_exhaust1, master=flow_controller_fuel, K=0.001)
CC_reactorNet = ct.ReactorNet([CC_reactor])
#React!
t = 0
state = ct.SolutionArray(gasOx, extra=['t','volume','enthalpy','eox','efuel'])
while t < 0.2:
CC_reactorNet.step()
t = CC_reactorNet.time
#CC_reactorNet.advance(t)
# Extract the state of the reactor
state.append(CC_reactor.thermo.state, volume=CC_reactor.volume, t=t, enthalpy=gasExhaust.enthalpy_mole, efuel=gasFuel.enthalpy_mole, eox=gasOx.enthalpy_mole)
A = 0.159 #CC cross sectional area
return(state)