diff options
Diffstat (limited to 'Fluid_mechanics/Chapter_5.ipynb')
-rwxr-xr-x | Fluid_mechanics/Chapter_5.ipynb | 244 |
1 files changed, 0 insertions, 244 deletions
diff --git a/Fluid_mechanics/Chapter_5.ipynb b/Fluid_mechanics/Chapter_5.ipynb deleted file mode 100755 index 3591a061..00000000 --- a/Fluid_mechanics/Chapter_5.ipynb +++ /dev/null @@ -1,244 +0,0 @@ -{
- "metadata": {
- "name": "",
- "signature": "sha256:0e0637dca57f500478b778450aaaee0067016f8da4c67cbada5f889a38068276"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 5 - Fluid viscosity and flow of real fluids"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 3 - Pg 187"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the viscosity of oil\n",
- "#Initialization of variables\n",
- "import math\n",
- "m=1155. #lb\n",
- "gam=62.4\n",
- "spg=0.93\n",
- "t=3*60. #sec\n",
- "d=1./6. #in\n",
- "L=20. #ft\n",
- "dp=2.5 #psi\n",
- "#calculations\n",
- "Q=m/(t*spg*gam)\n",
- "A=math.pi/4. *d*d\n",
- "V=Q/A\n",
- "mu=dp*d*d *144./(32.*V*L)\n",
- "#results\n",
- "print '%s %.4f %s' %(\"Viscosity of oil =\",mu,\"lb-sec/ft^2\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Viscosity of oil = 0.0031 lb-sec/ft^2\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4 - Pg 187"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the values of alpha and beta\n",
- "#Initialization of variables\n",
- "import math\n",
- "import scipy\n",
- "from scipy import integrate\n",
- "g=32.2\n",
- "gam=62.4\n",
- "r0=1.\n",
- "#calculations\n",
- "def func1(r):\n",
- " al=8./math.pow(r0,8) *math.pow((r0*r0-r*r),3) *(2*r)\n",
- " return al\n",
- "alpha,err=scipy.integrate.quad(func1,0,r0)\n",
- "def func2(r):\n",
- " a2=4/math.pow(r0,6) *math.pow((r0*r0 -r*r),2) *(2*r)\n",
- " return a2\n",
- "bet,err2=scipy.integrate.quad(func2,0,r0)\n",
- "#results\n",
- "print '%s %d' %(\"Alpha = \",alpha)\n",
- "print '%s %.2f' %(\"\\n beta = \",bet)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Alpha = 2\n",
- "\n",
- " beta = 1.33\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- " Example 5a - Pg 188"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the direction of flow and the loss of energy\n",
- "#Initialization of variables\n",
- "spg=0.93\n",
- "mu=3.1e-3 #lb-sec/ft^2\n",
- "gam=62.4\n",
- "z=50. #m\n",
- "p1=60. #psia\n",
- "p2=25. #psia\n",
- "#calculations\n",
- "p1g=144.*p1\n",
- "p2g=144.*p2 + spg*gam*z\n",
- "dp=p1g-p2g\n",
- "#results\n",
- "if p1g>p2g:\n",
- " print '%s' %(\"The flow is in upward direction\")\n",
- "else:\n",
- " print '%s' %(\"The flow is in downward direction\")\n",
- "\n",
- "print '%s %d %s' %(\"\\n Energy loss=\",dp,\"ft-lb/ft^3\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The flow is in upward direction\n",
- "\n",
- " Energy loss= 2138 ft-lb/ft^3\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 5b - Pg 189"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the flow rate\n",
- "#Initialization of variables\n",
- "import math\n",
- "hl=2140. #ft-lb/ft^3\n",
- "spg=0.93\n",
- "mu=3.1e-3 #lb-sec/ft^2\n",
- "gam=62.4\n",
- "z=50. #m\n",
- "p1=60. #psia\n",
- "p2=25. #psia\n",
- "d=1. #in\n",
- "#calculations\n",
- "V= hl*(d/12.)*(d/12.) /(32*mu*z)\n",
- "Q=V*math.pi/4. *(d/12.)*(d/12.)\n",
- "Q2=Q*7.48*60.\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Flow rate =\",Q2,\"gal/min\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Flow rate = 7.33 gal/min\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 7 - Pg 194"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the flow in model\n",
- "#Initialization of variables\n",
- "muw=2.04e-5 #lb-sec/ft^2\n",
- "rhow=1.94 #slugs/ft^3\n",
- "mua=3.74e-7 #lb-sec/ft^2\n",
- "rhoa=0.00237 #slug/ft^3\n",
- "Qw=200. #gal/min\n",
- "Lr=5.\n",
- "#calculations\n",
- "Qa=Qw*Lr *(rhow/rhoa)*(mua/muw)\n",
- "#results\n",
- "print '%s %d %s' %(\"Flow in model =\",Qa,\"gal/min\")\n",
- "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Flow in model = 15007 gal/min\n",
- "The answers are a bit different from textbook due to rounding off error\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
-}
\ No newline at end of file |