{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 1: Introduction and Basic Concepts" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-2, Page No.8" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given values\n", "p=850;# density in kg/m^3\n", "V=2; # volumne of tank in m^3\n", "\n", "#Calculations\n", "m=p*V;# mass, density and volumne corealtion\n", "\n", "#Result\n", "print 'The amount of oil in tank is %i kg' %round(m,0)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The amount of oil in tank is 1700 kg\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-3, Page No.9" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Constants used\n", "g=32.174;# gravitational constant in ft/s^2\n", "\n", "#given values\n", "m=1; # mass of 1.00 lbm is subjected to standard earth gravity\n", "\n", "#Calculations\n", "w=(m*g)/g; # weight is mass times the local value of gravitational acceleration\n", "#dimensionally the above equation is represented as lbm * ft/s^2 * (lbf/ft/s^2)\n", "\n", "#Result\n", "print 'The weight on earth is %i lbf' %w\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The weight on earth is 1 lbf\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-4, Page No.21" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Example 1.4\n", "\n", "# Given values\n", "Tc=10; #change in temp in Celcius\n", "\n", "# Calculations\n", "Tk=Tc;\n", "Tr=1.8*Tk;#conversion scale of temperature change from K to R\n", "Tf=Tr;\n", "# calculated using the corealtions b/w these scales\n", "\n", "#Results\n", "print 'the corresponding change is %i K' %Tk\n", "print 'the corresponding change is %i R' %Tr\n", "print 'the corresponding change is %i F' %Tf\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the corresponding change is 10 K\n", "the corresponding change is 18 R\n", "the corresponding change is 18 F\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-5, Page No.23" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given values\n", "Patm=14.5; #atmospheric pressure in psi\n", "Pvac=5.8; #vacuum gage reading in psi\n", "\n", "#Calculations\n", "Pabs=Patm-Pvac;#pressure in vaccumm is always treated to be negative\n", "\n", "#Results\n", "print'the absolute pressure in the chamber %f psi'%round(Pabs,1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the absolute pressure in the chamber 8.700000 psi\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-6, Page No.26" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Constants used\n", "pw=1000; # density of water in kg/m^3;\n", "g=9.81; # acceleration due to gravity in m/s^2;\n", " \n", "#Given values\n", "SG=0.85;# specific gravity of manometric fluid\n", "h=0.55;# converting height from cm to m\n", "Patm=96;# atmospheric pressure in kPa\n", "\n", "# Calculations\n", "p=SG*pw;\n", "Ptank=Patm+(p*g*h/1000); # calculating pressure using liquid at same height have same pressure\n", "\n", "#Results\n", "print 'absolute pressure in tank %f kPa' %round(Ptank,1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "absolute pressure in tank 100.600000 kPa\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-7, Page No.28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Constants used\n", "g=9.81;#acceleration due to gravity in m/s^2;\n", "\n", "#Given values\n", "h1=0.1;# distance b/w point 1 at air-water interface and point 2 at mercury-air interface in m\n", "h2=0.2;# distance b/w oil-water interface and mercury-oil interface in m\n", "h3=0.35;# distance b/w air-mercury interface and mercury-oil interface in m\n", "pw=1000;# density of water in kg/m^3\n", "pHg=13600;# density of mercury in kg/m^3\n", "poil=800;# density of oil in kg/m^3\n", "Patm=85.6;# atmospheric pressure in kPa\n", "\n", "#Calculation\n", "P1=Patm-(pw*g*h1+poil*g*h2-pHg*g*h3)/1000;#calculating pressure using liquid at same height have same pressure\n", "\n", "#Results\n", "print 'the air pressure in tank %i kPa' %round(P1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the air pressure in tank 130 kPa\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-8, Page No.31" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Constants used\n", "g=9.81;# acceleration due to gravity in m/s^2;\n", "\n", "#Given values\n", "pHg=13570;# density of mercury at 10 C in kg/m^3\n", "h=0.74;# converting barometric reading into m from mm\n", "\n", "#Calculationa\n", "Patm=pHg*g*h/1000;# standard pressure formula\n", "\n", "#Results\n", "print 'the atmospheric pressure %f kPa' %round(Patm,1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the atmospheric pressure 98.500000 kPa\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-9, Page No.31" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#constants used\n", "g=9.81;#acceleration due to gravity in m/s^2;\n", "\n", "#given values\n", "m=60;# mass of piston in kg\n", "Patm=0.97;# atmospheric pressure in kPa\n", "A=0.04;# cross-sectional area in m^2\n", "\n", "#calculation\n", "P=Patm+(m*g/A)/100000;# standard pressure formula\n", "print 'The pressure inside the cylinder %f bar' %round(P,2)\n", "#The volume change will have no effect on the free-body diagram drawn in part (a), and therefore the pressure inside the cylinder will remain the same\n", "print('If some heat is transferred to the gas and its volume is doubled, there is no change in pressure');\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The pressure inside the cylinder 1.120000 bar\n", "If some heat is transferred to the gas and its volume is doubled, there is no change in pressure\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1-10, Page No.32" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "from scipy.integrate import quad \n", "from pylab import *\n", "\n", "#Constants used\n", "g=9.81;#acceleration due to gravity in m/s^2;\n", "\n", "#Given values\n", "p=1040;# density on the water surface in kg/m^3\n", "h1=0.8;# thickness of surface zone\n", "H=4;# thickness of gradient zone\n", "x0=0.0;# lower limit of integration\n", "x1=4.0;# upper limit of integration\n", "\n", "\n", "#Calculations\n", "P1=p*g*h1/1000;#standard pressure determination formula\n", "#P2 = integration of the exp. p*g*(math.sqrt(1+(math.tan(math.pi*z/4/H)^2))) b/w 0-4\n", "def intgrnd1(z): \n", " return (p*g*(math.sqrt(1+(math.tan(math.pi*(z)/4/H)**2))) )#integrant\n", "P2, err = quad(intgrnd1, x0, x1) \n", "P2=P2/1000;#converting into kPa\n", "P=P1+P2;\n", "\n", "#Results\n", "print 'the gage pressure at the bottom of gradient zone %f kPa' %round(P)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the gage pressure at the bottom of gradient zone 54.000000 kPa\n" ] } ], "prompt_number": 17 } ], "metadata": {} } ] }