{ "metadata": { "name": "", "signature": "sha256:f6a6bb505322436c23c138c1e60d951ed65e1f5f903d0d7ef3e7664203b1c411" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3:Work and Heat" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.1:PG-45" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#initialization of variables\n", "m=1 # mass in kg\n", "x=20.0/100.0 #quality of steam\n", "P=200 #constant pressure in kPa\n", "T1=100 #temperature intitial in degree centigrade\n", "T2=400 #temperature final in degree centigrade\n", "\n", "\n", "# first we find initial volume v1 and final volume v2\n", "\n", "# using table C.2\n", "vf=0.001061 # specific volume of saturated liquid in m^3 per kg \n", "vg=0.8857 # specific volume of saturated vapour in m^3 per kg \n", "\n", "v1=vf+x*(vg-vf);\n", "\n", "v2=1.549 # specific volume of steam in m^3 per kg at T2=400*C and P2=0.2MPa\n", "# now calculate work\n", "W=m*P*(v2-v1); # work done in constant pressure process\n", "#result\n", "print \"Work done is\",round(W,2),\" kJ\" # work is in kJ as pressure was in kPa" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done is 274.2 kJ\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.2:PG-46" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#initialization of variables\n", "D=110.0/1000.0 # diameter of cylinder in m\n", "V1=100e-6 # initial volume@ state 1 in m^3\n", "T1=60.0 # initial temp @ state 1 in *C\n", "T2=200.0 # final temo @ state 2 in *C\n", "M=50 # weight of piston in kg\n", "g=9.81 # gravitational accleration in m/sec^2\n", "Patm=100000 # atmospheric pressure in Pa\n", "A=math.pi*(D**2)/4 # area of piston in m^2\n", "\n", "# BALANCING THE FORCES To GET PRESSURE P\n", "# M.g=P.A-Patm\n", "P=Patm+(M*g/A) # atm pressure is added to get absolute pressure\n", "\n", "v1=0.001017 # specific volume at 60*C and 0.15Mpa pressure\n", "m=V1/v1; # mass of water in kg\n", "\n", "# find volume at state 2 \n", "v2=1.444 # specific volume of steam at 200*C and 0.15 MPa\n", "V2=m*v2 # final volume in m^3\n", "\n", "W=P*(V2-V1)/1000; # work done divided by 1000 to get in kJ\n", "# result\n", "print \"The work done is\",round(W,1),\" kJ\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The work done is 21.5 kJ\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.3:PG-47" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#initialization of variables\n", "P1=200 # initial pressure in kPa\n", "V1=2 # initial volume in m^3\n", "P2=100 # final pressure in kPa\n", "C=P1*V1 # isothermal process i.e P.V=constant\n", "# find final volume \n", "V2=P1*V1/P2 # final volume by P1.V1=P2.V2\n", "\n", "from scipy.integrate import quad\n", " \n", "def integrand(v,C):\n", " return C/v\n", "W, err =quad(integrand, V1, V2,C ) # itegrating over volume to get work\n", "# result\n", "print \"The Work done by gas is\",int(W),\" kJ\" # answer is approximated in textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The Work done by gas is 277 kJ\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.4:PG-48" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# initialization of variables\n", "M=100 # mass in kg\n", "d=3 # depth by which mass drops in m\n", "V=0.002 # increased volume in m^3\n", "g=9.8 # gravitational accleration in m/sec^2\n", "Pgauge=100*1000 # gauge pressure in N/m\n", "Patm =100*1000 # atmospheric pressure in N/m\n", "P=Pgauge+Patm # to get absolute pressure\n", "\n", "# calculate work done by paddle wheel\n", "Wpaddlewheel=(-M*g*d) # work is negative as it is done on the system\n", "\n", "# calculate work done on piston it \n", "Wboundary=P*V # area mulitiplied by height is volume thus W=P.V \n", "\n", "#net work\n", "\n", "Wnet=Wpaddlewheel+Wboundary; # Work in joule as SI units are used\n", "print \"The Net Work done is \",round(Wnet),\" J\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The Net Work done is -2540.0 J\n" ] } ], "prompt_number": 33 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.5:PG-51" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# initialization of variables\n", "T=100 # torque of shaft in N.m\n", "N=3000 # rotation speed in rpm\n", "omega=(N*2*math.pi/60) # angular velocity in rad/sec\n", "# calculation of power\n", "Wdot=(T*omega); # power is work done per unit time\n", "print \"Power transmitted is\",round(Wdot/746,1),\" hp\" # divided by 746 to convert W into hp\n", "#answer is approximated in textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Power transmitted is 42.1 hp\n" ] } ], "prompt_number": 35 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.6:PG-51" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# initialization of variables\n", "D=10.0/100 # diameter of cylinder in m\n", "d=50.0/1000 # compression in spring in m\n", "Patm=100000 # atmospheric pressure in Pa\n", "K=10.0*1000 # spring constant converted in N/m\n", "w=50*9.81 # weight of piston in Newton =mass*gravitational acceleration\n", "\n", "# find the initial pressure in cylinder by force balance\n", "A=(math.pi*D**2)/4; # area of piston\n", "P1=((Patm*A)+w)/A; # balancing forces on piston P1.A=Patm.A+W\n", "\n", "# work done by air to raise the piston for 50mm if spring not present\n", "Wgas=P1*A*d; # pressure*area= force and Work = Force* displacement\n", "\n", "# work done on spring to compress\n", "Wspring=(K*d**2)/2; # Work in j\n", "\n", "# now total work done by air is sum of two works\n", "Wnet=Wgas+Wspring; # Work in j\n", "# result\n", "print \"The net work done by air is\",round(Wnet,1),\" J\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The net work done by air is 76.3 J\n" ] } ], "prompt_number": 43 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3.7:PG-53" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# variable initialization\n", "\n", "d=2 # distance travelled by weight in m\n", "m=50 # mass of weight in kg\n", "g=9.8 # gravitaional acceleration in m/sec^2\n", "\n", "# calculation of work in non-quasiequilibrium process\n", "W=m*g*d; # work in joules\n", "\n", "# the work done must be transferred as heat\n", "Q=W;\n", "\n", "print \"The heat that must transfer is \",int(Q),\" Joules\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The heat that must transfer is 980 Joules\n" ] } ], "prompt_number": 45 } ], "metadata": {} } ] }