{ "metadata": { "name": "", "signature": "sha256:98381098beaf5d6805e531ad8738dca152c4ca499326121575e7f6afde31d8cf" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5 : First Law Applied to Flow Processes" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.1 Page No : 101" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "V1 = 0.95;\n", "P1 = 100e03; #initial pressure Pa\n", "v1 = 7.; #initial velocity m/s\n", "V2 = 0.19; #final velocity m/s\n", "P2 = 700e03; #final pressure Pa\n", "v2 = 5.;\n", "w = 0.5;\n", "u21 = 90e03; \t\t\t# u21 = u2-u1\n", "Q = -58e03; \t\t\t# As heat is added Q = dQ/dt\n", "\n", "# Calculation and Results\n", "W = - w*( u21 + (P2*V2-P1*V1) + ((v2**2-v1**2)/2) ) + Q; \t\t\t# W = dW/dt \n", "print \"The rate of work input is\",round(W/1000),\"kW\"\n", "\n", "# Part (b)\n", "A = (v2/v1)*(V1/V2); \t\t\t# A = A1./A2\n", "d = math.sqrt(A); \t\t\t# d = d1./d2\n", "print \"The ratio of the inlet pipe diameter and outer pipe diameter is %.2f\"%d\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The rate of work input is -122.0 kW\n", "The ratio of the inlet pipe diameter and outer pipe diameter is 1.89\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.2 Page No : 102" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "V1 = 0.37; #specific volume m^3/kg\n", "P1 = 600.e03;\n", "v1 = 16.;\n", "V2 = 0.62; \n", "P2 = 100.e03;\n", "v2 = 270.;\n", "Z1 = 32.;\n", "Z2 = 0;\n", "g = 9.81; \n", "Q = -9.e03; \t\t\t# heat loss Q = dQ/dt\n", "W = 135.e03; \t\t\t# Work done W = dW/dt\n", "\n", "# Calculation\n", "U12 = (P2*V2-P1*V1) + ((v2**2-v1**2)/2.) + (Z2-Z1)*g + W - Q; \t\t\t# U12 = U1-U2\n", "\n", "# Results\n", "print \"The internal energy decreases by\",round(U12/1000,3),\"Joule\"\n", "\n", "# note : rounding off error" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The internal energy decreases by 20.008 Joule\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.3 Page No : 103" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "# Variables\n", "P1 = 4e06;\n", "t1 = 400.;\n", "h1 = 3213e03;\n", "V1 = 0.073;\n", "P2 = 3.5e06;\n", "t2 = 392.;\n", "h2 = 3202e03;\n", "V2 = 0.084;\n", "Q = -8.5e03;\n", "\n", "# Calculation\n", "v1 = math.sqrt((2*(h1-h2+Q))/(1.15**2-1));\n", "A1 = (math.pi/4)*0.2**2;\n", "w = (A1*v1)/V1;\n", "\n", "# Results\n", "print \"The stean flow rate is %.1f Kg/s\"%w\n", "\n", "# rounding off error" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The stean flow rate is 53.6 Kg/s\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.4 Page No : 104" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "import sys\n", "from numpy import *\n", "from sympy import Symbol\n", "\n", "# Variables\n", "h1 = 313.93;\n", "h2 = 2676.;\n", "h3 = 419.;\n", "w1 = 4.2;\n", "\n", "# Calculation\n", "w = Symbol('w') \t\t\t# w = w2\n", "P = w1*h1 + w*h2 - h3*(4.2+w)\n", "def stress(a,b,f):\n", " N = 100;\n", " eps = 1e-5;\n", " if((f(a)*f(b))>0):\n", " print ('no root possible f(a)*f(b)>0');\n", " sys.exit(0)\n", " if(abs(f(a))0):\n", " c = (a+b)/2.\n", " if(abs(f(c))