{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 13 : Non newtonian fluid flow in circular pipes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.1 page no : 432"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The pressure gradient is 61.241859 Pa/m\n"
     ]
    }
   ],
   "source": [
    "#Calculate the pressure gradient\n",
    "import math\n",
    "\n",
    "# variables\n",
    "v=1.                          #ft/s\n",
    "d=0.5                         #ft\n",
    "\n",
    "# calculation\n",
    "A=(math.pi)/4*d**2            #ft**2\n",
    "Q=v*A                         #ft**3/s\n",
    "#Let DP denote the pressure gradient\n",
    "n=0.41                        #dimentionless\n",
    "K=0.66                        #kg/m/s\n",
    "#1 m = 3.281 ft \n",
    "Q1=Q/3.281**3                 #m**3/s\n",
    "d1=d/3.281                    #m\n",
    "DP=(Q1*8*(3*n+1)/(n*(math.pi)*d1**3))**n*(4*K/d1)         #Pa/m\n",
    "\n",
    "# result\n",
    "print \"The pressure gradient is %f Pa/m\"%DP"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.3 page no : 437"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The fanning friction factor is 0.050081\n",
      "The reynolds number is 318.531771\n",
      "The flow is Laminar\n"
     ]
    }
   ],
   "source": [
    "#Calculate the fanning friction factor and reynolds number by power law\n",
    "\n",
    "# variables\n",
    "DP=61.3                      #Pa/m (pressure gradient)\n",
    "D=0.152                      #m\n",
    "V_avg=0.305                  #m/s\n",
    "rho=1000.                    #kg/m**3\n",
    "\n",
    "# calculation\n",
    "f=DP*D/(4*rho*V_avg**2/2.)    #dimentionless\n",
    "print \"The fanning friction factor is %f\"%f\n",
    "n=0.41                       #dimentionless\n",
    "K=0.66                       #dimentionless\n",
    "R_pl=8*rho*V_avg**(2-n)*D**n/(K*(2*(3*n+1)/n)**n)                   #dimentionless\n",
    "\n",
    "# result\n",
    "print \"The reynolds number is %f\"%R_pl\n",
    "if (R_pl<2000):\n",
    "    print \"The flow is Laminar\"\n",
    "else:\n",
    "    print \"The flow is turbulent\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.4 page no : 438"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The pressure gradient is 0.486400 KPa/m\n"
     ]
    }
   ],
   "source": [
    "#Calculate the pressure gradient\n",
    "\n",
    "# variables\n",
    "D=0.152                                #m\n",
    "V_avg=3.04                             #m/s\n",
    "rho=1000.                              #kg/m**3\n",
    "n=0.41                                 #dimentionless\n",
    "K=0.66                                 #dimentionless\n",
    "\n",
    "# calculation\n",
    "R_pl=8*rho*V_avg**(2-n)*D**n/(K*(2*(3*n+1)/n)**n)                     #dimentionless\n",
    "#print \"The reynolds number is %f\"%R_pl\n",
    "f=0.004                                #dimentionless (fanning friction factor)\n",
    "#Let DP denote the pressure gradient\n",
    "DP=4*f*(rho/D)*(V_avg**2/2)/1000       #KPa/m\n",
    "\n",
    "# result\n",
    "print \"The pressure gradient is %f KPa/m\"%DP"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.5 page no : 440"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The headstrom number is 52427.752042\n",
      "The reynolds number is 15942.778426\n",
      "The fanning friction factor is 0.006189\n"
     ]
    }
   ],
   "source": [
    "#Calculate the headstrom ,reynold numbers and the fanning friction factor\n",
    "\n",
    "# variables\n",
    "tow_yield=3.8                      #Pa\n",
    "mew=0.00686                        #Pa.s\n",
    "D=0.0206                           #m\n",
    "rho=1530.0                         #kg/m**3\n",
    "V=3.47                             #m/s\n",
    "\n",
    "# calculation and Result\n",
    "He=tow_yield*D**2*rho/mew**2       #dimentionless (headstrom number)\n",
    "print \"The headstrom number is %f\"%He\n",
    "R=D*V*rho/mew                      #dimentionless (reynolds number)\n",
    "print \"The reynolds number is %f\"%R\n",
    "dP=11069.                          #Pa/m\n",
    "f=dP*D/(4*rho*V**2/2)              #dimentionless (fanning friction factor)\n",
    "print \"The fanning friction factor is %f\"%f"
   ]
  }
 ],
 "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
}
