diff options
Diffstat (limited to 'Thermodynamics_by_F_P_Durham/chapter6.ipynb')
-rwxr-xr-x | Thermodynamics_by_F_P_Durham/chapter6.ipynb | 434 |
1 files changed, 434 insertions, 0 deletions
diff --git a/Thermodynamics_by_F_P_Durham/chapter6.ipynb b/Thermodynamics_by_F_P_Durham/chapter6.ipynb new file mode 100755 index 00000000..e688b1c7 --- /dev/null +++ b/Thermodynamics_by_F_P_Durham/chapter6.ipynb @@ -0,0 +1,434 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9350c41424c136ffdcb61a367641cc78b39d6999ad3a13b8f61c623099d55d5b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6: The Ideal Gas" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.1, page no. 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#intialization of variables\n", + "T1 = 40+460.0 #temperature(R)\n", + "T2 = 340+460.0 #temperature(R)\n", + "\n", + "#calculation\n", + "def Cv(T):\n", + "\tcv = 0.162+0.00046*T\n", + "\treturn cv\n", + "\t\n", + "du = scipy.integrate.quadrature(Cv, T1, T2)[0]\n", + "\n", + "#result\n", + "print \"Change in specific internal energy = %.1f B/lbm\" %du" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in specific internal energy = 138.3 B/lbm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2, page no. 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialization\n", + "\n", + "cp = 0.24 #B/lbm F\n", + "R = 53.3 #ft-lb/lbm F\n", + "\n", + "#calculation\n", + "cv = cp-R/778.0\n", + "\n", + "#result\n", + "print \"Specific heat at constant volume = %.3f B/lbm F\" %cv" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific heat at constant volume = 0.171 B/lbm F\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3, page no. 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "T1 = 1400+460.0 #temperature(R)\n", + "T2 = 1200+460.0 #temperature(R)\n", + "\n", + "#calculation\n", + "def Cp(T):\n", + "\tcp = 0.317- 1.2*100/T + 4*10**4/T**2\n", + "\treturn cp\n", + "\n", + "dh = scipy.integrate.quadrature(Cp, T1, T2)[0]\n", + "\n", + "#result\n", + "print \"Change in stagnation enthalpy = %.1f B/lbm\" %dh" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in stagnation enthalpy = -52.3 B/lbm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4, page no. 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "T1 = 100+460.0 #temperature(R)\n", + "T2 = 300+460.0 #temperature(R)\n", + "P1 = 15.0 #pressure(lb/in^2)\n", + "P2 = 30.0 #pressure(lb/in^2)\n", + "Cp = 0.3 #constant pressure(B/lbm F)\n", + "R = 40.0 #gas constant(ft-lb/lbm R)\n", + "\n", + "#calculation\n", + "def fun(f):\n", + "\ts=Cp/f\n", + "\treturn s\n", + "def fun1(f):\n", + "\ts2=R/(f*778)\n", + "\treturn s2\n", + "\n", + "ds1 = scipy.integrate.quadrature(fun, T1, T2)[0]\n", + "ds2 = scipy.integrate.quadrature(fun1, P1, P2)[0]\n", + "ds = ds1 - ds2\n", + "\n", + "#result\n", + "print \"Change in entropy = %.4f B/lbm R\" %ds" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy = 0.0560 B/lbm R\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.5, page no. 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialization\n", + "\n", + "T1 = 40+460.0 #temperature(R)\n", + "T2 = 340+460.0 #temperature(R)\n", + "P1 = 15.0 #pressure(lb/in^2)\n", + "cp = 0.24\n", + "cv = 0.171\n", + "\n", + "#calculation\n", + "gamma=cp/cv\n", + "P2=P1 *((T2/T1)**(gamma/(gamma-1)))\n", + "\n", + "#result\n", + "print \"Final pressure = %.1f lb/in^2\" %P2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final pressure = 76.9 lb/in^2\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6, page no. 110" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#initialization\n", + "P1 = 16.0 #lb/in^2\n", + "P2 = 14.0 #lb/in^2\n", + "Tt = 83+460.0 #R\n", + "gamma = 1.4\n", + "cp = 0.24 #B/lbm F\n", + "\n", + "#calculation\n", + "T = Tt *(P2/P1)**((gamma-1)/gamma)\n", + "dh = cp*(Tt-T)\n", + "V = math.sqrt(2*32.2*778*dh)\n", + "\n", + "#result\n", + "print \"Actual temperature in the flow = %d R\" %T\n", + "print \"Flow velocity = %d ft/sec\" %V\n", + "\n", + "#difference in answeres is due to internal rounding off in Python" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Actual temperature in the flow = 522 R\n", + "Flow velocity = 494 ft/sec\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.7, page no. 111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "T1 = 400.0+460.0 #R\n", + "P1 = 100.0 #lb/in^2\n", + "P2 = 20.0 #lb/in^2\n", + "T2 = 140.0+460.0 #R\n", + "Cp = 50.0\n", + "\n", + "#calculation\n", + "Pratio = P1/P2\n", + "Tratio = T1/T2\n", + "C = math.log(Tratio)/math.log(Pratio)\n", + "n=1/(1-C)\n", + "v1=Cp*T1/(144*P1)\n", + "v2=Cp*T2/(144*P2)\n", + "w=144*P1*v1**n\n", + "def fun(v):\n", + "\tp=w/v**n\n", + "\treturn p\n", + "\n", + "Work = scipy.integrate.quadrature(fun, v1, v2)[0]\n", + "\n", + "#result\n", + "print \"Work done = %f ft-lb/lbm\" %Work" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 45118.149895 ft-lb/lbm\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.8, page no. 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#initialization\n", + "P1 = 15.0 #lb/in^2\n", + "P2 = 20.0 #lb/in^2\n", + "T1 = 40+460 #R\n", + "T2 = 540+460 #R\n", + "\n", + "#calculation\n", + "#From table 6 at the two temperatures\"\n", + "phi1 = 0.58233\n", + "phi2 = 0.75042\n", + "ds = phi2-phi1-53.3*math.log(P2/P1)/778.0\n", + "\n", + "#result\n", + "print \"Entropy change = %.5f B/lbm R\" %ds" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change = 0.14838 B/lbm R\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.9, page no. 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#part a\n", + "\n", + "P2 = 1460.0 #pressure 2\n", + "P1 = 1900.0 #pressure 1\n", + "V2 = 1900.0 #volume 1\n", + "V1 = 1460.0 #volume 2\n", + "\n", + "pratio = (P2/P1)**3.5\n", + "vratio = (V2/V1)**2.5\n", + "\n", + "print \"Pressure ratio is \", round(pratio,2)\n", + "print \"Volume ratio is \", round(vratio,2)\n", + "\n", + "#part b\n", + "#from table 6\n", + "Pr2 = 50.34 #pressure 2\n", + "Pr1 = 141.51 #pressure 1\n", + "Vr2 = 10.743 #volume 1\n", + "Vr1 = 4.974 #volume 2\n", + "\n", + "pratio = (Pr2/Pr1)\n", + "vratio = (Vr2/Vr1)\n", + "\n", + "print \"Pressure ratio is \", round(pratio,2)\n", + "print \"Volume ratio is \", round(vratio,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure ratio is 0.4\n", + "Volume ratio is 1.93\n", + "Pressure ratio is 0.36\n", + "Volume ratio is 2.16\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |