summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics/ch8.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Engineering_Thermodynamics/ch8.ipynb')
-rwxr-xr-xEngineering_Thermodynamics/ch8.ipynb1018
1 files changed, 1018 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics/ch8.ipynb b/Engineering_Thermodynamics/ch8.ipynb
new file mode 100755
index 00000000..d0460b5a
--- /dev/null
+++ b/Engineering_Thermodynamics/ch8.ipynb
@@ -0,0 +1,1018 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c3df87d51665052238119b4e7ee4111718a96b4fbb9e6d0115f49e4b893482d1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8 : Available Energy, Availability and Irreversibility"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.1 Page No : 243"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "T0 = 308.;\n",
+ "T1 = 693.; \n",
+ "T1_ = 523.; \t\t\t# T1_ = T1'\n",
+ "T1_ = 523.; \t\t\t# \"\"\n",
+ "\n",
+ "# Calculation\n",
+ "f = (T0*(T1-T1_))/(T1_*(T1-T0));\n",
+ "\n",
+ "# Results\n",
+ "print \"The fraction of energy that becomes unavailable due to irreversible heat transfer is %.2f\"%f\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The fraction of energy that becomes unavailable due to irreversible heat transfer is 0.26\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.2 Page No : 244"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "lhw = 1858.5; \t\t\t# Latent heat of water\n",
+ "Tew = 220+273.;\n",
+ "Sw = lhw/Tew; \n",
+ "Tig = 1100.; \t\t\t# Initial temperature of the gas\n",
+ "Tfg = 550.; \t\t\t# Final \"\"\n",
+ "\n",
+ "# Calculation\n",
+ "k = 1*lhw/(Tig-Tfg); \t\t\t# k = mg_dot*cpg\n",
+ "Tg2 = 823.\n",
+ "Tg1 = 1373.\n",
+ "T0 = 303.;\n",
+ "\n",
+ "def f2(T): \n",
+ "\t return k/T\n",
+ "\n",
+ "Sg = quad(f2,Tg1,Tg2)[0]\n",
+ "\n",
+ "St = Sg+Sw; \n",
+ "\n",
+ "print \"Total change in entropy is %.3f kJ/K\"%St\n",
+ "print \"Increase in unavailable energy is %.0f Kj\"%(round(T0*St,-1))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total change in entropy is 2.040 kJ/K\n",
+ "Increase in unavailable energy is 620 Kj\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.3 Page No : 245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "Tw = 75. + 273;\n",
+ "Ts = 5. + 273; \t\t\t# Ts = T0\n",
+ "m = 40.;\n",
+ "cp = 4.2;\n",
+ "\n",
+ "# Calculation\n",
+ "def f9(T): \n",
+ "\t return m*cp*(1-(Tw/T))\n",
+ "\n",
+ "W = -quad(f9,Ts,Tw)[0]\n",
+ "Q1 = m*cp*(Tw-Ts);\n",
+ "UE = Q1-W;\n",
+ "\n",
+ "# Results\n",
+ "print \"Total work %.0f kJ\"%W\n",
+ "print \"Heat released\",Q1,\"kJ\"\n",
+ "print \"Internal energy change %.0f kJ\"%UE\n",
+ "\n",
+ "# quad gives slightly different answer than book has. pLease check."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total work 1370 kJ\n",
+ "Heat released 11760.0 kJ\n",
+ "Internal energy change 10390 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.4 Page No : 246"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "Ts = 273+15. #temperature \n",
+ "Tw1 = 95+273. #Water\n",
+ "Tw2 = 35+273. #water\n",
+ "m1 = 25. #energy\n",
+ "m2 = 35. \n",
+ "cp = 4.2 #Water\n",
+ "\n",
+ "# Calculation\n",
+ "def f3(T): \n",
+ "\t return m1*cp*(1-(Ts/T))\n",
+ "\n",
+ "AE25 = quad(f3,Ts,Tw1)[0]\n",
+ "\n",
+ "\n",
+ "def f4(T): \n",
+ "\t return m2*cp*(1-(Ts/T))\n",
+ "AE35 = quad(f4,Ts,Tw2)[0]\n",
+ "AEt = AE25 + AE35;\n",
+ "Tm = (m1*Tw1+m2*Tw2)/(m1+m2); \t\t\t# Temperature after mixing\n",
+ "\n",
+ "def f5(T): \n",
+ "\t return (m1+m2)*cp*(1-(Ts/T))\n",
+ "\n",
+ "AE60 = quad(f5,Ts,Tm)[0]\n",
+ "\n",
+ "AE = AEt - AE60;\n",
+ "print \"The decrease in the totla energy is %.2f kJ\"%AE\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The decrease in the totla energy is 281.82 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.5 Page No : 247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "N1 = 3000.; #RPM\n",
+ "w1 = (2*math.pi*N1)/60.; \n",
+ "I = 0.54;\n",
+ "Ei = 0.5*I*w1**2;\n",
+ "ti = 15.+273; #temperature\n",
+ "m = 2.; #water equivalent\n",
+ "\n",
+ "# Calculation\n",
+ "dt = Ei/(1000*2*4.187);\n",
+ "tf = ti+dt;\n",
+ "\n",
+ "def f6(T): \n",
+ "\t return m*4.187*(1-(ti/T))\n",
+ "\n",
+ "AE = quad(f6,ti,tf)[0]\n",
+ "\n",
+ "UE = Ei/1000 - AE;\n",
+ "w2 = math.sqrt(AE*1000*2/I);\n",
+ "N2 = (w2*60)/(2*math.pi);\n",
+ "\n",
+ "# Results\n",
+ "print \"The final RPM of the flywheel would be %.0f\"%N2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The final RPM of the flywheel would be 222\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.6 Page No : 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "T1 = 353.\n",
+ "T2 = 278.\n",
+ "V2 = 2.\n",
+ "V1 = 1.\n",
+ "P0 = 100. #tempareture\n",
+ "P1 = 500. #air\n",
+ "R = 0.287\n",
+ "cv = 0.718; #air \n",
+ "m = 2. \n",
+ "\n",
+ "# Calculation\n",
+ "def f7(T): \n",
+ "\t return (m*cv)/T\n",
+ "\n",
+ "def f8(V):\n",
+ " return m*R/V\n",
+ "\n",
+ "S = quad(f7,T1,T2)[0] + quad(f8,V1,V2)[0]\n",
+ "U = m*cv*(T1-T2);\n",
+ "Wmax = U-(T2*(-S));\n",
+ "V1_ = (m*R*T1)/P1;\n",
+ "CA = Wmax-P0*(V1_); \t\t\t# Change in availability\n",
+ "I = T2*S; \n",
+ "\n",
+ "# Results\n",
+ "print \"The maximum work is %.2f kJ\"%Wmax\n",
+ "print \"Change in availability is %.2f kJ\"%CA\n",
+ "print \"Irreversibility is %.1f kJ\"%I\n",
+ "\n",
+ "# rounding off error. please check."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum work is 122.96 kJ\n",
+ "Change in availability is 82.43 kJ\n",
+ "Irreversibility is 15.3 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.7 Page No : 250"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "P1 = 500. # air\n",
+ "P2 = 100.; # kPa \n",
+ "T1 = 793.\n",
+ "T2 = 573.\n",
+ "cp = 1.005 # air\n",
+ "T0 = 293.\n",
+ "R = 0.287;\n",
+ "\n",
+ "# Calculation and Results\n",
+ "S21 = (R*math.log(P2/P1))-(cp*math.log(T2/T1))\n",
+ "CA = cp*(T1-T2)-T0*S21; \t\t\t# Change in v=availability\n",
+ "print \"The decrease in availability is %.1f kJ/Kg\"%CA\n",
+ "\n",
+ "Wmax = CA;\n",
+ "print \"The maximum work is %.1f kJ/Kg\"%Wmax\n",
+ "\n",
+ "Q = -10.;\n",
+ "W = cp*(T1-T2)+Q ;\n",
+ "I = Wmax-W;\n",
+ "print \"The irreversibility is %.1f kJ/Kg\"%I\n",
+ "\n",
+ "# rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The decrease in availability is 260.8 kJ/Kg\n",
+ "The maximum work is 260.8 kJ/Kg\n",
+ "The irreversibility is 49.7 kJ/Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.8 Page No : 251"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "T0 = 300. # cooled\n",
+ "Tg1 = 573.\n",
+ "Tg2 = 473.;\n",
+ "Ta1 = 313.; \n",
+ "cpg = 1.09 # tempareture\n",
+ "cpa = 1.005; # air\n",
+ "mg = 12.5\n",
+ "ma = 11.15;\n",
+ "\n",
+ "# Calculation and Results\n",
+ "f1 = cpg*(Tg1-T0)-T0*cpg*(math.log(Tg1/T0));\n",
+ "f2 = cpg*(Tg2-T0)-T0*cpg*(math.log(Tg2/T0));\n",
+ "print \"The initial and final availbility of the products are %.2f and %.2f kJ/Kg respectively\"%(f1,f2)\n",
+ "\n",
+ "# Part (b)\n",
+ "Dfg = f1-f2;\n",
+ "Ta2 = Ta1 + (mg/ma)*(cpg/cpa)*(Tg1-Tg2);\n",
+ "Ifa = cpa*(Ta2-Ta1)-T0*cpa*(math.log(Ta2/Ta1));\n",
+ "I = mg*Dfg-ma*Ifa;\n",
+ "print \"The irreversibility of the process is %.2f kW\"%I\n",
+ "\n",
+ "# Part (c)\n",
+ "Ta2_ = Ta1*(math.e**(-(mg/ma)*(cpg/cpa)*math.log(Tg2/Tg1)));\n",
+ "Q1 = mg*cpg*(Tg1-Tg2);\n",
+ "Q2 = ma*cpa*(Ta2_-Ta1);\n",
+ "W = Q1-Q2;\n",
+ "print \"Tota power generated by the heat engine %.2f kW\"%W\n",
+ "\n",
+ "# rounding off error. please check."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The initial and final availbility of the products are 85.97 and 39.68 kJ/Kg respectively\n",
+ "The irreversibility of the process is 319.37 kW\n",
+ "Tota power generated by the heat engine 441.35 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.9 Page No : 253"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "T2 = 1063.;\n",
+ "T1 = 1073.;\n",
+ "m = 2.; # pipe\n",
+ "cp = 1.1;\n",
+ "\n",
+ "# Calculation and Results\n",
+ "I = m*cp*((T1-T2)-T0*(math.log(T1/T2)));\n",
+ "print \"The irrevesibility rate is %.3f kW\"%I\n",
+ "\n",
+ "# At lower temperature\n",
+ "T1_ = 353.\n",
+ "T2_ = 343.\n",
+ "I_ = m*cp*((T1_-T2_)-T0*(math.log(T1_/T2_)));\n",
+ "print \"The irrevesibility rate at lower temperature is %.3f kW\"%I_\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The irrevesibility rate is 15.820 kW\n",
+ "The irrevesibility rate at lower temperature is 3.033 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.10 Page No : 254"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables\n",
+ "m = 3.; # insulated pipe\n",
+ "R = 0.287; \n",
+ "T0 = 300.\n",
+ "k = 0.10; \t\t\t# k = dP/P1\n",
+ "\n",
+ "# Calculation\n",
+ "Sgen = m*R*k;\n",
+ "I = Sgen*T0;\n",
+ "\n",
+ "# Results\n",
+ "print \"The rate of energy loss because of the pressure drop due to friction\",I,\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of energy loss because of the pressure drop due to friction 25.83 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.11 Page No : 254"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "m1 = 2.; \t\t\t# m1_dot\n",
+ "m2 = 1.;\n",
+ "T1 = 90.+273; \n",
+ "T2 = 30.+273;\n",
+ "T0 =300.;\n",
+ "\n",
+ "# Calculation\n",
+ "m = m1+m2;\n",
+ "x = m1/m;\n",
+ "t = T2/T1; \t\t\t# Tau\n",
+ "cp = 4.187;\n",
+ "Sgen = m*cp*math.log((x+t*(1-x))/(t**(1-x)));\n",
+ "I = T0*Sgen;\n",
+ "\n",
+ "\n",
+ "print \"The rate of entropy generation is %.4f kW/K\"%Sgen\n",
+ "print \"The rate of energy loss due to mixing is %.1f kW\"%I\n",
+ "\n",
+ "# rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of entropy generation is 0.0446 kW/K\n",
+ "The rate of energy loss due to mixing is 13.4 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.12 Page No : 255"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables\n",
+ "Qr = 500.; \t\t\t# Heat release in kW\n",
+ "Tr = 2000.;\n",
+ "T0 = 300.; # chemical process \n",
+ "\n",
+ "# Calculation and Results\n",
+ "# Part (a)\n",
+ "Qa = 480.\n",
+ "Ta = 1000.;\n",
+ "n1a = (Qa/Qr);\n",
+ "n2a = n1a*(1-(T0/Ta))/(1-(T0/Tr));\n",
+ "print (\"PART (A)\")\n",
+ "print \"The first law efficiency is\",n1a*100,\"%\"\n",
+ "print \"The Second law efficiency is %.0f %%\"%(n2a*100)\n",
+ "\n",
+ "# Part (b)\n",
+ "Qb = 450.\n",
+ "Tb = 500.\n",
+ "n1b = (Qb/Qr);\n",
+ "n2b = n1b*(1-(T0/Tb))/(1-(T0/Tr));\n",
+ "print (\"PART (B)\")\n",
+ "print \"The first law efficiency is\",n1b*100,\"%\"\n",
+ "print \"The Second law efficiency is %.1f %%\"%(n2b*100)\n",
+ "\n",
+ "# Part (c)\n",
+ "Qc = 300.\n",
+ "Tc = 320.\n",
+ "n1c = (Qc/Qr);\n",
+ "n2c = n1c*(1-(T0/Tc))/(1-(T0/Tr));\n",
+ "print (\"PART (C)\")\n",
+ "print \"The first law efficiency is\",n1c*100,\"%\"\n",
+ "print \"The Second law efficiency is %.2f %%\"%(n2c*100)\n",
+ "\n",
+ "# Part (d)\n",
+ "Qd = 450.; \n",
+ "n1d = (Qd/Qr);\n",
+ "n2a_= n1d*(1-(T0/Ta))/(1-(T0/Tr));\n",
+ "n2b_= n1d*(1-(T0/Tb))/(1-(T0/Tr));\n",
+ "n2c_= n1d*(1-(T0/Tc))/(1-(T0/Tr));\n",
+ "print (\"Part (D)\")\n",
+ "print \"The first law efficiency is\",n1d\n",
+ "print \"The Second law efficiency of part (a) is %.2f %%\"%(n2a_*100)\n",
+ "print \"The Second law efficiency of part (b) is %.1f %%\"%(n2b_*100)\n",
+ "print \"The Second law efficiency of part (c) is %.2f %%\"%(n2c_*100)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "PART (A)\n",
+ "The first law efficiency is 96.0 %\n",
+ "The Second law efficiency is 79 %\n",
+ "PART (B)\n",
+ "The first law efficiency is 90.0 %\n",
+ "The Second law efficiency is 42.4 %\n",
+ "PART (C)\n",
+ "The first law efficiency is 60.0 %\n",
+ "The Second law efficiency is 4.41 %\n",
+ "Part (D)\n",
+ "The first law efficiency is 0.9\n",
+ "The Second law efficiency of part (a) is 74.12 %\n",
+ "The Second law efficiency of part (b) is 42.4 %\n",
+ "The Second law efficiency of part (c) is 6.62 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.14 Page No : 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "cp = 1.005\n",
+ "T2 = 433.\n",
+ "T1 = 298.;\n",
+ "T0 = 298.\n",
+ "R = 0.287\n",
+ "P2 = 8.\n",
+ "P1 = 1.\n",
+ "Q = -100.\n",
+ "m = 1.\n",
+ "\n",
+ "# Calculation\n",
+ "W = Q + m*cp*(T1-T2);\n",
+ "AF = cp*(T2-T1)-T0*((cp*math.log(T2/T1))-(R*math.log(P2/P1))) ; \t\t\t# AF = af2-af1\n",
+ "e = AF/-W \t\t\t# efficiency \n",
+ "\n",
+ "# Results\n",
+ "print \"The power input is %.1f kW\"%W\n",
+ "print \"The second law efficiency of the compressor is %.3f\"%e\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power input is -235.7 kW\n",
+ "The second law efficiency of the compressor is 0.855\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.15 Page No : 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "U = 0\n",
+ "H0 = 0\n",
+ "S = 0;\n",
+ "# If the vaccume ha reduced to dead state\n",
+ "U0 = 0\n",
+ "H0 = 0\n",
+ "S0 = H0\n",
+ "V0 = 0;\n",
+ "P0 = 100\n",
+ "V = 1;\n",
+ "\n",
+ "# Calculation\n",
+ "fi = P0*V;\n",
+ "\n",
+ "# Results\n",
+ "print \"The energy of the complete vaccume is\",fi,\"kJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The energy of the complete vaccume is 100 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.16 Page No : 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "m = 1000. # mass in kg\n",
+ "T0 = 300.\n",
+ "P0 = 1. \n",
+ "T1 = 300.;\n",
+ "T2 = 273-20.\n",
+ "Tf = 273-2.2; # freezing point in C\n",
+ "Cb = 1.7 \n",
+ "Ca = 3.2;\n",
+ "Lh = 235. # latent heat\n",
+ "\n",
+ "# Calculation\n",
+ "H12 = m*((Cb*(Tf-T2))+Lh+(Ca*(T1-Tf)));\n",
+ "H21 = -H12;\n",
+ "S12 = m*((Cb*math.log(Tf/T2))+(Lh/Tf)+(Ca*math.log(T1/Tf)));\n",
+ "S21 = -S12;\n",
+ "E = H21-T0*S21;\n",
+ "\n",
+ "# Results\n",
+ "print \"Energy produced is %.1f MJ\"%(E/1000)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy produced is 34.6 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.17 Page No : 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "cv = 0.718\n",
+ "T2 = 500. # tempareture\n",
+ "T1 = 300.\n",
+ "m = 1.\n",
+ "T0 = 300.\n",
+ "\n",
+ "# Case (a)\n",
+ "Sua = cv*math.log(T2/T1);\n",
+ "Ia = T0*Sua;\n",
+ "print \"The irreversibility in case a is %.1f kJ/Kg\"%Ia\n",
+ "\n",
+ "# Case (b)\n",
+ "Q = m*cv*(T2-T1);\n",
+ "T = 600.\n",
+ "Sub = Sua-(Q/T);\n",
+ "Ib = T0*Sub;\n",
+ "print \"The irreversibility in case b is %.2f kJ/Kg\"%Ib\n",
+ " \n",
+ "# rounding off error"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The irreversibility in case a is 110.0 kJ/Kg\n",
+ "The irreversibility in case b is 38.23 kJ/Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.18 Page No : 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "h1 = 3230.9\n",
+ "s1 = 6.69212\n",
+ "V1 = 160. # velocity\n",
+ "T1 = 273.+400; # Steam\n",
+ "h2 = 2676.1\n",
+ "s2 = 7.3549\n",
+ "V2 = 100.\n",
+ "T2 = 273. + 100;\n",
+ "T0 = 298.\n",
+ "W = 540. # water\n",
+ "Tb = 500. # tempareture\n",
+ "\n",
+ "# Calculation\n",
+ "Q = (h1-h2)+((V1**2-V2**2)/2)*1e-03-W;\n",
+ "I = 151.84-Q*(0.404);\n",
+ "AF = W + Q*(1-(T0/Tb)) + I; \t\t\t# AF = af1-af2\n",
+ "n2 = W/AF;\n",
+ "\n",
+ "# Results\n",
+ "print \"Irreversibility per unit mass is %.2f kJ/Kg\"%I\n",
+ "print \"The second law effiency of the turbine is %.2f\"%n2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Irreversibility per unit mass is 142.71 kJ/Kg\n",
+ "The second law effiency of the turbine is 0.78\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.19 Page No : 262"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variables\n",
+ "T0 = 300.\n",
+ "T = 1500. # resistor\n",
+ "Q = -8.5\n",
+ "W = 8.5;\n",
+ "\n",
+ "# Calculation and Results\n",
+ "# Case (a)\n",
+ "I = Q*(1-T0/T) + W;\n",
+ "R = Q*(1-T0/T);\n",
+ "print \"Rate of availability transfer with heat and the irreversibility rate are\",R,\"and\",I,\"kW\"\n",
+ "\n",
+ "# Case (b)\n",
+ "T1 = 500.;\n",
+ "Ib = - Q*(1-T0/T) + Q*(1-T0/T1);\n",
+ "print \"Rate of availability in case b is\",Ib,\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of availability transfer with heat and the irreversibility rate are -6.8 and 1.7 kW\n",
+ "Rate of availability in case b is 3.4 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.20 Page No : 263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "P1 = 1.\n",
+ "T1 = 273.+30; \n",
+ "P2 = 3.5\n",
+ "T2 = 141.+273 ; \n",
+ "V = 90.;\n",
+ "T0 = 303.;\n",
+ "\n",
+ "# Calculation and Results\n",
+ "# Part (a)\n",
+ "g = 1.4;\n",
+ "T2s = T1*((P2/P1)**((g-1)/g));\n",
+ "print \"As T2s> T2 so the process must be polytropic\"\n",
+ "\n",
+ "# Part (b)\n",
+ "p = math.log(P2/P1); q = math.log(T2/T1);\n",
+ "n = p/(p-q);\n",
+ "print \"The polytropic index is %.2f\"%n\n",
+ "\n",
+ "# Part (c)\n",
+ "cp = 1.0035; R = 0.287;\n",
+ "Wa = cp*(T1-T2)-(V2**2/2)*1e-03 ;\n",
+ "Wt = -R*T0*math.log(P2/P1)-(V2**2/2)*1e-03;\n",
+ "Nt = Wt/Wa;\n",
+ "print \"The isothermal effiency is %.3f\"%Nt\n",
+ "\n",
+ "# Part (d)\n",
+ "f12 = cp*(T1-T2) + T0*((R*math.log(P2/P1))-(cp*math.log(T2/T1))) - (V2**2/2)*1e-03 ;\n",
+ "I = f12-Wa ; \n",
+ "print \"The minimum work input and irreversibility are %.1f and %.1f kJ/Kg \"%(f12,I)\n",
+ "\n",
+ "# Part (e)\n",
+ "n2 = (f12/Wa);\n",
+ "print \"Second law efficiency is %.2f\"%n2\n",
+ "\n",
+ "# note : answer are slightly different because of rounding off error. please check."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "As T2s> T2 so the process must be polytropic\n",
+ "The polytropic index is 1.33\n",
+ "The isothermal effiency is 0.978\n",
+ "The minimum work input and irreversibility are -97.4 and 14.0 kJ/Kg \n",
+ "Second law efficiency is 0.87\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file