Advertisement
Guest User

Untitled

a guest
Mar 15th, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | Help | 0 0
  1. %% Shockwave Calcs
  2. clc;clear;close all;
  3. sympref('FloatingPointOutput',true);
  4.  
  5. %% Known info
  6. M0 = 2.1; % Free stream velocity
  7. M4_up = 1.273; % Velocity upstream of shock 4 (normal shockwave)
  8. gamma = 1.4; % specific heat ratio, assumed to be 1.4
  9.  
  10. %M4 needs to be 0.8, vary M4_up until it is - DONE
  11. M4 = sqrt((((gamma-1)*(M4_up^2))+2)/((2*gamma*(M4_up^2))-(gamma-1)));
  12.  
  13. %% Unknowns
  14. syms M1; % Mach number after first oblique shockwave
  15. syms M2; % Mach number after second oblique shockwave
  16. syms M3; % Mach number after third oblique shockwave
  17. syms theta1; % Shock wave angle of first shockwave
  18. syms theta2; % Shock wave angle of second shockwave
  19. syms theta3; % Shock wave angle of third shockwave
  20. syms d1; % deflection angle (half ramp angle) of M1 downstream flow
  21. syms d2; % deflection angle (half ramp angle) of M2 downstream flow
  22. syms d3; % deflection angle (half ramp angle) of M3 downstream flow
  23.  
  24. %% Equations for solving Mach numbers and angles
  25.  
  26.  
  27. eqn_M1 = sqrt(((36*M0^4*sind(theta1)^2)-5*(M0^2*sind(theta1)^2-1)*(7*M0^2*sind(theta1)^2+5))/((7*M0^2*sind(theta1)^2-1)*(M0^2*sind(theta1)^2+5)));
  28. eqn_d1 = acotd(tand(theta1)*((6*M0^2)/(5*(M0^2*sind(theta1)^2-1))-1));
  29. eqn_M2 = sqrt(((36*M1^4*sind(theta2)^2)-5*(M1^2*sind(theta2)^2-1)*(7*M1^2*sind(theta2)^2+5))/((7*M1^2*sind(theta2)^2-1)*(M1^2*sind(theta2)^2+5)));
  30. eqn_d2 = acotd(tand(theta2)*((6*M1^2)/(5*(M1^2*sind(theta2)^2-1))-1));
  31. eqn_M3 = sqrt(((36*M2^4*sind(theta3)^2)-5*(M2^2*sind(theta3)^2-1)*(7*M2^2*sind(theta3)^2+5))/((7*M2^2*sind(theta3)^2-1)*(M2^2*sind(theta3)^2+5)));
  32. eqn_d3 = acotd(tand(theta3)*((6*M2^2)/(5*(M2^2*sind(theta3)^2-1))-1));
  33.  
  34. eqn_7 = (M0*sind(theta1)) == (M1*sind(theta2));
  35. eqn_8 = (M1*sind(theta2)) == (M2*sind(theta3));
  36. eqn_9 = M3 == M4_up;
  37.  
  38. eqns = [eqn_M1, eqn_d1, eqn_M2, eqn_d2, eqn_M3, eqn_d3, eqn_7,eqn_8,eqn_9];
  39.  
  40. Solution = solve(eqns,[M1, M2, M3, theta1, theta2, theta3, d1, d2, d3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement