summaryrefslogtreecommitdiff
path: root/Thermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb')
-rwxr-xr-xThermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb473
1 files changed, 473 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb
new file mode 100755
index 00000000..f2acb74e
--- /dev/null
+++ b/Thermodynamics:_From_concepts_to_applications/Chapter9_2.ipynb
@@ -0,0 +1,473 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:15fd1db156f91825255a086dbc12ea12cb6caac30db6feed49ee7e31d29fef8c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter9-Applications of the second law of thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1-pg 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate final temperatures and total entropy\n",
+ "##changeinitialisation of variables\n",
+ "p1= 3.##changeMpa\n",
+ "p2= 0.2 ##changeMpa\n",
+ "V1= 0.6 ##changem^3\n",
+ "V2= 1.##changem^3\n",
+ "M= 28. ##changegms\n",
+ "R= 8.314 ##changeJ/mol K\n",
+ "T= 400. ##changeC\n",
+ "T1= 150. ##changeC\n",
+ "k= 1.4\n",
+ "p3= 1.25 ##changeMpa\n",
+ "##changeCALCULATIONS\n",
+ "m1= p1*V1*10*10*10*M/(R*(273.15+T))\n",
+ "m2= p2*V2*10*10*10*M/(R*(273.15+T1))\n",
+ "p4= (p1*V1+p2*V2)/(V1+V2)\n",
+ "T2= (math.pow(p4/p1,k-1)/k)*(273.15+T)\n",
+ "m3= p3*V1*M*10*10*10/(R*T2)\n",
+ "dm= m1-m3\n",
+ "m4= m2+dm\n",
+ "T4= p3*10*10*10*V2/((R/M)*m4)\n",
+ "S= (R/M)*(m2*((k/(k-1))*math.log(T4/(273.15+T1))-math.log(p3/p2))+dm*((k/(k-1))*math.log(T4/(273.15+T))-math.log(p3/p1)))\n",
+ "##changeRESULTS\n",
+ "print'%s %.1f %s'%('final temperature =',T2,'K')\n",
+ "print'%s %.1f %s'%('final temperature =',T4,'K')\n",
+ "print'%s %.4f %s'%('Total entropy =',S,'KJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "final temperature = 338.8 K\n",
+ "final temperature = 1340.2 K\n",
+ "Total entropy = 2.5525 KJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg156"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate work of the pump\n",
+ "##initialisation of variables\n",
+ "m= 10000 ##kg/h\n",
+ "P= 2.5 ##Mpa\n",
+ "P1= 100 ##kPa\n",
+ "v= 0.001003 ##m^3\n",
+ "##CALCULATIONS\n",
+ "W= -m*v*(P*10*10*10-P1)/3600\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' work of the pump =',W,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " work of the pump = -6.687 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg 158"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "##initialisation of variables\n",
+ "m= 4. ##kg/s\n",
+ "R= 8.314 ##J/mol K\n",
+ "M= 29. ##gms\n",
+ "k= 1.4\n",
+ "T1= 27. ##C\n",
+ "p2= 1800. ##kPa\n",
+ "p1= 105. ##kPa\n",
+ "n= 1.22\n",
+ "cp= 1.4 ##Jmol K\n",
+ "##CALCULATIONS\n",
+ "T2= (273.15+T1)*(p2/p1)**((n-1)/n)\n",
+ "W= m*k*(R/M)*((273.15+T1)/(k-1))*(1-(p2/p1)**((k-1)/k))\n",
+ "Q= -m*R*(273.15+T1)*math.log(p2/p1)/M\n",
+ "W1= m*(R/M)*n*((273.15+T1)/(n-1))*(1-(p2/p1)**((n-1)/n))\n",
+ "Q1= m*(R/M)*(n-k)*(T2-T1-273.15)/((n-1)*(k-1))\n",
+ "T3= (273.15+T1)*(p2/p1)**((k-1)/(2*k))\n",
+ "Q2= m*cp*(R/M)*(T1+273.15-T3)/(k-1)\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('heat removed in adiabatic compression =',W,'kW')\n",
+ "print'%s %.1f %s'%('heat removed in isothermal compression =',Q,'kW')\n",
+ "print'%s %.1f %s'%('heat removed in polytropic process =',Q1,'kW')\n",
+ "print'%s %.2f %s'%('heat removed in adiabatic compression in two stages =',Q2,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "heat removed in adiabatic compression = -1508.5 kW\n",
+ "heat removed in isothermal compression = -978.1 kW\n",
+ "heat removed in polytropic process = -471.2 kW\n",
+ "heat removed in adiabatic compression in two stages = -603.21 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4-pg 161"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy and entropy\n",
+ "##initialisation of variables\n",
+ "h1= 3422.25 ##kJ/kg\n",
+ "m= 8. ##kg/s\n",
+ "s2= 7.3755 ##kJ/kg K\n",
+ "s1= 6.8803 ##kJ/kg K\n",
+ "e= 0.8\n",
+ "h2s= 2496.8 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "h2= h1+e*(h2s-h1)\n",
+ "W= m*(h1-h2)\n",
+ "S= s2-s1\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('Enthalpy =',W,'kW')\n",
+ "print'%s %.4f %s'% ('Entropy =',S,'kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enthalpy = 5922.9 kW\n",
+ "Entropy = 0.4952 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5-pg162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "calculate volume flow rate into composser and volume flow rate out composser and heat and work \n",
+ "##initialisation of variables\n",
+ "m= 0.2 ##kg/s\n",
+ "v1= 1.0803 ##m^3/kg\n",
+ "T= 200 ##C\n",
+ "s2= 5.8041 ##kJ/kg K\n",
+ "s1= 7.5066 ##kJ/kg K\n",
+ "h1= 2328.1 ##kJ/kg\n",
+ "h2= 2654.4 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "V1= m*v1\n",
+ "V2= 0.1*V1\n",
+ "Q= m*(273.15+T)*(s2-s1)\n",
+ "W= Q-m*(h1-h2)\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'%('volume flow rate into composser =',V1,'m^3')\n",
+ "print'%s %.4f %s'%('volume flow rate out of composser =',V2,'m^3')\n",
+ "print'%s %.1f %s'%('Heat =',Q,'kJ')\n",
+ "print'%s %.1f %s'%(' Work =',W,'kJ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "volume flow rate into composser = 0.2161 m^3\n",
+ "volume flow rate out of composser = 0.0216 m^3\n",
+ "Heat = -161.1 kJ\n",
+ " Work = -95.8 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6-pg164"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate volume flow rate out and into the composser and work and heat\n",
+ "##initialisation of variables\n",
+ "m1= 0.2 ##kg/s\n",
+ "v1= 1.0803 ##m^3/kg\n",
+ "P= 200 ##kPa\n",
+ "T= 200 ##C\n",
+ "s1= 5.8041 ##kJ.kg K\n",
+ "s2= 7.5066 ##kJ/kg K\n",
+ "h1= 2870.5 ##kJ/kg\n",
+ "h2= 2495.9 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "V1= m1*v1\n",
+ "V2= 0.1*V1\n",
+ "Q= m1*(273.15+T)*(s1-s2)\n",
+ "W= m1*((h1-h2)-(273.15+T)*(s2-s1))\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'% ('volume flow rate into composser =',V1,'m^3/s')\n",
+ "print'%s %.4f %s'%('volume flow rate out of composser =',V2,'m^3/s') \n",
+ "print'%s %.1f %s'%('Work =',W,'kW')\n",
+ "print'%s %.1f %s'%('Heat =',Q,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "volume flow rate into composser = 0.2161 m^3/s\n",
+ "volume flow rate out of composser = 0.0216 m^3/s\n",
+ "Work = -86.2 kW\n",
+ "Heat = -161.1 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7-pg166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate rate of transfer\n",
+ "##initialisation of variables\n",
+ "e= 0.82\n",
+ "m= 5 ##kg/s\n",
+ "T3= 450 ##C\n",
+ "T1= 200 ##C\n",
+ "##CALCULATIONS\n",
+ "Q= e*m*1.0035*(T3-T1)\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('rate of transfer =',Q,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of transfer = 1028.6 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8-pg 166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate heat at given enthalpy\n",
+ "##initialisation of variables\n",
+ "h1= 174.076 ##kJ/kg\n",
+ "h3= 74.527 ##kJ/kg\n",
+ "h4= 8.854 ##kJ/kg\n",
+ "m= 0.8 ##kg\n",
+ "e= 0.85\n",
+ "##CALCULATIONS\n",
+ "h2= h1+h3-h4\n",
+ "Q= m*(h2-h1-23)\n",
+ "Q1= e*Q\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'%('Heat =',Q,'kW')\n",
+ "print'%s %.2f %s'%('Heat =',Q1,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat = 34.14 kW\n",
+ "Heat = 29.02 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9-pg 167"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy and entropy change\n",
+ "##initialisation of variables\n",
+ "W= 2000. ##kW\n",
+ "m= 2. ##kg/s\n",
+ "h1= 3023.5 ##kJ/kg\n",
+ "s2= 5.6106 ##kJ/kg K\n",
+ "s1= 6.7664 ##kJ/kg K\n",
+ "##CALCULATIONS\n",
+ "h2= h1-(W/m)\n",
+ "S=s2-s1\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'% ('enthalpy =',h2,'kJ/kg')\n",
+ "print'%s %.4f %s'%('entropy change =',S,'kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy = 2023.5 kJ/kg\n",
+ "entropy change = -1.1558 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10-pg 168"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy and entropy change\n",
+ "##initialisation of variables\n",
+ "m1= 1 ##kg\n",
+ "h1= 2967.6 ##kJ/kg\n",
+ "h2= 83.96 ##kJ/kg\n",
+ "m2= 10\n",
+ "s1= 7.5166 ##kJ/kg K\n",
+ "s2= 0.2966 ##kJ/kg K\n",
+ "s3= 1.1654 ##kJ/kg K\n",
+ "##CALCULATIONS\n",
+ "h3= (m1*h1+m2*h2)/(m1+m2)\n",
+ "S= -m1*s1-m2*s2+(m1+m2)*s3\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'% ('enthalpy =',h3,'kJ/kg')\n",
+ "print'%s %.4f %s'%('entropy change =',S,'kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy = 346.1 kJ/kg\n",
+ "entropy change = 2.3368 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file