import math
#calculate The ram drag for given engine in kN
M0=0.85 ##Mach no.
a0=300. ##speed of sound in m/s
m=50. ##Air mass flow rate in kg/s
##Calculations
V0=M0*a0 ##Flight speed
Dr=m*V0 ##Ram drag
Dk=Dr/1000. ##in kN
print'%s %.2f %s'%("The ram drag for given engine in kN:",Dk,"")
#calculate gross thurst of the core and fan nozzles
Cv=450. ##exhaust velocity at core in m/s
Nv=350. ##exhaust velocity at nozzle in m/s
Cm=50. ##Mass flow rate through core in kg/s
Nm=350. ##Mass flow rate through nozzle in kg/s
##Calculations:
##Newton's second law
Fgc=Cm*Cv ##gross thrust of the core
Fgf=Nm*Nv ##gross thrust of the nozzle fan
print'%s %.f %s'%("Gross thrust of the core in",Fgc,"N")
print'%s %.f %s'%("Gross thrust of the fan nozzles in",Fgf,"N")
import math
#calculate The rocket gross thrust and pressure thurst
V9=4000 ##in m/s
p9=200*10**3 ##in Pa
p0=100*10**3 ## in Pa
D=2. ##in meter
m=200.+50. ## in kg/s
A=math.pi*(D**2)/4. ##nozzle exit area
##let p=(p9-p0)*A i.e. pressure thrust
p=(p9-p0)*A
mt=m*V9 ##momentum thrust.
t=p+mt ##rocket gross thrust
print'%s %.2f %s'%("The pressure thrust in",p,"N")
print'%s %.1f %s'%("The rocket gross thrust in",t,"N")
import math
#calcualte engine thurst takeoff
m0=100. ##air flow rate in kg/s
V0=0. ##takeoff assumptions in m/s
mf=2. ##2% of fuel-to-air ratio
Qr=43000. ##Heating value of typical hydrocarbon fuel in kJ/kg
V9=900. ##high speed exhaust jet (in m/s)
e=((m0+mf)*(V9)**2.)/(2.*(mf)*(Qr)*1000.)
m9=m0+mf
t=m9*V9 ## the engine thrust at takeoff.
print'%s %.f %s'%("The engine thrust at takeoff in SI units",t,"N")
#calculate the Engine propulsive efficiency
V9=900. ## in m/s
V0=200. ## in m/s
e=2./(1.+(V9/V0))
print'%s %.7f %s'%("Engine propulsive efficiency",e,"")
#estimate Propulsive efficiency
import math
V9=250. ##in m/s
V0=200. ##in m/s
##Calculations:
e=2./(1.+(V9/V0))
print'%s %.3f %s'%("Propulsive efficiency:",e,"")