summaryrefslogtreecommitdiff
path: root/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.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/ch21.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/ch21.ipynb')
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb246
1 files changed, 246 insertions, 0 deletions
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb
new file mode 100644
index 00000000..741dcc7d
--- /dev/null
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb
@@ -0,0 +1,246 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 21 : Energy Terminology Concepts and Units"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 21.1 Page no : 616"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of Mechanical work by a gas on a piston showing how the path affects the value of the work\n",
+ "\n",
+ "from scipy.integrate import quad\n",
+ "\n",
+ "# Variables\n",
+ "V1 = 0.1 ;\t\t\t# Volume of gas initially -[cubic metres]\n",
+ "V2 = 0.2 ;\t\t\t# Volume of gas finally -[cubic metres]\n",
+ "T1 = 300 ;\t\t\t# Temperature of gas initially -[K]\n",
+ "P1 = 200 ;\t\t\t# Pressure of gas finally -[kPa]\n",
+ "R = 8.314 ;\t\t\t# Universal gas constant \n",
+ "n = (P1*V1)/(T1*R) ;\t\t\t# Moles of gas taken-[kg mol]\n",
+ "#You are asked to calculate work by eqn. 21.1 , but you do not know the F(force) exerted by gas , so write F = P.A, multiply divide A and eqn 21.1 reduces to W= integate(P.dv)\n",
+ "\n",
+ "# Calculations and Results\n",
+ "# Isobaric process see fig E21.1b to see the path followed\n",
+ "def f(V):\n",
+ " return -(P1)\n",
+ "W= quad(f,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n",
+ "print ' (a)Work done by gas on piston for isobaric process is %.0f kJ . ',W\n",
+ "\n",
+ "def f1(V):\n",
+ " return -(T1*R*n/V)\n",
+ "W= quad(f1,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n",
+ "print '(b)Work done by gas on piston for isothermal process is %.2f kJ . ',W\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " (a)Work done by gas on piston for isobaric process is %.0f kJ . -20.0\n",
+ "(b)Work done by gas on piston for isothermal process is %.2f kJ . -13.8629436112\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 21.2 page no. 624\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of Specific Kinetic energy for a Flowing fluid\n",
+ "\n",
+ "# Variables\n",
+ "id_ = 3. ;\t\t\t# Internal diameter of tube-[cm]\n",
+ "Vf = 0.001 ;\t\t\t# Volume flow rate of water in tube-[cubic meter/s]\n",
+ "rho = 1000. ;\t\t\t# Assumed density of water-[kg/cubic meter] \n",
+ "\n",
+ "# Calculations\n",
+ "rad = id_/2. ;\t\t\t# Radius of tube -[ cm]\n",
+ "a = 3.14*rad**2 ;\t\t\t# Area of flow of tube -[squqre centimeter]\n",
+ "v = Vf*(100)**2/a ;\t\t\t# Velocity of water in tube - [m/s]\n",
+ "KE = v**2/2. ;\t\t\t# Specific(mass=1kg) kinetic energy of water in tube -[J/kg]\n",
+ "\n",
+ "# Results\n",
+ "print 'Specific kinetic energy of water in tube is %.2f J/kg . '%KE\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Specific kinetic energy of water in tube is 1.00 J/kg . \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ " Example 21.3 page no. 626\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of potential Energy change of water\n",
+ "\n",
+ "# Variables\n",
+ "# Let water level in first reservoir be the reference plane\n",
+ "h = 40. ;\t\t\t# Difference of water-[ft]\n",
+ "g = 32.2 ;\t\t\t# acceleration due to gravity-[ft/square second]\n",
+ "\n",
+ "# Calculations\n",
+ "PE=g*h/(32.2*778.2) ;\t\t\t#\t\t\t# Specific(mass=1kg) potential energy of water -[Btu/lbm]\n",
+ "\n",
+ "# Results\n",
+ "print 'Specific potential energy of water is %.4f Btu/lbm . '%PE\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Specific potential energy of water is 0.0514 Btu/lbm . \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 21.4 page no : 629"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "# Calculation of an internal energy change using the heat capacity\n",
+ "\n",
+ "# Variables\n",
+ "#Constant volume process \n",
+ "mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n",
+ "T1 = 60.+273 ;\t\t\t# Initial temperature of air-[K]\n",
+ "T2 = 30.+273 ;\t\t\t# final temperature of air-[K]\n",
+ "# Additional data needed\n",
+ "Cv = 2.1*10.**4 ; \t\t\t# Specific heat capacity of air at constant volume-[J/(kg mol*C)]\n",
+ "\n",
+ "# Calculations\n",
+ "def f(T):\n",
+ " return mol_air*Cv\n",
+ "del_U = quad(f,T1,T2)[0] ;\t\t\t#Change in internal energy-[J]\n",
+ "\n",
+ "# Results\n",
+ "print 'Change in internal energy is %.1e J . '%del_U\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Change in internal energy is -6.3e+06 J . \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 21.7 page no : 633"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of Enthalpy change\n",
+ "\n",
+ "# Variables\n",
+ "#Constant pressure process \n",
+ "mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n",
+ "T1 = 60+273 ;\t\t\t# Initial temperature of air-[K]\n",
+ "T2 = 30+273 ;\t\t\t# final temperature of air-[K]\n",
+ "\n",
+ "# Calculations\n",
+ "# Additional data needed\n",
+ "Cp = 2.9*10**4 ;\t\t\t# Specific heat capacity of air at constant pressure-[J/(kg mol*C)]\n",
+ "# Use eqn. 21.11 for del_H\n",
+ "def f(T):\n",
+ " return mol_air*Cp\n",
+ "\n",
+ "del_H = quad(f,T1,T2)[0] ;\t\t\t#Change in enthalpy-[J]\n",
+ "print 'Change in enthalpy is %.1e J . '%del_H\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Change in enthalpy is -8.7e+06 J . \n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file