{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 7: Flow Under Varying Head" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.1: example_1.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "g= 32.2 //ft/sec^2\n", "d= 6 //ft\n", "di= 2 //in\n", "h= 9 //ft\n", "Cd= 0.6\n", "//CALCULATIONS\n", "function [y]=fun(H)\n", " y= H^-0.5*(d/2)^2*%pi/(Cd*%pi*sqrt(2*g)/144)\n", "endfunction\n", "vec2=intg(0,h,fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('Time to emptify = %.f sec',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.2: example_2.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "d1= 4//ft\n", "d2= 2 //in\n", "l= 300 //ft\n", "P= 5 //lb/in^2\n", "h1= 3 //ft\n", "h2= 6 //ft\n", "f= 0.01\n", "//CALCULATIONS\n", "X= P*2.31*10*(d2/12)^5/(f*l)\n", "A= %pi*d1^2/4\n", "function [y]=fun(h)\n", " y=A*sqrt((P*2.31*10*(d2/12)^5/(f*l))-(10*(d2/12)^5*h/(f*l)))/(10*(d2/12)^5/(f*l))/7\n", "endfunction\n", "vec2=intg(h1,h2,fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('time for the channel to fall = %.f sec',T)\n", " " ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.3: example_3.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc\n", "//initialisation of variables\n", "d= 10 //in\n", "l= 15 //ft\n", "di= 3 //in\n", "Cd= 0.62 \n", "g=32.2\n", "//CALCULATIONS\n", "function [y]=fun(H)\n", " y=-l*2*sqrt((d/2)^2-((d/2)-H)^2)/(Cd*(%pi*(di/12)^2/4)*H^0.5*sqrt(2*g))\n", "endfunction\n", "vec2=intg(d/2,0,fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('time for the channel to fall = %.f sec',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.4: example_4.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clear\n", "clc\n", "//initialisation of variables\n", "h= 4 //ft\n", "w= 6 //ft\n", "l= 100 //yd\n", "a= 60 //degrees\n", "h1= 3 //ft\n", "h2= 2 //ft\n", "Cd= 0.6\n", "g=32.2 //ft/s^2\n", "//CALCULATIONS\n", "A= l*3*w\n", "function [y]=fun(H)\n", " y=-A*H^-2.5/(Cd*(8/15)*tand(a/2)*sqrt(2*g))\n", "endfunction\n", "vec2=intg(h1,(h1-h2),fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('time for the channel to fall = %.f sec',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.5: example_5.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "clear\n", "A= 1/16 //mile^2\n", "d= 2 //ft\n", "h= 18 //ft\n", "h1= 5 //ft\n", "f= 0.006\n", "l= 200 //ft\n", "h2= 10 //ft\n", "g= 32.2 //ft/sec^2\n", "//CALCULATIONS\n", "X= sqrt(1/((1.5+(4*f*l/d))/(2*g)))\n", "function [y]=fun(H)\n", " y=A*5280^2*H^-0.5/(%pi*d^2*X/4)\n", "endfunction\n", "vec2=intg(h-h1,h,fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('time for the channel to fall = %.f sec',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.6: example_6.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clear\n", "clc\n", "//initialisation of variables\n", "l= 8 //ft\n", "b= 6 //ft\n", "h= 10 //ft\n", "r= 3\n", "Cd= 0.6\n", "A1= 36 //ft^2\n", "A2= 12 //ft^2\n", "l1= 6 //ft\n", "h1= 1 //ft\n", "d= 2 //in\n", "g=32.2 //ft/s^2\n", "//CALCULATIONS\n", "function [y]=fun(H)\n", " y=H^-0.5/(Cd*(%pi*(d/12)^2/4)*sqrt(2*g)*((1/A1)+(1/A2)))\n", "endfunction\n", "vec2=intg(0,(b-h1),fun)\n", "T= vec2\n", "//RESULTS\n", "printf ('time for the levels to become equal = %.f sec',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.7: ex_7.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "clear\n", "h1= 3 //ft\n", "h2= 4 //ft\n", "r= 0.95 //m^-1\n", "k= 27.65 //sec\n", "Cd= 0.95\n", "//CALCULATIONS\n", "T= k*(log(r*sqrt(h2)-1)+(r*sqrt(h2)-1))-k*(log(r*sqrt(h1)-1)+(r*sqrt(h1)-1))\n", "h= ((h2-h1)/Cd)^2\n", "//RESULTS\n", "printf ('Time = %.2f sec',T)\n", "printf ('\n Increase in water level = %.2f ft',h)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.8: ex_8.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "clear\n", "t= 75 //sec\n", "h= 10.5 //in\n", "h1= 13.5 //in\n", "//CALCULATIONS\n", "r= t*%pi*sqrt(2*h^2)/log((sqrt(2*h1^2)+h1)/(sqrt(2*h^2)-h))\n", "t= -r*((1/h1)-(1/h))\n", "//RESULTS\n", "printf ('A/K = %.f ',r)\n", "printf ('\n Time taken = %.1f sec',t)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7.9: ex_9.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//initialisation of variables\n", "clear\n", "g= 9.8 //m/sec^2\n", "h1= 10 //in\n", "h2= 12 //in\n", "r1= 1.32\n", "r2= 1.56\n", "r3= 1.97\n", "r4= 4.10\n", "r5= 2.64\n", "//CALCULATIONS\n", "Q= sqrt(32.2)*(h2/18)^1.5\n", "T= 10^5*(r1+2*r3+r4+4*(r3+r5))/(6*h2*60*60)\n", "//RESULTS\n", "printf ('Actual discharge = %.2f BH^1.5 cuses',Q)\n", "printf ('\n Time = %.1f hr',T)\n", "\n", "//The answer is a bit different due to rounding off error in textbook\n", "" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }