In [1]:

```
import math
#Input data
mp = 12. #flow rate in kg/s
Ae = 335.*10**-4 #exit area in m**2
Ce = 2000. #exhaust velocity in m/s
h = 10. #altitude in km
Pe = 1.*10**5 #exhaust pressure in Pa
P0 = 1.*10**5 #p0 = atomspheric pressure in Pa at h = 0.
P10 = 0.25*10**5 #atmospheric pressure in Pa umath.sing gas tables
#Calculations
Fs = mp*Ce*10**-3 #thrust of motor at sea level math.since pe = p0 in kN
F10 = ((mp*Ce) + Ae*(Pe-P10))*10**-3 #thrust of motor at altitude of 10km in kN
#Output
print 'A)thrust of motor at sea level is %3i kN upwards \
\nB)thrust of motor at an altitude 10km is %3.4f kN'%(Fs,F10)
```

In [2]:

```
import math
#Input data
P0 = 38*10**5 #combustion chamber pressure in Pa
T0 = 3500 #combustion chamber temperature in K
ma = 41.67 #oxidizer flow rate in kg/s
MR = 5 #mixture ratio
k = 1.3 #adiabatic consmath.tant
R = 287 #gas consmath.tant in J/kg-K
Pamb = 0.0582*10**5 #ambient pressure in Pa
Pe = Pamb #exhaust pressure at sea level in Pa
#Calculation
mf = ma/MR #mass flow of fuel in kg/s
mp = mf+ma #propellant mass flow in kg/s
Cp = (k*R)/(k-1) #specific heat at consmath.tant pressure in J/kg-k
p = P0/Pe #ratio of pressures at combustion chamber and exhaust
Me = ((((p**((k-1)/k))-1)*2)/(k-1))**0.5 #Mach number
t = 1/(1+(((k-1)/2)*Me**2)) #ratio of exhaust temperature to combustion temperature
Te = t*T0 #exhaust temperature in Kelvin
a = (1/Me)*(((2/(k+1))+(((k-1)/(k+1))*Me**2))**((k+1)/(2*(k-1)))) #ratio of areas at exit section and throat section of the nozzle
Ce = (k*R*Te)**0.5*Me #exit velocity in the exhaust in m/s
Cj = Ce #average effective jet velocity in m/s, math.since Pe = Pamb
P1 = P0*(2/(k+1))**(k/(k-1)) #pressure at throat section in Pa
T1 = T0*(2/(k+1)) #temperature at throat section in K
d1 = P1/(R*T1) #density of fuel at throat section in kg/m**3
C1 = (k*R*T1)**0.5 #velocity at throat section in m/s
A1 = (mp/(d1*C1))*10**4 #nozzle throat area in cm**2
Ae = a*A1 #exit area in cm**2
F = (mp*Ce)*10**-3 #thrust in kN
Cmax1 = (2*Cp*T0)**0.5 #maximum possible velocity in m/s
Cf = (F*10**3)/(P0*A1*10**-4) #thrust coefficient, F in kN and A1 in m**2
Cch1 = Cj/Cf #characteristic velocity in m/s
#Output
print 'A)nozzle throat area is %3.2f cm**2 \
\nB)thrust is %3.1f kN \
\nC)thrust coefficient is %3.2f \
\nD)characteristic velocity is %3i m/s \
\nE)exit velocity in exhaust is %3i m/s \
\nF)maximum possible exhaust velocity is %3i m/s'%(A1,F,Cf,Cch1,Ce,Cmax1)
```

In [3]:

```
import math
#Input data
a = 3. #exit area to throat area ratio
T0 = 2973. #combustion chamber temperature in K
P0 = 20.*10**5 #combustion chamber pressure in Pa
k = 1.3 #adiabatic consmath.tant
R = 248. #gas consmath.tant in J/kg-K
Pamb = 1.*10**5 #ambient pressure in Pa
Me = 2.52 #mach number for k = 1.3 and a = 3 umath.sing gas tables
g = 9.81 #acceleration due to gravity in m/s**2
#Calculation
p = 1/((1+(((k-1)/2)*Me**2))**(k/(k-1))) #ratio of pressures at exhaust and combustion chamber
Pe = p*P0 #exhaust pressure in Pa
t = 1/(1+(((k-1)/2)*Me**2)) #ratio of exhaust temperature to combustion temperature
Te = t*T0 #exhaust temperature in Kelvin
Ce = (k*R*Te)**0.5*Me #exit velocity in the exhaust in m/s
M = (Pe*Ce)/(R*Te) #propellant mass flow per unit area of exit in kg/m**2-s
Fa = ((M*Ce)+(Pe-Pamb))*10**-3 #thrust per unit area of exit in N/m**2
Is = (Fa*10**3)/(M*g) #specific impulse in sec
#Output
print 'A)thrust per unit area of exit is %3.2f kN/m**2 \
\nB)specific impulse is %3.2f sec'%(Fa,Is)
```

