{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 11 : Flow through porous media"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 11.1 page no : 401"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The velocity of water is 0.012422 ft/s\n",
      "\n",
      "The volumetric flow rate is 0.000271 ft**3/s\n",
      "\n",
      "Reynolds number is 4.288586\n"
     ]
    }
   ],
   "source": [
    "#Calculate the volumetric flow rate\n",
    "import math\n",
    "\n",
    "# variables\n",
    "g=32.2                                             #ft/s**2\n",
    "dz=1.25                                            #ft\n",
    "Dp=0.03                                            #in (Diameter of particle)\n",
    "eta=0.33                                           #dimentionless\n",
    "rho=62.3                                           #lbm/ft**3\n",
    "mew=1.002                                          #cP\n",
    "dx=1                                               #ft\n",
    "#1 cP.ft.s = 6.72*10**(-4)#lbm\n",
    "#1 ft = 12 in\n",
    "\n",
    "# calculation\n",
    "Vs=g*dz*(Dp/12.0)**2*eta**3*rho/(150*mew*(1-eta)**2*dx*6.72*10**(-4))                  #ft/s\n",
    "d=2                                                 #in (diameter of pipe)\n",
    "A=(math.pi)/4.0*(d/12.0)**2                         #ft**2\n",
    "Q=Vs*A                                              #ft**3/s\n",
    "R=(Dp/12)*Vs*rho/(mew*6.72*10**(-4)*(1-eta))        #dimentionless (Reynold's number)\n",
    "\n",
    "# results\n",
    "print \"The velocity of water is %f ft/s\\n\"%Vs\n",
    "print \"The volumetric flow rate is %f ft**3/s\\n\"%Q\n",
    "print \"Reynolds number is %f\"%R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 11.2 page no : 403"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The pressure gradient is 701 psi/ft\n"
     ]
    }
   ],
   "source": [
    "#Calculate the pressure gradient\n",
    "\n",
    "# variables\n",
    "Vs=2.                          #ft/s\n",
    "dp=0.03                        #in (diameter of particle)\n",
    "rho=62.3                       #lbm/ft**3\n",
    "eta=0.33                       #dimentionless\n",
    "\n",
    "# calculation\n",
    "#let DP denote pressure gradient\n",
    "#1 ft = 12 in\n",
    "#1 lbf.s**2 = 32.2lbm.ft\n",
    "DP=1.75*rho*Vs**2*(1-eta)/((dp/12)*eta**3*32.2*144)                 #psi/ft\n",
    "\n",
    "# result\n",
    "print \"The pressure gradient is %d psi/ft\"%DP"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 11.3 page no : 405"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The permeability is 0.086 darcy\n"
     ]
    }
   ],
   "source": [
    "#Calculate the permeability\n",
    "\n",
    "# variables\n",
    "Q=1.                                   #ft**3/min\n",
    "mew=0.018                              #cP\n",
    "dx=0.5                                 #in\n",
    "A=1.                                   #ft**2\n",
    "dP=2.                                  #lbf/in**2\n",
    "\n",
    "# calculations\n",
    "#1 ft = 12 in\n",
    "#1 min = 60 sec\n",
    "#1 ft**2.cP = 2.09*10**(-5) lbf.s\n",
    "#1 darcy = 1.06*10**(-11) ft**2\n",
    "k=(Q*mew*(dx/12.0)/A/dP)*(1/144.0)*2.09*10**(-5)*(1/60.0)*(1.0/(1.06*10**(-11)))            #darcy\n",
    "\n",
    "# result\n",
    "print \"The permeability is %.3f darcy\"%k"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
