{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 1 : introduction to transport phenomena" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 1.1 - Page No : 6\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "v=0.01283; \t\t\t #[m**3] - volume of tank in m**3\n", "v=0.4531; \t\t\t #[ft**3] - volume of tank in ft**3\n", "p=2; \t\t\t #[atm] - pressure\n", "T=1.8*300; \t\t\t #[degR] - temperature\n", "R=0.73; \t\t \t #[(atm*ft**3)/(lbmol*degR)] - gas constant\n", "\n", "# Calculations\n", "# usin the equation of state for an ideal gas pv=nRT\n", "n=(p*v)/(R*T);\n", "\n", "xN2=0.5; \t\t\t # fractiom of N2 in math.tank\n", "nN2=xN2*n;\n", "Ca=nN2/v;\n", "\n", "# Results\n", "print \"no. of moles , n = %.3e\"%n\n", "print \"Ca = %.2e lb*mol/ft**3\"%(Ca);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "no. of moles , n = 2.299e-03\n", "Ca = 2.54e-03 lb*mol/ft**3\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 1.2 - Page No :9\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from numpy import *\n", "\n", "# the three unknowns are x,y,z\n", "# the three equations are-\n", "# x+y+z = 1500\n", "# (1) 0.05*x+0.15*y+0.40*z = 1500*0.25\n", "# (2) 0.95*x+0.00*y+0.452*z = 1500*0.50\n", "# Variables\n", "a = array([[1, 1, 1],[0.05, 0.15, 0.40],[0.95, 0 ,0.452]])\n", "d = array([[1500.],[1500.*0.25],[1500.*0.50]])\n", "\n", "# Calculations\n", "#ainv = linalg.inv(a);\n", "#sol = ainv * d;\n", "sol = linalg.solve(a,d)\n", "# Results\n", "print \"the amount of concentrated HNO3 is %.0fkg \\\n", "\\nthe amount of concentrated H2SO4 is %.0fkg \\\n", "\\nthe amount of waste acids is %.0fkg\"%(sol[1],sol[0],round(sol[2],-1));\n", "\n", "# Answer may be different because of rounding error and inbuilt function solve." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the amount of concentrated HNO3 is 307kg \n", "the amount of concentrated H2SO4 is 423kg \n", "the amount of waste acids is 770kg\n" ] } ], "prompt_number": 7 } ], "metadata": {} } ] }