summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_/Chapter3.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Fluid_Mechanics_/Chapter3.ipynb')
-rw-r--r--Fluid_Mechanics_/Chapter3.ipynb536
1 files changed, 536 insertions, 0 deletions
diff --git a/Fluid_Mechanics_/Chapter3.ipynb b/Fluid_Mechanics_/Chapter3.ipynb
new file mode 100644
index 00000000..e702596e
--- /dev/null
+++ b/Fluid_Mechanics_/Chapter3.ipynb
@@ -0,0 +1,536 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:f598cdc0d1e1209f88ec87b2a9e5b6a08368d8e1e45eff28590bd3252c8de961"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Chapter : Fluid Kinematics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.1 Page no 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Dimension of flow field ; velocity components at (1,2) ; magnitude and direction of velocity \n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "# V = 4*Xi-4Yj\n",
+ "\n",
+ "x=1 # x co-ordinate\n",
+ "\n",
+ "y=2 # y co-ordinate\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "print \"(a) u = 4*X; v = -4*Y \"\n",
+ "\n",
+ "u = 4*x\n",
+ "\n",
+ "v=- 4*y\n",
+ "\n",
+ "print \"(b) u=\",round(u,0),\"m/s and v=\",round(v,0),\"m/s\"\n",
+ "\n",
+ "R =sqrt(u**2+v**2)\n",
+ "\n",
+ "ang = atan(v/u)*180/pi\n",
+ "\n",
+ "print \"(c) Magnitude of velocity =\",round(R,2),\"m/s and angle of resultant velocity = \",round(ang,1),\"deg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) u = 4*X; v = -4*Y \n",
+ "(b) u= 4.0 m/s and v= -8.0 m/s\n",
+ "(c) Magnitude of velocity = 8.94 m/s and angle of resultant velocity = -63.4 deg\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.2 Page no 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Discharge and mass flow rate\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d = 0.3 # diameter of pipe in m\n",
+ "\n",
+ "v = 15 # velocity in m/s\n",
+ "\n",
+ "rho = 997.1 # density in kg/m**3\n",
+ "\n",
+ "A = pi*d**2/4\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "Q=A*v\n",
+ "\n",
+ "print \"(a) Discharge =\",round(Q,2),\"m**3/s\"\n",
+ "\n",
+ "mdot = rho*Q\n",
+ "\n",
+ "print \"(b) Mass flow rate = \",round(mdot,2),\"kg/s\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Discharge = 1.06 m**3/s\n",
+ "(b) Mass flow rate = 1057.21 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.3 Page no 120 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Mean Velocity\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "from scipy import integrate\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "Vo = 10 # velocity in m/s\n",
+ "\n",
+ "r1 = 0\n",
+ "\n",
+ "ro = 0.1 # radius in m\n",
+ "\n",
+ "N = 1\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "R = lambda r: (10*r-1000*r**3)\n",
+ "\n",
+ "R1,err=integrate.quad(R,r1,ro)\n",
+ "\n",
+ "Q = R1*2*pi\n",
+ "\n",
+ "A = pi*(0.1)**2\n",
+ "\n",
+ "V = Q/A\n",
+ "\n",
+ "print \"Mean velocity of the flow =\",round(V,0),\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mean velocity of the flow = 5.0 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.4 Page no 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Sketch the stream lines in the first quadrant\n",
+ "\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from scipy import integrate\n",
+ "\n",
+ "import numpy as np\n",
+ "\n",
+ "from sympy import *\n",
+ "\n",
+ "#init_printing(use_unicode=False, warp_line=False, no_global=True)\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "# V = 4*y(m)i+2(m)j\n",
+ "\n",
+ "x = Symbol('x')\n",
+ "U = integrate(2,x)\n",
+ "\n",
+ "#print u\n",
+ "\n",
+ "y = Symbol('y')\n",
+ "\n",
+ "V = integrate(-4*y,y)\n",
+ "\n",
+ "#print V\n",
+ "\n",
+ "Zhi = U + V\n",
+ "\n",
+ "print Zhi # for x and y =0 we get C = 0\n",
+ "\n",
+ "X = [5,6,7,8,9,10,11,12,13,14,15,16,17]\n",
+ "Y = [0,1.414,2,2.449,2.828,3.16,3.46,3.741,4,4.242,4.472,4.69,4.898]\n",
+ "\n",
+ "b1=plt.plot(X,Y)\n",
+ "\n",
+ "\n",
+ "X1 = [2.5,3,4,5,6,7,8,9,10,11,12,13,14,15]\n",
+ "Y1 = [0,1,1.732,2.23,2.645,3,3.31,3.60,3.87,4.123,4.35889,4.5825,4.795,5]\n",
+ "\n",
+ "b2=plt.plot(X1,Y1)\n",
+ "\n",
+ "\n",
+ "X2 = [0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5,14.5,15.5]\n",
+ "Y2 = [0,1.414,2,2.449,2.828,3.162,3.462,3.741,4,4.242,4.472,4.69,4.898,5.099,5.29,5.4772]\n",
+ "\n",
+ "b3=plt.plot(X2,Y2)\n",
+ "\n",
+ "plt.xlabel(\"x\")\n",
+ "\n",
+ "plt.ylabel(\"y\")\n",
+ "\n",
+ "plt.title(\"Streamline plot\")\n",
+ "\n",
+ "plt.legend([\"zhi=10\",\"zhi=5\",\"zhi=1\"])\n",
+ "plt.show()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2*x - 2*y**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.5 PAge no 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# magnitude and direction of flow field\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from sympy import *\n",
+ "\n",
+ "import numpy as np\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "x = 2 # X co-ordinate\n",
+ "\n",
+ "Y = 4 # Y co-ordiante\n",
+ "\n",
+ "# Solution\n",
+ "y = Symbol('y')\n",
+ "\n",
+ "zhi = 4*x*y\n",
+ "\n",
+ "zhiprime = zhi.diff(y)\n",
+ "\n",
+ "u = zhiprime\n",
+ "\n",
+ "x = Symbol('x')\n",
+ "\n",
+ "zhi = 4*x*Y\n",
+ "\n",
+ "zhiprime = zhi.diff(x)\n",
+ "\n",
+ "v = zhiprime\n",
+ "\n",
+ "R=sqrt(u**2+v**2)\n",
+ "\n",
+ "theta = atan(v/u)*180/pi\n",
+ "\n",
+ "print \"Resutant velocity magnitude = \",round(R,2),\"m/s\"\n",
+ "\n",
+ "print \"Angle =\",round(theta,1),\"deg with the X-axis in the 4th quadrant\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resutant velocity magnitude = "
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "17.89 m/s\n",
+ "Angle = 63.4 deg with the X-axis in the 4th quadrant\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.6 Page no 130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determine velocity ; convective accleration\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "from sympy import *\n",
+ "\n",
+ "import numpy as np\n",
+ "\n",
+ "from scipy import integrate\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d1 = 0.09 # diameter in cm\n",
+ "\n",
+ "d2 = 0.025 # diameter in cm\n",
+ "\n",
+ "rho = 1000 # density in kg/m**3\n",
+ "\n",
+ "mdot = 25 # mass flow rate in kg/s\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "x = Symbol('x')\n",
+ "\n",
+ "A1 = pi*d1**2/4\n",
+ "\n",
+ "A2 = pi*d2**2/4\n",
+ "\n",
+ "AA = A1 - ((A1-A2)/40)*10 # from figure\n",
+ "\n",
+ "V = mdot/(rho*AA)\n",
+ "\n",
+ "print \"(a) Velocity =\",round(V,1),\"m/s\"\n",
+ "\n",
+ "AX = (A1 - ((A1-AA)/40)*x)\n",
+ "\n",
+ "v = 25*10**4/(rho*AX)\n",
+ "\n",
+ "vprime = v.diff(x)\n",
+ "\n",
+ "V1 = vprime\n",
+ "\n",
+ "# at x = 0.1 m we get dv/dx = 0..09\n",
+ "\n",
+ "VPrime = 0.09\n",
+ "\n",
+ "Acx = V*VPrime\n",
+ "\n",
+ "print \"(b) Convective acceleration =\",round(Acx,3),\"m**2/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Velocity = 5.1 m/s\n",
+ "(b) Convective acceleration = 0.46 m**2/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.8 Page no 143 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Is the flow irrotational\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "# w = (16y-12x)i +(12y-9x)j\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "y = Symbol('y')\n",
+ "\n",
+ "U = 16*y-12*x\n",
+ "\n",
+ "zhiprime = U.diff(y)\n",
+ "\n",
+ "u = zhiprime\n",
+ "\n",
+ "\n",
+ "x = Symbol('x')\n",
+ "\n",
+ "V = 12*y-9*x\n",
+ "\n",
+ "zhiprime1 = V.diff(x)\n",
+ "\n",
+ "v = zhiprime1\n",
+ "\n",
+ "#Vx = -9 # differentiate V wrt x\n",
+ "\n",
+ "#Vx = -9 # differentiate V wrt x\n",
+ "#Uy = 16 # differentiate U wrt y\n",
+ "\n",
+ "z = v-u\n",
+ "\n",
+ "print \"z = \",round(z,0)\n",
+ "\n",
+ "print \"Hence the flow is rotational\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "z = -25.0\n",
+ "Hence the flow is rotational\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.10 Page no 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Velocity in larger section\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d1 = 0.1 # diameter in m\n",
+ "\n",
+ "d2 = 0.3 # diameter in m\n",
+ "\n",
+ "V1 = 30 # velocity in m/s\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V2 = (d1**2/d2**2)*V1\n",
+ "\n",
+ "print \"Velocity at the larger cross section = \",round(V2,2),\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity at the larger cross section = 3.33 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file