summaryrefslogtreecommitdiff
path: root/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.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 /Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.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 'Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb')
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb328
1 files changed, 328 insertions, 0 deletions
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb
new file mode 100644
index 00000000..5268900c
--- /dev/null
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb
@@ -0,0 +1,328 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 26 : Energy Balances that include the Effects of Chemical Reaction"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 26.2 page no. 808\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of an adiabetic reaction temperature.\n",
+ "\n",
+ "# Variables\n",
+ "m1_CO = 1.; \t\t\t# Moles of CO input- [g mol]\n",
+ "m1_O2 = 1. ;\t\t\t# Moles of O2 input - [g mol]\n",
+ "m1_N2 = 3.76 ;\t\t\t# Moles of N2 input - [g mol]\n",
+ "#Output compounds\n",
+ "m2_CO2 = 1. ;\t\t\t# Moles of CO2 output - [g mol]\n",
+ "m2_O2 = .50 ;\t\t\t# Moles of O2 output - [g mol]\n",
+ "m2_N2 = 3.76 ;\t\t\t# Moles of N2 output - [g mol]\n",
+ "\n",
+ "H1_fCO = -110520 ;\t\t\t# Heat of formation of CO - [J/g mol] \n",
+ "H1_fO2 = 0 ;\t\t\t# Heat of formation of O2 - [J/g mol] \n",
+ "H1_fN2 = 0 ;\t\t\t# Heat of formation of N2 - [J/g mol] \n",
+ "H1_CO = 2917. - 728 ;\t\t\t# Change in enthalpy during temperature change from 298K to 373 K of CO - [J/g mol] \n",
+ "H1_O2 = 2953. - 732 ;\t\t\t# Change in enthalpy during temperature change from 298K to 373 K of input O2 - [J/g mol]\n",
+ "H1_N2 = 2914. - 728 ;\t\t\t# Change in enthalpy during temperature change from 298K to 373 K of input N2 - [J/g mol]\n",
+ "\n",
+ "# Calculations\n",
+ "H_in = (H1_fCO + H1_CO)*m1_CO + (H1_fO2 + H1_O2)*m1_O2 + (H1_fN2 + H1_N2)*m1_N2;\t\t\t# Enthalpy change for inputs -[J]\n",
+ "\n",
+ "H2_fCO2 = -393510 ;\t\t\t# Heat of formation of CO2 - [J/g mol] \n",
+ "H2_fO2 = 0 ;\t\t\t# Heat of formation of O2 - [J/g mol] \n",
+ "H2_fN2 = 0 ;\t\t\t# Heat of formation of N2 - [J/g mol] \n",
+ "H2_CO2 = 92466. - 912 ;\t\t\t# Change in enthalpy during temperature change from 298K to 2000 K of CO2 - [J/g mol] \n",
+ "H2_O2 = 59914.-732 ;\t\t\t# Change in enthalpy during temperature change from 298K to 2000 K of output O2 - [J/g mol] \n",
+ "H2_N2 = 56902. - 728 ;\t\t\t# Change in enthalpy during temperature change from 298K to 2000 K of output O2 - [J/g mol] \n",
+ "\n",
+ "H1_out = (H2_fCO2 + H2_CO2)*m2_CO2 + (H2_fO2 + H2_O2)*m2_O2 + (H2_fN2 + H2_N2)*m2_N2 ;\t\t\t# Enthalpy change for outputs at 2000 K -[J]\n",
+ "\n",
+ "del_H1 = H1_out - H_in ;\t\t\t# Net enthalpy change of process -[J]\n",
+ "\n",
+ "H2_fCO2 = -393510. ;\t\t\t# Heat of formation of CO2 - [J/g mol] \n",
+ "H3_CO2 = 77455. - 912 ;\t\t\t# Change in enthalpy during temperature change from 298K to 1750 K of CO2 - [J/g mol] \n",
+ "H3_O2 = 50555. -732 ;\t\t\t# Change in enthalpy during temperature change from 298K to 1750 K of output O2 - [J/g mol] \n",
+ "H3_N2 = 47940. - 728 ;\t\t\t# Change in enthalpy during temperature change from 298K to 1750 K of output O2 - [J/g mol] \n",
+ "\n",
+ "H2_out = (H2_fCO2 + H3_CO2)*m2_CO2 + (H2_fO2 + H3_O2)*m2_O2 + (H2_fN2 + H3_N2)*m2_N2 ;\t\t\t# Enthalpy change for outputs at 1750 K -[J]\n",
+ "\n",
+ "del_H2 = H2_out - H_in ;\t\t\t# Net enthalpy change of process -[J]\n",
+ "\n",
+ "# Results\n",
+ "print 'Heat of above reaction when output is assumed to be at 2000 K is %.0f J.'%del_H1\n",
+ "print ' Heat of above reaction when output is assumed to be at 1750 K is %.0f J.'%del_H2\n",
+ "\t\t\t# Energy balance here reduce to del_H = 0 \n",
+ "print ' So we can see that our desired result del_H = 0 is bracketed between 2000 K and 1750 K , hence we will use interpolation to get the theoretical flame temperature.'\n",
+ "\t\t\t# Use interpolation to get the theoretical flame temperature\n",
+ "del_H = 0. ;\t\t\t# Requred condition\n",
+ "Ft = 1750 + ((del_H - del_H2)/(del_H1 - del_H2))*(2000 - 1750) ;\t\t\t# Interpolation to get Flame temperature(Ft)-[K]\n",
+ "print ' Theoretical flame temperature by interpolation is %.0f K.'%Ft\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat of above reaction when output is assumed to be at 2000 K is 36740 J.\n",
+ " Heat of above reaction when output is assumed to be at 1750 K is -16648 J.\n",
+ " So we can see that our desired result del_H = 0 is bracketed between 2000 K and 1750 K , hence we will use interpolation to get the theoretical flame temperature.\n",
+ " Theoretical flame temperature by interpolation is 1828 K.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 26.3 page no. 811\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Application of general Energy Balance in a Process in which More than one Reaction Occurs\n",
+ "\n",
+ "# Solution Fig E26.3b\n",
+ "\n",
+ "# Variables\n",
+ "v_CH4 = 1000. ;\t\t\t# Volume of CH4 taken - [ cubic feet]\n",
+ "CH4 = 1. ;\t\t\t# assumed for convenience- [ g mol] \n",
+ "ex_air = .5 ;\t\t\t# Fraction of excess O2 required \n",
+ "hp_CaCO3 = 0.130 ;\t\t\t# Heat capacity of CaCO3 -[kJ/g mol]\n",
+ "hp_CaO = 0.062 ;\t\t\t# Heat capacity of CaO -[kJ/g mol]\n",
+ "w_CaCO3 = 100.09 ;\t\t\t# Mol. wt. of CaCO3 -[g]\n",
+ "w_CaO = 56.08 ;\t\t\t# Mol. wt. ofCaO - [g]\n",
+ "\n",
+ "# Calculations\n",
+ "req_O2 = 2. ;\t\t\t# By eqn. (b), O2 required by CH4 - [g mol]\n",
+ "ex_O2 = ex_air*req_O2 ;\t\t\t# Excess O2 required - [ g mol]\n",
+ "O2 = req_O2 + ex_O2 ;\t\t\t# Total O2 entering - [ g mol]\n",
+ "N2 = O2 *(.79/.21) ;\t\t\t# Total N2 entering - [ g mol]\n",
+ "\n",
+ "nG_N2 = N2 ;\t\t\t# N2 balance - [ g mol]\n",
+ "nG_H2O = 4*CH4/2. ;\t\t\t# H2O balance - [ g mol]\n",
+ "nG_O2 = ex_O2 ;\t\t\t# [g mol]\n",
+ "\n",
+ "del_Hi_out = [ -393.250,0,0,-241.835,-635.6] ;\t\t\t# \t\t\t# Heat of formation - [kJ/g mol] \n",
+ "del_Hf_out = [21.425,15.043,14.241,17.010,54.25] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n",
+ "del_H_out =del_Hi_out + del_Hf_out ;\t\t\t# Change in enthalpy final - [kJ/g mol]\n",
+ "\n",
+ "del_Hi_in = [ -49.963,-1206.9,0,0] ;\t\t\t# \t\t\t# Heat of formation - [kJ/g mol] \n",
+ "del_Hf_in = [0,0,0,0] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n",
+ "del_H_in = del_Hi_in + del_Hf_in ;\t\t\t# Change in enthalpy final - [kJ/g mol]\n",
+ "\n",
+ "from numpy import matrix\n",
+ "a = matrix([[1,-1],[(del_H_in[1]-del_H_out[4]),-del_H_out[0]]]) ;\t\t\t# Matrix of coefficients\n",
+ "b = matrix([[-1],[(del_H_out[1]*nG_O2 + del_H_out[2]*nG_N2 +del_H_out[3]*nG_H2O-del_H_in[0]*CH4)]]) ;\t\t\t# Matrix of constants\n",
+ "a = a.I\n",
+ "x = a*b ;\t\t\t# Matrix of solutions, L = x(1), nG_CO2 = x(2)\n",
+ "g_CaCO3 = x[0]*w_CaCO3 ;\t\t\t#CaCO3 processed for each g mol of CH4 - [g]\n",
+ "\n",
+ "# Results\n",
+ "print ' CaCO3 processed for each g mol of CH4 is %.0f g.'%g_CaCO3\n",
+ "m_CaCO3 = (v_CH4*g_CaCO3)/359.05 ;\n",
+ "print ' Therefore, CaCO3 processed per 1000 ft**3 of CH4 is %.0f lb.'%m_CaCO3\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " CaCO3 processed for each g mol of CH4 is 465 g.\n",
+ " Therefore, CaCO3 processed per 1000 ft**3 of CH4 is 1295 lb.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 26.4 page no. 815\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Application of general Energy Balance in a Process Composed of Multiple Units\n",
+ "\n",
+ "# Solution Fig E26.4b\n",
+ "\n",
+ "# Variables\n",
+ "SO2_in = 2200. ;\t\t\t# Amount of SO2 entering reactor 2-[lb mol/hr]\n",
+ "\n",
+ "R1_CO_in = 1. ;\t\t\t#CO entering reactor 1-[lb mol]\n",
+ "air = .80 ;\t\t\t# Fraction of air used in burning \n",
+ "\n",
+ "R2_fSO2_in = 0.667 ;\t\t\t# Fraction of SO2 entering reactor 2\n",
+ "R2_fO2_in = 0.333 ;\t\t\t# Fraction of O2 entering reactor 2\n",
+ "R2_fSO3_out = 0.586 ;\t\t\t# Fraction of SO3 exiting reactor 2\n",
+ "R2_fSO2_out = 0.276 ;\t\t\t# Fraction of SO2 exiting reactor 2\n",
+ "R2_fO2_out = 0.138 ;\t\t\t# Fraction of O2 exiting reactor 2\n",
+ "# Main Reaction: CO , (1/2)*O2 ---> CO2 \n",
+ "R1_O2_in = (1.0/2)*air ;\t\t\t# O2 entering reactor 1-[g mol]\n",
+ "R1_N2_in = R1_O2_in*(79./21) ;\t\t\t# N2 entering reactor 1-[g mol]\n",
+ "\n",
+ "# Calculations\n",
+ "#Output of reactor 1\n",
+ "R1_CO_out = R1_CO_in*(1 - air) ;\t\t\t# [g mol]\n",
+ "R1_CO2_out = 1*( air) ;\t\t\t# [g mol]\n",
+ "R1_N2_out = R1_N2_in ;\t\t\t#[g mol]\n",
+ "\n",
+ "del_Hi_out = [ -109.054,-393.250,0.,-296.855,-395.263,0.] ; \t\t\t# Heat of formation - [kJ/g mol] \n",
+ "del_Hf_out = [35.332,35.178,22.540,20.845,34.302,16.313] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n",
+ "del_H_out =del_Hi_out + del_Hf_out ;\t\t\t#[-371.825,15.043,160.781,-449.650,-581.35]\t\t\t# Change in enthalpy final - [kJ/g mol]\n",
+ "\n",
+ "del_Hi_in = [ -109.054,-393.250,0.,-296.855,0.] ;\t\t\t# \t\t\t# Heat of formation - [kJ/g mol] \n",
+ "del_Hf_in = [17.177,17.753,11.981,0.,0.] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n",
+ "del_H_in = del_Hi_in+ del_Hf_in ;\t\t\t# Change in enthalpy final - [kJ/g mol]\n",
+ "\n",
+ "from numpy import matrix\n",
+ "# Solve eqn. (a), (b) and (c) to get F ,P , ex \n",
+ "a = matrix([[(R2_fSO3_out),0,-1],\n",
+ " [(R2_fSO2_out),-(R2_fSO2_in),1],\n",
+ " [- 285.50, -(del_H_in[3]*R2_fSO2_in), 0]]) ;\t\t\t# Matrix of coefficients\n",
+ "\n",
+ "b = matrix([[0],[0],[- 33.459781 ]]) ;\t\t\t# Matrix of constants\n",
+ "#a = a.I\n",
+ "#x = a*b ;\t\t\t# Matrix of solutions, P = x(1), F = x(2) ,ex = x(3)\n",
+ "\n",
+ "from numpy import *\n",
+ "x = linalg.solve(a,b)\n",
+ "\n",
+ "F = x[1] ;\t\t\t#exit stream of reactor 2 - [lb mol]\n",
+ "R2_SO2_in = R2_fSO2_in*F ;\t\t\t# Moles of SO2 required per lb mol of CO - [lb mol]\n",
+ "\n",
+ "CO = (R1_CO_in*SO2_in)/R2_SO2_in ;\t\t\t#Mole of CO burned in reactor 1 - [lb mol] \n",
+ "\n",
+ "# Results\n",
+ "print 'Mole of CO burned in reactor 1 is %.0f lb mol.'%CO\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mole of CO burned in reactor 1 is 2259 lb mol.\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 26.5 page no. 819\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Production of Citric Acid by Fungus\n",
+ "\n",
+ "# Solution \n",
+ "\n",
+ "# Variables\n",
+ "CA = 10000. ;\t\t\t# Produced citric acid - [kg]\n",
+ "f_glucose = .30 ;\t\t\t# Fraction of glucose in solution \n",
+ "con_glucose = .60 ;\t\t\t# Fraction of glucose consumed\n",
+ "w_glucose = 180.16 ;\t\t\t# Mol. wt. of d,alpha glucose -[g]\n",
+ "H_glucose = -1266 ;\t\t\t# Specific enthalpy change of glucose - [kJ/g mol]\n",
+ "w_CA = 192.12; \t\t\t# Mol. wt. of citric acid -[g]\n",
+ "H_CA = -1544.8 ;\t\t\t# Specific enthalpy change of citric acid - [kJ/g mol]\n",
+ "w_BM = 28.6 ;\t\t\t# Mol. wt. of biomass -[g]\n",
+ "H_BM = -91.4 ;\t\t\t# Specific enthalpy change of biomass - [kJ/g mol]\n",
+ "H_CO2 = -393.51 ;\t\t\t# Specific enthalpy change of CO2 - [kJ/g mol]\n",
+ "\n",
+ "# Calculations\n",
+ "mol_CA = CA/w_CA ;\t\t\t# Mole of citric acid produced - [kg mol]\n",
+ "g_soln = (mol_CA*(3/2.22)*w_glucose*1)/(con_glucose*f_glucose) ;\t\t\t#Mass of 30 % glucose solution introduced -[kg]\n",
+ "i_glucose = g_soln* f_glucose / w_glucose ;\t\t\t# Initial moles of glucose - [kg mol]\n",
+ "f_glucose = (1 - con_glucose)*i_glucose ;\t\t\t# Final moles of glucose - [kg mol]\n",
+ "f_CA = mol_CA ;\t\t\t# Final moles of citric acid - [kg mol]\n",
+ "f_BM = f_CA*(5.35/2.22) ;\t\t\t# Using the reaction (a)- Final moles of biomass - [kg mol]\n",
+ "i_O2 = i_glucose*(7.8/3) ;\t\t\t# Using the reaction (a)- Initial moles of O2 - [kg mol]\n",
+ "f_CO2 = i_glucose*(4.5/3)*con_glucose ;\t\t\t# Using the reaction (a) - Final moles of CO2 - [kg mol]\n",
+ "\n",
+ "power = 100 ;\t\t\t# Power of aerator -[hp]\n",
+ "time = 220 ;\t\t\t# Time taken for reaction - [ hr ]\n",
+ "W = (power*745.7*time*3600)/1000 ;\t\t\t# Work done by aerator - [kJ]\n",
+ "\n",
+ "Hi_glucose = i_glucose*H_glucose*1000 ;\t\t\t# Enthalpy change of glucose input - [kJ]\n",
+ "Hi_O2 = i_O2*0*1000 ;\t\t\t# Enthalpy change of O2 input - [kJ]\n",
+ "H_in = Hi_glucose + Hi_O2 ;\t\t\t# Enthalpy change of input - [kJ]\n",
+ "\n",
+ "Hf_glucose = f_glucose*H_glucose*1000 ;\t\t\t# Enthalpy change of glucose output - [kJ]\n",
+ "Hf_BM = f_BM * H_BM*1000 ;\t\t\t#Enthalpy change of biomass output - [kJ]\n",
+ "Hf_CA = f_CA *H_CA*1000 ;\t\t\t#Enthalpy change of citric acid output - [kJ]\n",
+ "Hf_CO2 = f_CO2 *H_CO2*1000 ;\t\t\t#Enthalpy change of CO2 output - [kJ]\n",
+ "H_out = Hf_glucose + Hf_BM +Hf_CA + Hf_CO2 ;\t\t\t# Enthalpy change of output - [kJ]\n",
+ "del_H = H_out - H_in ;\t\t\t# Total enthalpy change in process - [kJ]\n",
+ "Q = del_H - W ;\t\t\t# Heat removed - [kJ]\n",
+ "\n",
+ "# Results\n",
+ "print 'Heat exchange from the fermentor during production of 10,000 kg citric acid is %.2e kJ(minus sign indicates heat is removed).'%Q\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat exchange from the fermentor during production of 10,000 kg citric acid is -1.03e+08 kJ(minus sign indicates heat is removed).\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file