diff options
author | Prashant S | 2020-04-14 10:25:32 +0530 |
---|---|---|
committer | GitHub | 2020-04-14 10:25:32 +0530 |
commit | 06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch) | |
tree | 2b1df110e24ff0174830d7f825f43ff1c134d1af /Thermodynamics_by_Gaggioli_and_Obert | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
parent | 476705d693c7122d34f9b049fa79b935405c9b49 (diff) | |
download | all-scilab-tbc-books-ipynb-master.tar.gz all-scilab-tbc-books-ipynb-master.tar.bz2 all-scilab-tbc-books-ipynb-master.zip |
Initial commit
Diffstat (limited to 'Thermodynamics_by_Gaggioli_and_Obert')
16 files changed, 4728 insertions, 0 deletions
diff --git a/Thermodynamics_by_Gaggioli_and_Obert/1-Survey_of_Units_and_Dimensions.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/1-Survey_of_Units_and_Dimensions.ipynb new file mode 100644 index 0000000..fa77488 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/1-Survey_of_Units_and_Dimensions.ipynb @@ -0,0 +1,194 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Survey of Units and Dimensions" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1: Force_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"gc=32.1739 //lbm ft/lbf s^2\n", +"m=10 //lbm\n", +"a=10 //ft/s^2\n", +"//calculations\n", +"F=m*a/gc\n", +"//results\n", +"printf('Force to accelerate = %.3f lbf',F)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2: Force_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"gc=32.1739 //lbm ft/lbf s^2\n", +"m=10 //lbm\n", +"a=gc //ft/s^2\n", +"//calculations\n", +"F=m*a/gc\n", +"//results\n", +"printf('Force to accelerate = %d lbf',F)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.3: velocity_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v=88 //ft/s\n", +"//calculations\n", +"v2=v*3600/5280\n", +"//results\n", +"printf('velocity = %d mph',v2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.4: velocity_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"v=88 //ft/s\n", +"//calculations\n", +"v2=v*1/5280*3600\n", +"//results\n", +"printf('velocity = %d mph',v2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.5: Force_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"F=5e-9 //lbf/ft^2 hr\n", +"g=32.1739\n", +"//calculations\n", +"F2=F*3600*g\n", +"//results\n", +"printf('Force without dimensions = %.2e lbm/ft sec',F2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.6: density_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"rho=62.305 //lbf/ft^2\n", +"g=32.1739 //ft/s^2\n", +"//calculations\n", +"gam=rho/g\n", +"//results\n", +"printf('Density of water in this system = %.3f lbf/ft^2',gam)\n", +"printf('\n Specific weight = %.3f lbf/ft^2',rho)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/10-The_Pvt_relationships.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/10-The_Pvt_relationships.ipynb new file mode 100644 index 0000000..07874fc --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/10-The_Pvt_relationships.ipynb @@ -0,0 +1,138 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: The Pvt relationships" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.1: Pressure_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"\n", +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m=1 //lbm\n", +"T1=212+460 //R\n", +"sv=0.193 //ft^3/lbm\n", +"M=44\n", +"a=924.2 //atm ft^2 /mole^2\n", +"b=0.685 //ft^3/mol\n", +"R=0.73 //atm ft^3/R mol\n", +"//calculations\n", +"v=sv*M\n", +"p=R*T1/v\n", +"p2=R*T1/(v-b) -a/v^2\n", +"//results\n", +"disp('For ideal gas case, Table B-6 and for vanderwaals case, Table B-8 have been used')\n", +"printf('\n In vanderwaals equation, pressure = %.1f atm',p2)\n", +"printf('\n In ideal gas case, pressure = %.1f atm',p)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.2: volume_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m=1 //lbm\n", +"p=50.9 //atm\n", +"t=212+460 //R\n", +"R=0.73\n", +"//calculations\n", +"pc=72.9 //atm\n", +"tc=87.9 +460 //R\n", +"pr=p/pc\n", +"Tr=t/tc\n", +"z=0.88\n", +"v=z*R*t/p\n", +"//results\n", +"printf('volume = %.3f ft^3/mole',v)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.3: Pressure_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t=212+460 //R\n", +"v=0.193 //ft^3/lbm\n", +"M=44\n", +"R=0.73\n", +"//calculations\n", +"tc=87.9+460 //F\n", +"zc=0.275\n", +"vc=1.51 //ft^3/mol\n", +"tr=t/tc\n", +"vr=v*M/vc\n", +"vrd=vr*zc\n", +"z=0.88\n", +"p=z*R*t/(M*v)\n", +"//results\n", +"printf('Pressure = %.1f atm',p)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/11-The_Ideal_gas_and_mixture_relationships.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/11-The_Ideal_gas_and_mixture_relationships.ipynb new file mode 100644 index 0000000..cbb9ad7 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/11-The_Ideal_gas_and_mixture_relationships.ipynb @@ -0,0 +1,611 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: The Ideal gas and mixture relationships" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.10: Entropy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T2=546.6 //R\n", +"T1=520 //R\n", +"T3=560 //R\n", +"v2=1389.2\n", +"v1=186.2\n", +"R0=1.986\n", +"c1=5.02\n", +"c2=4.97\n", +"n1=1\n", +"n2=2\n", +"v3=1203\n", +"//calculations\n", +"ds1=n1*c1*log(T2/T1) + n1*R0*log(v2/v1)\n", +"ds2=n2*c2*log(T2/T3)+n2*R0*log(v2/v3)\n", +"ds=ds1+ds2\n", +"ds3=n1*c1*log(T2/T1)+n2*c2*log(T2/T3)\n", +"ds4=n2*R0*log(v2/v3)+ n1*R0*log(v2/v1)\n", +"dss=ds3+ds4\n", +"//results\n", +"printf('Change in entropy for gas 1 = %.3f Btu/R',ds1)\n", +"printf('\n Change in entropy for gas 1 = %.3f Btu/R',ds2)\n", +"printf('\n Net change in entropy = %.3f Btu/R',ds)\n", +"printf('\n In case 2, change in entropy = %.3f Btu/R',dss)\n", +"disp('The answer is a bit different due to rounding off error in the textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.11: Entropy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=1 //lbm\n", +"m2=0.94 //lbm\n", +"M1=29\n", +"M2=18\n", +"p1=50 //psia\n", +"p2=100 //psia\n", +"t1=250 +460 //R\n", +"R0=1.986\n", +"cpa=6.96\n", +"cpb=8.01\n", +"//calculations\n", +"xa = (m1/M1)/((m1/M1)+ m2/M2)\n", +"xb=1-xa\n", +"t2=t1*(p2/p1)^(R0/(xa*cpa+xb*cpb))\n", +"d=R0/(xa*cpa+xb*cpb)\n", +"k=1/(1-d)\n", +"dsa=cpa*log(t2/t1) -R0*log(p2/p1)\n", +"dSa=(m1/M1)*dsa\n", +"dSw=-dSa\n", +"dsw=dSw*M2/m2\n", +"//results\n", +"printf('Final remperature = %d R',t2)\n", +"printf('\n Change in entropy of air = %.3f btu/mole R and %.5f Btu/R',dsa,dSa)\n", +"printf('\n Change in entropy of water = %.4f btu/mole R and %.5f Btu/R',dsw,dSw)\n", +"disp('The answers are a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.12: Volume_and_mass_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=250 + 460 //R\n", +"p=29.825 //psia\n", +"pt=50 //psia\n", +"vg=13.821 //ft^3/lbm\n", +"M=29\n", +"R=10.73\n", +"//calculations\n", +"pa=pt-p\n", +"V=1/M *R*T/pa\n", +"ma=V/vg\n", +"xa=p/pt\n", +"mb=xa/M *18/(1-xa)\n", +"//results\n", +"printf('In case 1, volume occupied = %.2f ft^3',V)\n", +"printf('\n In case 1, mass of steam = %.2f lbm steam',ma)\n", +"printf('\n In case 2, mass of steam = %.3f lbm steam',mb)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.13: Percentage_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ps=0.64 //psia\n", +"p=14.7 //psia\n", +"M=29\n", +"M2=46\n", +"//calculations\n", +"xa=ps/p\n", +"mb=xa*9/M *M2/(1-xa)\n", +"//results\n", +"printf('percentage = %.1f percent',mb*100)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.14: Partial_Pressure_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ps=0.5069 //psia\n", +"p=20 //psia\n", +"m1=0.01\n", +"m2=1\n", +"M1=18\n", +"M2=29\n", +"//calculations\n", +"xw= (m1/M1)/(m1/M1+m2/M2)\n", +"pw=xw*p\n", +"//results\n", +"printf('partial pressure of water vapor = %.3f psia',pw)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.1: Work_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n=1.3\n", +"T1=460+60 //R\n", +"P1=14.7 //psia\n", +"P2=125 //psia\n", +"R=1545\n", +"M=29\n", +"//calculations\n", +"T2=T1*(P2/P1)^((n-1)/n)\n", +"wrev=R/M *(T2-T1)/(1-n)\n", +"//results\n", +"printf('Work done = %d ft-lbf/lbm',wrev)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.2: Kinetic_energy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P2=10 //psia\n", +"P1=100 //psia\n", +"T1=900 //R\n", +"w=50 //Btu/lbm\n", +"k=1.39\n", +"cp=0.2418\n", +"//calculations\n", +"T2=T1*(P2/P1)^((k-1)/k)\n", +"T2=477\n", +"KE=-w-cp*(T2-T1)\n", +"//results\n", +"printf('Change in kinetic energy = %.1f Btu/lbm',KE)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.3: Temperature_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T1=900 //R\n", +"P1=100 //psia\n", +"P2=10 //psia\n", +"//calculations\n", +"disp('From table B-9')\n", +"pr1=8.411\n", +"pr2=pr1*P2/P1\n", +"T2=468 //R\n", +"//results\n", +"printf('Final temperature = %d R ',T2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.4: Temperature_work_and_Enthalpy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cr=6\n", +"p1=14.7 //psia\n", +"t1=60.3 //F\n", +"M=29\n", +"R=1.986\n", +"//calculations\n", +"disp('from table b-9')\n", +"vr1=158.58 \n", +"u1=88.62 //Btu/lbm\n", +"pr1=1.2147\n", +"vr2=vr1/cr\n", +"T2=1050 //R\n", +"u2=181.47 //Btu/lbm\n", +"pr2=14.686\n", +"p2=p1*(pr2/pr1)\n", +"dw=u1-u2\n", +"h2=u2+T2*R/M\n", +"//results\n", +"printf('final temperature = %d R',T2)\n", +"printf('\n final pressure = %.1f psia',p2)\n", +"printf('\n work done = %.2f Btu/lbm',dw)\n", +"printf('\n final enthalpy = %.1f Btu/lbm',h2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.5: Weight_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=10 //lbm\n", +"m2=15 //lnm\n", +"p=50 //psia\n", +"t=60+460 //R\n", +"M1=32\n", +"M2=28.02\n", +"R0=10.73 \n", +"//calculations\n", +"n1=m1/M1\n", +"n2=m2/M2\n", +"x1=n1/(n1+n2)\n", +"x2=n2/(n1+n2)\n", +"M=x1*M1+x2*M2\n", +"R=R0/M\n", +"V=(n1+n2)*R0*t/p\n", +"rho=p/(R0*t)\n", +"rho2=M*rho\n", +"p1=x1*p\n", +"p2=x2*p\n", +"v1=x1*V\n", +"v2=x2*V\n", +"//results\n", +"disp('part a')\n", +"printf('Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively',x1,x2)\n", +"disp('part b')\n", +"printf('Average molecular weight = %.1f ',M)\n", +"disp('part c')\n", +"printf('specific gas constant = %.4f psia ft^3/lbm R',R)\n", +"disp('part d')\n", +"printf('volume of mixture = %.1f ft^3',V)\n", +"printf('density of mixture is %.5f mole/ft^3 and %.2f lbm/ft^3',rho,rho2)\n", +"disp('part e')\n", +"printf('partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively' ,p1,p2)\n", +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=10 //lbm\n", +"m2=15 //lnm\n", +"p=50 //psia\n", +"t=60+460 //R\n", +"M1=32\n", +"M2=28.02\n", +"R0=10.73 \n", +"//calculations\n", +"n1=m1/M1\n", +"n2=m2/M2\n", +"x1=n1/(n1+n2)\n", +"x2=n2/(n1+n2)\n", +"M=x1*M1+x2*M2\n", +"R=1545/M\n", +"V=(n1+n2)*R0*t/p\n", +"rho=p/(R0*t)\n", +"rho2=M*rho\n", +"p1=x1*p\n", +"p2=x2*p\n", +"v1=x1*V\n", +"v2=x2*V\n", +"pt=p1+p2\n", +"vt=v1+v2\n", +"//results\n", +"disp('part a')\n", +"printf('Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively',x1,x2)\n", +"disp('part b')\n", +"printf('Average molecular weight = %.1f ',M)\n", +"disp('part c')\n", +"printf('specific gas constant = %.4f lbf ft/lbm R',R)\n", +"disp('part d')\n", +"printf('volume of mixture = %.1f ft^3',V)\n", +"printf('\n density of mixture is %.5f mole/ft^3 and %.3f lbm/ft^3',rho,rho2)\n", +"disp('part e')\n", +"printf('partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively' ,p1,p2)\n", +"printf('\n partial volumes of oxygen and nitrogen are %.2f ft^3 and %.2f ft^3 respectively',v1,v2)\n", +"printf('\n Net partial pressure in case of oxygen = %.2f psia',pt)\n", +"printf('\n Net partial volume =%.2f ft^3',vt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.6: Analysis_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"\n", +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=5.28\n", +"m2=1.28\n", +"m3=23.52\n", +"//calculations\n", +"m=m1+m2+m3\n", +"x1=m1/m\n", +"x2=m2/m\n", +"x3=m3/m\n", +"C=12/44 *m1/ m\n", +"O=(32/44 *m1 + m2)/m\n", +"N=m3/m\n", +"sum1=(x1+x2+x3)*100\n", +"sum2=(C+N+O)*100\n", +"//results\n", +"printf('From gravimetric analysis, co2 = %.1f percent , o2 = %.1f percent and n2 = %.1f percent',x1*100,x2*100,x3*100)\n", +"printf('\n From ultimate analysis, co2 = %.2f percent , o2 = %.2f percent and n2 = %.2f percent',C*100,O*100,N*100)\n", +"printf('\n Sum in case 1 = %.1f percent',sum1)\n", +"printf('\n Sum in case 2 = %.1f percent',sum2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.7: Entropy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x1=1/3\n", +"n1=1\n", +"n2=2\n", +"x2=2/3\n", +"p=12.7 //psia\n", +"cp1=7.01 //Btu/mole R\n", +"cp2=6.94 //Btu/mole R\n", +"R0=1.986\n", +"T2=460+86.6 //R\n", +"T1=460 //R\n", +"p0=14.7 //psia\n", +"//calculations\n", +"p1=x1*p\n", +"p2=x2*p\n", +"ds1= cp1*log(T2/T1) - R0*log(p1/p0)\n", +"ds2= cp2*log(T2/T1) - R0*log(p2/p0)\n", +"S=n1*ds1+n2*ds2\n", +"//results\n", +"printf('Entropy of mixture = %.2f Btu/R',S)\n", +"printf('\n the answer given in textbook is wrong. please check using a calculator')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.8: Internal_energy_and_entropy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"c1=4.97 //Btu/mol R\n", +"c2=5.02 //Btu/mol R\n", +"n1=2\n", +"n2=1\n", +"T1=86.6+460 //R\n", +"T2=50+460 //R\n", +"//calculations\n", +"du=(n1*c1+n2*c2)*(T2-T1)\n", +"ds=(n1*c1+n2*c2)*log(T2/T1)\n", +"//results\n", +"printf('Change in internal energy = %d Btu',du)\n", +"printf('\n Change in entropy = %.3f Btu/R',ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9: Pressure_and_temperature_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n1=1\n", +"n2=2\n", +"c1=5.02\n", +"c2=4.97\n", +"t1=60 //F\n", +"t2=100 //F\n", +"R0=10.73\n", +"p1=30 //psia\n", +"p2=10 //psia\n", +"//calcualtions\n", +"t=(n1*c1*t1+n2*c2*t2)/(n1*c1+n2*c2)\n", +"V1= n1*R0*(t1+460)/p1\n", +"V2=n2*R0*(t2+460)/p2\n", +"V=V1+V2\n", +"pm=(n1+n2)*R0*(t+460)/V\n", +"//results\n", +"printf('Pressure of mixture = %.1f psia',pm)\n", +"printf('\n Mixing temperature = %.1f F',t)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/12-Non_steady_flow_friction_and_availability.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/12-Non_steady_flow_friction_and_availability.ipynb new file mode 100644 index 0000000..7bfe834 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/12-Non_steady_flow_friction_and_availability.ipynb @@ -0,0 +1,336 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12: Non steady flow friction and availability" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.1: Work_done_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=100 //psia\n", +"p2=14.7 //psia\n", +"k=1.4\n", +"T1=700 //R\n", +"R=10.73/29\n", +"V=50\n", +"cv=0.171\n", +"cp=0.24\n", +"R2=1.986/29\n", +"//calculations\n", +"T2=T1/ (p1/p2)^((k-1)/k)\n", +"m1=p1*V/(R*T1)\n", +"m2=p2*V/(R*T2)\n", +"Wrev= cv*(m1*T1 - m2*T2) - (m1-m2)*(T2)*cp\n", +"//results\n", +"printf('Work done in case 1 = %d Btu',Wrev)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.2: Friction_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=100 //psia\n", +"p2=10 //psia\n", +"n=1.3\n", +"T1=800 //R\n", +"cv=0.172\n", +"R=1.986/29\n", +"T0=537 //R\n", +"cp=0.24\n", +"//calculations\n", +"T2=T1*(p2/p1)^((n-1)/n)\n", +"dwir=cv*(T1-T2)\n", +"dwr=R*(T2-T1)/(1-n)\n", +"dq=dwr-dwir\n", +"dI=-T0*(cp*log(T2/T1) - R*log(p2/p1))\n", +"//results\n", +"printf('The friction of the process per pound of air = %.1f Btu/lbm',dq)\n", +"printf('\n Loss of available energy = %.2f Btu/lbm',dI)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.3: Energy_loss_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ms=10 //lbm\n", +"den=62.3 //lbm/ft^3\n", +"A1=0.0218 //ft^2\n", +"A2=0.00545 //ft^2\n", +"p2=50 //psia\n", +"p1=100 //psia\n", +"gc=32.2 //ft/s^2\n", +"dz=30 //ft\n", +"T0=537 //R\n", +"T1=620 //R\n", +"T2=420 //R\n", +"//calculations\n", +"V1=ms/(A1*den)\n", +"V2=ms/(A2*den)\n", +"df=-144/den*(p2-p1) - (V2^2 -V1^2)/(2*gc) - dz\n", +"dI=-T0/T1 *df\n", +"dI2= -T0/T2 *df\n", +"//results\n", +"printf('Friction = %.1f ft-lbf/lbm',df)\n", +"printf('\n Available energy loss in case a = %.1f ft-lbf/lbm',dI)\n", +"printf('\n Available energy loss in case b = %.1f ft-lbf/lbm',dI2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.4: Pressure_drop_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"r=2.5 //in\n", +"mf=160 //cfm\n", +"rho=1/14\n", +"mu=0.0000121\n", +"v=14 //ft^3/lbm\n", +"g=32.2 //ft/s^2\n", +"z=100 //ft\n", +"//calculations\n", +"A=3.14*(r/12)^2\n", +"V=mf/A /60\n", +"Re=(2*r/12)*V*rho/mu\n", +"disp('From fig 12.4,')\n", +"f=0.0225/4\n", +"dp=4*f*(rho)*(V/v)^2 /(2*g*(2*r/12)) *z\n", +"//dp=2.32\n", +"//results\n", +"printf('Pressure drop = %.2f lbf/ft^2 100 ft',dp)\n", +"disp('The answer in the textbook is wrong. Please use a calculator to verify it.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.5: Mass_rate_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"D=0.0724 //ft\n", +"gc=32.2 //ft/s^2\n", +"rho=1/14\n", +"L=100 //ft\n", +"mu2=1.46*10^(-10)\n", +"dp=2.32\n", +"dia=5 //in\n", +"rho2=48500\n", +"vol=14 //ft^3/lbm\n", +"//calculations\n", +"ref=D^3 *2*dp*gc*rho/(mu2*L)\n", +"mf=rho2*%pi/4 *(dia/12) *sqrt(mu2)\n", +"mfr=mf*vol*60\n", +"//results\n", +"printf('Mass rate of air flow = %d cfm',mfr)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.6: Loss_and_effectiveness_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cp=0.25\n", +"T=3460 //R\n", +"T0=520 //R\n", +"dG=1228 //Btu/lbm\n", +"//calculations\n", +"hf=cp*(T-T0)-T0*cp*log(T/T0)\n", +"dC=hf-dG\n", +"Ec=hf/dG\n", +"//results\n", +"printf('Loss of available energy = %d Btu/lbm mixture ',dC)\n", +"printf('\n Effectiveness of combustion = %.3f ',Ec)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.7: Loss_and_effectiveness_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cp1=0.25\n", +"T=3460 //R\n", +"T0=946.2 //R\n", +"T00=520 //R\n", +"dG=1228 //Btu/lbm\n", +"cp=0.45\n", +"//calculations\n", +"dqa=cp1*(T-T0)\n", +"w=cp*dqa\n", +"hf=cp1*(T-T00)-T00*cp1*log(T/T00)\n", +"heat=w-hf\n", +"eff=w/hf\n", +"epower=w/dG\n", +"//results\n", +"printf('Loss of available energy = %.1f Btu/lbm mixture ',heat)\n", +"printf('\n Efficiency of cycle = %.3f ',eff)\n", +"printf('\n Effectiveness of overall cycle = %.2f',epower)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.8: Loss_and_effectiveness_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=400 //psia\n", +"t1=600 //F\n", +"h1=1306.9 //Btu/lbm\n", +"b1=480.9 //Btu/lbm\n", +"p2=50 //psia\n", +"h2=1122 //Btu/lbm\n", +"h3=1169.5 //Btu/lbm\n", +"b3=310.9 //Btu/lbm\n", +"//calculations\n", +"disp('All the values are obtained from Mollier chart,')\n", +"dw13=h1-h3\n", +"dw12=h1-h2\n", +"dasf=b3-b1\n", +"etae=dw13/dw12\n", +"eta=abs(dw13/dasf)\n", +"dq=dw13+dasf\n", +"//results\n", +"printf('Engine efficiency = %.1f percent',etae*100)\n", +"printf('\n Effectiveness = %.1f percent',eta*100)\n", +"printf('\n Loss of available energy = %.1f Btu/lbm',dq)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/13-Fluid_Flow.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/13-Fluid_Flow.ipynb new file mode 100644 index 0000000..b4f1534 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/13-Fluid_Flow.ipynb @@ -0,0 +1,667 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13: Fluid Flow" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.10: Thrust_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"M1=0.5\n", +"M2=1\n", +"A1=0.5 //ft^2\n", +"A2=1 //ft^2\n", +"p1=14.7 //psia\n", +"p2=14.7 //psia\n", +"k=1.4\n", +"//calculations\n", +"thru=p2*144*A2*(1+k*M2^2)-p1*144*A1*(1+k*M1^2)\n", +"net=thru-p1*144*(A2-A1)\n", +"//results\n", +"printf('Internal thrust = %d lbf',thru)\n", +"printf('\n Net thrust = %d lbf',net)\n", +"disp('The answers are a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.11: Mass_flow_rate_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=50 //psia\n", +"pr=0.58\n", +"//calculations\n", +"p=p1*pr\n", +"s1=1.6585\n", +"h1=1174.1 //Btu/lbm\n", +"sf=0.3680\n", +"sfg=1.3313\n", +"hfg=945.3\n", +"vg=13.746\n", +"hf=218.82\n", +"x= (s1-sf)/sfg\n", +"v2=vg*x\n", +"h2=hf+x*hfg\n", +"V2rev=223.77*sqrt(h1-h2)\n", +"m=%pi/4 *1/144 *V2rev/v2\n", +"//results\n", +"printf('mass flow rate = %.3f lbm/sec',m)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.12: Mass_flow_rate_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"k=1.31\n", +"p1=7200 //lbf/ft^2\n", +"v1=8.515 //ft^3/lbm\n", +"pr=0.6\n", +"m1=0.574\n", +"T1=741 //R\n", +"//calculations\n", +"V2rev=8.02*sqrt(k/(k-1) *p1*v1*(1- (pr)^((k-1)/k)))\n", +"v2=v1*(1/pr)^(1/k)\n", +"m=%pi/4 *1/144 *V2rev/v2\n", +"C=m/m1\n", +"T2=T1*(0.887)\n", +"t=250+460 //R\n", +"dt=t-T2\n", +"//results\n", +"printf('Mass flow rate = %.3f lbm/sec',m)\n", +"printf('\n Meta stable under cooling = %d F',dt)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.13: Area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"C=0.98\n", +"m=1\n", +"v=12.55 //ft^3/lbm\n", +"V=1372 //ft/s\n", +"//calculations\n", +"A=m*v/(C*V) *144\n", +"D=sqrt(A*4/%pi)\n", +"//results\n", +"printf('Area = %.3f in^2',A)\n", +"printf('\n diameter = %.2f in',D)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.14: Area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"nn=0.95\n", +"p1=50 //psia\n", +"p2=30 //psia\n", +"v1=8.515\n", +"m=1 //lbm\n", +"//calculations\n", +"cv=sqrt(nn)\n", +"V2rev=1372\n", +"V2act=cv*V2rev\n", +"n=1.283\n", +"v2=v1*(p1/p2)^(1/n)\n", +"A=m*v2/V2act *144\n", +"D=sqrt(A*4/%pi)\n", +"//results\n", +"printf('Area = %.2f in^2',A)\n", +"printf('\n diameter = %.3f in',D)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.15: Area_of_discharge_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"dFf=110.5 //ft-lbf/lbm\n", +"Vd=1028 //ft/s\n", +"gc=32.2 //ft/s^2\n", +"p0=100 //psia\n", +"k=1.4\n", +"v0=2.08\n", +"p1=55 //psia\n", +"p2=99.2 //psia\n", +"//calculations\n", +"dFe=0.01*Vd^2 /(2*gc)\n", +"dF=dFf+dFe\n", +"V2ig=(p0*144)^(1/k) *v0/(1-1/k) *((p1*144)^(1-1/k) -(p2*144)^(1-1/k))\n", +"C2=(V2ig+dF)/V2ig\n", +"C=sqrt(C2)\n", +"//results\n", +"printf('Coefficient of discharge = %.3f ',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.16: Pressure_drop_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"dL=1/6 //ft\n", +"mf=0.430 //lbm/sec\n", +"rho=62.4 \n", +"gc=32.2 //ft/s^2\n", +"d=0.81/12 //ft\n", +"//calculations\n", +"V=mf*4/(rho*%pi)\n", +"VD=V/dL^2\n", +"Vd=1.92 //ft/s\n", +"dFf=0.031/(2*gc) *2.31\n", +"dFe=0.04*Vd^2 /(2*gc)\n", +"dF=dFf+dFe\n", +"dp=rho*(3.5/(2*gc) +dF)\n", +"vd22=(2*gc)/rho *dp /(1-(d/dL)^4)\n", +"vd2=sqrt(vd22)\n", +"C=Vd/vd2\n", +"//results\n", +"printf('Pressure drop in the nozzle = %.2f lbf/ft^2',dp)\n", +"printf('\n Coefficient of discharge = %.3f ',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.17: Mass_flow_rate_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"K=0.6003\n", +"Y1=0.91\n", +"D1=6.065\n", +"D2=1.820\n", +"rho1=0.156\n", +"p1=30\n", +"p2=20.18\n", +"//calculations\n", +"bet=D2/D1\n", +"m=0.525*K*Y1 *D2^2 *sqrt(rho1*(p1-p2))\n", +"C=K*sqrt(1-bet^4)\n", +"//results\n", +"printf('mass flow rate = %.3f lbm/sec',m)\n", +"printf('\n Coefficient of discharge = %.3f',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.1: Velocity_and_area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"h1=1329.1 //Btu/lbm\n", +"v1=6.218 //ft^3/lbm\n", +"J=778\n", +"g=32.174\n", +"m=1\n", +"//calculations\n", +"p=[80 60 54.6 40 20]\n", +"h=[ 1304.1 1273.8 1265 1234.2 1174.8]\n", +"v=[ 7.384 9.208 9.844 12.554 21.279]\n", +"Fc=1\n", +"V2=Fc*sqrt(2*J*g*(h1-h))\n", +"A=m*v ./V2\n", +"V2=[0 V2]\n", +"A=[0 A]\n", +"//results\n", +"disp('velocity (ft/s)= ')\n", +"disp(V2 )\n", +"disp('Area (ft^2)= ')\n", +"disp(A)\n", +"disp('The initial values of velocity and area are 0 and infinity respectively. Since, Infinity in calculations stops the code to display an error. It has been mentioned separately.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.2: Area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n=1.4\n", +"p1=50 //psia\n", +"J=778\n", +"cp=0.24\n", +"T1=520 //R\n", +"k=n\n", +"R=1545/29\n", +"m=1\n", +"p2=10 //psia\n", +"//calculations\n", +"rpt=(2/(n+1))^(n/(n-1))\n", +"pt=p1*rpt\n", +"Vtrev=223.77*sqrt(cp*T1*(1- rpt^((k-1)/k)))\n", +"v1=R*T1/p1/144\n", +"vt=v1*(p1/pt)^(1/k)\n", +"At=m*vt/Vtrev\n", +"V2rev=223.77*sqrt(cp*T1*(1-(p2/p1)^((k-1)/k)))\n", +"v2=v1*(p1/p2)^(1/k)\n", +"A2=m*v2/V2rev\n", +"//results\n", +"printf('Area required = %.5f ft^2',At)\n", +"printf('\n Area in case 2 at the exit= %.5f ft^2',A2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.3: Area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"J=778\n", +"g=32.2\n", +"pc=54.6 //psia\n", +"h1=1329.1 //Btu/lbm\n", +"h2=1265 //btu/lbm\n", +"V2rev=1790 //ft/s\n", +"cv=0.99\n", +"m=1 //lbm\n", +"cv2=0.96\n", +"//calculations\n", +"V2d=cv*V2rev\n", +"hd=cv^2 *(h1-h2)\n", +"h2d=h1-hd\n", +"v2d=9.946\n", +"A2d=m*v2d/V2d\n", +"//results\n", +"printf('Throat area= %.4f ft^2',A2d)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.4: velocity_and_flow_rate_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"zm=0.216\n", +"pm=62.3 //lbm/ft^2\n", +"p1=0.0736 //lbm/ft^2\n", +"g=32.2\n", +"d=4\n", +"//calculations\n", +"H=zm*(pm-p1)/12/p1\n", +"V=sqrt(2*g*H)\n", +"m=%pi/4 *d^2 *V*p1\n", +"//results\n", +"printf('average velocity = %.1f ft/sec',V)\n", +"printf('\n mass flow rate = %.1f lbm/sec',m)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.5: Area_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p0=50 //psia\n", +"T0=520 //R\n", +"rho0=0.259 //lbm/ft^3\n", +"p2=10 //psia\n", +"mf=1 //lbm\n", +"//calculations\n", +"disp('From table B-17,')\n", +"pr=0.528\n", +"Tr=0.833\n", +"rhor=0.634\n", +"ps=pr*p0\n", +"Ts=Tr*T0\n", +"rhos=rho0*rhor\n", +"Vs=49.1*sqrt(Ts)\n", +"As=mf/(Vs*rhos)\n", +"p2r=p2/p0\n", +"M2=1.71\n", +"V2=1.487*Vs\n", +"T2=0.632*Ts\n", +"A2=As*1.35\n", +"rho2=rhos*0.317\n", +"//results\n", +"printf('Area of throat = %.5f ft^2',As)\n", +"printf('\n Area of exit = %.5f ft^2',A2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.6: Length_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"M1=0.2\n", +"M2=0.4\n", +"D=0.5 //ft\n", +"f=0.015\n", +"//calculations\n", +"f1=14.5\n", +"f2=2.31\n", +"dl=(f1-f2)*D/f\n", +"//results\n", +"printf('Length of pipe = %.1f ft',dl)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.7: Change_in_entropy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"py=20 //psia\n", +"px=3.55 //psia\n", +"R=1.986/29\n", +"//calculations\n", +"pr=py/px\n", +"disp('from table B-19')\n", +"Mx=2\n", +"My=0.577\n", +"pr2=0.721\n", +"ds=R*log(1/pr2)\n", +"//results\n", +"printf('Change in entropy = %.4f Btu/lbm R',ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.8: Pressure_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pi=50 //psia\n", +"pe=34.6 //psia\n", +"//calculations\n", +"disp('From table B-18 and B-17,')\n", +"pr1=1.35\n", +"p0f=pi/pr1\n", +"pfs=0.528*p0f\n", +"per=pe/pfs\n", +"Me=0.6\n", +"p0e=1.19\n", +"pyx=p0e/pr1\n", +"Mx=1.64\n", +"My=0.658\n", +"px=0.22*pi\n", +"py=32.9 //psia\n", +"p2yx=0.852\n", +"pe2=1.65*pfs\n", +"//results\n", +"printf('Mach numbers before and after are %.2f and %.3f respectively',Mx,My)\n", +"printf('\n Pressure before and after are %.1f psia and %.1f psia',px,py)\n", +"printf('\n Exhaust pressure = %.1f psia',pe2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.9: Heat_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T1=550 //R\n", +"T2=2660 //R\n", +"ts1=0.207\n", +"ts2=0.833\n", +"cp=0.24\n", +"//calculations\n", +"Ts=T1/ts1\n", +"Ts0=T2/ts2\n", +"disp('From table B-20')\n", +"tr1=0.529\n", +"tr2=0.174\n", +"dq=cp*Ts0*(tr1-tr2)\n", +"//results\n", +"printf('Heat required = %d Btu/lbm',dq)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/14-Psychrometrics.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/14-Psychrometrics.ipynb new file mode 100644 index 0000000..51e5eb6 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/14-Psychrometrics.ipynb @@ -0,0 +1,476 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14: Psychrometrics" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.10: Approach_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m=1 //lbm\n", +"t1=100 //F\n", +"t2=75 //F\n", +"db=65 //F\n", +"disp('From psychrometric charts,')\n", +"t11=82 //F\n", +"phi1=0.4\n", +"H1=30 //Btu/lbm dry air\n", +"w1=65 //grains/lbm dry air\n", +"w2=250 //grains/lbm dry air\n", +"//calculations\n", +"cr=t1-t2\n", +"appr=t2-db\n", +"dmf3=(w2-w1)*0.0001427\n", +"hf3=68\n", +"hf4=43\n", +"H2=62.2\n", +"H1=30\n", +"mf4= (H1-H2+ dmf3*hf3)/(hf4-hf3)\n", +"per=dmf3/(dmf3+mf4)\n", +"//results\n", +"printf('cooling range = %d F',cr)\n", +"printf('\n Approach = %d F',appr)\n", +"printf('\n amount of water cooled per pound of dry air = %.3f lbm dry air/lbm dry air',mf4)\n", +"printf('\n percentage of water lost by evaporation = %.2f percent',per*100)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.11: Heat_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"mfr=1\n", +"water=900 //gallons\n", +"t2=110 //F\n", +"t1=80 //F\n", +"cp1=1\n", +"//calculations\n", +"mfa=mfr*water*8.33*60\n", +"mfc=mfa/(60*0.075)\n", +"qa=mfa*(t2-t1)\n", +"dH=qa/(mfc*4.5)\n", +"dH2=mfr*cp1*(t2-t1)\n", +"H1=23.73\n", +"H2=5.08\n", +"f=3.309\n", +"lnmean=(H1-H2)/log(H1/H2)\n", +"dtt=(t2-t1)/lnmean\n", +"per=25\n", +"//results\n", +"printf('flow rate of air = %d lbm/hr.It is equal to %d cfm',mfa,mfc)\n", +"printf('\n Total heat transferred = %d Btu/hr',qa)\n", +"printf('\n Enthalpy = %.1f Btu/lbm dry air',dH)\n", +"printf('\n Using second method, Enthalpy = %.1f Btu/lbm',dH2)\n", +"printf('\n Performance factor = %.3f ',f)\n", +"printf('\n logrithamic mean enthalpy difference = %.2f . Estimated low percentage = %d low',dtt,per)\n", +"disp('The answers are a bit different due to rounding off error in textbook.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.1: Pressure_and_density_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t1=80+460 //R\n", +"ps=0.5069 //psia\n", +"disp('from steam tables,')\n", +"vs=633.1 //ft^3/lbm\n", +"phi=0.3\n", +"R=85.6\n", +"Ra=53.3\n", +"p=14.696\n", +"//calculations\n", +"tdew=46 //F\n", +"pw=phi*ps\n", +"rhos=1/vs\n", +"rhow=phi*rhos\n", +"rhow2= pw*144/(R*t1)\n", +"pa=p-pw\n", +"rhoa= pa*144/(Ra*t1)\n", +"w=rhow/rhoa\n", +"mu=phi*(p-ps)/(p-pw)\n", +"Ws=0.622*(ps/(p-ps))\n", +"mu2=w/Ws\n", +"//results\n", +"disp('part a')\n", +"printf('partial pressure of water = %.5f psia',pw)\n", +"printf('\n dew temperature = %d F',tdew)\n", +"disp('part b')\n", +"printf('density of water = %.6f lbm/ft^3',rhow)\n", +"printf('\n in case 2, density of water = %.6f lbm/ft^3',rhow2)\n", +"printf('\n density of air = %.6f lbm/ft^3',rhoa)\n", +"disp('part c')\n", +"printf('specific humidity = %.4f lbm steam/lbm air',w)\n", +"disp('part d')\n", +"printf('In method 1, Degree of saturation = %.3f',mu)\n", +"printf('\n In method 2, Degree of saturation = %.3f',mu2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.2: Moisture_content_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p=14.696 //psia\n", +"ps=0.0808 //psia\n", +"ps2=0.5069 //psia\n", +"phi2=0.5\n", +"phi=0.6\n", +"grain=7000\n", +"//calculations\n", +"pw=phi*ps\n", +"w1=0.622*pw/(p-pw)\n", +"pw2=phi2*ps2\n", +"w2=0.622*pw2/(p-pw2)\n", +"dw=w2-w1\n", +"dwg=dw*grain\n", +"//results\n", +"printf('change in moisture content = %.6f lbm water/lbm dry air',dw)\n", +"printf('\n in grains, change = %.2f grains water/lbm dry air',dwg)\n", +"disp('The answers are a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.3: Humidity_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t1=80 //F\n", +"t2=60 //F\n", +"p=14.696 //psia\n", +"ps=0.507 //psia\n", +"pss=0.256 //psia\n", +"cp=0.24\n", +"disp('From steam tables,')\n", +"//calculations\n", +"ws=0.622*pss/(p-pss)\n", +"w=(cp*(t2-t1) + ws*1060)/(1060+ 0.45*(t1-t2))\n", +"pw=w*p/(0.622+w)\n", +"phi=pw/ps\n", +"td=46 //F\n", +"//results\n", +"printf('\n humidity ratio = %.4f lbm/lbm dry air',w)\n", +"printf('\n relative humidity = %.1f percent',phi*100)\n", +"printf('\n Dew point = %d F',td)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.4: Enthalpy_and_sigma_function_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"W=0.0065 //lbm/lbm of dry air\n", +"t=80 //F\n", +"td=60 //F\n", +"//calculations\n", +"H=0.24*t+W*(1060+0.45*t)\n", +"sig=H-W*(td-32)\n", +"Ws=0.0111\n", +"H2=0.24*td+Ws*(1060+0.45*td)\n", +"sig2=H2-Ws*(td-32)\n", +"//results\n", +"printf('In case 1, enthalpy = %.2f Btu/lbm dry air',H)\n", +"printf('\n In case 1, sigma function = %.2f Btu/lbm dry air',sig)\n", +"printf('\n In case 2, enthalpy = %.2f Btu/lbm dry air',H2)\n", +"printf('\n In case 2, sigma function = %.2f Btu/lbm dry air',sig2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.5: Enthalpy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t1=30 //F\n", +"t2=60 //F\n", +"t3=80 //F\n", +"W1=0.00206\n", +"W2=0.01090\n", +"//calculations\n", +"cm1=0.24+0.45*W1\n", +"H1=cm1*t1+W1*1060\n", +"cm2=0.24+0.45*W2\n", +"H2=cm2*t3+W2*1060\n", +"hf=t2-32\n", +"dq=H2-H1-(W2-W1)*hf\n", +"//results\n", +"printf('In case 1, Enthalpy = %.2f Btu/lbm dry air',H1)\n", +"printf('\n In case 2, Enthalpy = %.2f Btu/lbm dry air',H2)\n", +"printf('\n Heat added = %.2f Btu/lbm dry air',dq)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.6: Humidity_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pw=0.15//psia\n", +"disp('using psychrometric charts,')\n", +"tdew=46 //F\n", +"//calculations\n", +"va=13.74 //ft^3/lbm dry air\n", +"rhoa=1/va\n", +"V=13.74\n", +"mw=46/7000\n", +"rhow=mw/V\n", +"w=0.00657\n", +"//results\n", +"disp('part a')\n", +"printf('partial pressure of water = %.2f psia',pw)\n", +"printf('\n dew temperature = %d F',tdew)\n", +"disp('part b')\n", +"printf('density of water = %.6f lbm/ft^3',rhow)\n", +"printf('\n density of air = %.4f lbm/ft^3',rhoa)\n", +"disp('part c')\n", +"printf('specific humidity = %.5f lbm water/lbm air',w)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.7: Enthalpy_change_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"W1=0.00206 //lbm/lbm dry air\n", +"W2=0.01090 //lbm/lbm dry air\n", +"t=60 //F\n", +"disp('From humidity charts,')\n", +"//calculations\n", +"dw=W1-W2\n", +"hs=144.4\n", +"hs2=66.8-32\n", +"w1=14.4 //Btu/lbm\n", +"ws1=20 //Btu/lbm\n", +"w2=76.3 //Btu/lbm\n", +"ws2=98.5 //Btu/lbm\n", +"dwh1=-(w1-ws1)/7000 *hs\n", +"H1=9.3+dwh1\n", +"dwh2=(w2-ws2)/7000 *hs2\n", +"H2=31.3+dwh2\n", +"dwc=dw*(t-32)\n", +"dq=H2-H1+dwc\n", +"//results\n", +"printf('Enthalpy change = %.2f Btu/lbm dry air',dq)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.8: Enthalpy_and_temperature_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"disp('From psychrometric charts at 50 F and 80 F,')\n", +"va1=13 //ft^3/lbm dry air\n", +"va2=13.88 //ft^3/lbm dry air\n", +"flow=2000 //cfm\n", +"//calculations\n", +"ma1= flow/va1\n", +"ma2=flow/va2\n", +"disp('The two initial states have been multiplied by 108/262 and distance 2-3 is located')\n", +"t=62.5// F\n", +"phi=0.83 //percent\n", +"//results\n", +"printf('humidity = %.2f ',phi)\n", +"printf('\n Temperature = %.1f F',t)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.9: Dry_bulb_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t=90 //F\n", +"ts=67.2 //F\n", +"phi=0.3\n", +"per=0.8\n", +"//calculations\n", +"dep=t-ts\n", +"dt=dep*per\n", +"tf=t-dt\n", +"disp('from psychrometric charts,')\n", +"phi2=0.8\n", +"//results\n", +"printf('Dry bulb temperature = %.2f F',tf)\n", +"printf('\n percent humidity = %.2f',phi2)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/15-Vapor_cycles_and_processes.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/15-Vapor_cycles_and_processes.ipynb new file mode 100644 index 0000000..d46abb4 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/15-Vapor_cycles_and_processes.ipynb @@ -0,0 +1,303 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15: Vapor cycles and processes" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.1: Efficiency_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p1=600 //psia\n", +"p2=0.2563 //psia\n", +"t1=486.21 //F\n", +"t2=60 //F\n", +"fur=0.75\n", +"//calculations\n", +"disp('from steam tables,')\n", +"h1=1203.2\n", +"hf1=471.6\n", +"hfg1=731.6\n", +"h2=1088\n", +"hf2=28.06\n", +"hfg2=1059.9\n", +"s1=1.4454\n", +"sf1=0.6720\n", +"sfg1=0.7734\n", +"s2=2.0948\n", +"sf2=0.0555\n", +"sfg2=2.0393\n", +"xd=(s1-sf2)/sfg2\n", +"hd=hf2+xd*hfg2\n", +"xa=0.3023\n", +"ha=hf2+xa*hfg2\n", +"wbc=0\n", +"wda=0\n", +"wcd=h1-hd\n", +"wab=ha-hf1\n", +"W=wab+wcd+wbc+wda\n", +"Wrev=hfg1- (t2+459.7)*sfg1\n", +"etat=(t1-t2)/(t1+459.7)\n", +"eta=fur*etat\n", +"//results\n", +"printf('Thermal efficiency = %d percent',etat*100)\n", +"printf('\n Furnace efficiency = %.1f percent',eta*100)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.2: Efficiency_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"dhab=-123.1\n", +"etac=0.5\n", +"ha=348.5\n", +"etaf=0.75\n", +"eta=0.85\n", +"hf=471.6\n", +"hfg=731.6\n", +"hc=1203.2\n", +"dhcd=452.7\n", +"//calculations\n", +"dwabs=dhab/etac\n", +"hbd=ha-dwabs\n", +"dwcds=dhcd*eta\n", +"dqa=hc-hbd\n", +"etat=(dwcds+dwabs)/dqa\n", +"eta=etat*etaf\n", +"//results\n", +"printf('Thermal efficiency = %.1f percent',etat*100)\n", +"printf('\n Overall efficiency = %.1f percent',eta*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.3: Efficiency_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"t=60 //F\n", +"J=778.16\n", +"p1=600 //psia\n", +"p2=0.2563 //psia\n", +"etaf=0.85 \n", +"//calculations\n", +"disp('From steam tables,')\n", +"vf=0.01604 //ft^3/lbm\n", +"dw=-vf*(p1-p2)*144/J\n", +"ha=28.06 //Btu/lbm\n", +"hb=29.84 //Btu/lbm\n", +"hd=1203.2 //Btu/lbm\n", +"he=750.5 //Btu/lbm\n", +"dqa=hd-hb\n", +"dqr=ha-he\n", +"dw=dqa+dqr\n", +"dwturb=hd-he\n", +"dwpump=ha-hb\n", +"etat=dw/dqa\n", +"eta=etat*etaf\n", +"//results\n", +"printf('Thermal efficiency = %.1f percent',etat*100)\n", +"printf('\n Overall efficiency = %.1f percent',eta*100)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.4: Efficiency_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"dhab=-1.78\n", +"etac=0.5\n", +"ha=28.06\n", +"eta=0.85\n", +"hf=471.6\n", +"hfg=731.6\n", +"hd=1203.2\n", +"dhcd=452.7\n", +"//calculations\n", +"dwabs=dhab/etac\n", +"hbd=ha-dwabs\n", +"dwcds=dhcd*eta\n", +"dqa=hd-hbd\n", +"etat=(dwcds+dwabs)/dqa\n", +"eta=etat*eta\n", +"//results\n", +"printf('Thermal efficiency = %.1f percent',etat*100)\n", +"printf('\n Overall efficiency = %.1f percent',eta*100)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.5: Efficiency_and_pressure_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"sh=1.6070\n", +"ph=94.8 //psia\n", +"th=324 //F\n", +"tr=60 //F\n", +"hh=1186.2 \n", +"pi=94.8 //psia\n", +"hi=1399.5\n", +"si=1.8265\n", +"//calculations\n", +"Q=hi-hh\n", +"Hr=-(tr+459.7)*(si-sh)\n", +"work= Q+Hr\n", +"eff=work/Q\n", +"Qa1=1557.5\n", +"W1=637.1 \n", +"etat=W1/Qa1\n", +"he=1374\n", +"hj=948\n", +"Whp=he-hh\n", +"Wlp=hi-hj\n", +"Wnet=Whp+Wlp\n", +"//results\n", +"printf('Thermal efficiency in case 1= %.1f percent',eff*100)\n", +"printf('\n Thermal efficiency in case 1= %.1f percent',etat*100)\n", +"printf('\n High pressure work = %.1f Btu/lbm',Whp)\n", +"printf('\n Low pressure work = %.1f Btu/lbm',Wlp)\n", +"printf('\n Net work = %.1f Btu/lbm',Wnet)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.6: Efficiency_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p2=600 //psia\n", +"p1=44 //psia\n", +"te=486.21 //F\n", +"tb=273.1 //F\n", +"J=778.16\n", +"p3=0.25 //psia\n", +"//calculations\n", +"hc=241.9\n", +"hj=834.6\n", +"y=1-0.805\n", +"v1=0.0172\n", +"v2=0.016\n", +"ha=28.06\n", +"hd=hc+v1*(p2-p1)*144/J\n", +"hb=ha+v2*(p1-p3)*144/J\n", +"hh=1374\n", +"Qa=hh-hd\n", +"Qr=(ha-hj)*(1-y)\n", +"etat=(Qa+Qr)/Qa\n", +"//results\n", +"printf('thermal efficiency = %.1f percent',etat*100)\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/16-Combustion.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/16-Combustion.ipynb new file mode 100644 index 0000000..1238c2b --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/16-Combustion.ipynb @@ -0,0 +1,680 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16: Combustion" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.10: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"N2=78.1 //Moles of Nitrogen\n", +"M=29 //Molar mass of Air\n", +"ba=2.12 //Basis\n", +"x4=0.3 //Moles of Ch4\n", +"x5=3.7 //Moles of H2\n", +"x6=14.7 //moles of H2o\n", +"//calculations\n", +"O2=N2/3.76\n", +"c=14.7\n", +"b= x4*4 + x5*2 + x6*2\n", +"a=b/ba\n", +"AF=(O2+N2)*M/(a*12 + b)\n", +"//results\n", +"printf('Air fuel ratio = %.1f lbm air/lbm fuel',AF)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.11: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"co2=8.7 //Moles of CO2\n", +"co=8.9 //Moles of CO\n", +"N2=78.1 //Moles of Nitrogen\n", +"M=29 //Molar mass of Air\n", +"ba=2.12 //Basis\n", +"x4=0.3 //Moles of Ch4\n", +"x5=3.7 //Moles of H2\n", +"x6=14.7 //moles of H2o\n", +"//calculations\n", +"O2=N2/3.76\n", +"c=14.7\n", +"Z=2.238\n", +"X=(Z*17-x4*4-x5*2)/2\n", +"a=co2+co/2+x4+x6/2\n", +"b=3.764*a\n", +"AF=(O2+N2)*M/(Z*113)\n", +"//results\n", +"printf('Air fuel ratio = %.1f lbm air/lbm fuel',AF)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.12: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x1=8.7 //Moles of Co2\n", +"x2=8.9 //Moles of CO\n", +"x3=0.3 //Moles of O2\n", +"N=78.1 //Moles of N2\n", +"z=113 //Af factor\n", +"M=29 //Molar mass of air\n", +"//calculations\n", +"co2=(x1+x2+x3)*100/(N+x1+x2+x3)\n", +"a=2.325\n", +"AF=103*M/(a*z)\n", +"//results\n", +"printf('Air fuel ratio = %.2f',AF)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.13: Equation_formulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"co=1.2 //Moles of CO\n", +"co2=10.8 //Moles of CO2\n", +"//calculations\n", +"H2=co/2\n", +"ch4=0.3\n", +"N2=88-H2-ch4\n", +"//results\n", +"printf('Nitrogen = %.1f percent',N2)\n", +"printf('\n Equation is a(96 CH4 + 3 H2+ 1 CO) + %.1f/3.76 O2 + %.1f N2 = %.1f CO2 + %.1f CO + %.1f H2 + %.1f CH4 + %.1f N2',N2,N2,co2,co,H2,ch4,N2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.14: Higher_heating_value.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"dH=-2369859 //Btu\n", +"r=1.986 //Gas constant\n", +"dn=5.5 //Change in number of moles\n", +"T=536.7 //R\n", +"//calculations\n", +"dQ=dH+dn*r*T\n", +"//results\n", +"printf('Higher heating value = %d Btu',dQ)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.15: Lower_heating_value.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"M2=18 //Molar mass of water\n", +"M=170 //Molar mass of octane\n", +"p=0.4593 //Pressure of octane //psia\n", +"disp('from steam tables,')\n", +"vfg=694.9 \n", +"J=778.2\n", +"m=9*18 //Mass of water\n", +"u1=-2363996 //Btu\n", +"//calculations\n", +"hfg=1050.4 //Btu/lbm\n", +"ufg= hfg- p*vfg*144/J\n", +"dU=ufg*m \n", +"Lhv=u1+dU\n", +"//results\n", +"printf('Lower heating value = %d Btu/lbm',Lhv)\n", +"disp('The answers are a bit different due to rounding off error in textbook.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.16: Heat_of_reactio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n1=8 //Moles of CO2\n", +"n2=9 //Moles of H2O\n", +"n3=1 //Moles of Octane\n", +"n4=12.5 //Moles of Oxygen\n", +"disp('From Table B-10,')\n", +"U11=3852 //Internal energy at 1000 R of CO2\n", +"U12=115 //Internal energy at 537 R of CO2\n", +"U21=3009 //Internal energy at 1000 R of H2O\n", +"U22=101 //Internal energy at 537 R of H2O\n", +"U31=24773 //Internal energy at 1000 R of Octane\n", +"U32=640 //Internal energy at 537 R of Octane\n", +"U41=2539 //Internal energy at 1000 R of Oxygen\n", +"U42=83 //Internal energy at 537 R of Oxygen\n", +"H=-2203389 //heat Btu\n", +"//calculations\n", +"dU1=n1*(U11-U12)+n2*(U21-U22)\n", +"dU2=n3*(U31-U32)+n4*(U41-U42)\n", +"Q=H+dU1-dU2\n", +"//results\n", +"printf('Heat of reaction = %d Btu',Q)\n", +"disp('The answers are a bit different due to rounding off error in textbook.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.17: Temperature_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n1=8 //Moles of CO2\n", +"n2=9 //Moles of H2O\n", +"n3=47 //Moles of N2\n", +"disp('from table B-10,')\n", +"h1=118 //Enthalpy of CO2\n", +"h2=104 //Enthalpy of H2O\n", +"h3=82.5 //Enthalpy of N2\n", +"Q=2203279 //Btu\n", +"//calculations\n", +"U11=n1*h1+n2*h2+n3*h3\n", +"U12=U11+Q\n", +"T2=5271 //R\n", +"//results\n", +"printf('Upon interpolating, T2 = %d R',T2)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.18: Equilibrium_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"n1=0.95\n", +"n2=0.05\n", +"n3=0.025\n", +"P=147 //psia\n", +"pa=14.7 //psia\n", +"//calculations\n", +"n=n1+n2+n3\n", +"p1=n1/n *P/pa\n", +"p2=n2/n *P/pa\n", +"p3=n3/n *P/pa\n", +"Kp1= p1/(p2*p3^0.5)\n", +"Kp2= p1^2 /(p2^2 *p3)\n", +"//results\n", +"printf('In case 1, Equilibrium constant = %.1f ',Kp1)\n", +"printf('\n In case 2, Equilibrium constant = %.1f ',Kp2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.19: Dissociation_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"kp=5 \n", +"//calculations\n", +"x=poly(0,'x')\n", +"vec=roots(24*x^3 + 3*x-2)\n", +"x=vec(3)\n", +"y=poly(0,'y')\n", +"vec2=roots(249*y^3 +3*y-2)\n", +"y=vec2(3)\n", +"//results\n", +"printf('percentage of dissociation = %.1f percent',x*100)\n", +"printf('\n If pressure =10 . degree of dissociation = %d percent',y*100)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.1: Molecule_formulatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"per=85\n", +"//calculations\n", +"a=per/12\n", +"b=100-per\n", +"ad=1.13*a\n", +"bd=1.13*b\n", +"//results\n", +"printf('Molecule is C %d H %d',ad,bd+1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.20: Extent_of_reaction.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x=poly(0,'x')\n", +"vec=roots(24*x^3 +48*x^2 + 7*x -4)\n", +"x=vec(3) *100\n", +"//results\n", +"printf('Extent of reaction= %d percent',100-x)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.2: Molecule_formulatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"per=0.071 //mass fraction of nitrogen\n", +"//calculations\n", +"O2=8.74\n", +"N2=per/2 + 3.76*O2\n", +"Nin=32.85\n", +"CO2=7.333\n", +"H2o=3\n", +"So2=0.0312\n", +"//results\n", +"printf('Oxygen = %.2f and Nitrogen = %.2f',O2,N2)\n", +"printf('\n Equation is C %.3f H %d + %.2f O2 + %.2f N2 = %.3f CO2 + %d H2O + %.5f SO2 + %.2f N2',CO2,2*H2o,O2,Nin,CO2,H2o,So2,N2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.3: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"M=29\n", +"m1=8.74\n", +"m2=32.85\n", +"fuel=100 //lbm\n", +"//calculations\n", +"mass=M*(m1+m2)\n", +"AF=mass/fuel\n", +"a2=9.75\n", +"b2=12.19\n", +"AF2=mass/(fuel+a2+b2)\n", +"//results\n", +"printf('Air fuel ratio = %.2f lbm air/lbm fuel',AF)\n", +"printf('\n In dry air, Air-fuel ratio = %.1f lbm air/lbm fuel as fired',AF2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.4: Mass_and_energy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m1=322.3 //Mass of Co2\n", +"m2=2 //Mass of SO2\n", +"m3=926 //Mass of N2\n", +"basis=121.94 //Basis taken\n", +"//calculations\n", +"m=m1+m2+m3\n", +"ratio=m/basis\n", +"dh=5777 //Btu/mol\n", +"h1=dh*7.364\n", +"h2=14037\n", +"h3=130501\n", +"H=h1+h2+h3\n", +"hrat=H/basis\n", +"//results\n", +"printf('Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel ash and moisture free',m/100)\n", +"printf('\n Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel as fired ',ratio)\n", +"printf('\n Energy carried away = %.1f btu/mol coal as fired which is same as = %.1f Btu/lbm mol coal ',H, hrat)\n", +"disp('The answers are a bit different due to rounding off errors in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.6: Percentage_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p=14.7 //psia\n", +"ps=0.363 //psia\n", +"n2=7.52 //moles\n", +"n1=1 //moles\n", +"//calculations\n", +"x= (n1+n2)*ps/p /(1-ps/p)\n", +"n=n1+n2+x\n", +"y1=n1/n\n", +"y2=n1/(n1+n2)\n", +"//results\n", +"printf('Final orsat composition is %d CO2 + %.2f H20 + %.2f N2',n1, x, n2)\n", +"printf('\n Percentage of co2 on a wet basis = %.1f percent',y1*100)\n", +"printf('\n percentage of co2 on a dry basis = %.2f percent',y2*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.7: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"N2=78.1\n", +"M=29\n", +"co2=8.7\n", +"co=8.9\n", +"x4=0.3\n", +"x5=3.7\n", +"x6=14.7\n", +"//calculations\n", +"O2=N2/3.76\n", +"Z=(co2+co+x4)/8\n", +"AF=(O2+N2)*M/(Z*113)\n", +"//results\n", +"printf('Air fuel ratio = %.1f lbm air/lbm fuel',AF)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.8: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"basis=100 //lbm\n", +"x1=0.6\n", +"ash=12 //lbm\n", +"N2=79.7\n", +"M=29\n", +"//calculations\n", +"x=ash/x1\n", +"C=(1-x1)*x\n", +"O2=N2/3.76\n", +"a= (14.6+0.2)/(5.83-0.66)\n", +"AF=(O2+N2)*M/(a*100)\n", +"//results\n", +"printf('Air fuel ratio = %.1f lbm air/lbm fuel as fired',AF)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16.9: Air_fuel_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"N2=78.1 //Moles of Nitrogen\n", +"M=29 //Molar mass of Air\n", +"ba=2.12 //Basis\n", +"x4=0.3 //Moles of Ch4\n", +"x5=3.7 //Moles of H2\n", +"x6=14.7 //moles of H2o\n", +"//calculations\n", +"O2=N2/3.76\n", +"O2=N2/3.76\n", +"Z=(x4*4+x5*2+x6*2)/17\n", +"AF=(O2+N2)*M/(Z*113)\n", +"//results\n", +"printf('Air fuel ratio = %.1f lbm air/lbm fuel',AF)\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/17-Gas_cycles_and_processes.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/17-Gas_cycles_and_processes.ipynb new file mode 100644 index 0000000..475a657 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/17-Gas_cycles_and_processes.ipynb @@ -0,0 +1,72 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17: Gas cycles and processes" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.1: Efficiency_and_air_fuel_ratio_Equilibrium_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"ha=1033 //Btu/mol air\n", +"hbd=2992 //Btu/mol air\n", +"hc=7823 //Btu/mol air\n", +"hdd=5142 //Btu/mol air\n", +"Hv=2733000 //Btu/mol\n", +"M=29\n", +"//calculations\n", +"Wt=hc-hdd\n", +"Wc=ha-hbd\n", +"Net=Wt+Wc\n", +"Heat=hc-hbd\n", +"etat=Net*100/Heat\n", +"molair=Heat/Hv\n", +"mr=molair*142/M\n", +"Af=1/mr\n", +"//results\n", +"printf('\n Thermal efficiency = %.1f percent',etat)\n", +"printf('\n Moles of fuel burned per mol of air = %.5f mol fuel/mol air',molair)\n", +"printf('\n Mass ratio in pounds = %.5f lbm fuel/lbm air',mr)\n", +"printf('\n Air fuel ratio = %d lbm air/lbm fuel',Af)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/18-Refrigeration.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/18-Refrigeration.ipynb new file mode 100644 index 0000000..1ed9863 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/18-Refrigeration.ipynb @@ -0,0 +1,305 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 18: Refrigeration" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.1: Work_and_cop_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"Ta=500 //R\n", +"Tr=540 //R\n", +"//calculations\n", +"cop=Ta/(Tr-Ta)\n", +"hp=4.71/cop\n", +"disp('From steam tables,')\n", +"ha=48.02\n", +"hb=46.6\n", +"hc=824.1\n", +"hd=886.9\n", +"Wc=-(hd-hc)\n", +"We=-(hb-ha)\n", +"//results\n", +"printf('Coefficient of performance = %.1f ',cop)\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp)\n", +"printf('\n Work of compression = %.1f Btu/lbm',Wc)\n", +"printf('\n Work of expansion = %.2f Btu/lbm',We)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.2: cop_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x=0.8\n", +"he=26.28 //Btu/lbm\n", +"hb=26.28 //Btu/lbm\n", +"pe=98.76 //psia\n", +"pc=51.68 //psia\n", +"hc=82.71 //Btu/lbm\n", +"hf=86.80+0.95\n", +"//calculations\n", +"dwisen=-(hf-hc)\n", +"dwact=dwisen/x\n", +"hd=hc-dwact\n", +"cop=(hc-hb)/(hd-hc)\n", +"//results\n", +"printf('Coefficient of performance = %.2f',cop)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.3: work_done_and_cop_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"hc=613.3//btu/lbm\n", +"hb=138.9//btu/lbm\n", +"ha=138.9//btu/lbm\n", +"hd=713.4 //btu/lbm\n", +"ta=464.7 //R\n", +"t0=545.7 //R\n", +"v=8.150 //ft^3/lbm\n", +"//calculations\n", +"Qa=hc-hb\n", +"Qr=ha-hd\n", +"Wcd=Qa+Qr\n", +"cop=abs(Qa/Wcd)\n", +"hp=abs(4.71/cop)\n", +"carnot=abs(ta/(t0-ta))\n", +"rel=abs(cop/carnot)\n", +"mass=200/Qa\n", +"C=mass*v\n", +"//results\n", +"printf('Work done = %.1f Btu/lbm',Wcd)\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp)\n", +"printf('\n Coefficient of performance actual = %.2f ',cop)\n", +"printf('\n Ideal cop = %.3f',carnot)\n", +"printf('\n relative efficiency = %.3f',rel)\n", +"printf('\n Mass flow rate = %.3f lbm/min ton',mass)\n", +"printf('\n Compressor capacity = %.2f cfm/ton',C)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.4: Pressure_ratio_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pc=0.6982 //psia\n", +"pe=0.1217 //psia\n", +"m=200 //gal/min\n", +"qual=0.98\n", +"h1=23.07 //Btu/lbm\n", +"h2=8.05 //Btu/lbm\n", +"hw=1071.3\n", +"//calculations\n", +"rp=pc/pe\n", +"m2=m/0.01602 *0.1388 //Conversion of units \n", +"m2=1670\n", +"dh=15.02\n", +"Qa=m2*(h1-h2)\n", +"h3=h2 + qual*hw\n", +"m3=Qa/(h3-h1)\n", +"v=0.016+ qual*2444\n", +"C=m3*v\n", +"//results\n", +"printf('Pressure ratio = %.2f',rp)\n", +"printf('\n Heat = %d Btu/min',Qa)\n", +"printf('\n Water make up required = %.2f lbm/min',m3)\n", +"printf('\n Volume of vapor entering ejector = %d cfm',C)\n", +"disp('The answers are a bit different due to rounding off error in textbook')\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.5: Work_done_and_heat_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"disp('From fig B-4,')\n", +"disp('Appropraite notation from textbook has been used')\n", +"disp('All are enthalpy values at different stages')\n", +"hc=73.5 //Btu/lbm\n", +"hb=26.28 //Btu/lbm\n", +"hd=91.58 //Btu/lbm\n", +"hc2=190.7 //Btu/lbm\n", +"hd2=244.3 //Btu/lbm\n", +"hb2=44.4 //Btu/lbm\n", +"m1=1 //lbm\n", +"m2=0.461 //lbm\n", +"hc1=73.5 //Btu/lbm\n", +"hd1=83.35 //Btu/lbm \n", +"hc2=190.7 //Btu/lbm \n", +"hd2=244.3 //Btu/lbm\n", +"hb1=12.55 //Btu/lbm \n", +"hc22=197.58 //Btu/lbm \n", +"hd22=224 //Btu/lbm\n", +"//Calculations\n", +"w1=hc-hd\n", +"qa1=hc-hb\n", +"cop1=abs(qa1/(w1))\n", +"hp1=4.71/cop1\n", +"w2=hc2-hd2\n", +"qa2=hc2-hb2\n", +"cop2=abs(qa2/(w2))\n", +"hp2=4.71/cop2\n", +"qa3=m1*(hc1-hb1)\n", +"w3=m1*(hc1-hd1) + m2*(hc22-hd22)\n", +"cop3=abs(qa3/w3)\n", +"hp3=4.71/cop3\n", +"//results\n", +"disp('part a')\n", +"printf('Work done = %.2f Btu/lbm',w1)\n", +"printf('\n Heat = %.2f Btu/lbm',qa1)\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp1)\n", +"printf('\n Coefficient of performance actual = %.2f ',cop1)\n", +"disp('case 2')\n", +"printf('\n Work done = %.1f Btu/lbm',w2)\n", +"printf('\n Heat = %.2f Btu/lbm',qa2)\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp2)\n", +"printf('\n Coefficient of performance actual = %.2f ',cop2)\n", +"disp('part b')\n", +"printf('\n Work done = %.1f Btu/lbm',w3)\n", +"printf('\n Heat = %.2f Btu/lbm',qa3)\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp3)\n", +"printf('\n Coefficient of performance actual = %.2f ',cop3)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18.6: hp_and_cop_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"disp('From fig B-4,')\n", +"disp('Appropraite notation from textbook has been used')\n", +"disp('All are enthalpy values at different stages')\n", +"ha=44.36 //Btu/lbm \n", +"hc=18.04 //Btu/lbm\n", +"hj=197.58 //Btu/lbm\n", +"hh=213.5 //Btu/lbm \n", +"hd=hc //Btu/lbm\n", +"he=190.66 //Btu/lbm\n", +"hk=241.25 //Btu/lbm\n", +"//calculations\n", +"m=(hc-ha)/(ha-hj)\n", +"hi=(m*hj+hh)/(1+m)\n", +"Qa=he-hd\n", +"W=he-hh + (1+m)*(hi-hk)\n", +"cop=abs(Qa/W)\n", +"hp=4.71/cop\n", +"//results\n", +"printf('\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration',hp)\n", +"printf('\n Coefficient of performance actual = %.2f ',cop)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/2-Fundamental_Concepts.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/2-Fundamental_Concepts.ipynb new file mode 100644 index 0000000..ba8928a --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/2-Fundamental_Concepts.ipynb @@ -0,0 +1,91 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Fundamental Concepts" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1: Potential_energy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"z=100 //ft\n", +"m=32.1739 //lbm\n", +"//calculations\n", +"PE=m*z\n", +"//results\n", +"printf('Potential energy = %.2f ft-lbm',PE)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2: Absolute_energy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m0=18.016 //lbm\n", +"gc=32.1739 //lbm ft/lbf sec^2\n", +"c=186000*5280\n", +"dU=94.4*10^6 //ft-lbf\n", +"//calculations\n", +"U=m0/gc *c^2\n", +"dm= -dU*gc/c^2\n", +"//results\n", +"printf('Absolute energy of this mixture = %.2e ft-lbf',U)\n", +"printf('\n In case b, there is no change in mass')\n", +"printf('\n Change in mass = %.2e lbm',dm)\n", +"disp('The answers are a bit different due to rounding off error in textbook.')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/3-Temperature_and_the_Ideal_gas.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/3-Temperature_and_the_Ideal_gas.ipynb new file mode 100644 index 0000000..896c8d1 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/3-Temperature_and_the_Ideal_gas.ipynb @@ -0,0 +1,89 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Temperature and the Ideal gas" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2: volume_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p=14.7 //psia\n", +"R0=1545 \n", +"t=460 +60 //R\n", +"//calculations\n", +"v=R0*t/(p*144)\n", +"//results\n", +"printf('Volume = %.1f ft^3/mol',v)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3: density_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"p=20 //psia\n", +"R0=1545 \n", +"t=460 +100 //R\n", +"M=28\n", +"//calculations\n", +"v=R0*t/(p*144*M)\n", +"rho=1/v\n", +"//results\n", +"printf('density of nitrogen = %.4f lbm/ft^3',rho)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/5-The_first_law_and_the_dynamic_open_system.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/5-The_first_law_and_the_dynamic_open_system.ipynb new file mode 100644 index 0000000..e084c01 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/5-The_first_law_and_the_dynamic_open_system.ipynb @@ -0,0 +1,128 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: The first law and the dynamic open system" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2: work_done_and_power_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"rate= 5 //lbm/sec\n", +"Q=50 //Btu/s\n", +"h2=1020 //Btu/lbm\n", +"h1=1000 //Btu/lbm\n", +"V2=50 //ft/s\n", +"V1=100 //ft/s\n", +"J=778\n", +"g=32.2 //ft/s^2\n", +"gc=g\n", +"Z2=0\n", +"Z1=100 //ft\n", +"//calculations\n", +"dw=Q/rate -(h2-h1) -(V2^2- V1^2)/(2*gc*J) -g/gc *(Z2-Z1)/J\n", +"power=dw*rate\n", +"//results\n", +"printf('work done by the system = %.1f Btu/lbm',dw)\n", +"printf('\n Power = %.1f Btu/s',power)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.3: Area_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"V=100 //ft/s\n", +"v=15 //lbm/ft^3\n", +"m=5 //lbm/s\n", +"//calculations\n", +"A=m*v/V\n", +"//results\n", +"printf('Area of inlet pipe = %.2f ft^2',A)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4: Temperature_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=100 //psia\n", +"//calculations\n", +"disp('From table B-4')\n", +"h=1187.2 //Btu/lbm\n", +"t1=328 //F\n", +"t2=540 //F\n", +"dt=t2-t1\n", +"//results\n", +"printf('Final temperature of the steam = %d F',t2)\n", +"printf('\n Change in temperature = %d F',dt)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/7-The_Second_law.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/7-The_Second_law.ipynb new file mode 100644 index 0000000..2a7fd41 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/7-The_Second_law.ipynb @@ -0,0 +1,141 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: The Second law" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.2: Entropy_and_efficiency_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cv=0.175 //Btu/lbm R\n", +"R0=1.986\n", +"M=29\n", +"T2=1040 //R\n", +"T1=520 //R\n", +"//calculations\n", +"cp=cv+R0/M\n", +"sab=cv*log(T2/T1)\n", +"sac=cp*log(T2/T1)\n", +"dqab=cv*(T2-T1)\n", +"dqca=cp*(T1-T2)\n", +"dqrev=T2*(sac-sab)\n", +"eta=(dqab+dqrev+dqca)/(dqab+dqrev)\n", +"//results\n", +"printf('Entropy in ab part = %.4f Btu/lbm R',sab)\n", +"printf('\n Entropy in ac part = %.4f Btu/lbm R',sac)\n", +"printf('\n Efficiency = %.2f percent',eta*100)\n", +"disp('The answers are a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.3: Entropy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"tc=32 //F\n", +"th=80 //F\n", +"mw=5 //lbm\n", +"mi=1 //lbm\n", +"P=14.7 //psia\n", +"cp=1\n", +"//calculations\n", +"t= (-144*mi+tc*mi+th*mw)/(mw+mi)\n", +"ds1=144/(tc+460)\n", +"ds2=cp*log((460+t)/(460+tc))\n", +"dsice=ds1+ds2\n", +"dswater=mw*cp*log((t+460)/(460+th))\n", +"ds=dsice+dswater\n", +"//results\n", +"printf('Change in entropy of the process = %.4f Btu/R',ds)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.4: Energy_calculations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cp=1\n", +"T2=60 //F\n", +"T1=100 //F\n", +"ta=32 //F\n", +"//calculations\n", +"dq=cp*(T2-T1)\n", +"ds=cp*log((460+T2)/(460+T1))\n", +"dE=dq-ds*(ta+460)\n", +"dec=dq-dE\n", +"//results\n", +"printf('Change in available energy = %.1f Btu/lbm',dE)\n", +"printf('\n The available energy of the isolated system decreased in the amount of %.1f Btu/lbm',dec)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/8-Second_and_Third_law_topics.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/8-Second_and_Third_law_topics.ipynb new file mode 100644 index 0000000..8a71a53 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/8-Second_and_Third_law_topics.ipynb @@ -0,0 +1,127 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Second and Third law topics" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.1: PvsS_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=500 //psia\n", +"T=700 //F\n", +"J=778\n", +"//calculations\n", +"dpds=1490 *144/J\n", +"//results\n", +"printf('dp by ds at constant volume = %d F/ft^3/lbm',dpds)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.2: Thermal_efficiency_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cp=0.25 //Btu/lbm R\n", +"T0=520 //R\n", +"T1=3460 //R\n", +"//calculations\n", +"dq=cp*(T0-T1)\n", +"ds=cp*log(T0/T1)\n", +"dE=dq-T0*ds\n", +"eta=dE/dq\n", +"//results\n", +"printf('Thermal efficiency = %.1f percent',eta*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.3: Loss_of_available_energy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"cp=0.25 //Btu/lbm R\n", +"T0=520 //R\n", +"T1=3460 //R\n", +"dG=21069 //Btu/lbm\n", +"dH=21502 //Btu/lbm\n", +"//calculations\n", +"dq=cp*(T0-T1)\n", +"ds=cp*log(T0/T1)\n", +"dE=dq-T0*ds\n", +"eta=dE/dq\n", +"dw=eta*dH\n", +"de=-dG+dw\n", +"//results\n", +"printf('Loss of available energy = %d Btu/lbm',de)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/9-Properties_of_the_pure_substance.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/9-Properties_of_the_pure_substance.ipynb new file mode 100644 index 0000000..614055e --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/9-Properties_of_the_pure_substance.ipynb @@ -0,0 +1,370 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Properties of the pure substance" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.10: Quality_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pb=14.696 //psia\n", +"pa=150 //psia\n", +"tb=300 //F\n", +"//calculations\n", +"disp('From steam tables,')\n", +"hb=1192.8 //Btu/lbm\n", +"ha=hb\n", +"hf=330.51 //Btu/lbm\n", +"hfg=863.6 //Btu/lbm\n", +"x=(ha-hf)/hfg\n", +"//results\n", +"printf('Quality of wet steam = %.1f percent',x*100)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1: Internal_energy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T=32 //F\n", +"m=1 //lbm\n", +"J=778.16\n", +"//calculations\n", +"disp('From steam tables,')\n", +"hf=0 \n", +"p=0.08854 //psia\n", +"vf=0.01602 //ft^3/lbm\n", +"u=hf-p*144*vf/J\n", +"//results\n", +"printf('Internal energy = %.7f Btu/lbm',u)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2: Entropy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=40 //psia\n", +"//calculations\n", +"disp('from steam tables,')\n", +"hf=200.8 //Btu/lbm\n", +"hg=27 //Btu/lbm\n", +"T=495 //R\n", +"ds=(hf-hg)/T\n", +"//results\n", +"printf('Change in entropy = %.3f Btu/lbm R',ds)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3: Enthalpy_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x=0.35\n", +"T=18 //F\n", +"//calculations\n", +"disp('From table B-14,')\n", +"hf=12.12 //Btu/lbm\n", +"hg=80.27 //Btu.lbm\n", +"hfg=-hf+hg\n", +"h=hf+x*hfg\n", +"//results\n", +"printf('specific enthalpy = %.1f Btu/lbm',h)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4: Heat_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"x=0.35\n", +"T=18 //F\n", +"T2=55.5 //F\n", +"//calculations\n", +"disp('From table B-14,')\n", +"hf=12.12 //Btu/lbm\n", +"hg=80.27 //Btu.lbm\n", +"hfg=-hf+hg\n", +"h=hf+x*hfg\n", +"h2=85.68 //Btu/lbm\n", +"dh=h2-h\n", +"//results\n", +"printf('Heat required = %.2f Btu/lbm',dh)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5: Enthalpy_and_Quality_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P=1460 //psia\n", +"T=135 //F\n", +"P2=700 //psia\n", +"//calculations\n", +"disp('From mollier chart,')\n", +"h=120 //Btu/lbm\n", +"x=0.83\n", +"//results\n", +"printf('enthalpy = %d Btu/lbm',h)\n", +"printf('\n Qulaity = %.2f',x)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6: Heat_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"m=1 //lbm\n", +"P1=144 //psia\n", +"P2=150 //psia\n", +"T1=360 //F\n", +"J=778.16\n", +"//calculations\n", +"disp('From table 3,')\n", +"v1=3.160 //ft^3/lbm\n", +"h1=1196.5 //Btu/lbm\n", +"u1=h1-P1*144*v1/J\n", +"h2=1211.4 //Btu/lbm\n", +"u2=h2-P2*144*v1/J\n", +"dq=u2-u1\n", +"//results\n", +"printf('Heat transferred = %.1f Btu/lbm',dq)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.7: Work_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"T1=100 //F\n", +"P2=1000 //psia\n", +"x=0.6\n", +"J=778.16\n", +"//calculations\n", +"disp('From table 3,')\n", +"v=0.01613 //ft^3/lbm\n", +"P1=0.9 //psia\n", +"wrev=-v*(P2-P1)*144/J\n", +"dv=0.000051 //ft^3/lbm\n", +"wcomp=(P2+P1)/2 *dv*144/J\n", +"wact=wrev/x\n", +"//results\n", +"printf('Work done = %.1f Btu/lbm',wrev)\n", +"printf('\n In case 2, work required = %.1f Btu/lbm',wact)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.8: Heat_calculatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"pa=1000 //atm\n", +"ta=100 //F\n", +"//calculations\n", +"hf=67.97 //Btu/lbm\n", +"w=3 //Btu/lbm\n", +"ha=hf+w\n", +"disp('from steam table 2,')\n", +"hc=1191.8 //Btu/lbm\n", +"qrev=hc-ha\n", +"//results\n", +"printf('Heat transferred = %.1f Btu/lbm',qrev)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.9: Work_done_calculation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"clc\n", +"clear\n", +"//Initialization of variables\n", +"P1=144 //psia\n", +"T1=400 //F\n", +"y=0.7\n", +"//calculations\n", +"disp('From steam tables,')\n", +"h1=1220.4 //Btu/lbm\n", +"s1=1.6050 //Btu/lbm R\n", +"s2=1.6050 //Btu/lbm R\n", +"P2=3 //psia\n", +"sf=0.2008 //Btu/lbm R\n", +"sfg=1.6855 //Btu/lbm R\n", +"x=(s1-sf)/sfg\n", +"hf=109.37 //Btu/lbm\n", +"hfg=1013.2 //Btu/;bm\n", +"h2=hf+x*hfg\n", +"work=h1-h2\n", +"dw=y*work\n", +"h2d=h1-dw\n", +"//results\n", +"printf('Work done = %d Btu/lbm',work)\n", +"printf('\n work done in case 2 = %.1f Btu/lbm',dw)\n", +"printf('\n Final state pressure = %d psia',P2)\n", +"disp('The answer is a bit different due to rounding off error in textbook')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |