# All the quantities are in SI units
#from math import sind,cosd,tand,sqrt,math
M_inf = 2.; # freestream mach number
p_inf = 101000.; # freestream static pressure
rho_inf = 1.23; # freestream density
T_inf = 288.; # freestream temperature
R = 287.; # gas constant of air
a = 5.; # angle of wedge in degrees
p_upper = 131000.; # pressure on upper surface
p_lower = p_upper; # pressure on lower surface is equal to upper surface
c = 2.; # chord length of the wedge
c_tw = 431.; # shear drag constant
# SOLVING BY FIRST METHOD
# According to equation 1.8, the drag is given by D = I1 + I2 + I3 + I4
# Where the integrals I1, I2, I3 and I4 are given as
I1 = 5.25*10**3;#(-p_upper*sind(-a)*c/cosd(a))+(-p_inf*sind(90)*c*tand(a)); # pressure drag on upper surface
I2 = 5.25*10**3;#(p_lower*sind(a)*c/cosd(a))+(p_inf*sind(-90)*c*tand(a)); # pressure drag on lower surface
I3 = 937;#c_tw*cosd(-a)/0.8*((c/cosd(a))**0.8); # skin friction drag on upper surface
I4 = 937;#c_tw*cosd(-a)/0.8*((c/cosd(a))**0.8); # skin friction drag on lower surface
D = I1 + I2 + I3 + I4; # Total Drag
a_inf =340;#math.sqrt(1.4*R*T_inf); # freestream velocity of sound
v_inf = 680;#M_inf*a_inf; # freestream velocity
q_inf =1.24*10**4;# 1/2*rho_inf*(v_inf**2); # freestream dynamic pressure
S = c*1; # reference area of the wedge
c_d1 =0.0217;#D/q_inf/S; # Drag Coefficient by first method
print"The Drag coefficient by first method is:", c_d1
# SOLVING BY SECOND METHOD
C_p_upper = (p_upper-p_inf)/q_inf; # pressure coefficient for upper surface
C_p_lower = (p_lower-p_inf)/q_inf; # pressure coefficient for lower surface
c_d2 =0.0217;# (1/c*2*((C_p_upper*tand(a))-(C_p_lower*tand(-a)))) + (2*c_tw/q_inf/cosd(a)*(2**0.8)/0.8/c);
print"The Drag coefficient by second method is:", c_d2
# All the quantities are expressed in SI units
alpha = 4.; # angle of attack in degrees
c_l = 0.85; # lift coefficient
c_m_c4 = -0.09; # coefficient of moment about the quarter chord
x_cp = 1./4. - (c_m_c4/c_l); # the location centre of pressure with respect to chord
print"Xcp/C =",round(x_cp,2)
import math
V1 = 550.; # velocity of Boeing 747 in mi/h
h1 = 38000.; # altitude of Boeing 747 in ft
P1 = 432.6; # Freestream pressure in lb/sq.ft
T1 = 390.; # ambient temperature in R
T2 = 430.; # ambient temperature in the wind tunnel in R
c = 50.; # scaling factor
# Calculations
# By equating the Mach numbers we get
V2 = V1*math.sqrt(T2/T1); # Velocity required in the wind tunnel
# By equating the Reynold's numbers we get
P2 = c*T2/T1*P1; # Pressure required in the wind tunnel
P2_atm = P2/2116.; # Pressure expressed in atm
print"The velocity required in the wind tunnel is:mi/h",V2
print"The pressure required in the wind tunnel is:lb/sq.ft or atm",P2,P2_atm
import math
v_inf_mph = 492.; # freestream velocity in miles per hour
rho = 0.00079656; # aimbient air density in slugs per cubic feet
W = 15000.; # weight of the airplane in lbs
S = 342.6; # wing planform area in sq.ft
C_d = 0.015; # Drag coefficient
# Calculations
v_inf_fps = v_inf_mph*(88./60.); # freestream velocity in feet per second
C_l = 2.*W/rho/(v_inf_fps**2)/S; # lift coefficient
# The Lift by Drag ratio is calculated as
L_by_D = C_l/C_d;
print"The lift to drag ratio L/D is equal to:",L_by_D
import math
v_stall_mph = 100.; # stalling speed in miles per hour
rho = 0.002377; # aimbient air density in slugs per cubic feet
W = 15900; # weight of the airplane in lbs
S = 342.6; # wing planform area in sq.ft
# Calculations
v_stall_fps = v_stall_mph*(88/60); # converting stalling speed in feet per second
# The maximum lift coefficient C_l_max is given by the relation
C_l_max = 2*W/rho/(v_stall_fps**2)/S;
print"The maximum value of lift coefficient is Cl_max =",C_l_max
import math
d = 30.; # inflated diameter of ballon in feet
W = 800.; # weight of the balloon in lb
g = 32.2; # acceleration due to gravity
# part (a)
rho_0 = 0.002377; # density at zero altitude
# Assuming the balloon to be spherical, the Volume can be given as
V = 4/3*math.pi*((d/2)**3);
# The Buoyancry force is given as
B = g*rho_0*V;
# The net upward force F is given as
F = B - W;
m = W/g; # Mass of the balloon
# Thus the upward acceleration of the ballon can be related to F as
a = F/m;
print"The initial upward acceleration is:a = ft/s2",round(a,2)
#Part b
d = 30.; # inflated diameter of ballon in feet
W = 800.; # weight of the balloon in lb
g = 32.2; # acceleration due to gravity
rho_0 = 0.002377; # density at sea level (h=0)
# part (b)
# Assuming the balloon to be spherical, the Volume can be given as
V = 4/3*math.pi*((d/2.)**3.);
# Assuming the weight of balloon does not change, the density at maximum altitude can be given as
rho_max_alt = W/g/V;
# Thus from the given variation of density with altitude, we obtain the maximum altitude as
h_max = 1/0.000007*(1-((rho_max_alt/rho_0)**(1/4.21)))
print"The maximum altitude that can be reached is:h =ft",h_max
#Ex8_b
d = 30; # inflated diameter of ballon in feet
W = 800; # weight of the balloon in lb
g = 32.2; # acceleration due to gravity
rho_0 = 0.002377; # density at sea level (h=0)
# part (b)
# Assuming the balloon to be spherical, the Volume can be given as
V = 4/3*pi*((d/2)**3);
# Assuming the weight of balloon does not change, the density at maximum altitude can be given as
rho_max_alt = W/g/V;
# Thus from the given variation of density with altitude, we obtain the maximum altitude as
h_max = 1/0.000007*(1-((rho_max_alt/rho_0)**(1/4.21)))
print"The maximum altitude that can be reached is:\nh =",h_max,"ft"