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 /Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
parent | 476705d693c7122d34f9b049fa79b935405c9b49 (diff) | |
download | all-scilab-tbc-books-ipynb-06b09e7d29d252fb2f5a056eeb8bd1264ff6a333.tar.gz all-scilab-tbc-books-ipynb-06b09e7d29d252fb2f5a056eeb8bd1264ff6a333.tar.bz2 all-scilab-tbc-books-ipynb-06b09e7d29d252fb2f5a056eeb8bd1264ff6a333.zip |
Initial commit
Diffstat (limited to 'Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb')
-rw-r--r-- | Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb | 795 |
1 files changed, 795 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb b/Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb new file mode 100644 index 0000000..7130c0d --- /dev/null +++ b/Engineering_Thermodynamics_by_O_Singh/5-Entropy.ipynb @@ -0,0 +1,795 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Entropy" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.10: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_10.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10')\n", +"p1=3;//initial pressure in Mpa\n", +"v1=0.05;//initial volume in m^3\n", +"v2=0.3;//final volume in m^3\n", +"disp('for reversible adiabatic process governing equation for expansion,')\n", +"disp('P*V^1.4=constant')\n", +"disp('also,for such process entropy change=0')\n", +"disp('using p2/p1=(v1/v2)^1.4 or v=(p1*(v1^1.4)/p)^(1/1.4)')\n", +"disp('final pressure(p2)in Mpa')\n", +"disp('p2=p1*(v1/v2)^1.4')\n", +"p2=p1*(v1/v2)^1.4\n", +"disp('from first law,second law and definition of enthalpy;')\n", +"disp('dH=T*dS+v*dP')\n", +"disp('for adiabatic process of reversible type,dS=0')\n", +"dS=0;//for adiabatic process of reversible type\n", +"disp('so dH=v*dP')\n", +"disp('integrating both side H2-H1=deltaH=v*dP in KJ')\n", +"p1=3*1000;//initial pressure in Kpa\n", +"p2=244;//final pressure in Kpa\n", +"disp('so enthalpy change(deltaH)in KJ')\n", +"function y = f(p), y =(p1*(v1^1.4)/p)^(1/1.4), endfunction\n", +"deltaH = intg(p2, p1, f) \n", +"disp('and entropy change=0')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.11: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_11.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11')\n", +"m=2;//mass of air in kg\n", +"v1=1;//initial volume of air in m^3\n", +"v2=10;//final volume of air in m^3\n", +"R=287;//gas constant in J/kg K\n", +"disp('during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion')\n", +"disp('a> change in entropy of air(deltaS_air)in J/K')\n", +"disp('deltaS_air=m*R*log(v2/v1)')\n", +"deltaS_air=m*R*log(v2/v1)\n", +"disp('b> during free expansion on heat is gained or lost to surrounding so,')\n", +"disp('deltaS_surrounding=0')\n", +"disp('entropy change of surroundings=0')\n", +"deltaS_surrounding=0;//entropy change of surroundings\n", +"disp('c> entropy change of universe(deltaS_universe)in J/K')\n", +"disp('deltaS_universe=deltaS_air+deltaS_surrounding')\n", +"deltaS_universe=deltaS_air+deltaS_surrounding" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.12: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12')\n", +"m=0.5;//mass of air in kg\n", +"p1=1.013*10^5;//initial pressure of air in pa\n", +"p2=0.8*10^6;//final pressure of air in pa\n", +"T1=800;//initial temperature of air in K\n", +"n=1.2;//polytropic expansion constant\n", +"y=1.4;//expansion constant for air\n", +"Cv=0.71;//specific heat at constant volume in KJ/kg K\n", +"disp('let initial and final states be denoted by 1 and 2')\n", +"disp('for poly tropic process pressure and temperature can be related as')\n", +"disp('(p2/p1)^((n-1)/n)=T2/T1')\n", +"disp('so temperature after compression(T2)=T1*(p2/p1)^((n-1)/n) in K')\n", +"T2=T1*(p2/p1)^((n-1)/n)\n", +"disp('substituting in entropy change expression for polytropic process,') \n", +"disp('entropy change(deltaS)inKJ/kg K')\n", +"disp('deltaS=Cv*((n-y)/(n-1))*log(T2/T1)')\n", +"deltaS=Cv*((n-y)/(n-1))*log(T2/T1)\n", +"disp('NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K')\n", +"disp('total entropy change(deltaS)=m*deltaS*1000 in J/K')\n", +"deltaS=m*deltaS*1000" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.13: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_13.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13')\n", +"disp('NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using scilab software')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.14: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_14.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14')\n", +"Q1=500;//heat supplied by source in kcal/s\n", +"T1=600;//temperature of source in K\n", +"T2=300;//temperature of sink in K\n", +"disp('clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink')\n", +"disp('K=dQ/T=Q1/T1-Q2/T2')\n", +"disp('i> for Q2=200 kcal/s')\n", +"Q2=200;//heat rejected by sink in kcal/s\n", +"disp('K=Q1/T1-Q2/T2 in kcal/s K')\n", +"K=Q1/T1-Q2/T2\n", +"disp('as K is not greater than 0,therefore under these conditions engine is not possible')\n", +"disp('ii> for Q2=400 kcal/s')\n", +"Q2=400;//heat rejected by sink in kcal/s\n", +"disp('K=Q1/T1-Q2/T2 in kcal/s K')\n", +"K=Q1/T1-Q2/T2\n", +"disp('as K is less than 0,so engine is feasible and cycle is reversible')\n", +"disp('iii> for Q2=250 kcal/s')\n", +"Q2=250;//heat rejected by sink in kcal/s\n", +"disp('K=Q1/T1-Q2/T2 in kcal/s K')\n", +"K=Q1/T1-Q2/T2\n", +"disp('as K=0,so engine is feasible and cycle is reversible')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.15: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_15.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15')\n", +"p1=0.5;//initial pressure of air in Mpa\n", +"T1=400;//initial temperature of air in K\n", +"p2=0.3;//final pressure of air in Mpa\n", +"T2=350;//initial temperature of air in K\n", +"R=0.287;//gas constant in KJ/kg K\n", +"Cp=1.004;//specific heat at constant pressure in KJ/kg K\n", +"disp('let the two points be given as states 1 and 2,')\n", +"disp('let us assume flow to be from 1 to 2')\n", +"disp('so entropy change(deltaS1_2)=s1-s2=Cp*log(T1/T2)-R*log(p1/p2)in KJ/kg K')\n", +"deltaS1_2=Cp*log(T1/T2)-R*log(p1/p2)\n", +"disp('deltaS1_2=s1-s2=0.01254 KJ/kg K')\n", +"disp('it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1')\n", +"disp('hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.16: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_16.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16')\n", +"disp('NOTE=>In question no. 16,value of n is derived which cannot be solve using scilab software.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.17: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_17.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17')\n", +"Q12=1000;//heat added during process 1-2 in KJ\n", +"Q34=800;//heat added during process 3-4 in KJ\n", +"T1=500;//operating temperature for process 1-2\n", +"T3=400;//operating temperature for process 3-4\n", +"T5=300;//operating temperature for process 5-6\n", +"T2=T1;//isothermal process\n", +"T4=T3;//isothermal process\n", +"T6=T5;//isothermal process\n", +"disp('total heat added(Q)in KJ')\n", +"disp('Q=Q12+Q34')\n", +"Q=Q12+Q34\n", +"disp('for heat addition process 1-2')\n", +"disp('Q12=T1*(s2-s1)')\n", +"disp('deltaS=s2-s1=Q12/T1 in KJ/K')\n", +"deltaS=Q12/T1\n", +"disp('or heat addition process 3-4')\n", +"disp('Q34=T3*(s4-s3)')\n", +"disp('deltaS=s4-s3=Q34/T3 in KJ/K')\n", +"deltaS=Q34/T3\n", +"disp('or heat rejected in process 5-6(Q56)in KJ')\n", +"disp('Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)')\n", +"Q56=T5*(deltaS+deltaS)\n", +"disp('net work done=net heat(W_net)in KJ')\n", +"disp('W_net=(Q12+Q34)-Q56')\n", +"W_net=(Q12+Q34)-Q56\n", +"disp('thermal efficiency of cycle(n)=W_net/Q')\n", +"n=W_net/Q\n", +"disp('or n=n*100 %')\n", +"n=n*100 \n", +"disp('so work done=600 KJ and thermal efficiency=33.33 %')\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.18: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_18.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18')\n", +"T1_a=800;//temperature of reservoir a in K\n", +"T1_b=700;//temperature of reservoir b in K\n", +"T1_c=600;//temperature of reservoir c in K\n", +"T2=320;//temperature of sink in K\n", +"W=20;//work done in KW\n", +"Q2=10;//heat rejected to sink in KW\n", +"disp('let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c')\n", +"disp('here Q1-Q2=W')\n", +"disp('so heat supplied by source(Q1)=W+Q2 in KW')\n", +"Q1=W+Q2\n", +"disp('also given that,Q1_a=0.7*Q1_b.......eq 1')\n", +"disp('Q1_c=Q1-(0.7*Q1_b+Q1_b)')\n", +"disp('Q1_c=Q1-1.7*Q1_b........eq 2')\n", +"disp('for reversible engine')\n", +"disp('Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3')\n", +"disp('substitute eq 1 and eq 2 in eq 3 we get, ')\n", +"disp('heat supplied by reservoir of 700 K(Q1_b)in KJ/s')\n", +"disp('Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))')\n", +"Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", +"disp('so heat supplied by reservoir of 800 K(Q1_a)in KJ/s')\n", +"disp('Q1_a=0.7*Q1_b')\n", +"Q1_a=0.7*Q1_b\n", +"disp('and heat supplied by reservoir of 600 K(Q1_c)in KJ/s')\n", +"disp('Q1_c=Q1-1.7*Q1_b')\n", +"Q1_c=Q1-1.7*Q1_b\n", +"disp('so heat supplied by reservoir at 800 K(Q1_a)')\n", +"Q1_a\n", +"disp('so heat supplied by reservoir at 700 K(Q1_b)')\n", +"Q1_b\n", +"disp('so heat supplied by reservoir at 600 K(Q1_c)')\n", +"Q1_c=-Q1_c\n", +"disp('NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.')\n", +"\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1')\n", +"p1=5;//initial pressure of air\n", +"T1=(27+273);//temperature of air in K\n", +"p2=2;//final pressure of air in K\n", +"R=0.287;//gas constant in KJ/kg K\n", +"Cp_air=1.004;//specific heat of air at constant pressure in KJ/kg K\n", +"disp('entropy change may be given as,')\n", +"disp('s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))')\n", +"disp('here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2')\n", +"disp('so change in entropy(deltaS)in KJ/kg K')\n", +"disp('deltaS=(Cp_air*log(1))-(R*log(p2/p1))')\n", +"deltaS=(Cp_air*log(1))-(R*log(p2/p1))" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2')\n", +"T1=(27+273);//temperature of water in K\n", +"T2=(100+273);//steam temperature of water in K\n", +"m=5;//mass of water in kg\n", +"q=2260;//heat of vaporisation at 100 degree celcius in KJ/kg\n", +"Cp=4.2;//specific heat of water at constant pressure in KJ/kg K\n", +"M=18;//molar mass for water/steam \n", +"R1=8.314;//gas constant in KJ/kg K\n", +"disp('total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)')\n", +"disp('deltaS1=Q1/T1,where Q1=m*Cp*deltaT')\n", +"disp('heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ')\n", +"disp('Q1=m*Cp*(T2-T1)')\n", +"Q1=m*Cp*(T2-T1)\n", +"disp('deltaS1=Q1/T1 in KJ/K')\n", +"deltaS1=Q1/T1\n", +"disp('now heat of vaporisation(Q2)=m*q in KJ')\n", +"Q2=m*q\n", +"disp('entropy change during phase transformation(deltaS2)in KJ/K')\n", +"disp('deltaS2=Q2/T2')\n", +"deltaS2=Q2/T2\n", +"disp('entropy change during steam temperature rise(deltaS3)in KJ/K')\n", +"disp('deltaS3=m*Cp_steam*dT/T')\n", +"disp('here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K')\n", +"disp('R=R1/M in KJ/kg K')\n", +"R=R1/M\n", +"T2=(100+273.15);//steam temperature of water in K\n", +"T3=(400+273.15);//temperature of steam in K\n", +"disp('now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K')\n", +"function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)/T , endfunction\n", +"deltaS3 = intg(T2, T3, f) \n", +"disp('total entropy change(deltaS)=deltaS1+deltaS2+deltaS3 in KJ/K')\n", +"deltaS3=51.84;//approximately\n", +"deltaS=deltaS1+deltaS2+deltaS3\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.3: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3')\n", +"R1=8.314;//gas constant in KJ/kg K\n", +"M=32;//molar mass for O2 \n", +"T1=(27+273);//initial temperature of O2 in K\n", +"p1=125;//initial pressure of O2 in Kpa\n", +"p2=375;//final pressure of O2 in Kpa\n", +"Cp=1.004;//specific heat of air at constant pressure in KJ/kg K\n", +"disp('gas constant for oxygen(R)in KJ/kg K')\n", +"disp('R=R1/M')\n", +"R=R1/M\n", +"disp('for reversible process the change in entropy may be given as')\n", +"disp('deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K')\n", +"T2=T1;//isothermal process\n", +"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))\n", +"disp('so entropy change=deltaS in KJ/kg K')\n", +"deltaS" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4')\n", +"T1=(150+273.15);//temperature of copper block in K\n", +"T2=(25+273.15);//temperature of sea water in K\n", +"m=1;//mass of copper block in kg\n", +"C=0.393;//heat capacity of copper in KJ/kg K\n", +"disp('entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water')\n", +"disp('where deltaS_block=m*C*log(T2/T1)')\n", +"disp('here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink')\n", +"disp('therefore deltaS_block=m*C*log(T2/T1)in KJ/K')\n", +"deltaS_block=m*C*log(T2/T1)\n", +"disp('heat loss by block =heat gained by water(Q)in KJ')\n", +"disp('Q=-m*C*(T1-T2)')\n", +"Q=-m*C*(T1-T2)\n", +"disp('therefore deltaS_water=-Q/T2 in KJ/K')\n", +"deltaS_water=-Q/T2\n", +"disp('thus deltaS_universe=(deltaS_block+deltaS_water)*1000 in J/K')\n", +"deltaS_universe=(deltaS_block+deltaS_water)*1000" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5')\n", +"m=1;//mass of copper block in kg\n", +"T=(27+273);//temperature of copper block in K\n", +"h=200;//height from which copper block dropped in sea water in m\n", +"C=0.393;//heat capacity for copper in KJ/kg K\n", +"g=9.81;//acceleration due to gravity in m/s^2\n", +"disp('deltaS_universe=(deltaS_block+deltaS_seawater)')\n", +"disp('since block and sea water both are at same temperature so,')\n", +"disp('deltaS_universe=deltaS_seawater')\n", +"disp('conservation of energy equation yields,')\n", +"disp('Q-W=deltaU+deltaP.E+deltaK.E')\n", +"disp('since in this case,W=0,deltaK.E=0,deltaU=0')\n", +"disp('Q=deltaP.E')\n", +"disp('change in potential energy=deltaP.E=m*g*h in J')\n", +"deltaPE=m*g*h\n", +"Q=deltaPE\n", +"disp('deltaS_universe=deltaS_seawater=Q/T in J/kg K')\n", +"deltaS_universe=Q/T\n", +"disp('entropy change of universe(deltaS_universe)in J/kg K')\n", +"deltaS_universe" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.6: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6')\n", +"m1=1;//mass of first copper block in kg\n", +"m2=0.5;//mass of second copper block in kg\n", +"T1=(150+273.15);//temperature of first copper block in K\n", +"T2=(0+273.15);//temperature of second copper block in K\n", +"Cp_1=0.393;//heat capacity for copper block 1 in KJ/kg K\n", +"Cp_2=0.381;//heat capacity for copper block 2 in KJ/kg K\n", +"disp('here deltaS_universe=deltaS_block1+deltaS_block2')\n", +"disp('two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf')\n", +"disp('then from energy conservation')\n", +"disp('m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)')\n", +"disp('Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)in K')\n", +"Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", +"disp('hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1')\n", +"disp('deltaS1=m1*Cp_1*log(Tf/T1)in KJ/K')\n", +"deltaS1=m1*Cp_1*log(Tf/T1)\n", +"disp('entropy change in block 2(deltaS2)in KJ/K')\n", +"disp('deltaS2=m2*Cp_2*log(Tf/T2)')\n", +"deltaS2=m2*Cp_2*log(Tf/T2)\n", +"disp('entropy change of universe(deltaS)=deltaS1+deltaS2 in KJ/K')\n", +"deltaS=deltaS1+deltaS2" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.7: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7')\n", +"disp('NOTE=>in this question formula is derived which cannot be solve using scilab software')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.8: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_8.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8')\n", +"T1=1800;//temperature of high temperature reservoir in K\n", +"T2=300;//temperature of low temperature reservoir in K\n", +"Q1=5;//heat addition in MW\n", +"W=2;//work done in MW\n", +"disp('for irreversible operation of engine,')\n", +"disp('rate of entropy generation=Q1/T1+Q2/T2')\n", +"disp('W=Q1-Q2=>Q2=Q1-W in MW')\n", +"Q2=Q1-W\n", +"disp('entropy generated(deltaS_gen)in MW')\n", +"disp('deltaS_gen=Q1/T1+Q2/T2')\n", +"Q1=-5;//heat addition in MW\n", +"deltaS_gen=Q1/T1+Q2/T2\n", +"disp('work lost(W_lost)in MW')\n", +"disp('W_lost=T2*deltaS_gen')\n", +"W_lost=T2*deltaS_gen" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.9: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_5_Example_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Display mode\n", +"mode(0);\n", +"// Display warning for floating point exception\n", +"ieee(1);\n", +"clear;\n", +"clc;\n", +"disp('Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9')\n", +"T1=500;//temperature of system in K\n", +"T2=300;//temperature of reservoir in K\n", +"disp('system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K')\n", +"disp('therefore,maximum heat(Q1)=(C*dT)in J')\n", +"disp('here C=0.05*T^2+0.10*T+0.085 in J/K')\n", +"disp('so Q1=(0.05*T^2+0.10*T+0.085)*dT')\n", +"function y = f(T), y = (0.05*T^2+0.10*T+0.085), endfunction\n", +"Q1 = intg(T1, T2, f)\n", +"Q1=-Q1\n", +"disp('entropy change of system,deltaS_system=C*dT/T in J/K')\n", +"disp('so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T')\n", +"function y = k(T), y = (0.05*T^2+0.10*T+0.085)/T, endfunction\n", +"deltaS_system = intg(T1, T2, k)\n", +"disp('deltaS_reservoir=Q2/T2=(Q1-W)/T2')\n", +"disp('also,we know from entropy principle,deltaS_universe is greater than equal to 0')\n", +"disp('deltaS_universe=deltaS_system+deltaS_reservoir')\n", +"disp('thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0')\n", +"disp('W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ')\n", +"W=(Q1+deltaS_system*T2)/1000\n", +"disp('hence maximum work=W in KJ')\n", +"W" + ] + } +], +"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 +} |