{ "metadata": { "name": "", "signature": "sha256:3e3cc60dc2a7aa47248e51781bc474e34ce30f23ed528c32391da2267db7146e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 7 : Entropy" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.2 Page No : Page No : 172" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "v1 = 0.05;\t\t \t# in m**3\n", "v2 = 8. * v1;\t\t\t# in m**3\n", "T1 = 280.;\t\t \t# in \u00b0C\n", "T1 = T1 + 273;\t\t\t# in K\n", "T2 = 25.;\t\t # in \u00b0C\n", "T2 = T2 + 273;\t\t\t# in K\n", "p1 = 8.;\t \t\t# in bar\n", "C_p = 1.005;\t\t\t# in kJ/kgK\n", "C_v = 0.712;\t\t\t# in kJ/kgK\n", "\n", "# Calculations\n", "R = C_p - C_v;\t\t\t# in kJ/kgK\n", "del_phi = (R * ( math.log(v2/v1)) ) + (C_v * (math.log(T2/T1)) );\t\t\t# in kJ/kgK\n", "\n", "# Results\n", "print \"The change in entrophy of air during the process in kJ/kgK is : %.3f\"%del_phi\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The change in entrophy of air during the process in kJ/kgK is : 0.169\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.3 Page No : 172" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "m = 5.; \t\t\t# in kg\n", "T1 = 50.;\t \t\t# in \u00b0C\n", "T1 = T1 + 273;\t\t\t# in K\n", "T2 = 250.;\t\t\t # in \u00b0C\n", "T2 = T2 + 273;\t \t# in K\n", "C_p = 1.0;\n", "C_v = 0.72;\n", "T3 = 50.; \t\t\t# in \u00b0C\n", "T3 = T3 + 273;\t\t\t# in K\n", "\n", "# Calculations\n", "del_phi = m * C_p * (math.log(T2/T1));\t\t\t# in kJ/ K (this is increase in entrophy)\n", "del_phi1 = m * C_v * (math.log(T3/T2));\t\t\t# in kJ/K (this is decrease in entrophy)\n", "phi_net = del_phi - abs(del_phi1);\t\t\t # in kJ/K\n", "\n", "# Results\n", "print \"net change in entrophy in kJ/K is : %.3f\"%phi_net\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "net change in entrophy in kJ/K is : 0.675\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.6 Page No : 174" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "Q1 = 1600.;\t\t\t# in kJ\n", "Q2 = 1600.;\t\t\t# in kJ\n", "T1 = 800.;\t\t\t# in K\n", "T2 = 127.;\t\t\t# in \u00b0C\n", "\n", "# Calculations\n", "T2 = T2 + 273;\t\t\t# in K\n", "d1_phi = Q1/T1;\t\t\t# in kJ per K\n", "d2_phi = Q2/T2;\t\t\t# in kJ per K\n", "net_phi = d2_phi - d1_phi;\t\t\t# in kJ per K\n", "\n", "# Results\n", "print \"entrophy generated during the process in kJ/K is : \",net_phi\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "entrophy generated during the process in kJ/K is : 2.0\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.8 Page No : 175" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "T_A = 50.+273;\t\t\t# in K\n", "T_B = 13.+273;\t\t\t# in K\n", "P_A = 130.;\t\t\t# in kPa\n", "P_B = 100.;\t\t\t# in kPa\n", "Cp = 1.005;\t\t\t# in kJ/kg-K\n", "pvByT = 0.287;\t\t\t# p in kPa, v in m**3/kg, T in K\n", "\n", "# Calculations\n", "del_S_system = Cp*math.log(T_B/T_A)-pvByT*math.log(P_B/P_A);\t\t\t# in kJ/kg-K\n", "del_S_surrounding = 0;\n", "del_S_universe = del_S_system+del_S_surrounding;\t\t\t# in kJ/kg-K\n", "\n", "# Results\n", "print \"change in entropy in kJ/kg-K is : %.3f\"%del_S_universe\n", "print (\"But a negative change in entropy is not possible,\");\n", "print (\"therefore the flow of air must be from B to A\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "change in entropy in kJ/kg-K is : -0.047\n", "But a negative change in entropy is not possible,\n", "therefore the flow of air must be from B to A\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.9 Page No : 176" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "m = 5.\t \t\t# in kg\n", "s= 4.18 \n", "T1 = 0.\t \t\t# in \u00b0C\n", "T2 = 20.\t\t\t# in \u00b0C\n", "dt = T2 - T1;\t\t\t# in \u00b0C\n", "Q = m * s * dt;\t\t\t# in kJ\n", "L = 335.;\t\t\t# in kJ/kg\n", "\n", "# Calculations\n", "# Q = m_i * l\n", "m_i = Q/L;\t\t\t# in kg\n", "T1 = T1 + 273;\t\t\t# in K\n", "T2 = T2 + 273;\t\t\t# in K\n", "del_S = ((m_i * L)/T1) - (m * s * (math.log(T1/T2)));\t\t\t# in kJ per K\n", "\n", "# Results\n", "print \"change in entropy of the adiabatic system in kJ/K is %.3f\"%del_S\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "change in entropy of the adiabatic system in kJ/K is 3.009\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.11 Page No : 177" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "p1 = 1. * 10**5;\t\t\t# in N/m**2\n", "C_p = 1.005;\t\t\t# in kJ/kg k\n", "R = 287.;\t\t\t# in j/kg k\n", "T1 = 290.;\t\t\t# in K\n", "T2 = 580.;\t\t\t# in K\n", "v1 = 1.;\t\t\t# in m**3\n", "\n", "# Calculations\n", "m = (p1 * v1)/(R * T1);\t\t\t# in kg\n", "Q = m * R * (T2-T1);\t\t\t# in J\n", "Q = Q * 10**-3;\t\t\t# in kJ\n", "del_phi = m * C_p * (math.log(T2/T1));\t\t\t# in kJ per K\n", "R = R * 10**-3;\t\t\t# in kJ/kg K\n", "C_v = C_p - R;\t\t\t# in kJ/kg k\n", "del1_phi = m * C_v * (math.log(T1/T2));\t\t\t# in kJ/K\n", "net_phi = del_phi + del1_phi;\t\t\t# in kJ/K\n", "\n", "# Results\n", "print \"Over all change in entrophy in kJ/K is : %.4f\"%net_phi\n", "\n", "# rounding off error\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Over all change in entrophy in kJ/K is : 0.2390\n" ] } ], "prompt_number": 1 } ], "metadata": {} } ] }