In [4]:

```
import math
#Input data
mp = 5. #propellent flow rate in kg/s (mismath.sing data)
de = 0.10 #nozzle exit diameter in m
Pe = 1.02*10**5 #nozzle exit pressure in Pa
Pamb = 1.013*10**5 #ambient pressure in Pa
P0 = 20. #thrust chamber pressure in Pa
F = 7000. #thrust in N
u = 1000. #rocket speed in m/s
g = 9.81 #acceleration due to gravity in m/s**2
#Calculation
Cj = F/mp #effective jet velocity in m/s
Ca = Cj-u #absolute jet velocity in m/s
wp = mp*g #weight flow rate of propellent in N/s
Is = F/(wp) #specific impulse in sec
SPC = 1/Is #specific propellent consumption in sec**-1
#Output
print 'A)effective jet velocity is %3i m/s \
\nB)specific impulse is %3.2f sec \
\nC)specific propellent consumption is %3.3f s**-1 \
\nD)absolute jet velocity is %3i m/s'%(Cj,Is,SPC,Ca)
```

In [5]:

```
import math
#Input data
Cj = 2700. #average effective jet velocity in m/s
u = 1350. #forward flight velocity in m/s
mp = 78.6 #propellant mass flow in kg/s
#Calculation
s = u/Cj #effective jet speed ratio
np = (2*s)/(1+s**2) #propulsive efficiency
F = Cj*mp*10**-3 #thrust in kN
Pt = F*u*10**-3 #Thrust power in MW, F in N
#Output
print 'A)thrust is %3.2f kN \
\nB)Thrust power is %3.3f MW \
\nC)propulsive efficiency is %3.1f'%(F,Pt,np)
```

In [6]:

```
import math
from scipy.integrate import quad
#Input data
mi = 15000. #mass of the rocket in kg
mp = 125. #propellant mass flow in kg/s
Cj = 2000. #velocity of gases coming out in m/s
t = 70. #time interval in sec
t0 = 0. #lower limit in integration in sec
t1 = 70. #upper limit in integration in sec
g = 9.81 #acceleration due to gravity in m/s**2
#Calculation
u = (-Cj*(math.log(1-((mp*t)/mi))))-(g*t) #velocity attained in 70 sec in m/s
def f0(t):
return ((-2000*(math.log(1-((125*t)/15000))))-(g*t))
h1 = ( quad(f0,t0,t1))[0]
h2 = (u**2/(2*g))*10**-3 #Distance reached after fuel last i.e. after 70 sec due to kinetic energy by umath.sing KE = PE in km
h = h1+h2 #maximum height the rocket will reach in km
#Output
print 'A)velocity attained in %i sec is %3.2f m/s \
\nB)maximum height the rocket will reach is %3.3f km'%(t,u,h)
```

In [7]:

```
import math
#Input data
A1 = 18.*10**-4 #throat area in m**2
P0 = 25.*10**5 #combustion chamber pressure in Pa
Is = 127.42 #specific impulse in sec
wp = 44.145 #weight flow rate of propellent in N/s
g = 9.81 #acceleration due to kravity in m/s**2
#Calculation
F = Is*wp #thrust in N
mp = wp/g #propellant mass flow in kg/s
Cj = F/mp #average effective jet velocity in m/s
Cf = F/(P0*A1) #thrust coefficient
Cw = wp/(P0*A1)/10**-3 #propellent weight flow coefficent *10**-3
SPC = (wp/F)/10**-3 #specific propellent consumption in sec**-1 *10**-3
Cch1 = Cj/Cf #characteristic velocity in m/s
#Output
print 'A)thrust coefficient is %3.2f \
\nB)propellent weight flow coefficent is %3.2f*10**-3 \
\nC)specific propellent consumption is %3.2f*10**-3 s**-1 \
\nD)characteristic velocity is %3.0f m/s'%(Cf,Cw,SPC,Cch1)
```

In [8]:

