{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1 : Fundamentals Concepts and Definitions of Thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.2 Page No : 16" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Absolute pressure in in = 0.0789 kg/cm**2\n", "Absolute pressure in = 0.0800 bar\n", "Absolute pressure in in = 7.999 kPa\n" ] } ], "source": [ "\n", "# Variables\t\t\t\n", "Pvacc = 700.;\t\t\t# mm of hg\n", "Patm = 760.; \t\t\t# mm of hg\n", "\n", "# Calculations\n", "Pabs = Patm - Pvacc;\t\t\t# mm of hg\n", "\n", "# Results\n", "print \"Absolute pressure in in = %.4f kg/cm**2\"%(Pabs/760)\n", "print \"Absolute pressure in = %.4f bar\"%(Pabs*1.01325/760)\n", "print \"Absolute pressure in in = %.3f kPa\"%(Pabs*1.01325/760*10**2)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.3 Page No : 16" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Total pressure in tank in = 0.434 Mpa\n" ] } ], "source": [ "\n", "# Variables\n", "Patm = 101;\t\t\t# kpa\n", "Rho = 13.6 * 10**3;\t\t\t# in kg per m**3\n", "h = 250;\t\t\t# in cm\n", "h = h*10**-2;\t\t\t# in m\n", "g = 9.806;\n", "\n", "# Calculations\n", "p = Rho * g * h;\t\t\t# in N/m**2\n", "p= p*10**-3;\t\t\t# in kPa\n", "# Total pressure in tank\n", "p = p + Patm;\t\t\t# in kpa\n", "p = p*10**-3;\t\t\t# in Mpa\n", "\n", "# Results\n", "print \"Total pressure in tank in = %.3f Mpa\"%p\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.4 Page No : 21" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Work done in kJ is : -251.63\n", "The -ve sign indicates work is done on the system, hence\n", "The work done by the piston in kJ is : 251.63\n" ] } ], "source": [ "import math \n", "\n", "# Variables\n", "m = 1.5;\t\t\t # in kg\n", "pi = 0.1;\t\t\t # in MPa\n", "pi= pi*10**6;\t\t\t# in Pa\n", "pf = 0.7;\t\t\t # in MPa\n", "pf= pf*10**6;\t\t\t# in Pa\n", "rho_i = 1.16;\t\t\t# kg per m**3\n", "\n", "# Calculations and Results\n", "vi = m/rho_i \t\t\t# in m**3\n", "WorkDone= pi*vi*math.log(pi/pf);\t\t\t# in J\n", "print \"Work done in kJ is : %.2f\"%(WorkDone*10**-3)\n", "\n", "if WorkDone<0:\n", " print (\"The -ve sign indicates work is done on the system, hence\");\n", " print \"The work done by the piston in kJ is : %.2f\"%abs(WorkDone*10**-3)\n", " \n", " \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.5 Page No : 25" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Work done by the pump upon the water in an hour in MJ is : 90.0\n" ] } ], "source": [ "\n", "# Variables\t\t\t\n", "p = 1.0; \t\t\t# in Mpa\n", "p = p*10**6;\t\t\t# in N per m**2\n", "del_v = 1.5;\t\t\t#m**3 per min\n", "\n", "# Calculations\n", "del_v = del_v*60;\t\t\t# m**3 per h\n", "W = p * del_v; \t\t\t# W standard for work done in J\n", "W = W*10**-6;\t \t\t# in MJ\n", "\n", "# Results\n", "print \"Work done by the pump upon the water in an hour in MJ is : \",W\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.6 Page No : 25" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The height from the mass should be fall in meter is : 89.63\n" ] } ], "source": [ "\n", "# Variables\n", "g = 9.81;\n", "J = 4.1868*10**3;\n", "\n", "# Calculations\n", "# W = 2*g*h\n", "# due to stirring of water\n", "\n", "m = (0.2+10*10**-3)*10**3;\t\t\t# in gm\n", "s= 1; \t\t\t# in cal per gm°C\n", "del_T = 2;\t\t\t # in ° C\n", "H = m * s * del_T \t\t\t# in cal\n", "H = H*10**-3;\t\t\t # in kcal\n", "# W = JH and W= 2*g*h\n", "h = J*H/(2 * g);\t\t\t # in m\n", "\n", "# Results\n", "print \"The height from the mass should be fall in meter is : %.2f\"%h\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.7 Page No : 26" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Power required for the feed pump in kW is : 0.192\n" ] } ], "source": [ "\n", "\n", "# Variables\n", "# mass of 1 litr of water is 1 kg. so\n", "m = 5000;\t\t\t# in kg\n", "h = 10-1;\t\t\t# in m\n", "g= 9.81;\t\t\t#\n", "\n", "# Calculations\n", "PE = m * g * h;\t\t\t# in N m\n", "PE = PE*10**-3;\t\t\t# in kj\n", "Eta = 0.85;\n", "# Eta = energy output/energy input\n", "E_input = PE/Eta;\t\t\t# in Kj\n", "E_input = E_input*10**3;\t\t\t# in J\n", "t = 45;\t\t\t# time in min\n", "t = t*60;\t\t\t# in sec\n", "P = E_input/t;\t\t\t# in J/s\n", "P = P*10**-3;\t\t\t# in kW\n", "\n", "# Results\n", "print \"Power required for the feed pump in kW is : %.3f\"%P\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.11 Page No : 29" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Power of the engine of a car in kW is : 12.5\n", "Heat equivalent of work per minute in kJ is 750.0\n" ] } ], "source": [ "\n", "# Variables\t\t\t\n", "V = 50.;\t\t\t# km per hr\n", "V = V * (1000./3600);\t\t\t# in m per sec\n", "F = 900.;\t\t\t# in N\n", "\n", "# Calculations and Results\n", "P = F * V \t\t\t# in watt\n", "P = P *10**-3;\t\t\t# in kW\n", "print \"Power of the engine of a car in kW is : \",P\n", "\n", "H = P * 60 \t\t\t# in kJ \n", "print \"Heat equivalent of work per minute in kJ is\",H\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.12 Page No : 29" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Power required for an air mass flowin kJ/s is : 70.0\n" ] } ], "source": [ "\n", "# Variables\t\t\t\n", "E_air = 200-100;\t\t\t# in kJ/kg\n", "E_lost = 40; \t\t\t# in kJ/kg\n", "\n", "# Calculations\n", "E_total = E_air + E_lost;\t\t\t# in kJ per kg\n", "M = 0.5;\t\t\t# mass flow rate in kg per s\n", "P = M * E_total;\t\t\t# in kJ/s\n", "\n", "# Results\n", "print \"Power required for an air mass flowin kJ/s is :\",P\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.13 Page No : 30" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Specific heat of metal block in kJ/kg-K is 4.18\n" ] } ], "source": [ "\n", "# Variables\t\t\t\n", "m_b = 1.;\t\t\t# in kg\n", "t_ib = 80;\t\t\t#in degree c\n", "m_w = 10.;\t\t\t# in kg\n", "t_iw = 25;\t\t\t# in degree c\n", "del_t = 5.;\t\t\t# in degree c\n", "S_w = 4.18;\t\t\t# in kJ/kg\n", "\n", "# Calculations\n", "t_equ = (t_iw + del_t);\t\t\t# in degree c\n", "# Heat loss by metal = Heat gained by water\n", "S_b = m_w * S_w * (t_equ - t_iw)/(m_b * (t_ib - t_equ));\t\t\t# in kJ/kg-K\n", "\n", "# Results\n", "print \"Specific heat of metal block in kJ/kg-K is\",S_b\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.15 Page No : 31" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Reading of pressure in kPa is 221.304\n", "Reading of pressure in Kpa 47.99 \n", "Reading of pressure in kPa 113.092\n" ] } ], "source": [ "\n", "\n", "# Variables\t\t\t\n", "P_gauge = 90;\t\t\t# in cm of hg\n", "P_atm = 760;\t\t\t# in mm of hg\n", "P_atm = 76;\t\t\t# in cm of hg\n", "\n", "# Calculations and Results\n", "P_abs = P_gauge + P_atm;\t\t\t# in cm of hg\n", "P_abs = P_abs * (101.32/76);\t\t\t# in kPa\n", "print \"Reading of pressure in kPa is %.3f\"%P_abs\n", "\n", "# Part (b)\n", "P_vacuum = 40;\t\t\t# in cm of hg\n", "P_abs = P_atm - P_vacuum;\t\t\t# in cm of hg\n", "P_abs = P_abs * (101.32/76);\t\t\t# in kpa\n", "print \"Reading of pressure in Kpa %.2f \"%P_abs\n", "\n", "# Part (c)\n", "Rho = 1000;\t\t\t# in kg per m**3\n", "g = 9.81;\t\t\t# \n", "h = 1.2;\t\t\t# in m \n", "P_gauge = Rho * g * h;\t\t\t# in N m**2\n", "P_gauge= P_gauge*10**-3;\t\t\t# in kPa\n", "P_atm = 101.32;\t\t\t# in kPa\n", "P_abs = P_gauge + P_atm;\t\t\t# in kpa\n", "print \"Reading of pressure in kPa\",P_abs\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.16 Page No : 32" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The value of H in km is : 12.61\n" ] } ], "source": [ "import math \n", "from scipy.integrate import quad \n", "\n", "\t\t\t\n", "g=9.81; \t\t\t# in m/s**2\n", "P=1.0332*10**5;\t\t\t# in kN/m**2\n", "\n", "def f4(p): \n", "\t return (1./p)**(1/1.4)\n", "\n", "H= 1/g*(2.3*10**4)**(1/1.4)* quad(f4,0,P)[0]\n", "\n", "print \"The value of H in km is : %.2f\"%(H*10**-3)\n", "\n", "# Note: There is calculation error in the book, so the answer differs.\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 }