summaryrefslogtreecommitdiff
path: root/Engineering_&_Chemical_Thermodynamics/ch4.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Engineering_&_Chemical_Thermodynamics/ch4.ipynb')
-rwxr-xr-xEngineering_&_Chemical_Thermodynamics/ch4.ipynb434
1 files changed, 434 insertions, 0 deletions
diff --git a/Engineering_&_Chemical_Thermodynamics/ch4.ipynb b/Engineering_&_Chemical_Thermodynamics/ch4.ipynb
new file mode 100755
index 00000000..dd2a21ec
--- /dev/null
+++ b/Engineering_&_Chemical_Thermodynamics/ch4.ipynb
@@ -0,0 +1,434 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 : Equation of states and intermolecular forces"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.1 Page No : 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "from numpy import *\n",
+ "\n",
+ "# Variables\n",
+ "H2O = 1. ;\n",
+ "NH3 = 2. ;\n",
+ "CH4 = 3. ;\n",
+ "CH3Cl = 4. ;\n",
+ "CCl4 = 5. ;\n",
+ "\n",
+ "M_11 = 1.85\n",
+ "alp_12 = 14.80\n",
+ "I_13 = 12.62 ;\n",
+ "M_12 = 1.47\n",
+ "alp_22 = 22.20\n",
+ "I_23 = 10.07 ;\n",
+ "M_31 = 0.00\n",
+ "alp_32 = 26.00\n",
+ "I_33 = 12.61 ;\n",
+ "M_41 = 1.87\n",
+ "alp_42 = 45.30\n",
+ "I_43 = 11.26 ; \n",
+ "M_51 = 0.00\n",
+ "alp_52 = 105.0\n",
+ "I_53 = 11.47 ;\n",
+ "\n",
+ "# Calculations\n",
+ "k = 1.38 * 10**-16 ; \t\t\t#[ J/K]\n",
+ "T = 298. \t\t\t#[K]\n",
+ "A =[[M_11 , alp_12 , I_13, 0,0,0,0],[M_12 , alp_22 , I_23,0,0,0,0 ],[M_31 , alp_32 , I_33,0,0,0,0],[M_41 , alp_42 , I_43,0,0,0,0],[M_51 , alp_52 , I_53,0,0,0,0 ]]\n",
+ "print A\n",
+ "\n",
+ "print (\" Molecule M alp*10**25 I C*10**60 Cd_d Cind Cdis\") ;\n",
+ "for i in range(5):\n",
+ " A[i][4] = ceil( 2./3 * A[i][0]**4 / (k * T) * 10**-12) ;\n",
+ " A[i][5] = ceil(2 * A[i][1] * A[i][0]**2 * 10**-1) ; \n",
+ " A[i][6] = ceil(3./4 * A[i][1]**2 * A[i][2] * 1.6 * 10**-2) ;\n",
+ " A[i][3] = ceil(A[i][4] + A[i][5] + A[i][6]) ; \t\t\t# ....E4.1D\n",
+ "\n",
+ "\n",
+ "print \" H2O %8.2f %5.1f %5.2f %7d %7d %5d %d \"%(A[0][0],A[0][1],A[0][2],A[0][3],A[0][4],A[0][5],A[0][6]) ;\n",
+ "print \" NH3 %8.2f %5.1f %5.2f %7d %7d %5d %d \"%(A[1][0],A[1][1],A[1][2],A[1][3],A[1][4],A[1][5],A[1][6]) ;\n",
+ "print \" CH4 %8.2f %5.1f %5.2f %7d %7d %5d %d \"%(A[2][0],A[2][1],A[2][2],A[2][3],A[2][4],A[2][5],A[2][6]) ;\n",
+ "print \" CH3Cl %8.2f %5.1f %5.2f %7d %7d %5d %d \"%(A[3][0],A[3][1],A[3][2],A[3][3],A[3][4],A[3][5],A[3][6]) ;\n",
+ "print \" CCl4 %8.2f %5.1f %5.2f %7d %7d %5d %d \"%(A[4][0],A[4][1],A[4][2],A[4][3],A[4][4],A[4][5],A[4][6]) ;\n",
+ "\n",
+ "print \"Even though it is non polar , CCl4 exhibit the largest intermolecular forces . It is due to the large polarizability accociated with the four Cl atom in CCl4 .\"\n",
+ "\n",
+ "# Note : Answer are slightly different because of rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[[1.85, 14.8, 12.62, 0, 0, 0, 0], [1.47, 22.2, 10.07, 0, 0, 0, 0], [0.0, 26.0, 12.61, 0, 0, 0, 0], [1.87, 45.3, 11.26, 0, 0, 0, 0], [0.0, 105.0, 11.47, 0, 0, 0, 0]]\n",
+ " Molecule M alp*10**25 I C*10**60 Cd_d Cind Cdis\n",
+ " H2O 1.85 14.8 12.62 235 190 11 34 \n",
+ " NH3 1.47 22.2 10.07 146 76 10 60 \n",
+ " CH4 0.00 26.0 12.61 103 0 0 103 \n",
+ " CH3Cl 1.87 45.3 11.26 509 199 32 278 \n",
+ " CCl4 0.00 105.0 11.47 1518 0 0 1518 \n",
+ "Even though it is non polar , CCl4 exhibit the largest intermolecular forces . It is due to the large polarizability accociated with the four Cl atom in CCl4 .\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2 Page No : 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "import math\n",
+ "C6_Ar_HCl_tab = 76 * 10**-60 ;\t\t\t#From table E4.2\n",
+ "C6_Ar_Ar_tab = 52 * 10**-60 ;\t\t\t#From table E4.2\n",
+ "C6_HCl_HCl_tab = 134 * 10**-60 ;\t\t\t#From table E4.2\n",
+ "\n",
+ "# Calculations\n",
+ "C6_Ar_HCl_gmean = math.sqrt(C6_Ar_Ar_tab * C6_HCl_HCl_tab) ; \t\t\t#[erg/cm**6]\n",
+ "x = (C6_Ar_HCl_gmean - C6_Ar_HCl_tab) / C6_Ar_HCl_tab * 100 ;\n",
+ "\n",
+ "# Results\n",
+ "print \"The geometric mean is different from that in table E4.2 by %d %%\"%(x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The geometric mean is different from that in table E4.2 by 9 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.4 Page No : 230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "import math\n",
+ "Psat_wat_25 = 3.169 * 10**3 ;\t\t\t# From steam table\n",
+ "Psat_wat_50 = 1.235 * 10**4 ;\t\t\t# From steam table\n",
+ "Psat_wat_100 = 1.014 * 10**5 ;\t\t\t# From steam table\n",
+ "A =11.9673 ;\n",
+ "B = 3626.55 ;\n",
+ "C = -34.29 ;\n",
+ "T1 = 25 ; \t\t\t#[*C]\n",
+ "T2 = 50 ; \t\t\t#[*C]\n",
+ "T3 = 100 ; \t\t\t#[*C]\n",
+ "\n",
+ "# Calculations\n",
+ "M = [[T1, Psat_wat_25 , 0],[T2 , Psat_wat_50, 0],[T3 , Psat_wat_100, 0]]\n",
+ "#M = array(M)\n",
+ "\n",
+ "print (\" T(*C) Water(Pa) Methanol(Pa)\")\n",
+ "for i in range(3):\n",
+ " M[i][2] = math.exp(A - B / (M[i][0] + 273 + C)) * 10**5 ;\n",
+ " print \"%5d %7.3e %7.2e\"%(M[i][0],M[i][1],M[i][2])\n",
+ " #t.append(math.exp(A - B / (M[i][0] + 273 + C)) * 10**5)\n",
+ "#M.append(t)\n",
+ "\n",
+ "# Results\n",
+ "\n",
+ "print \"1) Water can form two hydrogen bonds . While CH4Oh can form only one . Thus at\\\n",
+ " a given temperature, water has stronger attractive forces in the liquid and a lower vapour pressure .\"\n",
+ "print \"2) Since the Maxwell-Boltzmann distribution depends exponentially on temperature,\\\n",
+ " Psat also increses exponentially with temperature .\"\n",
+ "\n",
+ "# Note: Answers may vary because of rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " T(*C) Water(Pa) Methanol(Pa)\n",
+ " 25 3.169e+03 1.68e+04\n",
+ " 50 1.235e+04 5.52e+04\n",
+ " 100 1.014e+05 3.53e+05\n",
+ "1) Water can form two hydrogen bonds . While CH4Oh can form only one . Thus at a given temperature, water has stronger attractive forces in the liquid and a lower vapour pressure .\n",
+ "2) Since the Maxwell-Boltzmann distribution depends exponentially on temperature, Psat also increses exponentially with temperature .\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.6 Page No : 236"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "Pc_B = 49.1 ; \t\t\t# [bar] , From table\n",
+ "Pc_T = 42.0 ; \t\t\t# [bar] , From table\n",
+ "Pc_C = 40.4 ; \t\t\t# [bar] , From table\n",
+ "Tc_B = 562 ; \t\t\t# [K] , From table\n",
+ "Tc_T = 594 ; \t\t\t# [K] , From table \n",
+ "Tc_C = 553 ; \t\t\t# [K] , From table\n",
+ "R = 8.314 ;\n",
+ "\n",
+ "# Calculations\n",
+ "A = [[Pc_B , Tc_B, 0,0],[Pc_T , Tc_T,0,0],[Pc_C , Tc_C,0,0]]\n",
+ "\n",
+ "# Results\n",
+ "print \" P_c T_c a b \"\n",
+ "for i in range(3):\n",
+ " A[i][2] = 27./64 * (R * A[i][1])**2 /( A[i][0] * 10**5) ;\n",
+ " A[i][3] = R * A[i][1] / (8 * A[i][0] * 10**5) ;\n",
+ " print \" %5.1f %5d %7.2f %7.2e\"%(A[i][0],A[i][1],A[i][2],A[i][3])\n",
+ "\n",
+ "print \"The attractive interactions of all three compounds are dominated by\\\n",
+ " print ersion interactions ( parameter a) , while size affects parameter b .\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " P_c T_c a b \n",
+ " 49.1 562 1.88 1.19e-04\n",
+ " 42.0 594 2.45 1.47e-04\n",
+ " 40.4 553 2.21 1.42e-04\n",
+ "The attractive interactions of all three compounds are dominated by print ersion interactions ( parameter a) , while size affects parameter b .\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.11 Page No : 246"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "import math\n",
+ "B = 0.0486 * 10**-3 ;\n",
+ "T1 = 20 + 273 ; \t\t\t#[K]\n",
+ "T2 = 500 + 273 ; \t\t\t#[K]\n",
+ "v1 = 7.11 ; \t\t\t# [cm**3/mol]\n",
+ "\n",
+ "# Calculations\n",
+ "v2 = v1 * math.exp( B * (T2 - T1)) ;\n",
+ "\n",
+ "# Results\n",
+ "print \" Molar volume of solid state 2 = %.2f cm**3/mol\"%( v2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Molar volume of solid state 2 = 7.28 cm**3/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.12 Page No : 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "P_c = 37.9 * 10**5 ;\t\t\t#[N/m**2] , From compressibility chart\n",
+ "T_c = 425.2 \t\t\t# [K , From compressibility chart\n",
+ "P = 50. * 10**5 ; \t \t\t#N/m**2]\n",
+ "T = 333.2 ;\t\t\t #[K]\n",
+ "R = 8.314 ;\n",
+ "z_0 = 0.2148 ; \t\t\t\n",
+ "z_1 = -0.0855 ; \t\t\n",
+ "w = 0.199 ;\n",
+ "m = 10. ;\n",
+ "MW = 0.05812 ;\n",
+ "\n",
+ "# Calculations\n",
+ "a = (0.42748 * R**2 * T_c**2.5) / P_c ;\n",
+ "b = 0.08664 * R * T_c / P_c ;\n",
+ "A = P * T**(1./2) ;\n",
+ "B = -R * T**(3./2) ;\n",
+ "C = (a - P * T**(1./2) * b**2 - R * T**(3./2)*b) ;\n",
+ "D = - a * b;\n",
+ "\n",
+ "#mycoeff = [ D , C , B , A] ;\n",
+ "mycoeff = [ A,B,C,D]\n",
+ "#p = poly1d(mycoeff , \"v\" , \"coeff\" ); \n",
+ "M = roots(mycoeff);\n",
+ "\n",
+ "# Results\n",
+ "for i in range(3):\n",
+ " ans = sign(M[i])\n",
+ " if ans == 1:\n",
+ " V = m / MW *(M[i]) ;\n",
+ " #print \"Using Redlich Kwong equation the volume is = %.3f m**3\"%(V)\n",
+ "\n",
+ "z = z_0 + w * z_1 ; \n",
+ "v = z * R * T / P ;\n",
+ "V = m / MW * v ;\n",
+ "print \"Using compressibility chart the volume is = %.3f m**3\"%(V)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Using compressibility chart the volume is = 0.019 m**3\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.13 Page No : 253"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Variables\n",
+ "import math\n",
+ "T = 100. + 273 ; \t\t\t#[K]\n",
+ "P = 70. * 10**5 ; \t\t\t#[N/m**2]\n",
+ "P_c = 42.2 * 10 ** 5 ;\n",
+ "T_c = 370. ; \t\t\t#[K]\n",
+ "w = 0.153 \t \t\t# Interpolating from table C.1 and C.2\n",
+ "z_0 = 0.2822 ;\t\t \t# Interpolating from table C.1 and C.2\n",
+ "z_1 = - 0.0670 ;\t\t\t# Interpolating from table C.1 and C.2\n",
+ "m = 20. * 10**3 ;\t\t\t#[g]\n",
+ "MW = 44. ; \t\t \t#[g/mol]\n",
+ "R = 8.314 ;\n",
+ "\n",
+ "# Calculations and Results\n",
+ "P_r = P / P_c ;\n",
+ "T_r = T / T_c ;\n",
+ "z = z_0 + w * z_1 ;\n",
+ "V = m / MW *z * R * T / P ;\n",
+ "\n",
+ "print \"1) Volume = %.4f m**3 \"%( V )\n",
+ "\n",
+ "\n",
+ "T = 295. ;\t\t\t#[K]\n",
+ "n = 50. ; \t\t\t# [mol]\n",
+ "a = 0.42748 * R**2 * T_c**2.5 / P_c ;\n",
+ "b = 0.08664 * R * T_c / P_c ;\n",
+ "v = 0.1 ;\n",
+ "P = R * T / (v - b) - a / (T**0.5 * v * (v + b)) ;\n",
+ "x = P * n * 10**-6 ;\n",
+ "\n",
+ "print \"2) Pressure = %.1f MPa \"%( x )\n",
+ "\n",
+ "y1 = 0.4 ;\n",
+ "y2 = 1 - y1 ;\n",
+ "n = 50. ;\n",
+ "P_c = 48.7 * 10**5 ;\t\t\t#[N/m**2]\n",
+ "T_c = 305.5 ; \t\t\t#[K]\n",
+ "a1 = a ;\n",
+ "b1 = b ;\n",
+ "a2 = 0.42748 * R**2 * T_c**2.5 / P_c ;\n",
+ "b2 = 0.08664 * R * T_c / P_c ;\n",
+ "\n",
+ "a_mix = y1**2 * a1 + 2 * y1 * y2 * math.sqrt(a1 * a2) + y2**2 * a2 ;\n",
+ "b_mix = y1 * b1 + y2 * b2 ;\n",
+ "P = R * T / (v - b_mix) - a_mix /(T**0.5 * v * (v + b_mix));\n",
+ "x = P * n * 10**-6 ;\n",
+ "\n",
+ "print \"3) Pressure = %.2f MPa \"%( x )\n",
+ "\n",
+ "# Note : Answers are slightly different because of rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1) Volume = 0.0548 m**3 \n",
+ "2) Pressure = 1.2 MPa \n",
+ "3) Pressure = 1.22 MPa \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file