diff options
Diffstat (limited to 'Chemical_Engineering_Thermodynamics_by_P_Ahuja/ch16_1.ipynb')
-rwxr-xr-x | Chemical_Engineering_Thermodynamics_by_P_Ahuja/ch16_1.ipynb | 738 |
1 files changed, 738 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics_by_P_Ahuja/ch16_1.ipynb b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/ch16_1.ipynb new file mode 100755 index 00000000..1053ca6c --- /dev/null +++ b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/ch16_1.ipynb @@ -0,0 +1,738 @@ +{
+ "metadata": {
+ "name": "ch16_1",
+ "signature": "sha256:a00a89ec39a5812cdf143d7f00f601a0bb401404f1638737e2689f71d07acb65"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 16 : Other Phase Equilibria"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.1 Page Number : 564"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math \n",
+ "\n",
+ "# Variables\t\t\t\n",
+ "T = 0 + 273.15;\t\t\t#[K] - Temperature\n",
+ "P = 20*10**(5);\t\t\t#[Pa] - Pressure\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "\t\t\t#componenet 1 : methane (1)\n",
+ "\t\t\t#componenet 2 : methanol (2)\n",
+ "\n",
+ "H_constant = 1022;\t\t\t#[bar] - Henry's law constant\n",
+ "H_constant = H_constant*10**(5);\t\t\t#[Pa]\n",
+ "\n",
+ "\t\t\t# The second virial coefficients are\n",
+ "B_11 = -53.9;\t\t\t#[cm**(3)/mol]\n",
+ "B_11 = B_11*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "B_12 = -166;\t\t\t#[cm**(3)/mol]\n",
+ "B_12 = B_12*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "B_22 = -4068;\t\t\t#[cm**(3)/mol]\n",
+ "B_22 = B_22*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "den_meth = 0.8102;\t\t\t#[g/cm**(3)] - Density of methanol at 0 C\n",
+ "Mol_wt_meth = 32.04;\t\t\t# Molecular weight of methanol\n",
+ "P_2_sat = 0.0401;\t\t\t#[bar] - Vapour pressure of methanol at 0 C\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#The molar volume of methanol can be calculated as\n",
+ "V_2_liq = (1/(den_meth/Mol_wt_meth))*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#The phase equilibrium equation of the components at high pressure\n",
+ "\t\t\t#y1*phi_1*P = x_1*H_1\n",
+ "\t\t\t#y2*phi_2*P = x_2*H_2\n",
+ "\n",
+ "\t\t\t#Since methane follows Henry's law therefore methanol follows the lewis-Rnadall rule\n",
+ "\t\t\t#f_2 is the fugacity of the compressed liquid which is calculated using\n",
+ "\t\t\t#f_2 = f_2_sat*math.exp[V_2_liq*(P - P_sat_2)/(R*T)]\n",
+ "\t\t\t#where f_2_sat can be calculated using virial equation \n",
+ "\t\t\t# math.log(phi_2_sat) = math.log(f_2_sat/P_2_sat) = (B_22*P_2_sat)/(R*T)\n",
+ "\n",
+ "f_2_sat = P_2_sat*math.exp((B_22*P_2_sat*10**(5))/(R*T));\t\t\t#[bar]\n",
+ "\n",
+ "\t\t\t#Putting the value of 'f_2_sat' in the math.expression of f_2 , we get\n",
+ "f_2 = f_2_sat*math.exp(V_2_liq*(P - P_2_sat*10**(5))/(R*T));\t\t\t#[bar]\n",
+ "\n",
+ "\t\t\t#Now let us calculate the fugacity coefficients of the species in the vapour mixture\n",
+ "del_12 = 2*B_12 - B_11 - B_22;\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#math.log(phi_1) = (P/(R*T))*(B_11 + y2**(2)*del_12)\n",
+ "\t\t\t#math.log(phi_2) = (P/(R*T))*(B_22 + y1**(2)*del_12)\n",
+ "\n",
+ "\n",
+ "\t\t\t#The calculation procedure is to assume a value of y1, calculate 'phi_1' and 'phi_2' and calculate 'x_1' and 'x_2' from the phase equilibrium equations and see whether x_1 + x_2 = 1,if not then another value of y1 is assumed.\n",
+ "\n",
+ "y2 = 0.1;\n",
+ "error=10;\n",
+ "\n",
+ "while(error>0.001):\n",
+ " y1=1-y2;\n",
+ " phi_1 = math.exp((P/(R*T))*((B_11 + y2**(2)*del_12)));\n",
+ " phi_2 = math.exp((P/(R*T))*((B_22 + y1**(2)*del_12)));\n",
+ " x_1 = (y1*phi_1*P)/H_constant;\n",
+ " x_2 = (y2*phi_2*P)/(f_2*10**(5));\n",
+ " x = x_1 + x_2;\n",
+ " error=abs(1-x);\n",
+ " y2=y2 - 0.000001;\n",
+ "\n",
+ "# Results\n",
+ "print \" The solubility of methane in methanol is given by x1 = %f\"%(x_1);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The solubility of methane in methanol is given by x1 = 0.018614\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.2 Page Number : 566"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "x_C2H6_1 = 0.33*10**(-4);\t\t\t# Solubility of ethane in water at 25 C and 1 bar\n",
+ "\n",
+ "\t\t\t#componenet 1 : ethane (1)\n",
+ "\t\t\t#componenet 2 : water (2)\n",
+ "\n",
+ "\t\t\t# Z = 1 - 7.63*10**(3)*P - 7.22*10**(-5)*P**(2)\n",
+ "\n",
+ "\t\t\t#The phase equilibrium equation of ethane is\n",
+ "\t\t\t#f_1_V = x_1*H_1\n",
+ "\t\t\t#since vapour is pure gas, f_1_V = x_1*H_1 or, phi_1*P = x_1*H_1, where 'phi_1' is fugacity coefficient of pure ethane\n",
+ "\t\t\t# math.log(phi) = integral('Z-1)/P) from limit '0' to 'P'\n",
+ "\n",
+ "P1 = 0;\n",
+ "P2 = 1;\n",
+ "P3 = 35;\n",
+ "\n",
+ "# Calculations\n",
+ "def f51(P): \n",
+ "\t return (1-7.63*10**(-3)*P-7.22*10**(-5)*P**(2)-1)/P\n",
+ "\n",
+ "intgral = quad(f51,P1,P2)[0]\n",
+ "\n",
+ "phi_1_1 = math.exp(intgral);\t\t\t# - Fugacity coefficient of ethane at 1 bar\n",
+ "f_1_1 = phi_1_1*P2;\t\t\t#[bar] - Fugacity of ethane at 1 bar\n",
+ "\n",
+ "\t\t\t#Similarly\n",
+ "\n",
+ "def f52(P): \n",
+ "\t return (1-7.63*10**(-3)*P-7.22*10**(-5)*P**(2)-1)/P\n",
+ "\n",
+ "intgral_1 = quad(f52,P1,P3)[0]\n",
+ "\n",
+ "phi_1_35 = math.exp(intgral_1);\t\t\t# Fugacity coefficient of ethane at 35 bar\n",
+ "f_1_35 = phi_1_35*P3;\t\t\t#[bar] - Fugacity of ethane at 35 bar\n",
+ "\n",
+ "\t\t\t# At ethane pressure of 1 bar , x_C2H6_1*H_1 = phi_1_1\n",
+ "H_1 = phi_1_1/x_C2H6_1;\t\t\t#[bar] - Henry's constant\n",
+ "\n",
+ "\t\t\t# At ethane pressure of 35 bar , x_C2H6_35*H_1 = phi_1_35\n",
+ "x_C2H6_35 = f_1_35/H_1;\t\t\t# Solubility of ethane at 35 bar pressure\n",
+ "\n",
+ "# Results\n",
+ "print \"The solubility of ethane at 35 bar is given by x_C2H6 = %e \"%(x_C2H6_35);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The solubility of ethane at 35 bar is given by x_C2H6 = 8.525648e-04 \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.4 Page Number : 571"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from scipy.optimize import fsolve \n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "T = 200;\t\t\t#[K]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "\t\t\t# G_E = A*x_1*x_2\n",
+ "A = 4000;\t\t\t#[J/mol]\n",
+ "x_1 = 0.6;\t\t\t# Mle fraction of feed composition\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# Since A is given to be independent of temperature\n",
+ "UCST = A/(2*R);\t\t\t#[K] - Upper critical solution temperature\n",
+ "print \" The UCST of the system is %f K\"%(UCST);\n",
+ "\n",
+ "\t\t\t# Since the given temperature is less than UCST therefore two phase can get formed at the given temperature.\n",
+ "\n",
+ "\t\t\t# x1_alpha = 1 - x1_beta\n",
+ "\t\t\t# We know that, x1_alpha*Y_1_alpha = x2_alpha*Y_2_alpha\n",
+ "\t\t\t# x1_alpha*math.exp[(A/(R*T))*(x2_alpha)**(2)] = (1 - x1_alpha)*math.exp[(A/(R*T))*(x1_alpha)**(2)]\n",
+ "\t\t\t# where use has beeen made of the fact that x1_alpha = 1 - x1_beta and x2_beta = 1 - x1_beta = x1_alpha .Taking math.logarithm of both side we get\n",
+ "\t\t\t# math.log(x1_alpha) + (A/(R*T))*(1 - x1_alpha)**(2) = math.log(1 - x1_alpha) + (A/(R*T))*x1_alpha**(2)\n",
+ "\t\t\t# math.log(x1_alpha/(1-x1_alpha)) = (A/(R*T))*(2*x1_alpha - 1)\n",
+ "\n",
+ "def f(x1_alpha): \n",
+ "\t return math.log(x1_alpha/(1-x1_alpha)) - (A/(R*T))*(2*x1_alpha - 1)\n",
+ "x1_alpha = fsolve(f,0.1)\n",
+ "x1_beta = fsolve(f,0.9)\n",
+ "\t\t\t# Because of symmetry 1 - x1_beta = x1_alpha\n",
+ "\n",
+ "\t\t\t# It can be seen that the equation, math.log(x1/(1-x1)) = (A/(R*T))*(2*x1 - 1) has two roots.\n",
+ "\t\t\t\n",
+ "print \" The composition of two liquid phases in equilibrium is given by x1_alpha = %f and x1_beta = %f\"%(x1_alpha,x1_beta);\n",
+ "\n",
+ "z1 = 0.6;\n",
+ "\t\t\t# z1 = x1_alpha*alpha + x1_beta*beta\n",
+ "\t\t\t# beta = 1 - alpha\n",
+ "alpha = (z1-x1_beta)/(x1_alpha-x1_beta);\t\t\t#[mol]\n",
+ "Beta = 1 - alpha;\t\t\t#[mol]\n",
+ "print \" The relative amount of phases is given by alpha = %f mol and beta = %f mol\"%(alpha,Beta);\n",
+ "\n",
+ "\t\t\t# the relative amounts of the phases changes with the feed composition \n",
+ "\n",
+ "\t\t\t#math.log(x1/(1-x1)) = (A/(R*T))*(2*x1 - 1)\n",
+ "\t\t\t\n",
+ "\n",
+ "print \" math.logx1/1-x1 = A/R*T*2*x1 - 1\";\n",
+ "print \" If the above equation has two real roots of x1 one for phase alpha and the other for phase beta then two liquid phases get formed\";\n",
+ "print \" and if it has no real roots then a homogeneous liquid mixture is obtained\";\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The UCST of the system is 240.558095 K\n",
+ " The composition of two liquid phases in equilibrium is given by x1_alpha = 0.169102 and x1_beta = 0.830898\n",
+ " The relative amount of phases is given by alpha = 0.348896 mol and beta = 0.651104 mol\n",
+ " math.logx1/1-x1 = A/R*T*2*x1 - 1\n",
+ " If the above equation has two real roots of x1 one for phase alpha and the other for phase beta then two liquid phases get formed\n",
+ " and if it has no real roots then a homogeneous liquid mixture is obtained\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.5 Page Number : 573"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "T = 300;\t\t\t#[K]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "A = 7000;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# math.log(x_1/(1-x_1)) = (A/(R*T))*(2*x_1-1)\n",
+ "\n",
+ "# Calculations\n",
+ "def f(x_1): \n",
+ "\t return math.log(x_1/(1-x_1))-((A/(R*T))*(2*x_1-1))\n",
+ "\n",
+ "x1_alpha=fsolve(f,0.1)\n",
+ "\n",
+ "x1_beta=1-x1_alpha;\n",
+ "\n",
+ "# Results\n",
+ "print \"The equilibrium compositin of the two liquid phase system is given by x1_alpha \\t = %f x1_beta \\t = %f\"%(x1_alpha,x1_beta);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The equilibrium compositin of the two liquid phase system is given by x1_alpha \t = 0.091897 x1_beta \t = 0.908103\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.7 Page Number : 579"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "M_wt_meth = 32;\t\t\t# Molecular weight of methanol \n",
+ "M_wt_water = 18;\t\t\t# Molecular weight of water \n",
+ "m_meth = 0.01;\t\t\t#[g] - Mass of methanol added per cm**(3) of solution\n",
+ "\n",
+ "\n",
+ "den_sol = 1;\t\t\t#[g/cm**(3)]\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#The mole fraction of solute is given by\n",
+ "\t\t\t#x_2 = (moles of solute in cm**(3) of solution)/(moles of solute + moles of water) in 1 cm**(3) of solution\n",
+ "x_2 = (m_meth/M_wt_meth)/((m_meth/M_wt_meth)+((1-m_meth)/M_wt_water));\n",
+ "\n",
+ "\t\t\t#We know that heat of fusion of water is\n",
+ "H_fus = -80;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n",
+ "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t#Therefore freezing point depression is given by\n",
+ "\t\t\t# T - T_m = (R*(T**(2))*x_2)/H_fus\n",
+ "T_f = 273.15;\t\t\t#[K] - Freezing point of water\n",
+ "delta_T_f = (R*(T_f**(2))*x_2)/H_fus;\t\t\t#[K]\n",
+ "\n",
+ "# Results\n",
+ "print \"The depression in freezing point is given by delta_T = %f K\"%(delta_T_f);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The depression in freezing point is given by delta_T = -0.581403 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.8 Page Number : 580"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "T_f = 273.15;\t\t\t#[K] - Freezing point of water\n",
+ "m_water = 100;\t\t\t#[g] - Mass of water\n",
+ "m_NaCl = 3.5;\t\t\t#[g] - Mass of NaCl\n",
+ "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n",
+ "M_wt_NaCl = 58.5;\t\t\t# Molecular weight of NaCl\n",
+ "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n",
+ "mol_NaCl = m_NaCl/M_wt_NaCl;\t\t\t#[mol] - Moles of NaCl\n",
+ "\n",
+ "H_fus = -80;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n",
+ "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#Mole fraction of the solute (NaCl) is given by\n",
+ "x_2 = mol_NaCl/(mol_NaCl+mol_water);\n",
+ "\n",
+ "\n",
+ "x_2_act = 2*x_2;\t\t\t# Actual mole fraction\n",
+ "\n",
+ "\t\t\t#Now depression in freezing point is given by\n",
+ "\t\t\t# T - T_m = (R*(T**(2))*x_2_act)/H_fus\n",
+ "delta_T_f = (R*(T_f**(2))*x_2_act)/H_fus;\t\t\t#[C]\n",
+ "\n",
+ "\t\t\t#Thus freezing point of seawater = depression in freezing point\n",
+ "\n",
+ "# Results\n",
+ "print \"The freezing point of seawater is %f C\"%(delta_T_f);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The freezing point of seawater is -2.192853 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.10 Page Number : 583"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "T_b = 373.15;\t\t\t#[K] - Boiling point of water\n",
+ "m_water = 100.;\t\t\t#[g] - Mass of water\n",
+ "m_C12H22 = 5.;\t\t\t#[g] - Mass of glucise (C12H22)\n",
+ "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n",
+ "M_wt_C12H22 = 342.30;\t\t\t# Molecular weight of C12H22\n",
+ "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n",
+ "mol_C12H22 = m_C12H22/M_wt_C12H22;\t\t\t#[mol] - Moles of C12H22\n",
+ "\n",
+ "# Calculations\n",
+ "H_vap = 540.;\t\t\t#[cal/g] - Enthalpy change of vaporisation\n",
+ "H_vap = H_vap*4.186*M_wt_water;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t#Mole fraction of the solute (C12H22) is given by\n",
+ "x_2 = mol_C12H22/(mol_C12H22+mol_water);\n",
+ "\n",
+ "\t\t\t#The boiling point elevation is given by\n",
+ "\t\t\t# T - T_b = (R*T_b**(2)*x_2**(2))/H_vap**(2)\n",
+ "\n",
+ "delta_T_b = (R*T_b**(2)*x_2)/(H_vap);\n",
+ "\n",
+ "# Results\n",
+ "print \"The elevation in boiling point is given by delta_T = %f C\"%(delta_T_b)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The elevation in boiling point is given by delta_T = 0.074611 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.11 Page Number : 584"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "T = 25 + 273.15;\t\t\t#[K] - Surrounding temperature \n",
+ "den_water = 1000.;\t\t\t#[kg/m**(3)] - Density of water\n",
+ "m_water = 100.;\t\t\t#[g] - Mass of water\n",
+ "m_C12H22 = 5.;\t\t\t#[g] - Mass of glucise (C12H22)\n",
+ "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n",
+ "M_wt_C12H22 = 342.30;\t\t\t# Molecular weight of C12H22\n",
+ "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n",
+ "mol_C12H22 = m_C12H22/M_wt_C12H22;\t\t\t#[mol] - Moles of C12H22\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#Mole fraction of the water is given by\n",
+ "x_1 = mol_water/(mol_C12H22+mol_water);\n",
+ "\n",
+ "\t\t\t#Molar volume of water can be calculated as\n",
+ "V_l_water = (1./den_water)*M_wt_water*10**(-3);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#The osmotic pressure is given by\n",
+ "pi = -(R*T*math.log(x_1))/V_l_water;\t\t\t#[N/m**(2)]\n",
+ "pi = pi*10**(-5);\t\t\t#[bar]\n",
+ "\n",
+ "# Results\n",
+ "print \"The osmotic pressure of the mixture is %f bar\"%(pi);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The osmotic pressure of the mixture is 3.616073 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.12 Page Number : 585"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "T = 25 + 273.15;\t\t\t#[K] - Surrounding temperature\n",
+ "den_water = 1000.;\t\t\t#[kg/m**(3)] - Density of water\n",
+ "m_water = 100.;\t\t\t#[g] - Mass of water\n",
+ "m_NaCl = 3.5;\t\t\t#[g] - Mass of NaCl\n",
+ "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n",
+ "M_wt_NaCl = 58.5;\t\t\t# Molecular weight of NaCl\n",
+ "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n",
+ "mol_NaCl = m_NaCl/M_wt_NaCl;\t\t\t#[mol] - Moles of NaCl\n",
+ "\n",
+ "# Calculations\n",
+ "H_fus = -80.;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n",
+ "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t#Mole fraction of the solute (NaCl) is given by\n",
+ "x_2 = mol_NaCl/(mol_NaCl+mol_water);\n",
+ "\n",
+ "\n",
+ "x_2_act = 2*x_2;\t\t\t# Actual mole fraction\n",
+ "\n",
+ "x_1 = 1 - x_2_act;\n",
+ "\n",
+ "\t\t\t#Molar volume of water can be calculated as\n",
+ "V_l_water = (1/den_water)*M_wt_water*10**(-3);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#The osmotic pressure is given by\n",
+ "pi = -(R*T*math.log(x_1))/V_l_water;\t\t\t#[N/m**(2)]\n",
+ "pi = pi*10**(-5);\t\t\t#[bar]\n",
+ "\n",
+ "\n",
+ "# Results\n",
+ "print \"The minimum pressure to desalinate sea water is %f bar\"%(pi);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum pressure to desalinate sea water is 29.662232 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.13 Page Number : 586"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "T = 173.15;\t\t\t#[K] - Surrounding temperature\n",
+ "P = 60;\t\t\t#[bar]\n",
+ "P = P*10**(5);\t\t\t#[Pa] \n",
+ "\n",
+ "\t\t\t#componenet 1 : CO2 (1)\n",
+ "\t\t\t#componenet 2 : H2 (2)\n",
+ "P_1_sat = 0.1392;\t\t\t#[bar] - Vapour pressre of pure solid CO2\n",
+ "P_1_sat = P_1_sat*10**(5);\t\t\t#[bar]\n",
+ "V_s_1 = 27.6;\t\t\t#[cm**(3)/mol] - Molar volume of solid CO2\n",
+ "V_s_1 = V_s_1*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "n_1 = 0.01;\t\t\t#[mol] - Initial number of moles of CO2\n",
+ "n_2 = 0.99;\t\t\t#[mol] - Initial number of moles of H2\n",
+ "\n",
+ "\t\t\t#Let us determine the fugacity of solid CO2 (1) at 60 C and 173.15 K\n",
+ "\t\t\t# f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#Since vapour pressure of pure solid CO2 is very small, therefore\n",
+ "f_1_sat = P_1_sat;\n",
+ "f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T));\n",
+ "\n",
+ "\t\t\t#Since gas phase is ideal therefore\n",
+ "\t\t\t# y1*P = f_1\n",
+ "y1 = f_1/P;\n",
+ "\n",
+ "\t\t\n",
+ "\t\t\t#Number of moles of CO2 in vapour phase at equilibrium can be calculated as\n",
+ "\t\t\t#y1 = (n_1_eq/(n_1_eq + n_2)). Therefore\n",
+ "n_1_eq = n_2*y1/(1-y1);\n",
+ "\n",
+ "\t\t\t#Therefore moles of CO2 precipitated is\n",
+ "n_ppt = n_1 - n_1_eq;\t\t\t#[mol]\n",
+ "\n",
+ "# Results\n",
+ "print \"The moles of CO2 precipitated is %f mol\"%(n_ppt);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The moles of CO2 precipitated is 0.007417 mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.14 Page Number : 586"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "# Variables\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
+ "T = 350.;\t\t\t#[K] - Surrounding temperature\n",
+ "\n",
+ "\t\t\t#componenet 1 : organic solid (1)\n",
+ "\t\t\t#componenet 2 : CO2 (2)\n",
+ "\n",
+ "P_1_sat = 133.3;\t\t\t#[N/m**(2)] - Vapour pressre of organic solid\n",
+ "V_s_1 = 200.;\t\t\t#[cm**(3)/mol] - Molar volume of organic solid\n",
+ "V_s_1 = V_s_1*10.**(-6);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#/At 350 K, the values of the coefficients \n",
+ "B_11 = -500.;\t\t\t#[cm**(3)/mol]\n",
+ "B_22 = -85.;\t\t\t#[cm****(3)/mol]\n",
+ "B_12 = -430.;\t\t\t#[cm**(3)/mol]\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#From phase equilibrium equation of component 1, we get\n",
+ "\t\t\t# y1*P*phi_1 = f_1\n",
+ "\t\t\t# f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n",
+ "\n",
+ "\t\t\t#Since vapour pressure of organic solid is very small, therefore\n",
+ "f_1_sat = P_1_sat;\n",
+ "\n",
+ "\t\t\t# Now let us determine the fugacity coefficient of organic solid in the vapour mixture.\n",
+ "\t\t\t# math.log(phi_1) = (P/(R*T))*(B_11 + y2**(2)*del_12) \n",
+ "del_12 = (2*B_12 - B_11 - B_22)*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\t\t\t#It is given that the partial pressure of component 1 in the vapour mixture is 1333 N?m**(2)\n",
+ "\t\t\t# y1*P = 1333 N/m**(2) or, y1 = 1333/P\n",
+ "\t\t\t# y2 = 1- 1333/P\n",
+ "\t\t\t# math.log(phi_1) = (P/(R*T))*(B_11 + (1- 1333/P)**(2)*del_12)\n",
+ "\n",
+ "\t\t\t#The phase equilibrium equation becomes\n",
+ "\t\t\t# y1*P*phi_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n",
+ "\t\t\t#Taking math.log on both side we have\n",
+ "\t\t\t# math.log(y1*P) + math.log(phi_1) = math.log(f_1_sat) + (V_s_1*(P-P_1_sat)/(R*T))\n",
+ "\t\t\t# (V_s_1*(P-P_1_sat)/(R*T)) - math.log(phi_1) = math.log(1333/133.3) = math.log(10)\n",
+ "\n",
+ "\t\t\t#substituting for math.log(phi_1) from previous into the above equation we get\n",
+ "\t\t\t# (V_s_1*(P-P_1_sat)/(R*T)) - (P/(R*T))*(B_11 + (1- 1333/P)**(2)*del_12) - math.log(10) = 0\n",
+ "\t\t\t# On simplification we get,\n",
+ "\t\t\t# 975*P**(2) - 6.7*10**(9)*P + 4.89*10**(8) = 0\n",
+ "\t\t\t# Solving the above qyadratic equation using shreedharcharya rule\n",
+ "\n",
+ "P3 = (6.7*10**(9) + ((-6.7*10**(9))**(2)-4*975*4.98*10**(8))**(1./2))/(2*975);\t\t\t#[Pa]\n",
+ "P4 = (6.7*10**(9) - ((-6.7*10**(9))**(2)-4*975*4.98*10**(8))**(1./2))/(2*975);\t\t\t#[Pa]\n",
+ "\t\t\t# The second value is not possible, therefore pressure of the system is P3\n",
+ "P3 = P3*10**(-5);\t\t\t#[bar]\n",
+ "\n",
+ "# Results\n",
+ "print \" The total pressure of the system is %f bar\"%(P3);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The total pressure of the system is 68.717948 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |