import math
# Variables
T = 20. #[C]
m_1 = 0. #[molal]
m_2 = 1. #[molal]
# Calculations
# The data given in the figure 6.2 , as reported in book, can be repersented with excellent accuracy by a simple data fitting equation
#V = 1.0019+0.054668*m-0.000418*m**(2)
# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water
#The partial molal volume is obtained by differentiating the expression of the 'V' with respect to 'm'
# v_ethanol = dV/dm = 0.054668-2*0.000418*m
# So that at zero molality
m = 0 #[molal]
# the partial molal volume is
v_1 = 0.054668-2*0.000418*m #[L/mol]
# and at
m = 1. #[molal]
v_2 = 0.054668-2*0.000418*m #[L/mol]
v_1 = v_1*1000 #[cm**(3)/mol]
v_2 = v_2*1000 #[cm**(3)/mol]
# Results
print "Partial molal volume of ethanol in water at zero molality is %f cm**3/mol"%(v_1)
print " Partial molal volume of ethanol in water at unity molality is %f cm**3/mol"%(v_2)
import math
# Variables
n_eth = 1. #[mol]
W_water = 1. #[kg]
Temp = 20. #[C]
# For pure ethanol at 20C
v_ethanol = 58.4 #[cm**(3)/mol]
v_ethanol = v_ethanol/1000 # [L/mol]
v_water = 1.0019 #[L/1000g]
# Calculations
# Molality of ethanol in water is
m = n_eth/W_water #[molal]
# We have the equation used in the previous example as
V_final_mix = 1.0019+0.054668*m-0.000418*m**(2)
# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water
# V is the final volume of the solution
# The volume expansion on moxing is
V_exp = V_final_mix-v_ethanol-v_water #[L]
V_exp = V_exp*1000 #[cm**(3)]
# Results
print "Volume change on mixing emath.tanol and water is %0.3f cubic cm"%(V_exp)
# We see that there is a net contraction on mixing of the volume of the ethanol added.
import math
# Variables
# All the data are same as in the previous example
# The equation 6.5 reported in the book is
v_i_average = 0.05425 #[L/mol]
# and
v_i_0 = 0.0584 #[L/mol]
delta_n = 1.00 #[mol]
# Calculations
delta_V_mixing = (v_i_average-v_i_0)*delta_n #[L]
delta_V_mixing = delta_V_mixing*1000 #[cm**(3)]
# Results
print "Volume change on mixing etanol and water is %f cm**3"%(delta_V_mixing)
# Which is same as the solution in example 6.2
import math
# Variables
m = 1. #[molal] Molality of the solution with respect to ethanol
M_water = 18. #[g/mol] molecular weight of water
# Calculations
# First we convert molality to mole fraction
x_ethanol = m/(m + 1000/M_water)
# For the low range of data point on figure 6.5(page 112), we can fit an equation
# (Specific volume ) = 0.018032 + 0.037002*x_ethanol - 0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3)
# This is applicable for (0 < x_ethanol < 0.04 ), which is the case we have
# So
v_math_tan = 0.018032 + 0.037002*x_ethanol - \
0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3) #[L/mol]
# Now we will find the derivative of the specific volume with respect to x_ethanol at the known point x_ethanol
# (dv/dx_ethanol) = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2)
# Hence
v_derv_math_tan = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2) #[L/mol]
# By simple geometry from the figure 6.6(page 113) of the book we find
# a = v_math_tan + (1-x_math_tan)*(dv/dx_1)_math_tan
# b = v_math_tan - x_math_tan*(dv/dx_1)_math_tan
# We have a = v_ethanol and b = v_water
x_math_tan = x_ethanol
# So
v_ethanol = v_math_tan + (1-x_math_tan)*(v_derv_math_tan) #[L/mol]
v_water = v_math_tan - x_math_tan*(v_derv_math_tan) #[L/mol]
# Results
print " Partial molar volume of the ethanol in the given solution is %f L/mol"%(v_ethanol)
print " Partial molar volume of the water in the given solution is %f L/mol"%(v_water)
import math
# Variables
x_sulph = 0.6
x_water = 0.4
Temp = 200. #[F]
# In the given figure 6.8 in the book, drawing the math.tangent to the 200F curve at 60 wt% H2SO4, we find that it intersects the 0%(pure water) axis at 25 Btu/lbm, and the 100% H2SO4 axis at -100Btu/lbm. i.e.
h_water_per_pound = 25. #[Btu/lbm]
h_sulph_per_pound = -100. #[Btu/lbm]
# also molecular weight of water and sulphuric acid are
M_water = 18. #[lbm/lbmol]
M_sulph = 98. #[lbm/lbmol]
# Calculations
# Using equation 6.20 given in the book we have
h_water = h_water_per_pound*M_water #[Btu/lbmol]
h_sulph = h_sulph_per_pound*M_sulph #[Btu/lbmol]
# Results
print "Partial molar enthalpy of water in the mixture is %f Btu/lbmol"%(h_water)
print " Partial molar enthalpy of H2SO4 in the mixture is %f Btu/lbmol"%(h_sulph)
import math
# Variables
x_sulph = 0.6
x_water = 0.4
M_i = 18. #[lbm/lbmol]
Temp = 200. #[F]
# From Equation 6.11 as given in the book, we have
# dQ/dm_in = h_i-h_in
# where h_i is partial molal enthalpy which is taken from the example 6.7 and h_in is the pure species molar enthalpy which is read from the figure 6.8.
# So at 200F we have
h_i = 25. #[Btu/lbm]
h_in = 168. #[Btu/lbm]
# Calculations
# hence
dQ_by_dm_in = h_i-h_in #[Btu/lbm]
# Now
dQ_by_dn_in = M_i*dQ_by_dm_in #[Btu/lbmol]
# Results
print "The amount of heat removed to keep the temperature consmath.tant is %f Btu/lbm of water added"%(dQ_by_dm_in)
# The negative sign shows that this mixing is exothermic we must remove 143 Btu/lbm of water added.
import math
# Variables
m_sulph = 0.4
m_water = 0.6
m = m_sulph+m_water
Temp = 200. #[F]
# Here at 200F we can read the solution enthalpy h_solution and pure H2SO4 enthalpy h_sulph such that
h_solution = -43. #[Btu/lbm]
h_sulph = 168. #[Btu/lbm]
# By energy balance, umath.sing h_0_water from example 6.7 in the book i.e.
h_0_water = 53. #[Btu/lbm]
# We find
# Calculations
delta_Q = m*h_solution-(m_sulph*h_sulph+m_water*h_0_water) #[Btu]
# Results
print "The amount of heat added or removed is %f Btu"%(delta_Q)
# We must remove the given amount of to hold the temperature consmath.tant.
# Note However the book has some mistake in calculation and reporting -172 Btu
import math
# Variables
x_sulph = 0.6
x_water = 0.4
Temp = 200. #[F]
# At the 200F we have
h_water = 25. #[Btu/lbm]
h_sulph = -100. #[Btu/lbm]
# Calculations
# From equation 6.16 (as reporated in the book), rewritten for masses instead of moles we have
h_solution = h_water*x_water+h_sulph*x_sulph # [Btu/lbm]
# Results
print "Enthalpy of the solution is %f Btu/lbm"%(h_solution)
import math
# Variables
x_b = 0
x_a = 1
# We have
#dv_a/dx_a = 3*x_b**(2)+2*x_b
# We have the equation
# dv_b/dx_a = -(dv_a/dx_a)/(x_b/x_a)
# So
# dv_b/dx_a = -(x_a/x_b)*(3*x_b**(2)+2*x_b)
# Calculations
dv_b_by_dx_a = x_a*(-3*x_b-2)
# Results
print "Value of the dv_b/dx_a at x_b =0 is %0.0f"%(dv_b_by_dx_a)