Skip to content

Commit ce49d7f

Browse files
committed
Add filmCoolingLength method
1 parent 5c23c3c commit ce49d7f

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

Nozzle/nozzle_design.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
import matplotlib.pyplot as plt
1010
import CoolProp.CoolProp as CP
1111
from CoolProp.CoolProp import PropsSI
12+
from numpy.lib.function_base import _quantile_is_valid
1213
from scipy.optimize import fsolve
1314
from scipy.integrate import simps
1415
from pyswarm import pso
1516

16-
from noelle import *
17+
#from noelle import *
1718

1819
# Defining mathematical parameters and operations
1920
sqrt = math.sqrt
@@ -853,6 +854,51 @@ def circle1(Rt):
853854

854855
return(max(wall_temperature_profile))
855856

857+
def filmCoolingLength(self, x_inj, ml):
858+
859+
def stab_effectiveness(reynolds):
860+
effect = 0.5 + (4000 - reynolds)*0.5/4000
861+
862+
return effect
863+
864+
def find_nearest(a, a0):
865+
"Element in nd array `a` closest to the scalar value `a0`"
866+
idx = np.abs(a - a0).argmin()
867+
return idx
868+
869+
D = 2*self.yGeometry[find_nearest(self.xGeometry, x_inj)]
870+
871+
T = self.coolantInletTemperature
872+
P = self.coolantPressure
873+
874+
viscosity = PropsSI('viscosity', 'T', T, 'P', P, 'Ethanol')
875+
Re = ml/(np.pi*D*viscosity)
876+
Cp = PropsSI('Cpmass', 'T', T, 'P', P, 'Ethanol')
877+
T_sat = PropsSI('T', 'P', P, 'Q', 0.5, 'Ethanol')
878+
T_inj = self.coolantInletTemperature
879+
880+
eta = stab_effectiveness(Re)
881+
882+
Hv = PropsSI('H', 'P', P, 'Q', 1, 'Ethanol') - PropsSI('H', 'P', P, 'Q', 0, 'Ethanol')
883+
Q = eta*(ml*Cp*(T_sat-T_inj)) + eta*(ml*Hv)
884+
885+
def funct(L):
886+
x_i = x_inj
887+
x_f = L - x_inj
888+
889+
index_i = find_nearest(self.xGeometry, x_i)
890+
index_f = find_nearest(self.xGeometry, x_f) + 1
891+
892+
y = self.gasH*(np.pi*2*self.yGeometry)*(self.temperatureFunction - self.wallTemperatureFunction)
893+
Q_total = simps(y[index_i: index_f], self.xGeometry[index_i: index_f])
894+
895+
Q_total = Q_total*(L)/(self.xGeometry[index_f-1] - self.xGeometry[index_i])
896+
return Q_total - Q
897+
898+
L = fsolve(funct, self.xGeometry[-1]/2)[0]
899+
900+
return L
901+
856902
def geometryPlot(self):
857903
self.evaluateGeometry()
858904
x_vector = self.xGeometry

0 commit comments

Comments
 (0)