# Chapter 3: Importance of State Functions: Internal Energy and Enthalpy¶

## Example Problem 3.2, Page Number 45¶

In :
from math import log
#Variable Declaration
betaOH = 11.2e-4           #Thermal  exapnasion coefficient of ethanol, °C
betagl = 2.00e-5           #Thermal  exapnasion coefficient of glass, °C
kOH = 11.0e-5              #Isothermal compressibility of ethanol, /bar
dT = 10.0                  #Increase in Temperature, °C

#Calcualtions
vfbyvi = (1+ betagl*dT)
dP = betaOH*dT/kOH-(1./kOH)*log(vfbyvi)

#Results
print 'Pressure increase in capillary %4.1f bar'%dP

Pressure increase in capillary 100.0 bar


## Example Problem 3.4, Page Number 49¶

In :
#Variable Declaration
cpsubysy = 1000           #Specific heat ration of surrounding and system
Tpreci = 0.006             #Precision in Temperature measurement, °C

#Calcualtions
dtgas = -cpsubysy*(-Tpreci)

#Results
print 'Minimum detectable temperature change of gas +-%4.1f °C'%dtgas

Minimum detectable temperature change of gas +- 6.0 °C


## Example Problem 3.6, Page Number 50¶

In :
from sympy import symbols, integrate

#Variable Declaration
n = 1.0           #number of mole of N2, mol
Ti = 200.0        #Intial Temperature, K
Pi = 5.00         #Initial pressure, bar
Tf = 400.0        #Intial Temperature, K
Pf = 20.0         #Initial pressure, bar
a = 0.137         #van der Waals constant a, Pa.m3/(mol2)
b = 3.87e-5       #van der Waals constant b, m3/(mol)
A, B, C, D = 22.5, -1.187e-2,2.3968e-5, -1.0176e-8
#Constants in Cvm equation J, K and mol
vi = 3.28e-3      #initial volume, m3/mol
vf = 7.88e-3      #Final volume, m3/mol

#Calculations
T = symbols('T')
dUT = n**2*a*(1./vi-1./vf)
dUV = integrate( A + B*T + C*T**2 + D*T**3, (T,Ti,Tf))

#Results
print 'dUT = %4.1f J: This is wrongly reported in book'%dUT
print 'dUV = %4.1f J'%dUV

dUT = 24.4 J: This is wrongly reported in book
dUV = 4174.1 J


## Example Problem 3.7, Page Number 53¶

In :
from sympy import symbols, integrate

#Variable Declaration
m = 143.0         #Mass of graphite, g
Ti = 300.0        #Intial Temperature, K
Tf = 600.0        #Intial Temperature, K
A, B, C, D, E = -12.19,0.1126,-1.947e-4,1.919e-7,-7.8e-11
#Constants in Cvm equation J, K and mol
M = 12.01

#Calculations

T = symbols('T')
dH = (m/M)*integrate( A + B*T + C*T**2 + D*T**3 + E*T**4, (T,Ti,Tf))
expr = A + B*T + C*T**2 + D*T**3 + E*T**4
cpm = expr.subs(T,300.)
qp = (m/M)*cpm*(Tf-Ti)
err = abs(dH-qp)/dH
#Results
print 'dH = %6.1f kJ'%(dH/1000)
print 'qp = %6.1f kJ'%(qp/1000)
print 'Error in calculations %4.1f'%(err*100)

dH =   46.8 kJ
qp =   30.8 kJ
Error in calculations 34.3


## Example Problem 3.9, Page Number 56¶

In :
#Variable Declaration
m = 124.0         #Mass of liquid methanol, g
Pi = 1.0          #Initial Pressure, bar
Ti = 298.0        #Intial Temperature, K
Pf = 2.5          #Final Pressure, bar
Tf = 425.0        #Intial Temperature, K
rho = 0.791       #Density, g/cc
Cpm = 81.1        #Specifi heat, J/(K.mol)
M = 32.04

#Calculations
n = m/M
DH = n*Cpm*(Tf-Ti)+ m*(Pf-Pi)*1e-6/rho

#Results
print 'Enthalpy change for change in state of methanol is %4.1f kJ'%(DH/1000)

Enthalpy change for change in state of methanol is 39.9 kJ