# Chapter13-thermodynamic relations¶

## Example2-pg376¶

In [6]:
import math
#calculate entropy wrt pressures and volume wrt temerature
##initialisation of variables
S1= 6.539 ##kJ/kg K
S2= 6.7664 ##kJ/kg K
v1= 0.10976 ##m^3
v2= 0.08700 ##m^3
P= 3. ##Mpa
P1= 2. ##Mpa
T= 350. ##K
T1= 250. ##K
S3= 3.1741 ##kJ/kg K
S4= 3.2071 ##kJ/kg K
P2= 30. ##Mpa
P3= 20. ##Mpa
v3= 0.0014217 ##m^3
v4= 0.0012860 ##m^3
T2= 320. ##K
T3= 280. ##K
##CALCULATIONS
r= (S1-S2)/(P*10*10*10-P1*10*10*10)
r1= (v1-v2)/(T-T1)
R= (S3-S4)/(P2*10*10*10-P3*10*10*10)
R1= (v3-v4)/(T2-T3)
##RESULTS
print'%s %.7f %s'% ('entropy wrt pressre=',r,'kJ/kg K kpa')
print'%s %.e %s'% ('entropy wrt pressre=',R,'kJ/kg K kpa')
print'%s %.7f %s'%  ('volume wrt temperature=',r1,'m^3/kg K ')
print'%s %.2e %s'% ('volume wrt temperature=',R1,'m^3/kg K ')

entropy wrt pressre= -0.0002274 kJ/kg K kpa
entropy wrt pressre= -3e-06 kJ/kg K kpa
volume wrt temperature= 0.0002276 m^3/kg K
volume wrt temperature= 3.39e-06 m^3/kg K


## Example3-pg379¶

In [2]:
import math
#saturation pressure
##initialisation of variables
hfg= 2406.7 ##kJ/kg
Psat40= 7.384 ##kPa
R= 8.314 ##J/mol K
T= 40. ##C
T1= 50. ##C
M= 18.##kg
##CALCULATIONS
Psat50= Psat40*math.e**((hfg*M/R)*((1/(273.15+T))-(1/(273.15+T1))))
##RESULTS
print'%s %.3f %s' %('Saturation pressure=',Psat50,'kPa')

Saturation pressure= 12.357 kPa


## Example4-pg379¶

In [3]:
import math
#calcualte lowest temprature
##initialisation of variables
W= 800. ##N
A= 0.4 ##cm^2
p= 0.611 ##Mpa
P1= 0.1 ##Mpa
T= 0.01 ##C
vs= 0.0010908 ##m^3/kg
hs= -333.40 ##kJ/kg
vf= 0.0010002 ##m^3/kg
hf= 0 ##kJ/kg
vg= 206.14 ##m^3/kg
hg= 2501.4 ##kJ/kg
##CALCULATIONS
P2= P1+(W/A)*math.pow(10,(4-6))
dT= (273.15++T)*(vf-vs)*(P2*10*10*10-p)/(0-hs)
Tmin= dT+T
##RESULTS
print'%s %.2f %s'% ('lowest temperature=',Tmin,'C')

lowest temperature= -1.48 C


## Example7-pg385¶

In [4]:
import math
#calculate volume exapansion coefficent and isothermal compressibilitiy and isotherma modulus of elasticity
##initialisation of variables
vi= 0.0009992 ##m^3
T= 60. ##C
T1= 20. ##C
T2= 40. ##C
vi1= 0.0010042 ##m^3
vi2= 0.0009886 ##m^3
v= 0.000951 ##m^3
v1= 0.0009992 ##m^3
v2= 0.0009956 ##m^3
##CALCULATIONS
B= (vi1-vi2)/(vi*(T-T1))
Kt= (v1-v2)/(v*(T2-T1))
Et= 1/Kt
##RESULTS
print'%s %.2e %s'% ('volume exapansion coefficient=',B,'L/s')
print'%s %.3e %s'% ('isothermal compressibility=',Kt,'Mpa')
print'%s %.f %s'% ('isothermal modulus of elasticity=',Et,'Mpa')

##ANSWER FOR Et GIVEN IN THE TEXTBOOK IS WRONG

volume exapansion coefficient= 3.90e-04 L/s
isothermal compressibility= 1.893e-04 Mpa
isothermal modulus of elasticity= 5283 Mpa