{ "metadata": { "name": "", "signature": "sha256:0a185017fb6d8b2f89e2c9757a0bd5f1ee2fdeb7cbf86205eb93a1d0a3214502" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "\n", "Chapter 2 : Basic Thermodynamics" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 2.1 Page: 27" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import math \n", "\n", "# Variables\n", "m = 1. #[lbm] Mass of the steam\n", "T_1 = 300. #[F] Initial temperature\n", "P_1 = 14.7 #[psia] Initial pressure\n", "P_sorronding = 14.7 #[psia]\n", "Q = 50. #[Btu] Amount of the energy added to the system as heat\n", "\n", "# This is a closed system and we can apply the following equations\n", "# delta_U_system = sum(dQ_in_minus_out) + sum(dW_in_minus_out) (A)\n", "# dS_system = (m*ds)_system = sum((dQ)/T)_in_minus_out + dS_reversible (B)\n", "\n", "# From the steam tables, we look up the properties of steam at temperature 300F and pressure 14.7 psia and find \n", "u_initial = 1109.6 #[Btu/lbm] Internal energy of the steam\n", "h_initial = 1192.6 #[Btu/lbm] Enthalpy of the steam\n", "s_initial = 1.8157 #[Btu/(lbm*R)] Entropy of the steam\n", "\n", "# The work here is done by the system, equal to\n", "# -delta_w = P*A_piston*delta_x = P*m*delta_v\n", "\n", "# Calculations\n", "# Substituting this in the equation (A) and rearranging, we have\n", "# m*delta_(u + P*v) = m*delta_h = delta_Q\n", "# From which we can solve for the final specific enthalpy\n", "h_final = h_initial + Q #[Btu/lbm]\n", "\n", "# Now, by the linear interpolation we find that at h = 1242.6 Btu/lbm and P = 1 atm, temperature of the steam is given \n", "T_2 = 405.7 #[F] Final temperature\n", "\n", "# At this final temperature and pressure we have the steam properties \n", "u_final = 1147.7 #[Btu/lbm]\n", "s_final = 1.8772 #[Btu/(lbm*R)]\n", "\n", "# Thus, increase in the internal energy, enthalpy and entropy are \n", "delta_u = u_final - u_initial #[Btu/lbm]\n", "delta_s = s_final - s_initial #[Btu/(lbm*R)]\n", "delta_h = Q #[Btu/lbm]\n", "\n", "# The work done on the atmosphere is given by\n", "w = delta_h - delta_u #[Btulbm]\n", "\n", "# Results\n", "print \"The increase in internal energy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_u)\n", "print \"The increase in enthalpy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_h)\n", "print \"The increase in entropy of the steam by adding the heat is %0.4f Btu/lbm\"%(delta_s)\n", "print \"Work done by the piston expanding against the atmosphere is %0.2f Btu/lbm\"%(w)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The increase in internal energy of the steam by adding the heat is 38.10 Btu/lbm\n", "The increase in enthalpy of the steam by adding the heat is 50.00 Btu/lbm\n", "The increase in entropy of the steam by adding the heat is 0.0615 Btu/lbm\n", "Work done by the piston expanding against the atmosphere is 11.90 Btu/lbm\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 2.2 Page: 28\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import math \n", "\n", "# Variables\n", "T_in = 600. #[F] Input steam temperature\n", "P_in = 200. #[psia] Input steam pressure\n", "P_exit = 50. #[psia]\n", "\n", "# Because this is a steady-state, steady-flow process, we use \n", "# (work per pound) = W/m = -( h_in - h_out )\n", "\n", "# From the steam table we can read the the inlet enthalpy and entropy as \n", "h_in = 1322.1 #[Btu/lbm]\n", "s_in = 1.6767 #[Btu/(lb*R)]\n", "\n", "# Now, we need the value of h_out\n", "\n", "# For a reversible adiabatic steady-state, steady-flow process, we have\n", "# sum(s*m_in_minus_out) = ( s_in - s_out ) = 0\n", "\n", "# Which indicates that inlet and outlet entropies are same\n", "# We can find the outlet temperature by finding the value of the temperature in the steam table\n", "# For which the inlet entropy at 50 psia is the same as the inlet entropy, 1.6767 Btu/(lb*R). \n", "# By linear interpolation in the table we find \n", "T_in = 307.1 #[R]\n", "\n", "# and by the linear interpolation in the same table we find that\n", "h_out = 1188.1 #[Btu/lb]\n", "\n", "# Calculations\n", "# Thus, we find \n", "W_per_pound = (h_in - h_out) #[Btu/lb]\n", "\n", "# Results\n", "print \" The work output of the turbine of steam is %0.1f Btu/lb\"%(-W_per_pound)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The work output of the turbine of steam is -134.0 Btu/lb\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 2.3 Page: 38" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import math \n", "\n", "\n", "# Variables\n", "T = 500. #[F]\n", "P = 680. #[psi]\n", "\n", "# Calculations\n", "# It is reported in the book in the table A.1(page 417) that for water \n", "# We know that T_r = T/T_c and P_r = P/P_c, so\n", "T_c = 647.1*1.8 #[R]\n", "P_c = 220.55*14.51 #[psia]\n", "w = 0.345\n", "T_r = (T+459.67)/T_c\n", "P_r = P/P_c\n", "z_0 = 1+P_r/T_r*(0.083-0.422/T_r**(1.6))\n", "z_1 = P_r/T_r*(0.139-0.172/T_r**(4.2))\n", "z = z_0+w*z_1\n", "\n", "# Results\n", "print \"The compressibility factor of steam at the given state is %0.3f\"%(z)\n", "# Based on the steam table (which may be considered as reliable as the experimental data, the value of z is 0.804.\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The compressibility factor of steam at the given state is 0.851\n" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }