{ "metadata": { "name": "", "signature": "sha256:4df6ac0705dbecae7b5d61911e7c199aa54ae833c2fc9f2d87f583d3d1c651ef" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5:The Second Law of Thermodynamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.4:PG-112" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "Th=200+273.0 # higher temperture in kelvin \n", "Tl=20+273.0 # lower temperture in kelvin\n", "Wdot=15 # output of engine in kW\n", "\n", "ef=1-(Tl/Th) # carnot efficiency\n", "\n", "Qhdot=Wdot/ef # heat supplied by reservoir\n", "print \" The heat suppled by higher temperature reservoir is\",round(Qhdot,2),\"kW \\n \"\n", "# using forst law\n", "Qldot=Qhdot-Wdot # heat rejected to reservoir\n", "print \" The heat suppled by lower temperature reservoir is\",round(Qldot,2),\"kW\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The heat suppled by higher temperature reservoir is 39.42 kW \n", " \n", " The heat suppled by lower temperature reservoir is 24.42 kW\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.5:PG-113" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "TL1=-5+273.0 # lower temperature in kelvin for first situation\n", "TH=20+273.0 # higher temperature in kelvin\n", "TL2=-25+273.0 #lower temperature in kelvin for second situation\n", "\n", "#solution\n", "\n", "COP1=TL1/(TH-TL1) # carnot refrigerator COP for first situation\n", "# Let Heat be 100 kJ\n", "QL=100.0 # assumption\n", "W1=QL/COP1 # work done for situation 1\n", "\n", "# for situation 2\n", "COP2=TL2/(TH-TL2) # COP carnot for second situation\n", "W2=QL/COP2 # work done\n", "\n", "Per=(W2-W1)*100/W1 # percentage increase in work done \n", "#result\n", "print\" The perccentage increase in work is \",round(Per,1),\"%\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The perccentage increase in work is 94.5 %\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.6:PG-117" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# initialization of variables\n", "T1=20+273 # initial temperature in kelvin\n", "P=200 # pressure in kPa\n", "V=2 # volume in m^3\n", "R=0.287 # gas constant for air\n", "W=720 # work done on air in kJ\n", "Cv=0.717 # specific heat at constant volume for air\n", "\n", "#solution\n", "m=(P*V)/(R*T1) # mass of air\n", "\n", "T2=T1+(W/(m*Cv))# final temperature in kelvin\n", "\n", "delS=m*Cv*math.log(T2/T1) # ENROPY CHANGE FOR CONSTANT VOLUME PROCESS\n", "print \" The Entropy increase is\",round(delS,3),\"kJ/K \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The Entropy increase is 1.851 kJ/K \n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.7:PG-118" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "T1=350+273 # initial temperature in kelvin\n", "P1=1200.0 # initial pressure in kPa\n", "P2=140 # final pressure in kPa\n", "k=1.4 # polytopic index for air\n", "Cv=0.717 # specific heat at constant volume for air\n", "#solution\n", "T2=T1*((P2/P1)**((k-1)/k)) # reversible adiabatic process relation\n", "\n", "w=-Cv*(T2-T1) # work done by gases in reversible adiabatic process\n", "print\" The work done by gases is\",round(w),\"kJ/kg\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The work done by gases is 205.0 kJ/kg\n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.8:PG-120" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# initialization of variables\n", "T1=20+273.0 # initial temperature in kelvin\n", "P1=200.0 # pressure in kPa\n", "V=2 #volume in m^3\n", "R=0.287 # gas constant for air\n", "W=-720 # negative as work is done on air in kJ\n", "\n", "#solution\n", "\n", "m=(P1*V)/(R*T1)# mass of air\n", "\n", "u1=209.1 #specific internal energy of air at 293K and 200 kPa from table E.1\n", "s1=1.678 # by interpolation from table E.1\n", "# change in internal energy= work done\n", "u2=-(W/m)+u1 # final internal energy\n", "T2=501.2# final temperature interpolated from table E.1 corresponding to value of u2\n", "s2=2.222 # value of s from table E.3 by interpolating from corresponding to value of u2\n", "\n", "P2=P1*(T2/T1) # final pressure in kPa\n", "\n", "delS=m*(s2-s1-R*math.log(P2/P1))# entropy change\n", "# result\n", "print \" The Entropy increase is\",round(delS,3),\"kJ/K \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The Entropy increase is 1.855 kJ/K \n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.9:PG-120" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "T1=350+273.0 # initial temperature in kelvin\n", "P1=1200.0 # initial pressure in kPa\n", "P2=140.0 # final pressure in kPa\n", "k=1.4 # polytopic index for air\n", "\n", "#solution\n", "# The values are taken from table E.1\n", "Pr660=23.13# relative pressure @ 660K\n", "Pr620=18.36# relative pressure @ 620K\n", "Pr1=((Pr660-Pr620)*3/40)+Pr620 # relative pressure by interpolation\n", "\n", "Pr2=Pr1*(P2/P1) # relative pressure at state 2\n", "\n", "Pr340=2.149 # relative pressure @ 340K\n", "Pr380=3.176 # relative pressure @ 380K\n", "T2=((Pr2-Pr340)/(Pr380-Pr340))*40+340 # interpolating final temperature from table E.1\n", "\n", "# now interpolating u1 AND u2 from table E.1\n", "u620=451.0# specific internal energy @ 620k\n", "u660=481.0# specific internal energy @ 660k\n", "u1=(u660-u620)*(3/40.0)+u620 # initial internal energy\n", "\n", "u380=271.7 #specific internal energy @ 380k\n", "u340=242.8 #specific internal energy @ 340k\n", "u2=((Pr2-Pr340)/(Pr380-Pr340))*(u380-u340)+u340 # final internal energy\n", "\n", "w=u2-u1 # work= change in internal energy\n", "print \" The work done by gas is\",int(w),\"kJ/kg\"\n", "# The answer is slightly different as values are approximated in textbook\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The work done by gas is -209 kJ/kg\n" ] } ], "prompt_number": 33 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.10:PG-123" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "T1=300+273.0 # initial temperature in kelvin\n", "P1=600 # initial pressure in kPa\n", "P2=40 # final pressure in kPa\n", "\n", "#solution\n", "#please refer to steam table for values\n", "v1=0.4344 # specific volume from steam table @ 573k and 600 kPa\n", "v2=v1 # rigid container\n", "u1=2801.0 # specific internal energy from steam table @ 573k and 600 kPa\n", "s1=7.372 # specific entropy @ 600 kPa and 573 K\n", "\n", "vg2=0.4625 # specific volume of saturated vapour @ 40 kPa and 573 K\n", "vf2=0.0011 # specific volume of saturated liquid @ 40 kPa and 573 K\n", "sf2=1.777 # specific entropy of saturated liquid @ 40 kPa and 573 K\n", "sg2=5.1197 # specific entropy of saturated vapour @ 40 kPa and 573 K\n", "x=(v2-vf2)/(vg2-vf2)# quality of steam using pure substance relation\n", "\n", "s2=sf2+x*sg2 # overall specific enthalpy at quality 'x' \n", "delS=s2-s1 # entropy change\n", "print\" The entropy change is\",round(delS,3),\"kJ/kg.K \\n \"\n", "\n", "#heat transfer\n", "uf2=604.3 #specific internal energy of saturated liquid @ 40 kPa and 573 K\n", "ug2=1949.3 #specific internal energy of saturated vapour @ 40 kPa and 573 K\n", "u2=uf2+x*ug2 #specific internal energy @ quality x\n", "q=u2-u1 # heat transfer in kJ/kg from first law as W=0\n", "print \" The heat transfer is\",int(q),\"kJ/kg\"\n", "# result\n", "# the answers are approximated in textbook but here they are precise thus minute difference is there" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The entropy change is -0.787 kJ/kg.K \n", " \n", " The heat transfer is -366 kJ/kg\n" ] } ], "prompt_number": 37 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.11:PG-126" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# initialization of variables\n", "v1=0.5 # assumed as air is filled in half of the tank\n", "v2=1.0 # final volume when partition is removed\n", "R=0.287 # gas contant for air\n", "#solution\n", "q=0 # heat transfer is zero\n", "w=0 # work done is zero\n", "# temperatue is constant as no change in internal energy by first law\n", "dels=R*math.log(v2/v1)# change in entropy when temperature is constant\n", "print \"The change in specific entropy is\",round(dels,3),\"kJ/kg.K\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The change in specific entropy is 0.199 kJ/kg.K\n" ] } ], "prompt_number": 49 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.12:PG-127" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "T1=400+273.0 # initial temperature in kelvin\n", "P=600 # pressure in kPa\n", "Tsurr=25+273.0 # surrounding temperature in K\n", "m=2 # mass of steam in kg\n", "\n", "#solution\n", "#please refer to steam table for values\n", "s1=7.708 # specific entropy of steam @ 400 degree celsius and 0.6 MPa\n", "s2=1.9316# specific enropy of condensed water @ 25 degree celsius and 0.6 MPa\n", "delSsys=m*(s2-s1) # entropy change in system i.e of steam\n", "\n", "h1=3270 # specific enthalpy of steam @ 400 degree celsius and 0.6 MPa\n", "h2=670.6#specific enropy of condensed water @ 25 degree celsius and 0.6 MPa\n", "\n", "Q=m*(h1-h2)# heat transfer at constant pressure\n", "delSsurr=Q/Tsurr # entropy change in surroundings\n", "\n", "sigma=delSsys+delSsurr # net entropy change\n", "\n", "print \"The net entropy production is\",round(sigma,1),\"kJ/K\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The net entropy production is 5.9 kJ/K\n" ] } ], "prompt_number": 53 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.13:PG-130" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "T1=600+273 # initial temperature in kelvin\n", "P1=2 # initial pressure in MPa\n", "P2=10 # final pressure in kPa\n", "mdot=2 # mass flow rate in kg/s\n", "\n", "#solution\n", "#please refer to steam table for values\n", "h1=3690 # specific enthalpy in kJ/kg @ 2MPa and 600 degree celsius\n", "s1=7.702 #specific entropy in kJ/kg.K @ 2MPa and 600 degree celsius\n", "s2=s1 # Reversible adiabatic process thus entropy is constant\n", "sf2=0.6491 #specific entropy of saturated liquid from steam table @ 10 kPa\n", "sg2=8.151 #specific entropy of saturated vapour from steam table @ 10 kPa\n", "\n", "x2=(s2-sf2)/(sg2-sf2) # quality of steam at turbine exit\n", "\n", "h2f=191.8 #specific enthalpy of saturated liquid from steam table @ 10 kPa\n", "h2g=2584.8 #specific enthalpy of saturated vapour from steam table @ 10 kPa\n", "h2=h2f+x2*(h2g-h2f) # specific enthalpy @ quality 'x' \n", "\n", "WdotT=mdot*(h1-h2)# from work done in adiabatic process\n", "# result\n", "print \" The maximum power output is\",int(WdotT),\"kJ/s\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The maximum power output is 2496 kJ/s\n" ] } ], "prompt_number": 56 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.14:PG-130" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "\n", "T1=600+273 # initial temperature in kelvin\n", "P1=2 # initial pressure in MPa\n", "P2=10 # final pressure in kPa\n", "mdot=2 # mass flow rate in kg/s\n", "EffT=0.8 # efficiency of turbine \n", "WdotT=2496 # theoritical power of turbine in kW\n", "\n", "#solution\n", "Wdota=EffT*WdotT # actual power output of turbine\n", "h1=3690 # specific enthalpy @ 2MPa and 600 degree celsius\n", "h2=h1-(Wdota/mdot) # final enthalpy from first law of thermodynamics\n", "\n", "T2=((h2-2688)/(2783-2688))*(150-100)+100 # by interpolating from steam table @ P2= 10 kPa, h2=2770 \n", "s2=8.46 # final specific entropy by interpolation from steam table\n", "\n", "print \"The temperature by interpolation is\",round(T2),\" degree celsius \\n\"\n", "print \"The final entropy by interpolation is\",round(s2,2),\"kJ/kg.K\"\n", "# The temperature and entropy are found by interpolation from steam table and cannot be shown here.\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The temperature by interpolation is 102.0 degree celsius \n", "\n", "The final entropy by interpolation is 8.46 kJ/kg.K\n" ] } ], "prompt_number": 59 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5.15:PG-131" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "\n", "T2=250.0 # temperature of steam in degree celsius\n", "mdot2=0.5 # mass flow rate of steam in kg/s\n", "T1=45 # temperature of water in degree celsius\n", "mdot1=4 # mass flow rate of water in kg/s\n", "P=600.0 # pressure in kPa\n", "\n", "\n", "mdot3=mdot1+mdot2 # by mass balance\n", "\n", "h2=2957 # specific enthalpy in kJ/kg of steam @ 600 Kpa from steam table\n", "h1=188.4 # specific enthalpy in kJ/kg of water @ 600 Kpa from steam table\n", "\n", "h3=(mdot1*h1+mdot2*h2)/mdot3 # specific enthalpy in kJ/kg at exit\n", "\n", "# by interpolation from saturated steam table\n", "T3=(h3-461.3)*10/(503.7-461.3)+110 # temperature of mixture\n", "\n", "sf3=1.508 # entropy of saturated liquid in kJ/kg.K at 600Kpa and T3 temperature from steam table\n", "s3=sf3 # by interpolating sf\n", "s2=7.182 # entropy of superheated steam in kJ/kg.K @ 600Kpa from steam table\n", "s1=0.639 # entropy of entering water in kJ/kg.K at T= 45 degree celsius\n", "\n", "sigmaprod=mdot3*s3-mdot2*s2-mdot1*s1\n", "# result\n", "print \"The rate of entropy production is\",round(sigmaprod,3),\"kW/K \"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The rate of entropy production is 0.639 kW/K \n" ] } ], "prompt_number": 60 } ], "metadata": {} } ] }