Guest User

Film_Cooling_SIm_V0_1

a guest
Dec 1st, 2019
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 9.28 KB | None | 0 0
  1. %----
  2. %Film Cooling Sim
  3. %V0.1
  4. %----
  5.  
  6. close all
  7. clear
  8.  
  9. %Variables --------
  10. %Constants ----
  11. R_univ = 8314;  %J/kg,K  Universal gas constant
  12. SBC = 5.670373*10^-8;   %W/m2,K4  Stefan–Boltzmann constant
  13. %----
  14.  
  15. %Simulation ----
  16. n_Sim = 10^3;   %Number of steps in the sim
  17. %----
  18.  
  19. %Engine Properties ----
  20. %Fluid Properties (Taken from RPA)
  21. P_c = 2*10^6;   %Pa Chamber pressure (stagnation)
  22. T_c = 2948; %K  Chamber temperature (stagnation)
  23. gamma_c = 1.156; %Heat capacity ratio
  24. R_c = 321.1;    %J/kg,K  Gas constant
  25. Lchar = 1.0;  %m  Characteristic length
  26.  
  27. %Physical Properties
  28. D_t = 30/1000;  %m  Diameter of throat
  29. D_c = D_t*sqrt(9);  %m  Diameter of chamber
  30. D_e = D_t*sqrt(3.845);    %m  Diameter of nozzle exit
  31. theta_Frus = 45;    %Degrees  Contraction angle of chamber frustrum
  32. theta_Nzzl = 15;    %Degrees  Contraction anfle of nozzle (frustrum)
  33. T_Wall_Max = 1000;  %K Maximum engine wall temperature
  34. %----
  35.  
  36. %Coolant Properties ----
  37. %Methanol
  38.  
  39. %Base Properties
  40. MW_FC = 32.04;  %kg/kmol  Molar weight of coolant
  41. rho_l_FC = 792; %kg/m3  Density of coolant as liquid
  42. CP_l_FC = 2490; %J/kg,K  Specific heat of coolant as liquid
  43. CP_g_FC = 1920; %J/kg,K  Specific heat of coolant as gas
  44. k_l_FC = 0.202; %W/m,K  Thermal conductivity of coolant as liquid
  45. k_g_FC = 0.0262; %W/m,K  Thermal conductivity of coolant as gas
  46. mu_l_FC = 6.05*10^-4; %N,s/m2  Dynamic viscosity of coolant as liquid
  47. mu_g_FC = 1.38*10^-5; %N,s/m2  Dynamic viscosity of coolant as gas
  48. T_boil_FC = 337.85;  %K  Boiling temperature of coolant
  49. DeltaHv_FC = 1.17*10^6;  %J/kg,K Specific heat of vaporization of coolant
  50. epsilon_FC = 0.8;   %Emissivity of coolant
  51.  
  52. %Injection Properties
  53. f_FC = 7/100;   %Fraction of total engine mass flux as coolant
  54. T_inj_FC = 288;  %K  Temperature of coolant injection
  55. u_inj_FC = 16;  %m/s  Coolant injection velocity
  56. %----
  57. %--------
  58.  
  59. %Preliminary Math ----
  60. mDot_Engine = 0.25*pi*(D_t^2)*((P_c/sqrt(T_c))*sqrt(gamma_c/R_c)* ...
  61.     (0.5*gamma_c+0.5)^(-1*(gamma_c+1)/(2*gamma_c-2))); %kg/s
  62. mDot_FC = mDot_Engine*f_FC;   %kg/s  Mass flux of coolant
  63.  
  64. L_Frus = abs(D_c - D_t)/tand(theta_Frus)/2;    %m  Length of chamber frustrum
  65. L_Nzzl = abs(D_e - D_t)/tand(theta_Nzzl)/2;    %m  Length of nozzle
  66.  
  67. V_c = 0.25*pi*(D_t^2)*Lchar;    %m3  Chamber volume
  68. V_Frus = (pi*L_Frus/12)*(D_c*D_c+D_c*D_t+D_t*D_t);  %m3  Frustrum volume
  69. V_Cyl = V_c - V_Frus;   %m3  Chamber cylinder volume
  70. L_Cyl = V_Cyl/(0.25*pi*D_c^2);  %m  Chamber cylinder length
  71. L_c = L_Cyl + L_Frus;   %m  Length of chamber
  72. L_Engine = L_Cyl + L_Frus + L_Nzzl;  %m  Total length of engine
  73.  
  74. dD_Frus = (D_t - D_c)/L_Frus;
  75. dD_Nzzl = (D_e - D_t)/L_Nzzl;
  76.  
  77. PR_l_FC = CP_l_FC*mu_l_FC/k_l_FC;   %Prandtl number of coolant as liquid
  78. PR_g_FC = CP_g_FC*mu_g_FC/k_g_FC;   %Prandtl number of coolant as gas
  79. %----
  80.  
  81. %Modeling the Engine ----
  82. dL = L_Engine/(n_Sim - 1);   %m
  83. L_Array = 0:dL:L_Engine;    %m
  84. D_Array = zeros(1,n_Sim); %m
  85. M_s_Array = zeros(1,n_Sim); %Mach
  86. T_s_Array = zeros(1,n_Sim); %K
  87. P_s_Array = zeros(1,n_Sim); %Pa
  88. u_s_Array = zeros(1,n_Sim); %m/s
  89.  
  90. for i = 1:1:n_Sim
  91.     L_i = L_Array(i);   %m
  92.     D_i = 0;    %m
  93.     SuperSonic_i = 0;   %'Is the flow supersonic?' bool
  94.    
  95.     if (L_i <= L_Cyl)
  96.         D_i = D_c;  %m
  97.     elseif (L_i > L_Cyl)&&(L_i <= L_c)
  98.         D_i = dD_Frus*(L_i - L_Cyl) + D_c;  %m
  99.     else
  100.         D_i = dD_Nzzl*(L_i - L_c) + D_t;    %m
  101.         SuperSonic_i = 1;
  102.     end
  103.    
  104.     G_i = (D_i/D_t)^2;
  105.     M_i = AreaMachFunc(G_i,gamma_c,SuperSonic_i,4);
  106.     T_i = T_c*(1+0.5*(gamma_c-1)*M_i^2)^-1; %K
  107.     P_i = P_c*(1+0.5*(gamma_c-1)*M_i^2)^(-1*gamma_c/(gamma_c-1));   %Pa
  108.     u_i = M_i*sqrt(gamma_c*R_c*T_i);    %m/s
  109.    
  110.     if (L_i <= L_Cyl)
  111.         u_i = (L_i/L_Cyl)*u_i;  %m/s
  112.     end
  113.    
  114.     D_Array(i) = D_i;   %m
  115.     M_s_Array(i) = M_i;   %Mach
  116.     T_s_Array(i) = T_i; %K
  117.     P_s_Array(i) = P_i; %Pa
  118.     u_s_Array(i) = u_i; %m/s
  119. end
  120. %----
  121.  
  122. %Film Cooling Modeling --------
  123. T_FC_Array = zeros(1,n_Sim);    %K
  124. qa_Array = zeros(1,n_Sim);  %W/m2
  125.  
  126. %Liquid Phase ----
  127. %It is assumed that the coolant will quickly vaporize.
  128. %Therefore the cooling contribution during liquid phase will be...
  129. %calculated in one step.
  130. RE_D_l_FC = rho_l_FC*D_c*u_inj_FC/mu_l_FC;   %Reynold's number of coolant as liquid
  131.  
  132. %Gnielinski correlation for Nusselt number
  133. DFF_l_FC = (0.79*log(RE_D_l_FC)-1.64)^-2;  %Darcy friction factor
  134. NU_D_l_FC = ((DFF_l_FC/8)*(RE_D_l_FC-1000)*PR_l_FC)/...
  135.     (1+12.7*sqrt(DFF_l_FC/8)*(-1 + PR_l_FC^(2/3))); %Nusselt number
  136. h_l_FC = NU_D_l_FC*k_l_FC/D_c;  %W/m2,K  Heat transfer coeff.
  137.  
  138. %Heat Transfer
  139. QDot_l_FC = mDot_FC*(CP_l_FC*(T_boil_FC - T_inj_FC) + DeltaHv_FC);  %W
  140. T_l_FC_AVG = (T_boil_FC + T_inj_FC)/2;  %K
  141.  
  142. %Length of liquid film cooling
  143. L_l_FC = QDot_l_FC/(h_l_FC*pi*D_c*(T_c - T_l_FC_AVG));  %m
  144.  
  145. %Heat Transfer per Area
  146. A_l_FC = pi*D_c*L_l_FC; %m2  Area covered by liquid film cooling
  147. qa_l_FC = QDot_l_FC/A_l_FC; %W/m2
  148.  
  149. %Where did the liquid film cooling end?
  150. Delta_L_Array = abs(L_Array - L_l_FC);
  151. [Delta_min,n_l_End] = min(Delta_L_Array);
  152. T_FC_Array(n_l_End) = T_boil_FC;    %K
  153.  
  154. T_FC_Array(1,1:n_l_End) = ...
  155.     T_inj_FC:(T_boil_FC-T_inj_FC)/(n_l_End-1):T_boil_FC;  %K
  156. qa_Array(1,1:n_l_End) = qa_l_FC/(n_l_End); %W/m2
  157. %----
  158.  
  159. %Gas Phase ----
  160. for j = (n_l_End+1):1:n_Sim
  161.     D_j = D_Array(j);   %m
  162.     D_jp = D_Array(j-1);    %m
  163.     T_s_jp = T_s_Array(j);   %K
  164.     P_s_jp = P_s_Array(j);   %Pa
  165.     u_s_jp = u_s_Array(j);    %m/s
  166.     T_FC_jp = T_FC_Array(j-1); %K
  167.    
  168.     A_j = 0.25*pi*(D_j+D_jp)*sqrt(((abs(D_j-D_jp))^2)+4*dL^2);  %m2
  169.     %A_j = pi*D_jp*dL;   %m2
  170.    
  171.     %Convective Heat Transfer with Exhaust
  172.     u_FC_j = u_inj_FC; %m/s
  173.     if (u_s_jp > u_FC_j)
  174.         u_FC_j = u_s_jp;    %m/s
  175.     end
  176.     rho_jp = P_s_jp/((R_univ/MW_FC)*T_FC_jp);    %kg/m3
  177.     RE_D_jp = rho_jp*u_FC_j*D_jp/mu_g_FC;
  178.     DFF_jp = (0.79*log(RE_D_jp)-1.64)^-2;
  179.     NU_jp = ((DFF_jp/8)*(RE_D_jp-1000)*PR_g_FC)/...
  180.     (1+12.7*sqrt(DFF_jp/8)*(-1 + PR_g_FC^(2/3)));
  181.     h_jp = k_g_FC*NU_jp/D_jp;   %W/m2,K
  182.    
  183.     QDot_Conv = h_jp*A_j*(T_s_jp - T_FC_jp);    %W
  184.    
  185.     %Convective Heat Transfer with Wall(add when wall temp can be modeled)
  186.     QDot_Wall = 0;  %W
  187. %     if (T_FC_jp > T_Wall_Max)
  188. %         QDot_Wall = h_jp*A_j*(T_Wall_Max - T_FC_jp);   %W
  189. %     end
  190.    
  191.     %Radiative Heat Transfer(add when wall temp can be modeled)
  192.     %Also it's contribution is very small
  193.     %QDot_Radi = -1*A_j*epsilon_FC*SBC*T_FC_jp^4;  %W
  194.     QDot_Radi = 0;  %W
  195.    
  196.     %Summing
  197.     QDot_j = QDot_Conv + QDot_Wall + QDot_Radi; %W
  198.     DeltaT = QDot_j/(mDot_FC*CP_g_FC);  %K
  199.     T_FC_j = DeltaT + T_FC_jp;  %K
  200.     qa_j = QDot_j/A_j; %W/m2
  201.    
  202.     T_FC_Array(j) = T_FC_j; %K
  203.     qa_Array(j) = qa_j; %W/m2
  204. end
  205. %----
  206.  
  207. T_FC_Max = max(T_FC_Array); %K  Maximum film coolant temperaure
  208.  
  209. [~,n_t] = min(abs(D_Array - D_t));
  210. T_FC_t = T_FC_Array(n_t);   %K  Film coolant temperature at throat
  211. %--------
  212.  
  213. %Plotting ----
  214. % %Engine Shape
  215. % figure
  216. % plot(L_Array,D_Array/2,'k-')
  217. % grid on
  218. % axis equal
  219. % title('Engine Shape')
  220. % xlabel('Length (m)')
  221. % ylabel('Radius (m)')
  222. % xlim([0,L_Engine])
  223. % ylim([0,1*D_c])
  224.  
  225. %Heat Flux per Area 3D
  226. figure
  227. [X,Y,Z] = cylinder(0.5*D_Array);
  228. [m,n] = size(Z);
  229. C = zeros(m,n);
  230. for i = 1:1:n
  231.     C(:,i) = qa_Array;
  232. end
  233. eng = surf(X,Y,L_Engine*(-1*Z+1),C);
  234. eng.EdgeColor = 'none';
  235. axis equal
  236. cbar = colorbar;
  237. cbar.Label.String = 'Watts-per-meter-squared';
  238. title('Heat Flux per Area in Engine')
  239. xlabel('Meters')
  240. ylabel('Meters')
  241. zlabel('Meters')
  242.  
  243. %Film Cooling Temperature 3D
  244. figure
  245. [X,Y,Z] = cylinder(0.5*D_Array);
  246. [m,n] = size(Z);
  247. C = zeros(m,n);
  248. for i = 1:1:n
  249.     C(:,i) = T_FC_Array;
  250. end
  251. eng = surf(X,Y,L_Engine*(-1*Z+1),C);
  252. eng.EdgeColor = 'none';
  253. axis equal
  254. cbar = colorbar;
  255. cbar.Label.String = 'Kelvin';
  256. title('Film Coolant Temperature in Engine')
  257. xlabel('Meters')
  258. ylabel('Meters')
  259. zlabel('Meters')
  260.  
  261. %Heat Flux per Area
  262. figure
  263. yyaxis left
  264. plot(L_Array,qa_Array,'b-');
  265. ylabel('Heat Flux per Area (W/m2)')
  266. grid on
  267. yyaxis right
  268. plot(L_Array,D_Array/2,'r-');
  269. ylabel('Engine Radius (m)')
  270. title('Heat Flux per Area VS. Length')
  271. xlabel('Length (m)')
  272. xlim([0,L_Engine])
  273.  
  274. %Film Cooling Temperature
  275. figure
  276. yyaxis left
  277. plot(L_Array,T_FC_Array,'b-');
  278. ylabel('Film Coolant Temperature (K)')
  279. grid on
  280. yyaxis right
  281. plot(L_Array,D_Array/2,'r-');
  282. ylabel('Engine Radius (m)')
  283. title('Film Coolant Temperature VS. Length')
  284. xlabel('Length (m)')
  285. xlim([0,L_Engine])
  286. %----
  287.  
  288. %Display ----
  289. Display = ['Maximum Film Coolant Temperature: ',num2str(T_FC_Max),' K'];
  290. disp(Display)
  291. Display = ['Film Coolant Temperature at Throat: ',num2str(T_FC_t),' K'];
  292. disp(Display)
  293. %----
  294.  
  295. disp('Done!')
  296.  
  297. %----------------
  298. %Functions
  299. %----------------
  300. function [M_Guess] = AreaMachFunc(G,gamma,SuperSonic,Accuracy)
  301. M_Step = 10^(-1*Accuracy);
  302. M_Guess = 1;
  303. Delta1 = 10^99;
  304. Loop = 1;
  305.  
  306. if SuperSonic == 0
  307.     M_Guess = M_Step;
  308. end
  309.  
  310. G1 = ((gamma+1)/2)^(-1*(gamma+1)/(2*gamma-2));
  311. while Loop > 0
  312.     G2 = (1+0.5*(gamma-1)*M_Guess^2)^((gamma+1)/(2*gamma-2));
  313.     G_guess = G1*G2/M_Guess;
  314.     Delta2 = abs(G_guess - G);
  315.     if (Delta2 > Delta1)
  316.         M_Guess = M_Guess - M_Step;
  317.         Loop = 0;
  318.     else
  319.         M_Guess = M_Guess + M_Step;
  320.         Delta1 = Delta2;
  321.         if (SuperSonic == 0)&&(M_Guess >= 1)
  322.             %disp('Error! Left subsonic bounds!')
  323.             M_Guess = 1;
  324.             Loop = 0;
  325.         end
  326.     end
  327. end
  328.  
  329. end
Advertisement
Add Comment
Please, Sign In to add comment