{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 5 : First Law of Thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5.1 Page No : 115" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The mass flow rate of air in kg/min is : 20.0\n", "The change in the work flow in kJ/min is : 740.0\n", "Change in velocity of the air flow in m/min is : -13.32\n" ] } ], "source": [ "import math \n", "\n", "# Variables\n", "v1_total = 7;\t\t\t# in m**3/min\n", "v_s1 = 0.35;\t\t\t# in m**3/kg\n", "v_s2 = 0.12;\t\t\t# in m**3/kg\n", "p1 = 1;\t\t\t# in bar\n", "p1 = p1 * 10**5;\t\t\t# in N/m**2\n", "p2 = 6;\t\t\t# in bar\n", "p2 = p2 * 10**5;\t\t\t# in N/m**2\n", "D1 = 110;\t\t\t# in mm\n", "D1 = D1 * 10**-3;\t\t\t# in m\n", "D2 = 65;\t\t\t# in mm\n", "D2 = D2 * 10**-3;\t\t\t# in m\n", "\n", "# Calculations and Results\n", "Af1 = math.pi/4*D1**2;\t\t\t# in m**2\n", "Af2 = math.pi/4*D2**2;\t\t\t# in m**2\n", "# v1_total = m1 * v_s1\n", "m1 = v1_total / v_s1;\t\t\t#in kg/min\n", "print \"The mass flow rate of air in kg/min is :\",m1\n", "\n", "m2 = m1;\t\t\t# in kg/min\n", "v2_total = m2 * v_s2;\t\t\t# in m**3/min\n", "del_W_flow = (p2 * v2_total) - (p1 * v1_total);\t\t\t# in J/min\n", "print \"The change in the work flow in kJ/min is : \",del_W_flow*10**-3\n", "\n", "v_f1 = v1_total/Af1;\t\t\t# in m/min\n", "v_f2 = v2_total /Af2;\t\t\t#in m/min\n", "del_v = v_f2 - v_f1;\t\t\t# in m/min\n", "print \"Change in velocity of the air flow in m/min is : %.2f\"%del_v\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5.2 Page No : 118" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rate of heat transfer to the water jacket in kJ/sec 16.67\n" ] } ], "source": [ "\n", "# Variables\n", "m = 2.;\t\t\t# in kg per min\n", "m = m / 60;\t\t\t# in kg per sec\n", "W = 20;\t\t\t# in kW\n", "h1 = 1400;\t\t\t# in kJ/kg\n", "h2 = 1300;\t\t\t# in kJ/kg\n", "\n", "# Calculations\n", "Q = (m * (h2 - h1)) + W;\t\t\t# in kJ/s\n", "\n", "# Results\n", "print \"Rate of heat transfer to the water jacket in kJ/sec %.2f\"%Q\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5.3 Page No : 127" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The power output of the turbine in MW is : -1.471\n", "Total error introduced in % is : 0.4\n" ] } ], "source": [ "\n", "# Variables\n", "g= 9.81;\n", "p1 = 3;\t\t\t# in Mpa\n", "p2 = 10;\t\t\t# in kPa\n", "T1 = 350;\t\t\t# in °C\n", "T1 = T1 + 273;\t\t\t# in K\n", "m = 1;\t\t\t# in kg per sec\n", "v1 = 50;\t\t\t# in m per sec\n", "v2 = 120;\t\t\t# in m per sec\n", "z1 = 2;\t\t\t# in m\n", "z2 = 5;\t\t\t# in m\n", "C_p = 1.005;\t\t\t# in kJ per sec\n", "Q = 5;\t\t\t# in kJ per sec\n", "\n", "# Calculations and Results\n", "Q = -(Q) * 10**3;\t\t\t# in J per sec\n", "T2 = (p2 * T1)/p1;\t\t\t# in K\n", "del_h = C_p * (T2-T1);\t\t\t# in kJ\n", "del_h = del_h * 10**3;\t\t\t# in J\n", "t = m * ( del_h +(v2**2-v1**2)/2 + (g * (z2 - z1)));\t\t\t# t is variable taken for calculation\n", "W_s = Q - t;\t\t\t# in J per sec\n", "W_s = W_s * 10**-6;\t\t\t# in MW\n", "print \"The power output of the turbine in MW is : %.3f\"%W_s\n", "\n", "# If kinetic and potential energy are ignored then\n", "W_s2 = Q -(m * del_h);\t\t\t# in J per sec\n", "W_s2 = W_s2 * 10**-6;\t\t\t# in MW\n", "errorIntroduced= (abs(W_s)-abs(W_s2))/abs(W_s)*100;\t\t\t# in %\n", "print \"Total error introduced in %% is : %.1f\"%errorIntroduced\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5.4 Page No : 128" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Quantity of water circulated through the pipe in kg/hr is : 2189.69\n" ] } ], "source": [ "\n", "# Variables\n", "h1 = 246.6;\t\t\t# in kJ/kg\n", "h2 = 198.55;\t\t\t# in kJ/kg\n", "W = 0;\n", "g= 9.8;\n", "Q= -(105000);\t\t\t# in kJ per hr\n", "\n", "# Calculations\n", "# m * (h1 + ((v1***2)/(2*1000)) + ((g * z1)/1000)) + Q = m * (h2 + ((v2**2)/(2*1000)) + ((g * z2)/1000)) + W\n", "# v1 and v2 is change in velocity is neglected and z2 = z1 + 10\n", "m = Q/( (h2-h1) + ((g * 10)/1000) );\t\t\t# kg per hr\n", "\n", "# Results\n", "print \"Quantity of water circulated through the pipe in kg/hr is : %.2f\"%m\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5.5 Page No : 128" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Power of the motor required to drive the compressor in kW is : 45.17\n", "Ratio of inlet pipe diameter to outlet pipe diameter is : 2.24\n" ] } ], "source": [ "import math \n", "\n", "# Variables\n", "#Given data \n", "m=15.;\t\t\t # in kg/min\n", "m= m/60;\t\t\t# in kg/sec\n", "H1= 5;\t \t\t# in kJ/kg\n", "H1= H1*10**3;\t\t\t# in J/kg\n", "H2= 173;\t\t\t# in kJ/kg\n", "H2= H2*10**3;\t\t\t# in J/kg\n", "V1= 5;\t\t \t# in m/s\n", "V2= 7.5;\t\t\t# in m/s\n", "Q= 760;\t\t\t # in kJ/min\n", "Q= Q*10**3/60;\t\t\t# in J/s\n", "\n", "# Calculations and Results\n", "# Formula (H1+V1**2/2)+(-Q)= (H2+V2**2/2)+W\n", "W= (H1+V1**2/2)+(-Q)-(H2+V2**2/2);\t\t\t# in W/kg\n", "W= W*10**-3;\t\t\t# in kW/kg\n", "# The work done will be\n", "W= m*W;\t\t\t# in kW\n", "P= abs(W);\t\t\t# in kW\n", "print \"Power of the motor required to drive the compressor in kW is : %.2f\"%P\n", "\n", "# Part (b)\n", "v1= 0.5;\t\t\t# in m**3/kg\n", "v2= 0.15;\t\t\t# in m**3/kg\n", "# A1/A2= rho2*V2/(rho1*V1) = v1*V2/(v2*V1)\n", "ratioOFA1andA2= v1*V2/(v2*V1);\n", "radioOFd1andd2= math.sqrt(ratioOFA1andA2);\n", "print \"Ratio of inlet pipe diameter to outlet pipe diameter is : %.2f\"%radioOFd1andd2\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }