# Chapter 13 : Equilibrium In Complex Chemical Reactions¶

### Example 13.1 Page: 349¶

In [13]:
import math

T =273.15+25            #[K] given temperature
R = 8.314               #[J/(mol*K)] universal gas consmath.tant

g_0_H = 0               #[kJ/mol]
g_0_OH = -157.29        #[kJ/mol]
g_0_H2O = -237.1        #[kJ/mol]

delta_g_0 = g_0_H + g_0_OH - g_0_H2O        #[kJ/mol]
delta_g_1 = delta_g_0*1000                  #[J/mol]

K = math.exp((-delta_g_1)/(R*T))

K_w = K

print "At the equilibrium the product of the hydrogen ion and hydroxil ion is %0.1e"%(K_w)
At the equilibrium the product of the hydrogen ion and hydroxil ion is 1.0e-14

### Example 13.2 Page: 351¶

In [14]:
from scipy.optimize import fsolve
import math

n_H2SO4 = 1.                #[mol] mole of the sulphuric acid
w_water = 1000.             #[g] weight of the water
T =273.15+25                #[K] temperature
R = 8.314                   #[J/(mol*K)]

g_0_H = 0                   #[J/mol] free energy of the hydrogen ion
g_0_HSO4 = -756.01*1000     #[J/mol] free energy of the bisulphate ion
g_0_H2SO4 = -744.50*1000    #[J/mol] free enery of sulphuric acid

delta_g_0 = g_0_H + g_0_HSO4 - g_0_H2SO4            #[J/mol]

K_1 = math.exp((-delta_g_0)/(R*T))

g_0_H = 0                   #[J/mol] free energy of the hydrogen ion
g_0_SO4 = -744.62*1000      #[J/mol] free energy of sulphate ion
g_0_HSO4 = -756.01*1000     #[J/mol] free energy of the bisulphate ion

delta_g_1 = g_0_H + g_0_SO4 - g_0_HSO4      #[J/mol]

K_2 = math.exp((-delta_g_1)/(R*T))

def F(e):
f = [0,0]
f[0] = ((e[0]-e[1])*(e[0]+e[1]))/(1-e[0]) - K_1
f[1] = ((e[1])*(e[0]+e[1]))/(e[0]-e[1]) - K_2
return f

e = [0.8,0.1]
y = fsolve(F,e)
e_1 = y[0]
e_2 = y[1]

m_H2SO4 = 1-e_1             # [molal]
m_HSO4 = e_1 - e_2          #[molal]
m_SO4 = e_2                 #[molal]
m_H = e_1 + e_2             #[molal]

print " The equilibrium concentration of H2SO4 in terms of molality is %f molal"%(m_H2SO4)
print " The equilibrium concentration of HSO4- in terms of molality is %f molal"%(m_HSO4)
print " The equilibrium concentration of SO4-- in terms of molality is %f molal"%(m_SO4)
print " The equilibrium concentration of H+ in terms of molality is    %f molal"%(m_H)
The equilibrium concentration of H2SO4 in terms of molality is 0.009444 molal
The equilibrium concentration of HSO4- in terms of molality is 0.980653 molal
The equilibrium concentration of SO4-- in terms of molality is 0.009903 molal
The equilibrium concentration of H+ in terms of molality is    1.000459 molal

### Example 13.3 Page: 352¶

In [15]:
from scipy.optimize import fsolve
import math

P = 10.             #[MPa] given pressure
T = 250.            #[C] Temperature
n_T_0 = 1.          #[mol]
n_CO = 0.15         #[mol]
n_CO2 = 0.08        #[mol]
n_H2 = 0.74         #[mol]
n_CH4 = 0.03        #[mol]

V_1 = -2
V_2 = 0
K_1 = 49.9          # For the first reaction
K_2 = 0.032         # For the second reaction

v_CO_1 = -1
v_H2_1 = -2
v_CH3OH_1 = +1
v_CO2_2 = -1
v_H2_2 = -1
v_CO_2 = +1
v_H2O_2 = +1

def F(e):
f = [0,0]
f[0] = ((0 + e[0])/(1 - 2*e[0]))/(((0.15 - e[0] + e[1])/(1 - 2*e[0]))*((0.74 - 2*e[0] - e[1])/(1 - 2*e[0]))**(2)) - K_1
f[1] = (((0.15 - e[0] + e[1])/(1 - 2*e[0]))*((0 + e[1])/(1 - 2*e[0])))/(((0.08 - e[1])/(1 - 2*e[0]))*((0.74 - 2*e[0] - e[1])/(1 - 2*e[0]))) - K_2
return f

