diff options
author | Thomas Stephen Lee | 2015-09-04 22:04:10 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-09-04 22:04:10 +0530 |
commit | 41f1f72e9502f5c3de6ca16b303803dfcf1df594 (patch) | |
tree | f4bf726a3e3ce5d7d9ee3781cbacfe3116115a2c /Thermodynamics_An_Engineering_Approach/Chapter4.ipynb | |
parent | 9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e (diff) | |
download | Python-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.tar.gz Python-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.tar.bz2 Python-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.zip |
add/remove/update books
Diffstat (limited to 'Thermodynamics_An_Engineering_Approach/Chapter4.ipynb')
-rwxr-xr-x | Thermodynamics_An_Engineering_Approach/Chapter4.ipynb | 720 |
1 files changed, 0 insertions, 720 deletions
diff --git a/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb deleted file mode 100755 index b9e964f0..00000000 --- a/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb +++ /dev/null @@ -1,720 +0,0 @@ -{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 4: Energy Analysis of Closed Systems"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-2 ,Page No.169"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Given values\n",
- "m=10;#mass in lbm\n",
- "Po=60;#steam oressure in psia\n",
- "T1=320;#intial temp in F\n",
- "T2=400;#final temp in F\n",
- "\n",
- "#from Table A\u20136E\n",
- "v1=7.4863;#at 60 psia and 320 F\n",
- "v2=8.3548;#at 60 psia and 400 F\n",
- "\n",
- "#calculations\n",
- "#W = P dV which on integrating gives W = m * P * (V2 - V1)\n",
- "W=m*Po*(v2-v1)/5.404;#coverting into Btu from psia-ft^3\n",
- "print'work done by the steam during this process %f Btu'%round(W,1)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "work done by the steam during this process 96.400000 Btu\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-3 ,Page No.170"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "from math import log\n",
- "#given data\n",
- "P1=100;#pressure in kPa\n",
- "V1=0.4;#intial vol in m^3\n",
- "V2=0.1;#final vol in m^3\n",
- "\n",
- "#calculations\n",
- "#for isothermal W = P1*V1* ln(V2/V1)\n",
- "W=P1*V1*log(V2/V1);\n",
- "print'the work done during this process %f kJ'%round(W,1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the work done during this process -55.500000 kJ\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-4 ,Page No.171"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "V1=0.05;#Volumne of gas in m^3\n",
- "P1=200;#Pressure in kPa\n",
- "k=150;#Spring constant in kN/m\n",
- "A=0.25;#Cross-sectional area in m^2\n",
- "\n",
- "#calculations\n",
- "\n",
- "#Part - a\n",
- "V2=2*V1;\n",
- "x2=(V2-V1)/A;#printlacement of spring\n",
- "F=k*x2;#compression force\n",
- "P2=P1+F/A;#additional pressure is equivalent the compression of spring\n",
- "print'the final pressure inside the cylinder %i kPa'%P2;\n",
- "\n",
- "#Part - b\n",
- "#work done is equivalent to the area of the P-V curve of Fig 4-10\n",
- "W=(P1+P2)/2*(V2-V1);#area of trapezoid = 1/2 * sum of parallel sides * dist. b/w them\n",
- "print'the total work done by the gas %i kJ'%W;\n",
- "\n",
- "#Part - c\n",
- "x1=0;#intial compression of spring\n",
- "Wsp=0.5*k*(x2**2-x1**2);\n",
- "print'the fraction of this work done against the spring to compress it %i kJ'%Wsp\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the final pressure inside the cylinder 320 kPa\n",
- "the total work done by the gas 13 kJ\n",
- "the fraction of this work done against the spring to compress it 3 kJ\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-5 ,Page No.174"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given values\n",
- "m=0.025;#mass of saturated water vapor in kg\n",
- "V=120;#rated voltage of heater in V\n",
- "I=0.2;#rated current in A\n",
- "t=300;#total time taken in sec\n",
- "P1=300;#constant pressure in kPa\n",
- "Qout=3.7;#heat lost in kJ\n",
- "\n",
- "#from Table A\u20135\n",
- "#at P1 the conditon is sat. vap\n",
- "h1=2724.9;\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Part - a\n",
- "#therotical proving\n",
- "\n",
- "#Part - b\n",
- "We=V*I*t/1000;#electrical work in kJ\n",
- "#from eqn 4 -18 i.e derived in earler part\n",
- "#it states it Ein - Eout = Esystem\n",
- "# it applies as Win - Qout = H = m (h2 - h1)\n",
- "h2=(We-Qout)/m+h1;\n",
- "##from Table A\u20135\n",
- "#at h2 we get\n",
- "P2=300;\n",
- "T=200;\n",
- "print'the final temperature of the steam %i C'%T\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the final temperature of the steam 200 C\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-6 ,Page No.176"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "m=5.0;#mass of water in kg\n",
- "P1=200;#pressure on one side in kPa\n",
- "T=25;#temperature in C\n",
- "\n",
- "#from Table A\u20134\n",
- "#the liq. is in compressed state at 200 kPa and 25 C\n",
- "vf=0.001;\n",
- "vg=43.340;\n",
- "uf=104.83;\n",
- "ufg=2304.3;\n",
- "v1=vf;\n",
- "u1=uf;\n",
- "\n",
- "#calculations\n",
- "\n",
- "#Part - a\n",
- "V1=m*v1;\n",
- "Vtank=2*V1;\n",
- "print'the volume of the tank %f m^3'%round(Vtank,2);\n",
- "\n",
- "#Part - b\n",
- "V2=Vtank;\n",
- "v2=V2/m;\n",
- "#from Table A\u20134 \n",
- "# at T=25 vf=0.101003 m^3/kg and vg=43.340 m^3/kg\n",
- "# vf<v2<vg therefore it is saturated liquid\u2013vapor mixture\n",
- "P2=3.1698;\n",
- "print'the final pressure %f kPa'%round(P2,4);\n",
- "\n",
- "#Part - c\n",
- "#Ein - Eout = Esystem\n",
- "#Qin= dU = m(u2 - u1)\n",
- "x2=(v2-vf)/(vg-vf);\n",
- "u2=uf+x2*ufg;\n",
- "Qin=m*(u2-u1);\n",
- "print'the heat transfer for this process %f kJ'%Qin\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the volume of the tank 0.010000 m^3\n",
- "the final pressure 3.169800 kPa\n",
- "the heat transfer for this process 0.265846 kJ\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-7 ,Page No.183"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "from scipy.integrate import quad \n",
- "from pylab import *\n",
- "\n",
- "#given data\n",
- "T1=300;#intial temp of air in K\n",
- "P=200;#pressure in kPa\n",
- "T2=600;#final temp in K\n",
- "M=28.97;#molecular weight in kg/kmol\n",
- "Ru=8.314;\n",
- "\n",
- "#Part - a\n",
- "#from Table A\u201317\n",
- "u1=214.07;\n",
- "u2=434.78;\n",
- "du=u2-u1;#change in internal energy\n",
- "print'change in internal energy from data from the air table %f kJ/kg'%round(du,2);\n",
- "\n",
- "#Part - b\n",
- "#from Table A\u20132c\n",
- "a=28.11;\n",
- "b=0.1967*10**-2;\n",
- "c=0.4802*10**-5;\n",
- "d=-1.966*10**-9;\n",
- "# by equation Cp(T)=a+bT+cT^2+dT^3\n",
- "def intgrnd1(T): \n",
- " return ((a-Ru)+b*T+c*T**2+d*T**3)\n",
- "dU, err = quad(intgrnd1, T1, T2) \n",
- "du=dU/M;\n",
- "print'change in internal energy the functional form of the specific heat %f kJ/kg'%round(du,1); \n",
- "\n",
- "#Part - c\n",
- "#from Table A\u20132b\n",
- "Cavg=0.733;\n",
- "du=Cavg*(T2-T1);\n",
- "print'change in internal energy the functional form the average specific heat value %i kJ/kg'%round(du,0);\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "change in internal energy from data from the air table 220.710000 kJ/kg\n",
- "change in internal energy the functional form of the specific heat 222.500000 kJ/kg\n",
- "change in internal energy the functional form the average specific heat value 220 kJ/kg\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-8 ,Page No.184"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "m=1.5;#mass in lbm\n",
- "T1=80;#temperature in F\n",
- "P1=50;#pressure in psia\n",
- "W=0.02;#power rating in hp\n",
- "t=30.0/60;#converting into hrs from min\n",
- "\n",
- "#from Table A\u20132Ea\n",
- "Cv=0.753;\n",
- "\n",
- "#calculations\n",
- "\n",
- "#part a\n",
- "Wsh=W*t*2545;#in Btu\n",
- "#Ein - Eout = Esystem\n",
- "#Wsh = dU = m (u2 - u1) = m * Cv * (T2 - T1)\n",
- "T2= Wsh/(m*Cv)+T1;\n",
- "print'the final temperature %f F'%round(T2,1);\n",
- "\n",
- "#part b\n",
- "#using ideal gas eqn\n",
- "# P1 * V1 / T1 = P2 * T2 /V2\n",
- "P2= 50 * (T2 +460)/ (T1+460);\n",
- "# temp should in R therefore + 460\n",
- "print'the final pressure %f psia'%round(P2,1)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the final temperature 102.500000 F\n",
- "the final pressure 52.100000 psia\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-9 ,Page No.185"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "V1=0.5;#volumne of nitrogen gas in m^3\n",
- "P=400;#pressure in kPa\n",
- "T1=27;#temp in C\n",
- "I=2;#rated current in A\n",
- "t=5*60;#converting into s from min\n",
- "V=120;#rated voltage in V\n",
- "Qout=2800/1000;#in kJ\n",
- "R=0.297;\n",
- "\n",
- "#from Table A\u20132a\n",
- "Cp=1.039;\n",
- " \n",
- "#calculations\n",
- "P1=P;\n",
- "We=V*I*t/1000;#in kJ\n",
- "m=P1*V1/(R*(T1+273));\n",
- "#Ein - Eout = Esystem\n",
- "# We,in - Qout = dH = m (h2 - h1) = m * Cp * (T2 - T1)\n",
- "T2=(We-Qout)/(m*Cp)+T1;\n",
- "print'the final temperature of nitrogen in %i C'%T2\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the final temperature of nitrogen in 57 C\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-10 ,Page No.187"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "P1=150;#initially air pressure in kPa\n",
- "P2=350;#final pressure in kPa\n",
- "T1=27+273;#temperatuere in K\n",
- "V1=400.0/1000;#volumne in m^3\n",
- "R=0.287;\n",
- "\n",
- "#from Table A\u201317\n",
- "u1=214.07;\n",
- "u2=1113.52;\n",
- "\n",
- "#calculations\n",
- "\n",
- "#part a\n",
- "V2=2*V1;\n",
- "#using ideal gas eqn\n",
- "# P1 * V1 / T1 = P2 * T2 /V2\n",
- "T2=P2*V2*T1/(P1*V1);\n",
- "print'the final temperature %i K'%T2;\n",
- "\n",
- "#part b\n",
- "# Work done is Pdv\n",
- "W=P2*(V2-V1);\n",
- "print'the work done by the air %i kJ'%W;\n",
- "\n",
- "#part c\n",
- "#Ein - Eout = Esystem\n",
- "#Qin - Wout = dU = m(u2 - u1)\n",
- "m= P1* V1 /(T1 * R);\n",
- "Q= m*(u2 - u1)+ W;\n",
- "print'the total heat transferred to the air %i kJ'%round(Q)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the final temperature 1400 K\n",
- "the work done by the air 140 kJ\n",
- "the total heat transferred to the air 767 kJ\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-11 ,Page No.190"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "T=100;#twmperature of liquid water in C\n",
- "P=15;#pressure in MPa\n",
- "\n",
- "#from Table A\u20137\n",
- "#at P=15 mPa and T = 100 C\n",
- "hg=430.39;\n",
- "hf=419.17\n",
- "vf=0.001;\n",
- "Psat=101.42;#in kPa\n",
- "\n",
- "#calculations\n",
- "\n",
- "#part a\n",
- "h=hg;\n",
- "print'enthalpy of liquid water by using compressed liquid tables %f kJ/kg'%round(h,2);\n",
- "\n",
- "#part b\n",
- "#Approximating the compressed liquid as a saturated liquid at 100\u00b0C\n",
- "h=hf;\n",
- "print'enthalpy of liquid water by approximating it as a saturated liquid %f kJ/kg'%round(h,2);\n",
- "\n",
- "#part c\n",
- "h=hf + vf*(P*1000 - Psat );\n",
- "print'enthalpy of liquid water by using the correction given by Eq. 4\u201338 %f kJ/kg'%round(h,2);\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "enthalpy of liquid water by using compressed liquid tables 430.390000 kJ/kg\n",
- "enthalpy of liquid water by approximating it as a saturated liquid 419.170000 kJ/kg\n",
- "enthalpy of liquid water by using the correction given by Eq. 4\u201338 434.070000 kJ/kg\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-12 ,Page No.191"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#suffix i for iron\n",
- "#suffix w for water\n",
- "#given data\n",
- "mi=50;#mass in Kg\n",
- "T1i=80;#temperature in C \n",
- "Vw=0.5;#volumne in m^3\n",
- "T1w=25;#temperature in C \n",
- "v=0.001;#specific volume of liquid water at or about room temperature\n",
- "\n",
- "#from Table A\u20133\n",
- "ci=0.45;\n",
- "cw=4.18;\n",
- "\n",
- "#calculations\n",
- "mw=Vw/v;\n",
- "#Ein - Eout = Esystem\n",
- "# du = 0 i.e (mcdT)iron + (mcdT)water = 0\n",
- "# mi * ci * (T - T1i) + mw *cw * (T-T1w)\n",
- "#on rearranging above equn\n",
- "T= (mi*ci*T1i + mw*cw*T1w)/(mi*ci+mw*cw);\n",
- "print'the temperature when thermal equilibrium is reached %f C'%round(T,1)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the temperature when thermal equilibrium is reached 25.600000 C\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-13 ,Page No.191"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "from math import sqrt\n",
- "\n",
- "#given data\n",
- "maf=0.15;#mass of affected tissue in kg\n",
- "caf=3.8;#specific heat of the tissue in kJ/Kg C\n",
- "dTaf=1.8;#suffix af for affected tissue\n",
- "mh=1.2;#suffix h for hand ; mass of hand in kg\n",
- "\n",
- "#calculations\n",
- "#Ein - Eout = Esystem\n",
- "#dUaffected tissue - KEhand = 0\n",
- "#from above equation we can deduce that\n",
- "Vhand= sqrt(2*maf*caf*dTaf*1000/mh);#for conversion factor mutiplying by 1000 to get m^2/s^2\n",
- "print'the velocity of the hand just before impact %f m/s'%round(Vhand,1);"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "the velocity of the hand just before impact 41.400000 m/s\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-14 ,Page No.199"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "m=90;#mass of man in kg\n",
- "\n",
- "#from Tables 4\u20131 and 4\u20132\n",
- "Ehb=275;#hamburger\n",
- "Ef=250;#fries\n",
- "Ec=87;#cola\n",
- "\n",
- "#calculation\n",
- "\n",
- "#part a\n",
- "Ein=2*Ehb+Ef+Ec;\n",
- "#The rate of energy output for a 68-kg man watching TV is to be 72 Calories/h\n",
- "Eout=m*72.0/68;\n",
- "t=Ein/Eout;\n",
- "print'by watching TV %f hours'%round(t,1);\n",
- "\n",
- "#part b\n",
- "#The rate of energy output for a 68-kg man watching TV is to be 860 Calories/h\n",
- "Eout=m*860.0/68;\n",
- "t=Ein/Eout*60#converting in min\n",
- "t=ceil(t);\n",
- "print'by fast swimming %f mins'%t;\n",
- "\n",
- "#for last question\n",
- "print('answers be for a 45-kg man energy takes twice as long in each case');\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "by watching TV 9.300000 hours\n",
- "by fast swimming 47.000000 mins\n",
- "answers be for a 45-kg man energy takes twice as long in each case\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4-15 ,Page No.199"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#given data\n",
- "E=75;#in Cal/day\n",
- "\n",
- "#calculation\n",
- "Ereduced=E*365.0;\n",
- "#The metabolizable energy content of 1 kg of body fat is 33,100 kJ\n",
- "Ec=33100.0;\n",
- "mfat=Ereduced/Ec*4.1868;\n",
- "print'weight this person will lose in one year %f kg'%round(mfat,2)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "weight this person will lose in one year 3.460000 kg\n"
- ]
- }
- ],
- "prompt_number": 41
- }
- ],
- "metadata": {}
- }
- ]
-}
\ No newline at end of file |