from __future__ import division
import math
#variable initialization
Mg=44 #molecular weight of carbondioxide
#solution
R=8314/Mg #gas constant for carbondioxide
print "R=",int(round(R,1)),"N.m/(Kg.K)"
Mg=32 #molecular weight of oxygen
R=8314/Mg #gas constant for oxygen
print "R=",int(math.ceil(round(R,1))),"N.m/(Kg.K)"
from __future__ import division
import math
#variable initialization
Mg=28.96 #molecular weight of air
k=1.4 #constant for air
#solution
R=int(8314/Mg) #in J/(kg.K)
Cp=(k/(k-1.0))*R
print "Cp=",Cp,"J/(Kg.K)"
Cv=R/(k-1) #in J/(kg.K)
print "Cv=",Cv,"J/(Kg.K)"
#1 Kcal = 4187 J
print "In heat units"
Cp=Cp/4187
print "Cp=",round(Cp,3),"Kcal/(Kg.K)"
Cv=Cv/4187
print "Cv=",round(Cv,3),"Kcal/(Kg.K)"
import math
#variable initialization
T1=15 #temperature initially in degree
T2=65 #increased temperature in degree
Cv=670 #in j/(kg.k)
E=1000 #enthalpy
Cp=858 #in j/(kg.k)
#Calculation
T1=273+T1 #temperature in kelvin
T2=273+T2
m=E/9.81 #Mass of 1000N of co2
del_u=Cv*(T2-T1)
Tc=m*del_u #Total change in internal energy
print "Total change in internal energy=",int(Tc/1000),"kJ"
del_h=Cp*(T2-T1)
Te=m*del_h
print "Total change in enthalpy=",int(Te/1000),"kJ"
import math
#variable initialization
R=260 #in j/(kg.k)
k=1.4 #given value
T1=27 #temperature initially in degree
T2=85 #increased temperature in degree
p1=150 #Pressure in kPa
p2=450 #pressure 2 in kPa
m=7 #kg of oxygen
#Calculation
Cv=R/(k-1)
T1=T1+273 #Temperature in kelvin
T2=T2+273
S=Cv*math.log((((T2/T1)**k)*((p1/p2)**(k-1)))) #Change in entropy per kg
T=m*S
print "Total change in entropy=",round(T,1),"J/K"
import math
#variable initialization
k=1.40 #constant for gases
R=260 #gas constant in J/(Kg.K)
T=25 #temperature in degree C
#solution
T=273 +T #converting into K
C=math.sqrt(k*R*T) #Speed of sound
print "C=",round(C,1),"m/s"
import math
#variable initialization
M=1.5 #Mach number
p=89.89 #Pressure in kPa
rho=1.112 #density in kg/m^3
k=1.4 #constant for gases
#solution
#At 1000 m altitude,
C=math.sqrt((k*(p*1000))/rho)
V=C*M #Using Mach number
V=(V*3600)/1000 #Converting V from m/s to Km/h
print "V=",int(math.ceil(round(V,1))),"Km/h"
#At 10,000 m altitude
p=26.42 #Pressure in kPa
rho=0.4125 #density in kg/m^3
C=math.sqrt((k*(p*1000))/rho)
V=C*M
V=(V*3600)/1000 #Converting V from m/s to Km/h
print "V=",int(V),"Km/h"
import math
#variable initialization
k=1.28 #given value
R=188 #in j/(kg.k)
T=30 #Temperature in degree
V1=150 #velocity in m/s
P1=500 #pressure in kPa
#Calculation
T=T+273 #Converting into kelvin
C=math.sqrt(k*R*T) #Speed of sound in CO2
M1=V1/C #Mach number
T0=T*((1+((k-1)/2)*(M1**2)))
print "T0=",int(T0-273),"degree C" #In degree celsius
P0=P1*((1+((k-1)/2)*(M1**2)))**(k/(k-1))
print "P0=",round(P0,2),"kPa(abs)"
import math
#variable initialization
T0=30 #temperatuer in degree
p1=50 #Pressure in kPa
p0=95 #pressure 2 in kPa
k=1.4 #given value
R=287 #in j/(kg.k)
#Calculation
T0=T0+273 #converting into kelvin
T1=round(T0*(p1/p0)**((k-1)/k),1)#For isentropic flow with subscript zero denoting stagnation values
V1=((2*k*R)/(k-1.0))*(T0-T1)
print "(i)V1=",round((V1**(1/2)),1),"m/s"
rho1=round((p0*1000)/(R*T0),3) #When compressibility effects are ignored
V1=(2*(p0-p1)*1000)/rho1
print "(ii)V1=",round(math.sqrt(V1),1),"m/s"
import math
#variable initialization
To=35 #temperature in degree C
R=287 #gas constant in (J/Kg.K)
po=250 #pressure in kPa
k=1.4 #constant for gases
V1=200 #velocity in m/s
#solution
To=273+To #converting into K
Cp=(k*R)/(k-1)
T1=int(To-((V1**2)/(2*Cp)))
#The Mach number M1,at the exit is,
M1=math.sqrt(((To/T1)-1)/0.2)
print "M1=",round(M1,3)
import math
#variable initialization
k=1.32 #given value
M2=0.40 #Mach number of downstream
#Calculation
#by using formula M2**2=(2+(k-1)M1**2)/(2*K*M!**2-(k-1))
M1_s=(((M2**2)*2*k)-(k-1))
M1=-((-((M2**2)*(k-1))-2.0)/M1_s)
print "M1=",round(M1**(1/2),3)