Advertisement
Guest User

Untitled

a guest
May 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.36 KB | None | 0 0
  1. clc;clear all;
  2. %% Problem 4
  3.  
  4. %Nomenclature for numbering:
  5. %No number means freestream
  6. %1 means upper left panel
  7. %2 means upper right panel
  8. %3 means bottom panel
  9.  
  10. M = 3;
  11. gamma = 1.4;
  12. alpha = 5; %degrees
  13. epsilon = 3; %Angle the panels of the triangle, degrees
  14.  
  15. %% Calculate P1/P using expansion wave relations
  16. theta_R1 = alpha - epsilon;
  17.  
  18. %Using Appendix C:
  19. [~,v] = flowprandtlmeyer(gamma,M); %Prandtl-Meyer for Mach 3
  20. v1 = v + theta_R1; %New Prandtl - Meyer
  21.  
  22. %Mach in Region 2
  23. M1 = flowprandtlmeyer(gamma,v1,'nu');
  24.  
  25. %P/P0
  26. [~,~,stag_pressure_ratio] = flowisentropic(gamma,M);
  27.  
  28. %P1/P01
  29. [~,~,stag_pressure_ratio_1] = flowisentropic(gamma,M1);
  30.  
  31. %Answer
  32. pressure_ratio_R1 = stag_pressure_ratio_1/stag_pressure_ratio; %P1/P, region 1
  33.  
  34. %% Calculate P2/P using expansion wave relations
  35. theta_R2 = 2*epsilon;
  36. v2 = theta_R2 + v1; %degrees, turn once at tip, turn again for panel
  37.  
  38. %Mach in Region 2
  39. M2 = flowprandtlmeyer(gamma,v2,'nu');
  40.  
  41. %P2/P02
  42. [~,~,stag_pressure_ratio_2] = flowisentropic(gamma,M2);
  43.  
  44. %ANSWER
  45. pressure_ratio_R2 = pressure_ratio_R1*(stag_pressure_ratio_2/stag_pressure_ratio_1); %P2/P, accounts for effects of Region 1.
  46.  
  47. %% Calculate P3/P1 using oblique shock relations
  48. theta_R3 = alpha; %degrees, total deflection from zero aoa
  49.  
  50. lambda = sqrt((M^2-1)^2 - 3*(1+((gamma-1)/2)*M^2)*(1+((gamma+1)/2)*M^2)*tand(theta_R3)^2);
  51. X = ((M^2-1)^3-9*((1+((gamma-1)/2)*M^2)*(1 + ((gamma-1)/2)*M^2 + ((gamma+1)/4)*M^4)*tand(theta_R3)^2))/lambda^3;
  52. delta = 1;
  53.  
  54. %Calculate Shock Angles, degrees
  55. beta = (atan((M^2-1+2*lambda*cos((4*pi*delta + acos(X))/3))/(3*(1 + ((gamma-1)/2)*M^2)*tand(theta_R3))))*180/pi;
  56.  
  57. Mn = M*sind(beta);
  58.  
  59. %Mach in Region 3
  60. Mn3 = sqrt((1 + ((gamma-1)/2)*Mn^2)/(gamma*Mn^2 - (gamma-1)/2));
  61. M3 = Mn3/sind(beta-theta_R3);
  62.  
  63.  
  64. %ANSWER
  65. pressure_ratio_R3 = 1 + ((2*gamma)/(gamma+1))*(Mn^2-1); %P3/P
  66.  
  67. %% Calculate Cp
  68. Cp1 = (2/(gamma*M^2))*(pressure_ratio_R1 - 1);
  69. Cp2 = (2/(gamma*M^2))*(pressure_ratio_R2 - 1);
  70. Cp3 = (2/(gamma*M^2))*(pressure_ratio_R3 - 1);
  71.  
  72. disp(['Cp of Panel 1 is: ',num2str(Cp1)])
  73. disp(['Cp of Panel 2 is: ',num2str(Cp2)])
  74. disp(['Cp of Panel 3 is: ',num2str(Cp3) newline])
  75.  
  76. %% Calculate Cl and Cd
  77. Cn = .5*((Cp3 - Cp1)+(Cp3 - Cp2));
  78. Ca = .5*tand(epsilon)*(Cp1 - Cp2);
  79.  
  80. Cl = (Cn*cosd(alpha)) - (Ca*sind(alpha));
  81. Cd = (Cn*sind(alpha)) + (Ca*cosd(alpha));
  82.  
  83. disp(['Cl is: ',num2str(Cl)])
  84. disp(['Cd is: ',num2str(Cd)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement