summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_J._P._Holman/ch3.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-11 17:31:11 +0530
committerhardythe12015-06-11 17:31:11 +0530
commit251a07c4cbed1a5a960f5ed416ce6ac13c8152b7 (patch)
treecb7f084fad6d7ee6ae89e586fad0e909b5408319 /Thermodynamics_by_J._P._Holman/ch3.ipynb
parent47d7279a724246ef7aa0f5359cf417992ed04449 (diff)
downloadPython-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.tar.gz
Python-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.tar.bz2
Python-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.zip
add books
Diffstat (limited to 'Thermodynamics_by_J._P._Holman/ch3.ipynb')
-rwxr-xr-xThermodynamics_by_J._P._Holman/ch3.ipynb305
1 files changed, 305 insertions, 0 deletions
diff --git a/Thermodynamics_by_J._P._Holman/ch3.ipynb b/Thermodynamics_by_J._P._Holman/ch3.ipynb
new file mode 100755
index 00000000..98e0dd2e
--- /dev/null
+++ b/Thermodynamics_by_J._P._Holman/ch3.ipynb
@@ -0,0 +1,305 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b83edffd06279953e9d9c22648c2ce548f84e9427ec05c98afa676ab5960d29e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3 : Macroscopic properties of pure substances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.1 pg : 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables\n",
+ "V = 1. \t\t\t#ft**3\n",
+ "m = 30. \t\t\t#lbm\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "v = V/m\n",
+ "vf1 = 0.01665\n",
+ "vfg1 = 32.38 \t\t\t#ft**3/lbm\n",
+ "x1 = 0.000515\n",
+ "uf1 = 169.92\n",
+ "ufg1 = 904.8\n",
+ "u1 = uf1+x1*ufg1\n",
+ "vfg = 0.0216\n",
+ "vfg2 = 0.4240\n",
+ "v2 = v\n",
+ "x2 = 0.0277\n",
+ "uf2 = 538.4\n",
+ "ufg2 = 571.\n",
+ "u2 = uf2+x2*ufg2\n",
+ "Q = m*(u2-u1)\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Heat transfer = %d Btu\"%(round(Q,-2))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat transfer = 11500 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.2 pg : 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables\n",
+ "V2 = 2.5 \t\t\t#ft**3\n",
+ "V1 = 0.5 \t\t\t#ft**3\n",
+ "P = 100. \t\t\t#psia\n",
+ "x1 = 0.5\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "W = -P*144*(V2-V1)\n",
+ "vf1 = 0.01774\n",
+ "vfg1 = 4.414\n",
+ "v1 = vf1+x1*vfg1\n",
+ "m = V1/v1\n",
+ "v2 = V2/m\n",
+ "uf1 = 298.08\n",
+ "ufg1 = 807.1\n",
+ "u1 = uf1+x1*ufg1\n",
+ "h2 = 1747.9\n",
+ "u2 = h2-P*144*v2/778\n",
+ "Q = m*(u2-u1)\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Amount of heat = %d Btu\"%(Q)\n",
+ "\t\t\t#The answer for u2 is given wrong in the textbook. Please use a calculator to find it\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Amount of heat = 188 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.3 pg : 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables\n",
+ "V1 = 1.735*10**-4 \t\t\t#ft**3\n",
+ "v1 = 0.016080 \t\t\t#ft**3/lbm\n",
+ "h1 = 70.61 \t\t \t #B/lbm\n",
+ "P1 = 100. \t\t \t#psia\n",
+ "V2 = 1. \t\t \t #ft**3\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "u1 = h1-P1*v1*144/778.\n",
+ "m = V1/v1\n",
+ "v2 = V2/m\n",
+ "vf2 = 0.01613\n",
+ "vfg2 = 350.3\n",
+ "x2 = (v2-vf2)/vfg2\n",
+ "hf2 = 67.97\n",
+ "hfg2 = 1037.2\n",
+ "h2 = hf2+x2*hfg2\n",
+ "P2 = 0.9492\n",
+ "u2 = h2- P2*144*v2/778.\n",
+ "Q = m*(u2-u1)\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Enthalpy change = %.2f Btu\"%(Q)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enthalpy change = 2.76 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.4 pg : 64"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables\n",
+ "P = 20. \t\t\t#psia\n",
+ "V = 1. \t\t\t#ft**3\n",
+ "T = 560. \t\t\t#R\n",
+ "cv = 0.1715\n",
+ "Q = 10. \t\t\t#Btu\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "m = P*144*V/(53.35*T)\n",
+ "T2 = Q/(m*cv) +T\n",
+ "P2 = m*53.35*T2/V\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Fina pressure = %d lbf/ft**2\"%(P2)\n",
+ "\n",
+ "# note : rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Fina pressure = 5990 lbf/ft**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.5 pg : 66"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from scipy.integrate import quad\n",
+ "\t\t\t\n",
+ "# Variables\n",
+ "T1 = 560 \t\t\t#R\n",
+ "T2 = 3460 \t\t\t#R\n",
+ "m = 28.02 \t\t\t#lb\n",
+ "cv = 0.248\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "def fun(T):\n",
+ " return 9.47 - 3.29*10**3 /T +1.07*10**6 /T**2\n",
+ "\n",
+ "Q1 = quad(fun,T1,T2)[0]\n",
+ "Q2 = m*cv*(T2-T1)\n",
+ "Error = (Q1-Q2)/Q1\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Percentage error = %.1f percent\"%(Error*100)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Percentage error = 12.7 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.6 pg : 66"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "# Variables\n",
+ "import math \n",
+ "rate = 20. \t\t\t#gal/min\n",
+ "P1 = 20. \t\t\t#psia\n",
+ "P2 = 1000. \t\t\t#psia\n",
+ "T = 100.+460 \t\t\t#R\n",
+ "\t\t\t\n",
+ "# Calculations\n",
+ "vf = 0.01613\n",
+ "dv = -5.2*10**-5 \t\t\t#ft**3/lbm\n",
+ "K = -dv/(vf*P2*144)\n",
+ "wt = K*vf*(P2**2 - P1**2)*144*144*10**4 /2\n",
+ "m = rate*8.33\n",
+ "Wt = wt*m\n",
+ "Wthp = Wt/33000\n",
+ "\t\t\t\n",
+ "# Results\n",
+ "print \"Pump power required = %d hp\"%(Wthp)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pump power required = 188 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file