N1 = 1.;
P1 = 1. ; # Number of phases present
C1 = 1. ; #Number of components present
F1 = 2.-P1+C1 ; #Number of degree of freedom
print ' (a) Number of degree of freedom of pure benzene is %i.\n Therefore %i additional \
intensive variables must be specified to fix to fix the system.'%(F1,F1)
# (b)
N2 = 1.;
P2 = 2. ; # Number of phases present
C2 = 1. ; #Number of components present
F2 = 2.-P2+C2 ; #Number of degree of freedom
print '(b) Number of degree of freedom of a mixture of ice and water only is %i.\
\nTherefore %i additional intensive variables must be specified to fix the system. '%(F2,F2)
# (c)
N3 = 2.;
P3 = 2. ; # Number of phases present
C3 = 2. ; #Number of components present
F3 = 2.-P3+C3 ; #Number of degree of freedom
print '(c) Number of degree of freedom of a mixture of liquid benzene,benzene vapour and\
helium gas is %i. \nTherefore %i additional intensive variables must be specified to fix the system. '%(F3,F3)
# (d)
N4 = 2.;
P4 = 2. ; # Number of phases present
C4 = 2. ; #Number of components present
F4 = 2.-P4+C4 ; #Number of degree of freedom
print '(d) Number of degree of freedom of a mixture of salt and water designed to achieve\
a specific vapour pressure is %i. \nTherefore %i additional intensive variables must be\
specified to fix the system. '%(F4,F4)
N1 = 5.;
P1 = 1.; # Number of phases present,here 1 gas
C1 = 3. ; #Number of independent components present,here 3 because 3 elements(C,O and H)
F1 = 2-P1+C1 ; #Number of degree of freedom
print ' (a) Number of degree of gas composed of CO,CO2,H2,H2O and CH4 is %i. \n \
Therefore %i additional intensive variables must be specified to fix the system. '%(F1,F1)
# (b)
N2 = 4.;
P2 = 4. ; # Number of phases present,here 3 different solid phases and 1 gas phase
C2 = 3. ; #Number of components present, here 3 because 3 elements(Zn,O and C) ,you can also use method explained
#in Appendix L1
F2 = 2.-P2+C2 ; #Number of degree of freedom
print '(b) Number of degree of freedom of a mixture of ZnO(s), C(s) ,CO(g) and Zn(s) is %i. \n \
Therefore %i additional intensive variables must be specified to fix the system. '%(F2,F2)
from scipy.optimize import fsolve
import math
# Variables
P_atm = 1. ; #[atm]
P = 760. ; #[mm of Hg]
x_1 = 4./100 ; # Mole fraction of hexane in liquid phase
# Constant A,B and C for Antoine eqn. of n_hexane
A1 = 15.8366;
B1 = 2697.55 ;
C1 = -48.784;
# Constant A,B and C for Antoine eqn. of n_octane
A2 = 15.9798;
B2 = 3127.60 ;
C2 = -63.633;
# Calculations
# Solve for bubble point temperature by eqn. obtained by using Antoine equation
def f(T):
return math.exp(A1-(B1/(C1+T)))*x_1 + math.exp(A2-(B2/(C2+T)))*(1-x_1) - P
T = fsolve(f,390)[0] ; # Bubble point temperature
print 'Bubble point temperature is %.1f K'%T
# Composition of first vapour
# Get vapour pressure of hexane and octane from Perry, it is
vp_1 = 3114. ; # vapour pressure of hexane-[mm of Hg]
vp_2 = 661. ; # vapour pressure of octane-[mm of Hg]
y_1 = vp_1*x_1/P ; # Mole fraction of hexane in vapour phase
y_2 = 1- y_1 ; #Mole fraction of octane in vapour phase
# Results
print ' Composition of first vapour. '
print 'Component Mole fraction. '
print 'n_hexane %.3f'%y_1
print ' n_octane %.3f'%y_2
# Variables
# Basis : 100 g solution
F = 100. ; # Amount of solution-[g]
P_atm = 1. ; #[atm]
P = 760. ; # Total pressure -[mm of Hg]
wf_hex = 68.6/100 ; #Weight fraction of hexane in mixture
wf_tol = 31.4/100 ; #Weight fraction of toluene in mixture
mw_hex = 86.17 ; # Mol.wt. of hexane-[g]
mw_tol = 92.13 ; # Mol.wt. of toluene-[g]
# Calculations
mol_hex = wf_hex *F/mw_hex ; # moles of hexane-[g mol]
mol_tol = wf_tol*F/mw_tol ; # moles of toluene-[g mol]
mol_total = mol_hex + mol_tol ; # Total moles in mixture-[g mol]
molf_hex = mol_hex/mol_total ; # Mole fraction of hexane
molf_tol = mol_tol/mol_total ; # Mole fraction of toluene
# Get vapour pressure of hexane and toluene at 80 deg. C from Perry, it is
vp_hex = 1020. ; # vapour pressure of hexane-[mm of Hg]
vp_tol = 290. ; # vapour pressure of toluene-[mm of Hg]
K_hex = vp_hex/P ; # K-value of hexane
K_tol = vp_tol/P ; # K-value of toluene
rec_K_hex = 1/K_hex ; # Reciprocal of K-value of hexane
rec_K_tol = 1/K_tol ; # Reciprocal of K-value of toluene
# Let L/F = x, then use eqn. 19.11 to find x(L/F)
def g(x):
return (molf_hex)/(1-x*(1-rec_K_hex)) + (molf_tol)/(1-x*(1-rec_K_tol))-1
x = fsolve(g,1)[0] ; # L/F value
# Results
print ' Fraction of liquid(L/F) that will remain at equilibrium after vaporization is %.3f. '%x
# Variables
Vo = 3.0 ; # Initial volume of the solution containing the culture and virus-[L]
Vp = 0.1 ; # Volume of the polymer solution added to the vessel -[L]
Kpc = 100. ; # Partition coefficient for virus(cp/cc) between two phases
# Calculations
Vc = Vo ; # At equilibrium -[L]
cp_by_co = Vo/(Vp+(Vo/Kpc)) ;
Fr_rec = cp_by_co*(Vp/Vo) ;
# Results
print ' Fraction of the initial virus in the culture phase that is recovered in the polymer phase is %.2f . '%Fr_rec