e = [0.109, 0]
y = fsolve(F,e)
e_1 = y[0]
e_2 = y[1]

c_CO2 = e_2/(n_CO2)*100
c_CO = e_1/(n_CO + 0.032)*100

print " Percent conversion of CO is %f%%"%(c_CO)
print " Percent conversion of CO2 is %f%%"%(c_CO2)
Percent conversion of CO is 96.815234%
Percent conversion of CO2 is 47.930771%

### Example 13.4 Page: 354¶

In [16]:
import math

T = 273.15+25           #[K] Temperature
R = 8.314               #[J/(mol*K)] universal gas consmath.tant

g_0_Ag = 77.12*1000         #[J/mol]
g_0_Cl = -131.26*1000       #[J/mol]
g_0_AgCl = -109.8*1000      #[J/mol]

delta_g_0 = g_0_Ag + g_0_Cl - g_0_AgCl      #[J/mol]

K = math.exp((-delta_g_0)/(R*T))

a_AgCl = 1.00

print "The amount of solid dissolved in terms of solubility product is %0.2e"%(K)
The amount of solid dissolved in terms of solubility product is 1.77e-10

### Example 13.5 Page: 357¶

In [17]:
import math

T = 273.15+25           #[K] Given temperature of air
P = 1.                  #[atm] Pressure of the air
y_CO2 = 350.*10**(-6)   # Amount of CO2 present in air at the given condition
R = 8.314               #[J/(mol*K)]

g_0_H2CO3 = -623.1*1000         #[J/mol]
g_0_H = 0.                      #[J/mol]
g_0_HCO3 = -586.85*1000         #[J/mol]

delta_g_0 = g_0_H + g_0_HCO3 - g_0_H2CO3            #[J/mol]
K_1 = math.exp((-delta_g_0)/(R*T))

g_0_CO3 = -527.89*1000          #[J/mol]

delta_g_1 = g_0_H + g_0_CO3 - g_0_HCO3          #[J/mol]
K_2 = math.exp((-delta_g_1)/(R*T))

H = 1480.               #[atm]

x_CO2 = P*y_CO2/H

n_water = 1000/18.                  #[mol]
m_CO2 = x_CO2*n_water               #[molal]

m_HCO3 = math.sqrt(K_1*m_CO2)       #[molal]
m_H = m_HCO3                        #[molal]

m_CO3 = K_2*(m_HCO3/m_H)            #[molal]

print " Amount of the CO2 dissolved in water in equilibrium with air is \t\t\t%0.2e molal"%(m_CO2)
print " Conentration of HCO3 ion and hydrogen ion H- in solution in equilibrium with air is    %0.2e molal"%(m_HCO3)
print " And concentration of CO3 ion in the solution in equilibrium with air is\t\t%0.2e molal"%(m_CO3)
Amount of the CO2 dissolved in water in equilibrium with air is 			1.31e-05 molal
Conentration of HCO3 ion and hydrogen ion H- in solution in equilibrium with air is    2.42e-06 molal
And concentration of CO3 ion in the solution in equilibrium with air is		4.68e-11 molal

### Example 13.6 Page: 358¶

In [18]:
import math

m_H = 10**(-10)         #[molal] molality of hydrogen ion
K_1 = 4.5*10**(-7)
K_2 = 4.7*10**(-11)

m_CO2 = 1.32*10**(-5)           #[molal] from previous example
m_HCO3 = K_1*(m_CO2/m_H)        #[molal]

m_CO3 = K_2*(m_HCO3/m_H)        #[molal]

print " Amount of the CO2 dissolved in water in equilibrium with air is    \t%0.2e molal"%(m_CO2)
print " Conentration of HCO3 ion in solution in equilibrium with air is \t %0.2e molal"%(m_HCO3)
print " And concentration of CO3 ion in the solution in equilibrium with air is  %0.2e molal"%(m_CO3)
Amount of the CO2 dissolved in water in equilibrium with air is    	1.32e-05 molal
Conentration of HCO3 ion in solution in equilibrium with air is 	 5.94e-02 molal
And concentration of CO3 ion in the solution in equilibrium with air is  2.79e-02 molal

