# Chapter 4: Aerodynamics¶

## Example 4.1¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 4.1
'''Consider as a system the gas in the cylinder shown in Fig. 4.7; the cylinder is fitted with
a piston on which a number of small weights are placed. The initial pressure is 200 kPa,
and the initial volume of the gas is 0.04 m3.'''
from math import log

#Variable Declaration:
P1 = 200 		#Initial pressure inside cylinder in kPa
V2 = 0.1 		#in m**3
V1 = 0.04 		#Initial volume of gas in m**3
W4 = 0 		#Work done in isovolumic process

#Calculation:
W1 = P1*(V2-V1) 	#Work done in isobaric process in kJ
W2 = P1*V1*log(V2/V1) #Work done in isothermal process in kJ
P2 = P1*(V1/V2)**(1.3)	#Final pressure according to the given process
W3 = (P2*V2-P1*V1)/(1-1.3)

#Result:
print "Work done during the isobaric process is: ",round(W1,2),"KJ"
print "Work done in isothermal process is: ",round(W2,2),"KJ"
print "Work done during the described process is: ",round(W3,2),"KJ"
print "Work done in the isovolumic process is: ",round(W4,2),"KJ"

Work done during the isobaric process is:  12.0 KJ
Work done in isothermal process is:  7.33 KJ
Work done during the described process is:  6.41 KJ
Work done in the isovolumic process is:  0.0 KJ


## Example 4.3¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 4.3
'''The cylinder/piston setup of Example 4.2 contains 0.5 kg of ammonia at −20◦C with
a quality of 25%. The ammonia is now heated to +20◦C, at which state the volume
is observed to be 1.41 times larger. Find the final pressure and the work the ammonia
produced.'''

#Variable Declaration:
Psat = 190.2 		#in kPa
vf = 0.001504 		#in m**3/kg
vfg = 0.62184 		#in m**3/kg
x1 = 0.25 		      #Quality
P2 = 600 		      #Pressure in state 2 in kPa
m = 0.5 		      #Mass of ammonia in kg

#Calculation:
P1 = Psat 		      #Saturation pressure in state 1
v1 = vf+x1*vfg 		#Specific volume at state 1 in m**3/kg
v2 = 1.41*v1 		#Specific volume at state 2 in m**3/kg
W = m*(P1+P2)*(v2-v1)/2#Work produced by ammonia in kJ

#Result:
print "Work produced by ammonia is: ",round(W,2),"KJ"

Work produced by ammonia is:  12.71 KJ


## Example 4.4¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 4.4
'''The piston/cylinder setup shown in Fig. 4.12 contains 0.1 kg of water at 1000 kPa, 500◦C.
The water is now cooled with a constant force on the piston until it reaches half the initial
volume. After this it cools to 25◦C while the piston is against the stops. Find the final water
pressure and the work in the overall process, and show the process in a P–v diagram.'''

#Variable Declaration:
v1 = 0.35411 	#Specific volume at state 1 in m**3/kg
m = 0.1 		#Mass of water in kg
P1 = 1000 		#Pressure inside cylinder in kPa

#Calculation:
v2 = v1/2
W = m*P1*(v2-v1) 	#in kJ

#Result:
print "Work in the overall process is: ",round(W,2),"KJ"

Work in the overall process is:  -17.71 KJ


## Example 4.7¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 4.7
'''Consider the constant transfer of energy from a warm room at 20◦C inside a house to the
colder ambient temperature of −10◦C through a single-pane window, as shown in Fig.
4.19. The temperature variation with distance from the outside glass surface is shown
by an outside convection heat transfer layer, but no such layer is inside the room (as a
simplification). The glass pane has a thickness of 5 mm (0.005 m) with a conductivity of
1.4W/mKand a total surface area of 0.5m2. The outside wind is blowing, so the convective
heat transfer coefficient is 100 W/m2 K.With an outer glass surface temperature of 12.1◦C,
we would like to know the rate of heat transfer in the glass and the convective layer'''

#Variable Declaration:
k = 1.4 		#Conductivity of glass pane in W/m-K
A = 0.5 		#Total surface area of glass pane
dx = 0.005 		#Thickness of glasspane in m
dT1 = 20-12.1 	#Temperature difference between room air and outer glass surface temperature in celsius
h = 100 		#Convective heat transfer coefficient in W/m**2-K
dT = 12.1-(-10)  	#Temperature difference between warm room and colder ambient in celsius

#Calculation:
Q = -k*A*dT1/dx 	#Conduction through glass slab in W
Q2 = h*A*dT 	#Heat transfer in convective layer in W

#Result:
print "Rate of heat transfer in the glass and convective layer is: ",round(Q2,2),"KW"

Rate of heat transfer in the glass and convective layer is:  1105.0 KW