{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 4 : The first law of thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.1 page no : 111" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "change in pot. energy per unit mass is 225.630000 m^2/s^2\n", "The total change in potential energy is 2256.300000 J\n" ] } ], "source": [ "#calculate change in pot. energy per unit mass and total change in pot. energy\n", "\n", "# variables\n", "g=9.81; #m/s^2 acc. due to gravity\n", "dh=23.; #m change in height\n", "\n", "# calculation and result\n", "dpe=g*dh #m^2/s^2 change in pot energy per unit mass\n", "print \"change in pot. energy per unit mass is %f m^2/s^2\"%dpe\n", "\n", "m=10.; #kg\n", "dPE=m*dpe #kgm^2/s^2 or J change in pot. energy \n", "print \"The total change in potential energy is %f J\"%dPE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.2 page no : 112" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the kinetic energy of bullet is 842.236025 J\n" ] } ], "source": [ "#calculate the kinetic energy of bullet\n", "\n", "# variables\n", "m=0.01; #lbm mass of bullet\n", "v=2000.; #ft/s\n", "\n", "# calculation\n", "KE=(m*v**2/2)*(1.356/32.2) #J\n", "\n", "# result\n", "print \"the kinetic energy of bullet is %f J\"%KE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.3 page no : 112" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the kinetic energy of bullet fired from a airplane is 0.021056 J\n" ] } ], "source": [ "#Calculate the kinetic energy of bullet fired from a airplane\n", "\n", "# variables\n", "v_bp=2000.; #ft/s vel of bullet wrt plane\n", "v_p=-1990.; #ft/s\n", "v_b=v_bp+v_p #ft/s vel of bullet wrt ground\n", "m=0.01; #lbm\n", "\n", "# calculation\n", "KE=(m*v_b**2/2)*(1.356/32.2) #J\n", "\n", "# result\n", "print \"the kinetic energy of bullet fired from a airplane is %f J\"%KE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.4 page no : 119" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the change in internal energy of the system is -44.720823 Btu\n" ] } ], "source": [ "#calculate the change in internal energy of the system\n", "\n", "# variables\n", "p=14.7; #lbf/in^2 atmospheric pressure\n", "dV=1.; #ft^3 change in volume\n", "\n", "# calculation\n", "dW=p*dV*(144/778.) #Btu work done\n", "dQ=-42.; #Btu heat removed from the system\n", "dU=dQ-dW #Btu change in internal energy of the system\n", "\n", "# result\n", "print \"the change in internal energy of the system is %f Btu\"%dU" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.5 page no : 120" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The work done is 101.650000 J/Kg\n" ] } ], "source": [ "#calculate the work done\n", "#work done=change in pot. energy + change in kinetic energy considering steady flow and adiabatic conditions\n", "\n", "# variables\n", "v_in=3.; #m/s\n", "v_out=10.; #m/s\n", "dke=(v_in**2-v_out**2)/2.0; #m^2/s^2\n", "g=9.81; #m/s^2\n", "dh=15.; #m change in height in inlet and outlet\n", "\n", "# calculation\n", "dpe=g*dh; #m^2/s^2\n", "W=dpe+dke #J/kg\n", "\n", "# result\n", "print \"The work done is %f J/Kg\"%W" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 4.6 page no : 124" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "the mass consumed in a nuclear reactor per unit time is 2.222222 * 10^(-8) kg/s\n" ] } ], "source": [ "#calculate the mass consumed in a nuclear reactor per unit time\n", "\n", "# variables\n", "#let D=d/dt\n", "DQ=-13.*10**8; #J/s\n", "DW=7*10.**8; #J/s\n", "\n", "#Dm=(DQ-DW)/c^2 where c is velocity of light sice E=mc^2\n", "c=3.0*10**8; #m/s\n", "c1=3.0; #velocity of light without power\n", "p=8. #power of 10 in speed of light \n", "\n", "# calculation\n", "Dm=float(DW-DQ)/c/c1 #kg/s\n", "\n", "# result\n", "print \"the mass consumed in a nuclear reactor per unit time is %f * 10^(-%d) kg/s\"%(Dm,p)" ] } ], "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 }