summaryrefslogtreecommitdiff
path: root/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb')
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb569
1 files changed, 569 insertions, 0 deletions
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb
new file mode 100644
index 0000000..d7eef21
--- /dev/null
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/6-Using_Entropy.ipynb
@@ -0,0 +1,569 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 6: Using Entropy"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.10: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"m1 = 5.00 // initial mass in kg\n",
+"P1 = 5.00 // initial pressure in bar\n",
+"T1 = 500.00 // initial temperature in kelvin\n",
+"P2 = 1.00 // final pressure in bar\n",
+"// From table A-22\n",
+"pr1 = 8.411\n",
+"// Using this value of pr2 and interpolation in table A-22\n",
+"T2 = 317.00 // in kelvin\n",
+"// Calculations \n",
+"pr2 = (P2/P1)*pr1\n",
+"m2 = (P2/P1)*(T1/T2)*m1\n",
+"// Results\n",
+"printf('The amount of mass remaining in the tank is %f kg',m2)\n",
+"printf('and its temperature is %f kelvin.',T2);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.11: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 1.00 // inlet pressure in bar\n",
+"T1 = 593.00 // inlet temperature in kelvin\n",
+"P2 = 1.00 // exit pressure in bar\n",
+"eta =0.75 // turbine efficiency\n",
+"// From table A-4\n",
+"h1 = 3105.6 // in Kj/kg\n",
+"s1 = 7.5308 // in kj/kg.k\n",
+"// From table A-4 at 1 bar\n",
+"h2s = 2743.00 // in kj/kg\n",
+"// Calculations\n",
+"w = eta*(h1 - h2s)\n",
+"// Result\n",
+"printf( ' The work developed per unit mass of steam flowing through is %f kJ/kg.',w);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.12: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 3.00 // pressure of air entering in bar\n",
+"T1 = 390.00 // temperature of air entering in kelvin\n",
+"P2 = 1.00 // pressure of exit air\n",
+"Wcvdot = 74.00 // work developed in kj/kg\n",
+"// From table A-22,at 390k\n",
+"h1 = 390.88 // in kj/kg\n",
+"pr1 = 3.481\n",
+"// From interpolation table A-22\n",
+"h2s = 285.27 // in kj/kg\n",
+"// calculations\n",
+"pr2 = (P2/P1)*pr1\n",
+"Wcvdots = h1 - h2s\n",
+"eta = Wcvdot/Wcvdots\n",
+"// Result\n",
+"printf( ' The turbine efficiency is %.4f ',eta)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.13: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 1.00 // pressure of entering steam in Mpa\n",
+"T1 = 593.00 // temperature of entering steam in kelvin\n",
+"V1 = 30.00 // velocity of entering steam in m/s\n",
+"P2 = 0.3 // pressure of exit steam in Mpa\n",
+"T2 = 453.00 // temperature of exit steam in kelvin\n",
+"// From table A-4, at T1 = 593 kelvin and P1 = 1 Mpa;\n",
+"// and at T2 = 453 kelvin and P2 = .3 Mpa\n",
+"h1 = 3093.9 // in kj/kg\n",
+"s1 = 7.1962 // in kj/kg.k\n",
+"h2 = 2823.9 // in kj/kg\n",
+"// Interpolating in table A-4\n",
+"h2s = 2813.3 // in kj/kg\n",
+"// Calculations\n",
+"V2squareby2 = h1 - h2 + (V1**2)/2000\n",
+"V2squareby2s = h1 - h2s + (V1**2)/2000\n",
+"eta = V2squareby2/V2squareby2s\n",
+"// Results\n",
+"printf( ' The nozzle efficiency is %.4f',eta)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.14: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"// From table A-9\n",
+"h1 = 249.75 // in kj/kg\n",
+"h2 = 294.17 // in kj/kg\n",
+"mdot = 0.07 // in kg/s\n",
+"// From table A-9\n",
+"s1 = 0.9572 // in Kj/Kg.k\n",
+"h2s = 285.58 // in kj/kg\n",
+"// Calculations\n",
+"wcvdot = -(mdot*(h2-h1))\n",
+"eta = (h2s-h1)/(h2-h1) \n",
+"// Results\n",
+"printf( ' The power in is %f kw',wcvdot);\n",
+"printf( ' The isentropic efficiency is %.3f',eta)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.15: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 1.00 // pressure of entering air in bar\n",
+"T1 = 293.00 // temperature of entering air in kelvin\n",
+"P2 = 5.00 // pressure of exit air in bar\n",
+"n = 1.3\n",
+"R = 8.314/28.97\n",
+"// From table A-22\n",
+"h1 = 293.17 // in kj/kg\n",
+"h2 = 426.35 // in kj/kg\n",
+"// Calculations\n",
+"T2 = T1*((P2/P1)**((n-1)/n)) // in kelvin\n",
+"wcvdot=((n*R)/(n-1))*(T1-T2) // in kj/kg\n",
+"Qcvdot= wcvdot + (h2-h1) // in kj/kg\n",
+"// Results\n",
+"printf( ' The work per unit mass passing through the device is %.2f kJ/kg',wcvdot)\n",
+"printf( ' The heat transfer per unit mass is %.2f kJ/kg. ',Qcvdot)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.1: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"T = 373.15 // temperature in kelvin\n",
+"// From table A-2\n",
+"p = 1.014*(10**5) // pressure in pascal\n",
+"vg = 1.673\n",
+"vf = 1.0435e-3\n",
+"sg = 7.3549\n",
+"sf = 1.3069\n",
+"// Calculations\n",
+"w = p*(vg-vf)*(10**(-3))\n",
+"Q = T*(sg-sf)\n",
+"// Results \n",
+"printf( ' The work per unit mass is %.3f KJ/Kg',w)\n",
+"printf( ' The heat transfer per unit mass is %.2f kj/kg',Q)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.2: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"// Assumptions:\n",
+"// From table A-2 at 100 degree celcius\n",
+"ug = 2506.5 // in kj/kg\n",
+"uf = 418.94 // in kj/kg\n",
+"sg = 7.3549\n",
+"sf = 1.3069\n",
+"// Calculations:-\n",
+"// From energy balance\n",
+"W = -(ug-uf)\n",
+"// From entropy balance\n",
+"sigmabym = (sg-sf)\n",
+"// Results\n",
+"printf( ' The net work per unit mass is %.2f KJ/kg. ',W)\n",
+"printf( ' The amount of entropy produced per unit mass is %.2f KJ/kg.',sigmabym)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.3: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"T1 = 273.0 // initial temperature of saturated vapor in kelvin\n",
+"P2 = 0.7*(10**6) // final pressure in pascal\n",
+"// From table A-10,\n",
+"u1 = 227.06 // in kj/kg\n",
+"// minimum theoretical work corresponds to state of isentropic compression\n",
+"// From table A-12,\n",
+"u2s = 244.32 // in kj/kg\n",
+" \n",
+"// Calculations \n",
+"Wmin = u2s-u1\n",
+"// Results\n",
+"printf( ' The minimum theoretical work input required per unit mass of refrigerant is: %.2f kJ/kg',Wmin)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.4: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given :-\n",
+"Qdot = -1.2 // in kilo watt\n",
+"Tb = 300.0 // in kelvin\n",
+"Tf = 293.0 // in kelvin\n",
+"// Calculations\n",
+"// Part (a)\n",
+"// From entropy balance \n",
+"sigmadot = -Qdot/Tb\n",
+"// Part(b)\n",
+"// From entropy balance \n",
+"sigmadt = -Qdot/Tf\n",
+"// Results\n",
+"printf( ' The rate of entropy production with gearbox as system is %f kw/k',sigmadot)\n",
+"printf( ' The rate of entropy production with gearbox + sorrounding as system is %f kw/k',sigmadt)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.5: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// GIven:-\n",
+"Tmi = 1200.0 // initial temperature of metal in kelvin\n",
+"cm = 0.42 // specific heat of metal in KJ/kg.k\n",
+"mm = 0.3 // mass of metal in kg\n",
+"Twi = 300.0 // initial temperature of water in kelvin\n",
+"cw = 4.2 // specific heat of water in KJ/Kg.k\n",
+"mw = 9.0 // mass of water in kg\n",
+"// Calculations\n",
+"// Part(a)\n",
+"// Solving energy balance equation yields\n",
+"Tf = (mw*(cw/cm)*Twi+mm*Tmi)/(mw*(cw/cm)+mm)\n",
+"// Part (b)\n",
+"// Solving entropy balance equation yields\n",
+"sigma = mw*cw*log(Tf/Twi)+mm*cm*log(Tf/Tmi)\n",
+"// Results\n",
+"printf( ' The final equilibrium temperature of the metal bar and the water is %.2f kelvin.',Tf)\n",
+"printf( ' The amount of entropy produced is: %.2f kJ/k.',sigma)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.6: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 30.0 // pressure of steam entering the turbine in bar\n",
+"T1 = 400.0 // temperature of steam entering the turbine in degree celcius\n",
+"V1 = 160.0 // velocity of steam entering the turbine in m/s\n",
+"T2 = 100.0 // temperature of steam exiting in degree celcius\n",
+"V2 = 100.0 // velocity of steam exiting in m/s\n",
+"Wcvdot = 540.0 // work produced by turbine in kJ/kg of steam\n",
+"Tb = 350.0 // temperature of the boundary in kelvin\n",
+"// From table A-4 and table A-2\n",
+"h1 = 3230.9 // specific enthalpy at entry in Kj/kg\n",
+"h2 = 2676.1 // specific enthalpy at exit in kj/kg\n",
+"// Calculations\n",
+"// Reduction in mass and energy balance equations results in \n",
+"Qcvdot = Wcvdot + (h2 - h1)+ (V2**2-V1**2)/(2*(10**3)) // heat transfer rate\n",
+"// From table A-2\n",
+"s2 = 7.3549 // in kj/kg.k\n",
+"// From table A-4\n",
+"s1 = 6.9212 // in kj/kg.k\n",
+"// From entropy and mass balance equations\n",
+"sigmadot = -(Qcvdot/Tb) + (s2-s1)\n",
+"// Results\n",
+"printf( 'The rate at which entropy is produced within the turbine per kg of steam flowing is %.2f kJ/kg.k',sigmadot)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.7: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"T1 = 294.0 // entry temperature of air in kelvin\n",
+"P1 = 5.1 // entry pressure of air in bars\n",
+"T2 = 352.0 // exit temperature of hot stream in kelvin\n",
+"P2 = 1.0 // exit pressure of hot stream in bars\n",
+"T3 = 255.0 // exit temperature of cold stream in kelvin\n",
+"P3 = 1.0 // exit pressure of cold stream in bars\n",
+"cp = 1.0 // in kj/kg.k\n",
+"// Calculations\n",
+"R = 8.314/28.97\n",
+"se = 0.4*(cp*log((T2)/(T1))-R*log(P2/P1)) + 0.6*(cp*log((T3)/(T1))-R*log(P3/P1))\n",
+" // specific entropy in kj/kg.k\n",
+"// Results\n",
+"printf( ' Specific entropy in kj/kg.k = %.3f KJ/kg.',se)\n",
+"printf( ' Since se > 0, the claim of the writer is true');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.8: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 3.5 // pressure of refrigerant entering the compressor in bars\n",
+"T1 = 268.0 // temperature of refrigerant entering the compressor in kelvin\n",
+"P2 = 14.0 // pressure of refrigerant entering the condenser in bars\n",
+"T2 = 348.0 // temperature of refrigerant entering the condenser in kelvin\n",
+"P3 = 14.0 // pressure of refrigerant exiting the condenser in bars\n",
+"T3 = 301.0 // temperature of refrigerant exiting the condenser in kelvin\n",
+"P4 = 3.5 // pressure of refrigerant after passing through expansion valve in bars\n",
+"P5 = 1.0 // pressure of indoor return air entering the condenser in bars\n",
+"T5 = 293.0 // temperature of indoor return air entering the condenser in kelvin\n",
+"AV5 = 0.42 // volumetric flow rate of indoor return air entering the condenser in m^3/s\n",
+"P6 = 1.0 // pressure of return air exiting the condenser in bar\n",
+"T6 = 323.0 // temperature of return air exiting the condenser in kelvin\n",
+"// Part(a)\n",
+"// From table A-9\n",
+"s1 = 0.9572 // in kj/kg.k\n",
+"// Interpolating in table A-9\n",
+"s2 = 0.98225 // in kj/kg.k\n",
+"h2 = 294.17 // in kj/kg\n",
+"// From table A-7\n",
+"s3 = 0.2936 // in kj/kg.k\n",
+"h3 = 79.05 // in kj/kg\n",
+"h4 = h3 // since expansion through valve is throttling process\n",
+"// From table A-8\n",
+"hf4 = 33.09 // in kj/kg\n",
+"hg4 = 246.00 // in kj/kg\n",
+"sf4 = 0.1328 // in kj/kg.k\n",
+"sg4 = 0.9431 // in kj/kg.k\n",
+"cp = 1.005 // in kj/kg.k\n",
+"// Calculations\n",
+"x4 = (h4-hf4)/(hg4-hf4) // quality at state 4\n",
+"s4 = sf4 + x4*(sg4-sf4) // specific entropy at state 4\n",
+"// CONDENSER!!\n",
+"v5 = ((8314/28.97)*T5)/(P5*(10**5)) // specific volume at state 5\n",
+"mairdot = AV5/v5 \n",
+"h6 = cp*T6\n",
+"h5 = cp*T5\n",
+"mrefdot = mairdot*(h6-h5)/(h2-h3)\n",
+"deltaS65 = cp*log(T6/T5)-(8.314/28.97)*log(P6/P5) // change in specific entropy\n",
+"sigmacond = (mrefdot*(s3-s2)) + (mairdot*(deltaS65))\n",
+"// COMPRESSOR!!\n",
+"sigmacomp = mrefdot*(s2-s1)\n",
+"// VALVE!!\n",
+"sigmavalve = mrefdot *(s4-s3)\n",
+"// Results\n",
+"printf( ' The rates of entropy production for control volume enclosing the condenser is %f kw/k',sigmacond);\n",
+"printf( ' The rates of entropy production for control volume enclosing the compressor is %f kW/K.',sigmacomp);\n",
+"printf( ' The rates of entropy production for control volume enclosing the expansion valve is %f kW/K ',sigmavalve)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6.9: Example.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Given:-\n",
+"P1 = 1.00 // initial pressure in bar\n",
+"T1 = 300.00 // initial temperature in kelvin\n",
+"T2 = 650.00 // final temperature in kelvin\n",
+"// Part(a)\n",
+"// From table A-22\n",
+"pr2 = 21.86 \n",
+"pr1 = 1.3860\n",
+"k = 1.39 // From table A-20\n",
+"// Calculations\n",
+"p2 = P1*(pr2/pr1)\n",
+"p2a = P1*((T2/T1)**(k/(k-1)))\n",
+"// Results\n",
+"printf( ' P2 = %f bar.',p2)\n",
+"printf( ' Part(b) IT software problem');\n",
+"printf( ' P2a = %f bar',p2a);"
+ ]
+ }
+],
+"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
+}