{ "metadata": { "name": "", "signature": "sha256:796b0d55d49c3a8708377f5eda9102cc03f40afdc4e2bd80f2e4fc59de97aea2" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 4 : The First Law of Thermodynamics for Systems-Pure Substances" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.1 Page No : 93" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\t\t\t\n", "# Variables\n", "#four heat transfer\n", "Q_1 = 900 \t\t\t#J\n", "Q_2 = 80 \t\t\t#J\n", "Q_3 = -800 \t\t\t#J\n", "Q_4 = 150 \t\t\t#J\n", "#four work interactions\n", "W_1 = 200 \t\t\t#J\n", "W_2 = 150 \t\t\t#J\n", "W_3 = 300 \t\t\t#J\n", "\t\t\t#W_4\n", "\t\t\t\n", "# Calculations and Results\n", "W_4 = Q_1 +Q_2 +Q_3 +Q_4 -W_1 -W_2 -W_3 \n", "print \"Magnitude and Direction of the fourth work interaction, W4 = %.0f J\"%(W_4)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Magnitude and Direction of the fourth work interaction, W4 = -320 J\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.2 Page No : 94" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\t\t\t\n", "# Variables\n", "Q_a = -50 \t\t\t#KJ \t\t\t#heat transferred from the system along path A\n", "W_a = -65 \t\t\t#KJ \t\t\t#work done along path A\n", "Q_b = 0 \t\t\t#KJ \t\t\t#heat transferred from the system along path B\n", "\t\t\t#W_b work done along path B\n", "\n", "\t\t\t\n", "# Calculations and Results\n", "\n", "#Part(a)\n", "print \"Part a\";\n", "delE_a = Q_a - W_a \t\t\t#KJ \t\t\t#Change in energy along path A\n", "print \"Change in energy of the system = %.0f KJ\"%(delE_a);\n", "\n", "#Part(b)\n", "print \"Part b\";\n", "delE_b = -1*delE_a \t\t\t#KJ \t\t\t#Change in energy along path B\n", "W_b = delE_b - Q_b \t\t\t#KJ \t\t\t#work done along path B\n", "print \"Magnitude and direction of work done during B, W_b = %.0f KJ\"%(W_b)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Part a\n", "Change in energy of the system = 15 KJ\n", "Part b\n", "Magnitude and direction of work done during B, W_b = -15 KJ\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.3 Page No : 99" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "# Variables\n", "m = 2.3 \t\t\t#kg \t\t\t#mass of substance\n", "u = 21 * 10**3 \t\t\t#J/kg \t\t\t#internal energy\n", "V = 110. \t\t\t#m/s \t\t\t#velocity \n", "z = 1500. \t\t\t#m \t\t\t#elevation above sea level\n", "g = 9.81 \t\t\t#m/s**2 \t\t\t#acceleration due to gravity\n", "\n", "\n", "\t\t\t\n", "# Calculations and Results\n", "E = m*(g*z + V**2/2 + u) \t\t\t#J/kg \t\t\t#Total energy of the system\n", "print \"The total energy of the system with respect to an observer at rest at sea level, E = %.4f KJ\"%(0.001*E);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The total energy of the system with respect to an observer at rest at sea level, E = 96.0595 KJ\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.4 Page No : 103" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import *\n", "from sympy import Derivative\n", "\t\t\t\n", "# Variables\n", "t = poly1d(0); \t\t\t#C \t\t\t#Temperature in C\n", "u = 196. + .718*t; \t\t\t#KJ/kg \t\t\t#specific internal energy\n", "pv = 287*(t+273.); \t\t\t#Nm/kg \t\t\t#p is pressure and v = specific volume\n", "\n", "\t\t\t\n", "# Calculations and Results\n", "Cv = poly(u);\n", "print \"Specific heat at constant volume,Cv = %.3f kJ/kgK\"%(Cv[0])\n", "\n", "h = u + pv*.001 \t\t\t#KJ/kg \t\t\t#enthalpy\n", "Cp = poly(h);\n", "print \"Specific heat at constant pressure,Cp = %.3f kJ/kgK\"%(Cp[0])\n", "\n", "# Note: Poly function gives different result then book has." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Specific heat at constant volume,Cv = 1.000 kJ/kgK\n", "Specific heat at constant pressure,Cp = 1.000 kJ/kgK\n" ] } ], "prompt_number": 6 } ], "metadata": {} } ] }