```
import math
#Input data
m1 = 200. #internal mass in kg
m2 = 130. #mass after rocket operation in kg
m3 = 110. #payload,non-propulsive structure, etc in kg
tp = 3. #rocket operation duration in sec
Is = 240. #specific impulse in sec
g = 9.81 #acceleration due to kravity in m/s**2
#Calculation
MR = m2/m1 #mass ratio
Mp = m1-m2 #mass of propellant in kg
mp = Mp/tp #propellent flow rate in kg/s
wp = mp*g #weight flow rate of propellent in N/s
IMF = (m2-m3)/(m1-m3) #initial mass fraction
PMF = 1-IMF #propellant mass fraction
F = Is*wp #thrust in N
TWRi = F/(m1*g) #initial thrust to weight ratio
TWRf = F/(m2*g) #final thrust to weight ratio
av = F/m2 #Maximum accelaration of the vechicle in m/s**2
Cj = Is*g #effective exhaust velocity in m/s
It = Is*Mp*g*10**-3 #total impulse in kN-s, units of the answer given in the book is wrong
IWR = (It*10**3)/((m1-m3)*g) #impulse to weighr ratio, It in N-s
#Output
print 'A)mass ratio is %3.2f \
\nB)propellent mass fraction is %3.3f \
\nC)propellent flow rate is %3.1f kg/s \
\nD)thrust is %3.1f N \
\nE)thrust to weight ratio is %3.2f intial) and %3.2f final) \
\nF)accelaration of the vechicle is %3.2f m/s**2 \
\nG)effective exhaust velocity is %3.1f m/s \
\nH)total impulse is %3.3f kN-s \
\nI)impulse to weighr ratio is %3.2f'%(MR,PMF,mp,F,TWRi,TWRf,av,Cj,It,IWR)
```

In [9]:

```
import math
#Input data
u = 2800. #rocket speed in m/s
Cj = 1400. #effective exhaust velocity in m/s
mp = 5. #propellent flow rate in kg/s
q = 6500. #heat of propellent per kg of propellant mixture in kJ/kg
#Calculation
s = u/Cj #effective jet speed ratio
np = (2*s)/(1+s**2) #propulsive efficiency
F = Cj*mp*10**-3 #thrust in kN
Pt = F*10**3*u*10**-6 #Thrust power in MW, F in N
Pe = Pt/np #engine outputin MW
nth = Pe*10**3/(mp*q) #thermal efficiency, Pe in kW
no = np*nth #overall efficiency
#Output
print 'A)propulsive efficiency is %3.1f \
\nB)propulsive power is %3.1f MW \
\nC)engine outut is %3.1f MW \
\nD)thermal efficiency is %3.4f \
\nE)overall efficiency is %3.3f'%(np,Pt,Pe,nth,no)
```

In [10]:

```
import math
#Input data
Cj = 1250. #effective exhaust velocity in m/s
s = 0.8 #effective jet speed ratio i.e. flight to jet speed ratio
ma = 3.5 #oxidizer flow rate in kg/s
mf = 1. #fuel flow rate in kg/s
g = 9.81 #acceleration due to gravity in m/s**2
q = 2500.*10**3 #heat of propellent per kg of propellant mixture in J/kg
#Calculation
u = s*Cj #flight velocity in m/s
mp = ma+mf #propellant mass flow in kg/s
F = Cj*mp*10**-3 #thrust in kN
wp = mp*g #weight flow rate of propellent in N/s
Is = (F*10**3)/(wp) #specific impulse in sec,F in N
np = (2*s)/(1+s**2) #propulsive efficiency
nth = 0.5*mp*((Cj**2+u**2)/(mp*q)) #thermal efficiency
no = np*nth #overall efficiency
#Output
print 'A)thrust is %3.3f kN \
\nB)specific impulse is %3.2f sec \
\nC)propulsive efficiency is %3.4f \
\nD)thermal efficiency is %3.4f \
\nE)overall efficiency is %3.1f'%(F,Is,np,nth,no)
```

In [11]:

