summaryrefslogtreecommitdiff
path: root/Transport_Phenomena/ch1.ipynb
blob: 0a893e9acd9dec035ef13d05ec0c3c71decc5055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
 "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": [
      "# Calculate the concentration of nitrogen in the tank in\n",
      "\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": [
      "# find the mass of each concentrated solution to be added.\n",
      "\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": {}
  }
 ]
}