Wedge Code
Wedge Code
m 1 of 4
%This script receives the input parameters of upstream Mach number and
%static pressure, flow angle of attack, and forward and rear wedge half
%angles and finds the forces in the x and y direction, lift and grag,
%and coefficients of lift and drag.
%Written on October 7th, 2019 by Daniel Wolfe Bradford for ME425 at Boston
%University under Professor Cheryl Grace
%Calculate p2 and M2
%This calculation is dependent on angle of attack
if alpha_flow > alpha_front %Expansion case
theta_2 = alpha_flow - alpha_front;
%Find M2
pm_1 = pmang(M1,gamma);
pm_2 = theta_2 + pm_1;
M2 = findm2_new(pm_2,gamma);
%Find p2
p2_p1 = presratpm(M1,M2,gamma);
p2 = p2_p1 * p1;
else
if alpha_flow < alpha_front %Compression case
theta_2 = alpha_front - alpha_flow;
%Find M2 through Beta2
beta2 = abs(findbet(M1,theta_2,gamma));
Mn1 = M1*sin(beta2);
Mn2 = oblique(Mn1,gamma);
M2 = Mn2/sin(beta2 - theta_2);
%Find p2
p2_p1 = presratoblique(Mn1,gamma);
p2 = p2_p1 * p1;
else %Nuetral case (alpha_flow = alpha_front)
M2 = M1;
p2 = p1;
end
end
%Calculate p3 and M3
%This calculation will always be a compression calculation
theta_3 = alpha_flow + alpha_front;
%Find M3 through Beta3
beta3 = abs(findbet(M1,theta_3,gamma));
Mn1 = M1*sin(beta3);
Mn3 = oblique(Mn1,gamma);
M3 = Mn3/sin(beta3 - theta_3);
%Find p2
p3_p1 = presratoblique(Mn1,gamma);
p3 = p3_p1 * p1;
cL = sprintf('c_L = %.4f\n',c_L);
cD = sprintf('c_D = %.4f\n',c_D);