### Example 13.7 Page: 362¶

In [19]:
import math

T = 298.15          #[K] Temperature
F = 96500.          #[(coulomb)/(mole*electrons)] faraday consmath.tant

n_e = 6.            #[electron]
g_0_CO2 = -394.4*1000           #[J/mol]
g_0_Al = 0                      #[J/mol]
g_0_C = 0                       #[J/mol]
g_0_Al2O3 = -1582.3*1000        #[J/mol]

delta_g_0 = 1.5*g_0_CO2 + 2*g_0_Al - 1.5*g_0_C - g_0_Al2O3          #[J/mol]

E_0 = (-delta_g_0)/(n_e*F)      #[V]

print "Standard state cell voltage for the production of aluminium is %f Volt"%(E_0)
Standard state cell voltage for the production of aluminium is -1.711054 Volt

### Example 13.8 Page: 362¶

In [20]:
import math

T = 298.15          #[K] Temperature
F = 96500.          #[(coulomb)/(mole*electrons)] faraday consmath.tant

delta_g_0 = -587.7*1000         #[J/mol]
n_e = 1                         #[electron] no of electron transferred
E_298_0 = (-delta_g_0)/(n_e*F)          #[V]

print "The reversible voltage for given electrochemical device is %f Volt"%(E_298_0)
The reversible voltage for given electrochemical device is 6.090155 Volt

### Example 13.9 Page: 363¶

In [21]:
import math

T = 298.15      #[K] Temperature
P_0 = 1.        #[atm]
P = 100.        #[atm]
E_0 = -1.229    #[V]
F = 96500.      #[(coulomb)/(mole*electrons)] faraday consmath.tant
R = 8.314       #[J/(mol*K)] universal gas consmath.tant

n_e = 2.        #[(mole electrons)/mole]

E = E_0 - 1.5*(R*T)*math.log(P/P_0)/(n_e*F)

print "The equilibrium cell voltage of electrolytic cell if feed and product are at the pressure 100 atm is %f Volt"%(E)
The equilibrium cell voltage of electrolytic cell if feed and product are at the pressure 100 atm is -1.317721 Volt

### Example 13.10 Page: 365¶

In [22]:
import math

T = 273.15+25           #[K] Temperature
P = 11.38/760           #[atm] Pressure
R = 0.08206             #[(L*atm)/(mol*K)] Gas consmath.tant
v = 0.6525/0.04346      #[L/g] Specific volume
M = 60.05               #[g/mol] Molecular weight of HAc in the monomer form

V = v*M                 #[L/mol]

z = (P*V)/(R*T)

print "The value of the compressibility factor for HAc at given condition is %f"%(z)
The value of the compressibility factor for HAc at given condition is 0.551780

### Example 13.11 Page: 366¶

In [23]:
from scipy.optimize import fsolve
import math

T = 273.15+25       #[K] Temperature
P = 11.38           #[torr] Pressure

K = 10**(-10.4184 + 3164/T)         #[1/torr]

def f(y_HAc_2):
return  K*(P*(1-y_HAc_2))**(2)/P-y_HAc_2
y_HAc_2 = fsolve(f,0)
y_HAc = 1-y_HAc_2

print "Mole fraction of the monomer in the vapour phase is %f"%(y_HAc)
print "Mole fraction of the dimer in the vapour phase is   %f"%(y_HAc_2)
Mole fraction of the monomer in the vapour phase is 0.210713
Mole fraction of the dimer in the vapour phase is   0.789287

### Example 13.12 Page: 367¶

In [25]:
import math

T = 273.15+25           #[K] Temperature
P = 11.38/760           #[atm] Pressure
R = 0.08206             #[(L*atm)/(mol*K)] Gas consmath.tant
v = 0.6525/0.04346      #[L/g] Specific volume

y_HAc = 0.211           # monomer
y_HAc_2 = 0.789         # dimer

M_HAc = 60.05           #[g/mol] monomer
M_HAc_2 = 120.10        #[g/mol] dimer

M_avg = M_HAc*y_HAc + M_HAc_2*y_HAc_2           #[g/mol]

V = v*M_avg             #[L/mol]

z = (P*V)/(R*T)

print "The compressibility factor z for the gaseous mixture is %f"%(z)
The compressibility factor z for the gaseous mixture is 0.987135
In [ ]: