summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb')
-rw-r--r--Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb536
1 files changed, 536 insertions, 0 deletions
diff --git a/Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb b/Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb
new file mode 100644
index 0000000..77c5dfb
--- /dev/null
+++ b/Basic_Engineering_Thermodynamics_by_R_Joel/7-Entropy.ipynb
@@ -0,0 +1,536 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 7: Entropy"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.1: specific_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.1');\n",
+"\n",
+"// aim : To determine\n",
+"// the specific enthalpy of water\n",
+"\n",
+"// Given values\n",
+"Tf = 273+100;// Temperature,[K]\n",
+"\n",
+"// solution\n",
+"// from steam table\n",
+"cpl = 4.187;// [kJ/kg K]\n",
+"// using equation [8]\n",
+"sf = cpl*log(Tf/273.16);// [kJ/kg*K]\n",
+"mprintf('\n The specific entropy of water is = %f kJ/kg K\n',sf);\n",
+"\n",
+"// using steam table\n",
+"sf = 1.307;// [kJ/kg K]\n",
+"mprintf('\n From table The accurate value of sf in this case is = %f kJ/kg K\n',sf);\n",
+"\n",
+"// There is small error in book's final value of sf\n",
+"\n",
+"\n",
+"// End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.2: specific_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clear;\n",
+"clc;\n",
+"disp('Example 7.2');\n",
+"\n",
+"// aim : To determine\n",
+"// the specific entropy\n",
+"\n",
+"// Given values\n",
+"P = 2;// pressure,[MN/m^2]\n",
+"x = .8;// dryness fraction\n",
+"\n",
+"// solution\n",
+"// from steam table at given pressure\n",
+"Tf = 485.4;// [K]\n",
+"cpl = 4.187;// [kJ/kg K]\n",
+"hfg = 1888.6;// [kJ/kg]\n",
+"\n",
+"// (a) finding entropy by calculation\n",
+"s = cpl*log(Tf/273.16)+x*hfg/Tf;// formula for entropy calculation\n",
+"\n",
+"mprintf('\n (a) The specific entropy of wet steam is = %f kJ/kg K\n',s);\n",
+"\n",
+"// (b) calculation of entropy using steam table\n",
+"// from steam table at given pressure\n",
+"sf = 2.447;// [kJ/kg K]\n",
+"sfg = 3.89;// [kJ/kg K]\n",
+"// hence\n",
+"s = sf+x*sfg;// [kJ/kg K]\n",
+"\n",
+"mprintf('\n (b) The specific entropy using steam table is = %f kJ/kg K\n',s);\n",
+"\n",
+"// End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.3: specific_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.3');\n",
+"\n",
+"// aim : To determine\n",
+"// the specific entropy of steam\n",
+"\n",
+"// Given values\n",
+"P = 1.5;//pressure,[MN/m^2]\n",
+"T = 273+300;//temperature,[K]\n",
+"\n",
+"// solution\n",
+"\n",
+"// (a)\n",
+"// from steam table\n",
+"cpl = 4.187;// [kJ/kg K]\n",
+"Tf = 471.3;// [K]\n",
+"hfg = 1946;// [kJ/kg]\n",
+"cpv = 2.093;// [kJ/kg K]\n",
+"\n",
+"// usung equation [2]\n",
+"s = cpl*log(Tf/273.15)+hfg/Tf+cpv*log(T/Tf);// [kJ/kg K]\n",
+"mprintf('\n (a) The specific entropy of steam is = %f kJ/kg K\n',s);\n",
+"\n",
+"// (b)\n",
+"// from steam tables\n",
+"s = 6.919;// [kJ/kg K]\n",
+"mprintf('\n (b) The accurate value of specific entropy from steam table is = %f kJ/kg K\n',s);\n",
+"\n",
+"// End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.4: dryness_fraction.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.4');\n",
+"\n",
+"// aim : To determine\n",
+"// the dryness fraction of steam\n",
+"\n",
+"// Given values\n",
+"P1 = 2;// initial pressure, [MN/m^2]\n",
+"t = 350;// temperature, [C]\n",
+"P2 = .28;// final pressure, [MN/m^2]\n",
+"\n",
+"// solution\n",
+"// at 2 MN/m^2 and 350 C,steam is superheated because the saturation temperature is 212.4 C\n",
+"// From steam table\n",
+"s1 = 6.957;// [kJ/kg K]\n",
+"\n",
+"// for isentropic process\n",
+"s2 = s1;\n",
+"// also\n",
+"sf2 = 1.647;// [kJ/kg K]\n",
+"sfg2 = 5.368;// [kJ/kg K]\n",
+"\n",
+"// using\n",
+"// s2 = sf2+x2*sfg2, where x2 is dryness fraction of steam\n",
+"// hence\n",
+"x2 = (s2-sf2)/sfg2;\n",
+"mprintf('\n The final dryness fraction of steam is x2 = %f\n',x2);\n",
+"\n",
+"// End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.5: condition_of_steam_and_change_in_specific_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.5');\n",
+"\n",
+"// aim : To determine\n",
+"// the final condition of steam...\n",
+"// the change in specific entropy during hyperbolic process\n",
+"\n",
+"// Given values\n",
+"P1 = 2;// pressure, [MN/m^2]\n",
+"t = 250;// temperature, [C]\n",
+"P2 = .36;// pressure, [MN/m^2]\n",
+"P3 = .06;// pressure, [MN/m^2]\n",
+"\n",
+"// solution\n",
+"\n",
+"// (a)\n",
+"// from steam table\n",
+"s1 = 6.545;// [kJ/kg K]\n",
+"// at .36 MN/m^2\n",
+"sg = 6.930;// [kJ/kg*K]\n",
+"\n",
+"sf2 = 1.738;// [kJ/kg K]\n",
+"sfg2 = 5.192;// [kJ/kg K]\n",
+"vg2 = .510;// [m^3]\n",
+"\n",
+"// so after isentropic expansion, steam is wet\n",
+"// hence, s2=sf2+x2*sfg2, where x2 is dryness fraction\n",
+"// also\n",
+"s2 = s1;\n",
+"// so\n",
+"x2 = (s2-sf2)/sfg2;\n",
+"// and\n",
+"v2 = x2*vg2;// [m^3]\n",
+"\n",
+"// for hyperbolic process\n",
+"// P2*v2=P3*v3\n",
+"// hence\n",
+"v3 = P2*v2/P3;// [m^3]\n",
+" \n",
+"mprintf('\n (a) From steam table at .06 MN/m^2 steam is superheated and has temperature of 100 C with specific volume is = %f m^3/kg\n',v3);\n",
+"\n",
+"// (b)\n",
+"// at this condition\n",
+"s3 = 7.609;// [kJ/kg*K]\n",
+"// hence\n",
+"change_s23 = s3-sg;// change in specific entropy during the hyperblic process[kJ/kg*K]\n",
+"mprintf('\n (b) The change in specific entropy during the hyperbolic process is = %f kJ/kg K\n',change_s23);\n",
+"\n",
+"// In the book they have taken sg instead of s2 for part (b), so answer is not matching\n",
+"\n",
+"// End\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.6: heat_transfer_and_work_done.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clear;\n",
+"clc;\n",
+"disp('Example 7.6');\n",
+"\n",
+"// aim : To determine the\n",
+"// (a) heat transfer during the expansion and\n",
+"// (b) work done durind the expansion\n",
+"\n",
+"// given values\n",
+"m = 4.5; // mass of steam,[kg]\n",
+"P1 = 3; // initial pressure,[MN/m^2]\n",
+"T1 = 300+273; // initial temperature,[K]\n",
+"\n",
+"P2 = .1; // final pressure,[MN/m^2]\n",
+"x2 = .96; // dryness fraction at final stage\n",
+"\n",
+"// solution\n",
+"// for state point 1,using steam table\n",
+"s1 = 6.541;// [kJ/kg/K]\n",
+"u1 = 2751;// [kJ/kg]\n",
+" \n",
+" // for state point 2\n",
+" sf2 = 1.303;// [kJ/kg/K]\n",
+" sfg2 = 6.056;// [kJ/kg/k]\n",
+" T2 = 273+99.6;// [K]\n",
+" hf2 = 417;// [kJ/kg]\n",
+" hfg2 = 2258;// [kJ/kg]\n",
+" vg2 = 1.694;// [m^3/kg]\n",
+" \n",
+" // hence\n",
+" s2 = sf2+x2*sfg2;// [kJ/kg/k]\n",
+" h2 = hf2+x2*hfg2;// [kJ/kg]\n",
+" u2 = h2-P2*x2*vg2*10^3;// [kJ/kg]\n",
+" \n",
+" // Diagram of example 7.6\n",
+" x = [s1 s2];\n",
+" y = [T1 T2];\n",
+"plot2d(x,y);\n",
+" xtitle('Diagram for example 7.6(T vs s)');\n",
+" xlabel('Entropy (kJ/kg K)');\n",
+" ylabel('Temperature (K)');\n",
+"\n",
+"x = [s1,s1];\n",
+"y = [0,T1];\n",
+"plot2d(x,y);\n",
+"\n",
+"x = [s2,s2];\n",
+"y = [0,T2];\n",
+"plot2d(x,y);\n",
+"\n",
+" // (a)\n",
+" // Q_rev is area of T-s diagram\n",
+" Q_rev = (T1+T2)/2*(s2-s1);// [kJ/kg]\n",
+" // so total heat transfer is\n",
+" Q_rev = m*Q_rev;// [kJ]\n",
+" \n",
+" // (b)\n",
+" del_u = u2-u1;// change in internal energy, [kJ/kg]\n",
+" // using 1st law of thermodynamics\n",
+" W = Q_rev-m*del_u;// [kJ]\n",
+" \n",
+"mprintf('\n (a) The heat transfer during the expansion is = %f kJ (received)\n',Q_rev);\n",
+"\n",
+" mprintf('\n (b) The work done during the expansion is = %f kJ\n',W);\n",
+" \n",
+" // End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.7: change_of_entropy_and_ratio_of_change_of_entropy_and_heat_transfer.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clear;\n",
+"clc;\n",
+"disp('Example 7.7');\n",
+"\n",
+"// aim : To determine the \n",
+"// (a) change of entropy\n",
+"// (b) The approximate change of entropy obtained by dividing the heat transferred by the gas by the mean absolute temperature during the compression\n",
+"\n",
+"// Given values\n",
+"P1 = 140;// initial pressure,[kN/m^2]\n",
+"V1 = .14;// initial volume, [m^3]\n",
+"T1 = 273+25;// initial temperature,[K]\n",
+" P2 = 1400;// final pressure [kN/m^2]\n",
+" n = 1.25; // polytropic index\n",
+" cp = 1.041;// [kJ/kg K]\n",
+" cv = .743;// [kJ/kg K]\n",
+" \n",
+" // solution\n",
+" // (a)\n",
+" R = cp-cv;// [kJ/kg/K]\n",
+" // using ideal gas equation \n",
+" m = P1*V1/(R*T1);// mass of gas,[kg]\n",
+" // since gas is following law P*V^n=constant ,so \n",
+" V2 = V1*(P1/P2)^(1/n);// [m^3]\n",
+" \n",
+" // using eqn [9]\n",
+" del_s = m*(cp*log(V2/V1)+cv*log(P2/P1));// [kJ/K]\n",
+" mprintf('\n (a) The change of entropy is = %f kJ/K\n',del_s);\n",
+" \n",
+" // (b)\n",
+" W = (P1*V1-P2*V2)/(n-1);// polytropic work,[kJ]\n",
+" Gamma = cp/cv;// heat capacity ratio\n",
+" Q = (Gamma-n)/(Gamma-1)*W;// heat transferred,[kJ]\n",
+" \n",
+" // Again using polytropic law\n",
+" T2 = T1*(V1/V2)^(n-1);// final temperature, [K]\n",
+" T_avg = (T1+T2)/2;// mean absolute temperature, [K]\n",
+" \n",
+" // so approximate change in entropy is\n",
+" del_s = Q/T_avg;// [kJ/K]\n",
+" \n",
+" mprintf('\n (b) The approximate change of entropy obtained by dividing the heat transferred by the gas by the mean absolute temperature during the compression = %f kJ/K\n',del_s);\n",
+" \n",
+" // End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.8: change_of_entropies.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.8');\n",
+"\n",
+"// aim : To determine\n",
+"// the change of entropy\n",
+"\n",
+"// Given values\n",
+"m = .3;// [kg]\n",
+"P1 = 350;// [kN/m^2]\n",
+"T1 = 273+35;// [K]\n",
+"P2 = 700;// [kN/m^2]\n",
+"V3 = .2289;// [m^3]\n",
+"cp = 1.006;// [kJ/kg K]\n",
+"cv = .717;// [kJ/kg K]\n",
+"\n",
+"// solution\n",
+"// for constant volume process\n",
+"R = cp-cv;// [kJ/kg K]\n",
+"// using PV=mRT\n",
+"V1 = m*R*T1/P1;// [m^3]\n",
+"\n",
+"// for constant volume process P/T=constant,so\n",
+"T2 = T1*P2/P1;// [K]\n",
+"s21 = m*cv*log(P2/P1);// formula for entropy change for constant volume process\n",
+"mprintf('\n The change of entropy in constant volume process is = %f kJ/kg K\n',s21);\n",
+"\n",
+"// 'For the above part result given in the book is wrong\n",
+"\n",
+"V2 = V1;\n",
+"// for constant pressure process\n",
+"T3 = T2*V3/V2;// [K]\n",
+"s32 = m*cp*log(V3/V2);// [kJ/kg K]\n",
+"\n",
+"mprintf('\n The change of entropy in constant pressure process is = %f kJ/kg K\n',s32);\n",
+"\n",
+"// there is misprint in the book's result\n",
+"\n",
+"// End"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7.9: change_of_entropy.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('Example 7.9');\n",
+"\n",
+"// aim : To determine\n",
+"// the change of entropy\n",
+"\n",
+"// Given values\n",
+"P1 = 700;// initial pressure, [kN/m^2]\n",
+"T1 = 273+150;// Temperature ,[K]\n",
+"V1 = .014;// initial volume, [m^3]\n",
+"V2 = .084;// final volume, [m^3]\n",
+"\n",
+"// solution\n",
+"// since process is isothermal so\n",
+"T2 = T1;\n",
+"// and using fig.7.10\n",
+"del_s = P1*V1*log(V2/V1)/T1 ;// [kJ/K]\n",
+"mprintf('\n The change of entropy is = %f kJ/kg K\n',del_s);\n",
+"\n",
+"// End"
+ ]
+ }
+],
+"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
+}