summaryrefslogtreecommitdiff
path: root/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb')
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb499
1 files changed, 499 insertions, 0 deletions
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
new file mode 100644
index 00000000..fb02a429
--- /dev/null
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
@@ -0,0 +1,499 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6 : Partial Molal Properties"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.1 Page: 108\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "calculate\n",
+ "Partial molal volume of ethanol in water at zero molality\n",
+ "Partial molal volume of ethanol in water at unity molality \n",
+ "'''\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "T = 20. #[C]\n",
+ "m_1 = 0. #[molal]\n",
+ "m_2 = 1. #[molal]\n",
+ "\n",
+ "# Calculations\n",
+ "# The data given in the figure 6.2 , as reported in book, can be repersented with excellent accuracy by a simple data fitting equation\n",
+ "#V = 1.0019+0.054668*m-0.000418*m**(2)\n",
+ "# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water\n",
+ "#The partial molal volume is obtained by differentiating the expression of the 'V' with respect to 'm'\n",
+ "# v_ethanol = dV/dm = 0.054668-2*0.000418*m\n",
+ "# So that at zero molality \n",
+ "m = 0 #[molal]\n",
+ "# the partial molal volume is \n",
+ "v_1 = 0.054668-2*0.000418*m #[L/mol]\n",
+ "# and at\n",
+ "m = 1. #[molal]\n",
+ "v_2 = 0.054668-2*0.000418*m #[L/mol]\n",
+ "v_1 = v_1*1000 #[cm**(3)/mol]\n",
+ "v_2 = v_2*1000 #[cm**(3)/mol]\n",
+ "\n",
+ "# Results\n",
+ "print \"Partial molal volume of ethanol in water at zero molality is %f cm**3/mol\"%(v_1)\n",
+ "print \" Partial molal volume of ethanol in water at unity molality is %f cm**3/mol\"%(v_2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Partial molal volume of ethanol in water at zero molality is 54.668000 cm**3/mol\n",
+ " Partial molal volume of ethanol in water at unity molality is 53.832000 cm**3/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.2 Page: 109\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate Volume change on mixing etanol and water\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "n_eth = 1. #[mol]\n",
+ "W_water = 1. #[kg]\n",
+ "Temp = 20. #[C]\n",
+ "\n",
+ "# For pure ethanol at 20C\n",
+ "v_ethanol = 58.4 #[cm**(3)/mol]\n",
+ "v_ethanol = v_ethanol/1000 # [L/mol]\n",
+ "v_water = 1.0019 #[L/1000g]\n",
+ "\n",
+ "# Calculations\n",
+ "# Molality of ethanol in water is\n",
+ "m = n_eth/W_water #[molal]\n",
+ "# We have the equation used in the previous example as\n",
+ "V_final_mix = 1.0019+0.054668*m-0.000418*m**(2)\n",
+ "\n",
+ "# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water\n",
+ "# V is the final volume of the solution \n",
+ "# The volume expansion on moxing is \n",
+ "V_exp = V_final_mix-v_ethanol-v_water #[L]\n",
+ "V_exp = V_exp*1000 #[cm**(3)]\n",
+ "\n",
+ "# Results\n",
+ "print \"Volume change on mixing emath.tanol and water is %0.3f cubic cm\"%(V_exp)\n",
+ "# We see that there is a net contraction on mixing of the volume of the ethanol added.\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Volume change on mixing emath.tanol and water is -4.150 cubic cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.3 Page: 109\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Volume change on mixing etanol and water \n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "# All the data are same as in the previous example \n",
+ "# The equation 6.5 reported in the book is \n",
+ "v_i_average = 0.05425 #[L/mol]\n",
+ "# and\n",
+ "v_i_0 = 0.0584 #[L/mol]\n",
+ "delta_n = 1.00 #[mol]\n",
+ "\n",
+ "# Calculations\n",
+ "delta_V_mixing = (v_i_average-v_i_0)*delta_n #[L]\n",
+ "delta_V_mixing = delta_V_mixing*1000 #[cm**(3)]\n",
+ "\n",
+ "# Results\n",
+ "print \"Volume change on mixing etanol and water is %f cm**3\"%(delta_V_mixing)\n",
+ "# Which is same as the solution in example 6.2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Volume change on mixing etanol and water is -4.150000 cm**3\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.4 Page: 113\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "calculate\n",
+ "Partial molar volume of the ethanol \n",
+ "Partial molar volume of the water \n",
+ "'''\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "m = 1. #[molal] Molality of the solution with respect to ethanol\n",
+ "M_water = 18. #[g/mol] molecular weight of water\n",
+ "\n",
+ "# Calculations\n",
+ "# First we convert molality to mole fraction\n",
+ "x_ethanol = m/(m + 1000/M_water)\n",
+ "\n",
+ "# For the low range of data point on figure 6.5(page 112), we can fit an equation\n",
+ "# (Specific volume ) = 0.018032 + 0.037002*x_ethanol - 0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3)\n",
+ "# This is applicable for (0 < x_ethanol < 0.04 ), which is the case we have\n",
+ "\n",
+ "# So\n",
+ "v_math_tan = 0.018032 + 0.037002*x_ethanol - \\\n",
+ "0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3) #[L/mol]\n",
+ "\n",
+ "# Now we will find the derivative of the specific volume with respect to x_ethanol at the known point x_ethanol\n",
+ "# (dv/dx_ethanol) = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2)\n",
+ "# Hence\n",
+ "v_derv_math_tan = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2) #[L/mol]\n",
+ "\n",
+ "# By simple geometry from the figure 6.6(page 113) of the book we find\n",
+ "# a = v_math_tan + (1-x_math_tan)*(dv/dx_1)_math_tan\n",
+ "# b = v_math_tan - x_math_tan*(dv/dx_1)_math_tan\n",
+ "\n",
+ "# We have a = v_ethanol and b = v_water\n",
+ "x_math_tan = x_ethanol\n",
+ "# So\n",
+ "v_ethanol = v_math_tan + (1-x_math_tan)*(v_derv_math_tan) #[L/mol]\n",
+ "v_water = v_math_tan - x_math_tan*(v_derv_math_tan) #[L/mol]\n",
+ "\n",
+ "# Results\n",
+ "print \" Partial molar volume of the ethanol in the given solution is %f L/mol\"%(v_ethanol)\n",
+ "print \" Partial molar volume of the water in the given solution is %f L/mol\"%(v_water)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Partial molar volume of the ethanol in the given solution is 0.053848 L/mol\n",
+ " Partial molar volume of the water in the given solution is 0.018042 L/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.7 Page: 117\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "calculate\n",
+ "Partial molar enthalpy of water in the mixture\n",
+ "Partial molar enthalpy of H2SO4 in the mixture\n",
+ "'''\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "x_sulph = 0.6\n",
+ "x_water = 0.4\n",
+ "Temp = 200. #[F]\n",
+ "# 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.\n",
+ "h_water_per_pound = 25. #[Btu/lbm]\n",
+ "h_sulph_per_pound = -100. #[Btu/lbm]\n",
+ "# also molecular weight of water and sulphuric acid are\n",
+ "M_water = 18. #[lbm/lbmol]\n",
+ "M_sulph = 98. #[lbm/lbmol]\n",
+ "\n",
+ "# Calculations\n",
+ "# Using equation 6.20 given in the book we have\n",
+ "h_water = h_water_per_pound*M_water #[Btu/lbmol]\n",
+ "h_sulph = h_sulph_per_pound*M_sulph #[Btu/lbmol]\n",
+ "\n",
+ "# Results\n",
+ "print \"Partial molar enthalpy of water in the mixture is %f Btu/lbmol\"%(h_water)\n",
+ "print \" Partial molar enthalpy of H2SO4 in the mixture is %f Btu/lbmol\"%(h_sulph)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Partial molar enthalpy of water in the mixture is 450.000000 Btu/lbmol\n",
+ " Partial molar enthalpy of H2SO4 in the mixture is -9800.000000 Btu/lbmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.8 Page: 119\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find The amount of heat removed to keep the temperature constant\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "x_sulph = 0.6\n",
+ "x_water = 0.4\n",
+ "M_i = 18. #[lbm/lbmol]\n",
+ "Temp = 200. #[F]\n",
+ "# From Equation 6.11 as given in the book, we have \n",
+ "# dQ/dm_in = h_i-h_in\n",
+ "# 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.\n",
+ "# So at 200F we have \n",
+ "h_i = 25. #[Btu/lbm]\n",
+ "h_in = 168. #[Btu/lbm]\n",
+ "\n",
+ "# Calculations\n",
+ "# hence\n",
+ "dQ_by_dm_in = h_i-h_in #[Btu/lbm]\n",
+ "# Now \n",
+ "dQ_by_dn_in = M_i*dQ_by_dm_in #[Btu/lbmol]\n",
+ "\n",
+ "# Results\n",
+ "print \"The amount of heat removed to keep the temperature consmath.tant is %f Btu/lbm of water added\"%(dQ_by_dm_in)\n",
+ "# The negative sign shows that this mixing is exothermic we must remove 143 Btu/lbm of water added.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amount of heat removed to keep the temperature consmath.tant is -143.000000 Btu/lbm of water added\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.9 Page: 119\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find The amount of heat added or removed \n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "m_sulph = 0.4\n",
+ "m_water = 0.6\n",
+ "m = m_sulph+m_water\n",
+ "Temp = 200. #[F]\n",
+ "# Here at 200F we can read the solution enthalpy h_solution and pure H2SO4 enthalpy h_sulph such that\n",
+ "h_solution = -43. #[Btu/lbm]\n",
+ "h_sulph = 168. #[Btu/lbm]\n",
+ "# By energy balance, umath.sing h_0_water from example 6.7 in the book i.e.\n",
+ "h_0_water = 53. #[Btu/lbm]\n",
+ "\n",
+ "# We find \n",
+ "# Calculations\n",
+ "delta_Q = m*h_solution-(m_sulph*h_sulph+m_water*h_0_water) #[Btu]\n",
+ "\n",
+ "# Results\n",
+ "print \"The amount of heat added or removed is %f Btu\"%(delta_Q)\n",
+ "# We must remove the given amount of to hold the temperature consmath.tant.\n",
+ "# Note However the book has some mistake in calculation and reporting -172 Btu\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amount of heat added or removed is -142.000000 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.10 Page: 120\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate enthalpy of the solution\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "x_sulph = 0.6\n",
+ "x_water = 0.4\n",
+ "Temp = 200. #[F]\n",
+ "# At the 200F we have\n",
+ "h_water = 25. #[Btu/lbm]\n",
+ "h_sulph = -100. #[Btu/lbm]\n",
+ "\n",
+ "# Calculations\n",
+ "# From equation 6.16 (as reporated in the book), rewritten for masses instead of moles we have \n",
+ "h_solution = h_water*x_water+h_sulph*x_sulph # [Btu/lbm]\n",
+ "\n",
+ "# Results\n",
+ "print \"Enthalpy of the solution is %f Btu/lbm\"%(h_solution)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enthalpy of the solution is -50.000000 Btu/lbm\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 6.11 Page: 121\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Value of the dv_b/dx_a at x_b =0\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "x_b = 0\n",
+ "x_a = 1\n",
+ "# We have\n",
+ "#dv_a/dx_a = 3*x_b**(2)+2*x_b\n",
+ "# We have the equation \n",
+ "# dv_b/dx_a = -(dv_a/dx_a)/(x_b/x_a)\n",
+ "# So\n",
+ "# dv_b/dx_a = -(x_a/x_b)*(3*x_b**(2)+2*x_b) \n",
+ "# Calculations\n",
+ "dv_b_by_dx_a = x_a*(-3*x_b-2)\n",
+ "\n",
+ "# Results\n",
+ "print \"Value of the dv_b/dx_a at x_b =0 is %0.0f\"%(dv_b_by_dx_a)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of the dv_b/dx_a at x_b =0 is -2\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file