|
9 | 9 | import matplotlib.pyplot as plt |
10 | 10 | import CoolProp.CoolProp as CP |
11 | 11 | from CoolProp.CoolProp import PropsSI |
| 12 | +from numpy.lib.function_base import _quantile_is_valid |
12 | 13 | from scipy.optimize import fsolve |
13 | 14 | from scipy.integrate import simps |
14 | 15 | from pyswarm import pso |
15 | 16 |
|
16 | | -from noelle import * |
| 17 | +#from noelle import * |
17 | 18 |
|
18 | 19 | # Defining mathematical parameters and operations |
19 | 20 | sqrt = math.sqrt |
@@ -853,6 +854,51 @@ def circle1(Rt): |
853 | 854 |
|
854 | 855 | return(max(wall_temperature_profile)) |
855 | 856 |
|
| 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 | + |
856 | 902 | def geometryPlot(self): |
857 | 903 | self.evaluateGeometry() |
858 | 904 | x_vector = self.xGeometry |
|
0 commit comments