```
import math
#Input data
mp = 193. #propellent flow rate in kg/s
P1 = 27.*10**5 #pressure at throat section in Pa
T1 = 3000. #temperature at throat section in K
de = 0.6 #nozzle exit diameter in m
Pe = 1.1*10**5 #exhaust pressure in Pa
Pamb = 1.013*10**5 #ambient pressure in Pa
F = 380*10**3 #thrust of motor in N
u = 694.44 #flight velocity in m/s
g = 9.81 #acceleration due to gravity in m/s**2
q = 6500*10**3 #heat of propellent per kg of propellant mixture in J/kg
#Calculation
Ae = (math.pi*0.6**2)/4 #exit area in m**2
Cj = F/mp #average effective jet velocity in m/s
Ce = (F-((Pe-Pamb)*Ae))/mp #exhaust velocity in m/s, wrong answer in textbook
wp = mp*g #weight flow rate of propellent in N/s
Is = (F)/(wp) #specific impulse in sec
SPC = (wp/F)/10**-3 #specific propellent consumption in sec**-1 *10**-3
Pt = F*u*10**-6 #Thrust power in MW
Pl = (0.5*mp*((Cj-u)**2))*10**-6 #Power loss in exhaust in MW
Pe = Pt+Pl #engine output in MW
np = Pt/Pe #propulsive efficiency
nth = Pe*10**3/(mp*q*10**-3) #thermal efficiency and Pe,q in kW
no = np*nth #overall efficiency
#Output
print 'A)effective jet velocity is %3.4f m/s \
\nB)Actual jet velocity is %3.4f m/s \
\nC)specific impulse is %3.1f sec \
\nD)specific propellent consumption is %3.4f*10**-3 sec**-1 \
\nE)propulsive efficiency is %3.5f \
\nD)thermal efficiency is %3.3f \
\nE)overall efficiency is %3.5f'%(Cj,Ce,Is,SPC,np,nth,no)
```

In [12]:

```
import math
#Input data
m1 = 3600. #internal mass in kg
Cj = 2070. #average effective jet velocity in m/s
tp = 80. #rocket operation duration in sec
g = 9.81 #acceleration due to gravity in m/s**2
#Calculation
up = 2*Cj #flight velocity in m/s
MR = 1/math.exp((up+(g*tp))/Cj) #mass ratio
m2 = MR*m1 #mass after rocket operation in kg
PMF = 1-MR #propellant mass fraction
Mp = m1-m2 #mass of propellant in kg
mp = Mp/tp #propellent flow rate in kg/s
F = Cj*mp*10**-3 #thrust in kN
Zp = (((1+((1-(1/PMF))*math.log(1/MR)))*Cj*tp)-(0.5*g*tp**2))*10**-3 #powered altitude gain in km
Zc = ((0.5*up**2)/g)*10**-3 #coasting altitude gain in km
Z = Zp+Zc #maximum altitude in km
#Output
print 'A)flow rate of propellent is %3.2f kg/s \
\nB)thrust developed is %3.3f kN \
\nC)altitude gains during powered and coasting flights are %3.3f km and %3.3f km respectively'%(mp,F,Zp,Zc)
```

In [13]:

```
import math
#Input data
s = 0.2105 #effective jet speed ratio
Is = 203.88 #specific impulse in sec
tp = 8 #rocket operation duration i.e. burn out time in sec
g = 9.81 #acceleration due to kravity in m/s**2
#Calculation
Cj = g*Is #average effective jet velocity in m/s
up = s*Cj #maximum flight speed in m/s
MR = 1/math.exp((up+(g*tp))/Cj) #mass ratio
PMF = 1-MR #propellant mass fraction
Zp = (((1+((1-(1/PMF))*math.log(1/MR)))*Cj*tp)-(0.5*g*tp**2))*10**-3 #powered altitude gain in km
Zc = ((0.5*up**2)/g)*10**-3 #coasting altitude gain in km
Z = Zp+Zc #maximum altitude in km
#Output
print 'A)effective jet velocity is %3i m/s \
\nB)mass ratio and propellent mass fraction are %3.2f and %3.2f respectively \
\nC)maximum flight speed is %3.2f m/s \
\nD))altitude gains during powered and coasting flights are %3.3f km and %3.3f km respectively'%(Cj,MR,PMF,up,Zp,Zc)
```

In [14]:

```
import math
#Input data
R0 = 6341.6*10**3 #radius of earth at mean sea-level in m
g = 9.809 #acceleration due to gravity in m/s**2
Z1 = 0 #altitude at sea-level in m
Z2 = 300*10**3 #altitude above sea-level in m
#Calculation
uorb1 = R0*math.sqrt(g/(R0+Z1)) #orbit velocity of a rocket at mean sea level in m/s
uesc1 = math.sqrt(2)*uorb1 #escape velocity of a rocket at mean sea level in m/s
uorb2 = R0*math.sqrt(g/(R0+Z2)) #orbit velocity of a rocket at an altitude of 300 km in m/s
uesc2 = math.sqrt(2)*uorb2 #escape velocity of a rocket at an altitude of 300 km in m/s
#Output
print 'A)orbit and escape velocities of a rocket at mean sea level are %3i m/s and %3i m/s \
\nB)orbit and escape velocities of a rocket at an altitude of 300 km are %3.1f m/s and %3.2f m/s'%(uorb1,uesc1,uorb2,uesc2 )
```