Detailed Open Channel Hydraulics
Detailed Open Channel Hydraulics
Detailed Open Channel Hydraulics
Topics to be covered
Basic Concepts Conservation Laws Critical Flows Uniform Flows Gradually Varied Flows Rapidly Varied Flows Unsteady Flows
Basic Concepts
Open Channel flows deal with flow of water in open channels Pressure is atmospheric at the water surface and the pressure is equal to the depth of water at any section Pressure head is the ratio of pressure and the specific weight of water Elevation head or the datum head is the height of the section under consideration above a datum Velocity head (=v2/2g) is due to the average velocity of flow in that vertical section
The flow of water in an open channel is mainly due to head gradient and gravity Open Channels are mainly used to transport water for irrigation, industry and domestic water supply
Conservation Laws
The main conservation laws used in open channels are
Conservation Laws
Conservation of Mass Conservation of Momentum Conservation of Energy
Conservation of Mass
Conservation of Mass
In any control volume consisting of the fluid ( water) under consideration, the net change of mass in the control volume due to inflow and out flow is equal to the the net rate of change of mass in the control volume
This leads to the classical continuity equation balancing the inflow, out flow and the storage change in the control volume. Since we are considering only water which is treated as incompressible, the density effect can be ignored
Conservation of Momentum
This law states that neither the energy can be created or destroyed. It only changes its form.
Conservation of Energy
Conservation of Energy
Mainly in open channels the energy will be in the form of potential energy and kinetic energy Potential energy is due to the elevation of the water parcel while the kinetic energy is due to its movement In the context of open channel flow the total energy due these factors between any two sections is conserved This conservation of energy principle leads to the classical Bernoullis equation P/ + v2/2g + z = Constant When used between two sections this equation has to account for the energy loss between the two sections which is due to the resistance to the flow by the bed shear etc.
gy
Critical flow
Fr=1
Unsteady Flow
Flow is said to be unsteady when the discharge changes with time
Uniform Flow
Flow is said to be uniform when both the depth and discharge is same at any two sections of the channel
kinematic wave
diffusion wave
dynamic wave
Definitions
Specific Energy
It is defined as the energy acquired by the water at a section due to its depth and the velocity with which it is flowing
Specific Energy E is given by, E = y + v2/2g Where y is the depth of flow at that section and v is the average velocity of flow Specific energy is minimum at critical condition
Specific Force
Definitions
It is defined as the sum of the momentum of the flow passing through the channel section per unit time per unit weight of water and the force per unit weight of water
F = Q2/gA +yA
The specific forces of two sections are equal provided that the external forces and the weight effect of water in the reach between the two sections can be ignored. At the critical state of flow the specific force is a minimum for the given discharge.
Critical Flow
Flow is critical when the specific energy is minimum. Also whenever the flow changes from sub critical to super critical or vice versa the flow has to go through critical condition figure is shown in next slide
Sub-critical flow-the depth of flow will be higher whereas the velocity will be lower. Super-critical flow-the depth of flow will be lower but the velocity will be higher Critical flow: Flow over a free over-fall
E-y curve
1
Emin
y1
C
2
Alternate Depths
45
y c
Critical Depth
However, dA=Tdy, where T is the width of the channel at the water surface, then applying dE/dy = 0, will result in following
Q 2Tc gAc
3
=1
Ac Q2 = 2 Tc gAc
Ac VC2 = Tc g
The same principle is valid for trapezoidal and other cross sections Critical flow condition defines an unique relationship between depth and discharge which is very useful in the design of flow measurement structures
Uniform Flows
This is one of the most important concept in open channel flows The most important equation for uniform flow is Mannings equation given by
1 2 / 3 1/ 2 V= R S n
Where R = the hydraulic radius = A/P P = wetted perimeter = f(y, S0) Y = depth of the channel bed S0 = bed slope (same as the energy slope, Sf) n = the Mannings dimensional empirical constant
Uniform Flows
1 V12/2g
2 hf z2 y2 v22/2g
y1
Control Volume So z1
Datum
Uniform Flow
Example : Flow in an open channel This concept is used in most of the open channel flow design The uniform flow means that there is no acceleration to the flow leading to the weight component of the flow being balanced by the resistance offered by the bed shear In terms of discharge the Mannings equation is given by
1 Q = AR 2 / 3 S 1/ 2 n
Uniform Flow
This is a non linear equation in y the depth of flow for which most of the computations will be made Derivation of uniform flow equation is given below, where
direction of flow
Uniform Flow
The force balance equation can be written as
W sin 0 Px = 0
Or Or
Ax sin 0 Px = 0
A 0 = sin P
Now A/P is the hydraulic radius, R, and sin is the slope of the channel S0
Uniform Flow
The shear stress can be expressed as
0 = c f (V 2 / 2)
Where cf is resistance coefficient, V is the mean velocity is the mass density Therefore the previous equation can be written as Or
V2 cf = RS 0 2
V = 2g RS 0 = C RS 0 cf
1.49 1 / 6 C= R n
dy S 0 S f = dx 1 Fr 2
Where the variation of depth y with the channel distance x is shown to be a function of bed slope S0, Friction Slope Sf and the flow Froude number Fr. This is a non linear equation with the depth varying as a non linear function
v2/2g
Datum
After simplification,
S0 S f dy = dx 1 + d V 2 / 2 g / dy
Unsteady flows
When the flow conditions vary with respect to time, we call it unsteady flows. Some terminologies used for the analysis of unsteady flows are defined below:
Vw = V c
Plus sign if the wave is traveling in the flow direction and minus for if the wave is traveling in the direction opposite to flow For shallow water waves c = gy0 where y0=undisturbed flow depth.
Surges in power canals or tunnels Surges in upstream or downstream channels produced by starting or stopping of pumps and opening and closing of control gates Waves in navigation channels produced by the operation of navigation locks Flood waves in streams, rivers, and drainage channels due to rainstorms and snowmelt Tides in estuaries, bays and inlets
3.
4.
5.
Unsteady flows
Unsteady flow commonly encountered in an open channels and deals with translatory waves. Translatory waves is a gravity wave that propagates in an open channel and results in appreciable displacement of the water particles in a direction parallel to the flow For purpose of analytical discussion, unsteady flow is classified into two types, namely, gradually varied and rapidly varied unsteady flow In gradually varied flow the curvature of the wave profile is mild, and the change in depth is gradual In the rapidly varied flow the curvature of the wave profile is very large and so the surface of the profile may become virtually discontinuous.
When the channel is to feed laterally with a supplementary discharge of q per unit length, for instance, into an area that is being flooded over a dike
The general dynamic equation for gradually varied unsteady flow is given by:
y V V 1 V ' =0 + + x g x g t
Contents
General introduction Energy equation Head loss equations Head discharge relationships Pipe transients flows through pipe networks Solving pipe network problems
General Introduction
Pipe flows are mainly due to pressure difference between two sections Here also the total head is made up of pressure head, datum head and velocity head The principle of continuity, energy, momentum is also used in this type of flow. For example, to design a pipe, we use the continuity and energy equations to obtain the required pipe diameter Then applying the momentum equation, we get the forces acting on bends for a given discharge
General introduction
In the design and operation of a pipeline, the main considerations are head losses, forces and stresses acting on the pipe material, and discharge. Head loss for a given discharge relates to flow efficiency; i.e an optimum size of pipe will yield the least overall cost of installation and operation for the desired discharge. Choosing a small pipe results in low initial costs, however, subsequent costs may be excessively large because of high energy cost from large head losses
Energy equation
The design of conduit should be such that it needs least cost for a given discharge The hydraulic aspect of the problem require applying the one dimensional steady flow form of the energy equation:
p1
2 V12 p2 V2 + 1 + z1 + h p = + 2 + z2 + ht + hL 2g 2g
Where
p/ =pressure head V2/2g =velocity head z =elevation head hp=head supplied by a pump ht =head supplied to a turbine hL =head loss between 1 and 2
Energy equation
Energy Grade Line Hydraulic Grade Line v2/2g z2
z1
hp
p/y
Energy equation
Velocity head
In V2/2g, the velocity V is the mean velocity in the conduit at a given section and is obtained by V=Q/A, where Q is the discharge, and A is the cross-sectional area of the conduit. The kinetic energy correction factor is given by , and it is defines as, where u=velocity at any point in the section 3 u dA
= A
V 3A
has minimum value of unity when the velocity is uniform across the section
Likewise if head is supplied to turbine, the power supplied to the turbine will be
P = Qht
These two equations represents the power supplied directly or power taken out directly from the flow
0 = f V 2 / 8
h = p
L V2 = f D 2g
S=
32V D 2 g
64 f = VD
Also we can write in terms of Reynolds number
64 f = Nr
This relation is valid for Nr<1000
Energy losses caused by valves, bends and changes in pipe diameter This is smaller than friction losses in straight sections of pipe and for all practical purposes ignored Minor losses are significant in valves and fittings, which creates turbulence in excess of that produced in a straight pipe
Minor losses may be expressed in terms of the equivalent length of straight pipe, or as pipe diameters (L/D) which produces the same head loss. 2
h= f LV D 2g
A flow coefficient Cv which gives a flow that will pass through the valve at a pressure drop of 1psi may be specified. Given the flow coefficient the head loss can be calculated as
h= 18.5 106 D 4V 2
2 Cv 2 g
P V12 P2 V22 z1 + 1 + = z2 + + + hL g 2 g g 2 g
The energy equation represents elevation, pressure, and velocity forms of energy. The energy equation for a fluid moving in a closed conduit is written between two locations at a distance (length) L apart. Energy losses for flow through ducts and pipes consist of major losses and minor losses.
Major losses are due to friction between the moving fluid and the inside walls of the duct. The Darcy-Weisbach method is generally considered more accurate than the Hazen-Williams method. Additionally, the Darcy-Weisbach method is valid for any liquid or gas. Moody Friction Factor Calculator
Hazen-Williams is only valid for water at ordinary temperatures (40 to 75oF). The Hazen-Williams method is very popular, especially among civil engineers, since its friction coefficient (C) is not a function of velocity or duct (pipe) diameter. Hazen-Williams is simpler than DarcyWeisbach for calculations where one can solve for flowrate, velocity, or diameter
1. 2. 3.
If the liquid is assumed incompressible and the pipe is rigid, then at any instant the velocity along the pipe will be same,
( AV 2 ) in = ( AV 2 ) out
D=pipe diameter L=pipe length =specific weight of fluid 0=shear stress at the pipe wall
When the flow is fully established, dV/dt=0. The final velocity V0 will be such that
fL V0 2 H 0 = 1 + D 2g
We use the above relationship to get the time for flow to establish 2 LD dV
dt = D + fL V02 V 2 .
By simplifying and discarding terms of higher order, this equation becomes p = 2 VV + 2 Va + V 2 + 2Va + a 2
The general form of the equation for conservation of mass for one-dimensional flows may be written as
x2
0 = ( + )(V + a + V )A (V + a )A
V
V +a
=
Since
V
a
p = gH we can write as
H = a V g
Note: change in pressure head due to an instantaneous change in flow velocity is approximately 100 times the change in the flow velocity
Contents
Numerical computing Computer arithmetic Parallel processing Examples of problems needing numerical treatment
1 + cos 2 ( x ) dx
Numerical analysis can compute the length of this curve by standard methods that apply to essentially any integrand Numerical computing helps in finding effective and efficient approximations of functions
Computer arithmetic
Numerical method is tedious and repetitive arithmetic, which is not possible to solve without the help of computer. On the other hand Numerical analysis is an approximation, which leads towards some degree of errors The errors caused by Numerical treatment are defined in terms of following:
Computer arithmetic
numbers of fixed word length; the true values are not expressed exactly by such representations. Such error due to this computer imperfection is round-off error. through mathematical expressions which have some coefficients that are imperfectly known. but since humans are involved in programming, operation, input preparation, and output interpretation, blunders or gross errors do occur more frequently than we like to admit.
succeeding steps due to the occurrence of error in the earlier step, such error is in addition to the local errors. If the errors magnified continuously as the method continues, eventually they will overshadow the true value, destroying its validity, we call such a method unstable. For stable method (which is desired) errors made at early points die out as the method continues.
Parallel processing
It is a computing method that can only be performed on systems containing two or more processors operating simultaneously. Parallel processing uses several processors, all working on different aspects of the same program at the same time, in order to share the computational load For extremely large scale problems (short term weather forecasting, simulation to predict aerodynamics performance, image processing, artificial intelligence, multiphase flow in ground water regime etc), this speeds up the computation adequately.
Parallel processing
Most computers have just one CPU, but some models have several. There are even computers with thousands of CPUs. With single-CPU computers, it is possible to perform parallel processing by connecting the computers in a network. However, this type of parallel processing requires very sophisticated software called distributed processing software. Note that parallel processing differs from multitasking, in which a single CPU executes several programs at once.
Parallel processing
Types of parallel processing job: In general there are three types of parallel computing jobs
Parallel task
A parallel task can take a number of forms, depending on the application and the software that supports it. For a Message Passing Interface (MPI) application, a parallel task usually consists of a single executable running concurrently on multiple processors, with communication between the processes.
Parallel processing
Parametric Sweep
A parametric sweep consists of multiple instances of the same program, usually serial, running concurrently, with input supplied by an input file and output directed to an output file. There is no communication or interdependency among the tasks. Typically, the parallelization is performed exclusively (or almost exclusively) by the scheduler, based on the fact that all the tasks are in the same job.
Task flow
A task flow job is one in which a set of unlike tasks are executed in a prescribed order, usually because one task depends on the result of another task.
Contents
Set of linear equations Matrix notation Method of solution:direct and iterative Pathology of linear systems Solution of nonlinear systems :Picard and Newton techniques
Matrix notation
Matrix : a rectangular array (n x m) of numbers
a11 a12 a21 a22 A = aij = . . . an1 an 2 . . . . . . a1m a2 m . . . anm nxm
[ ]
Matrix Addition: C = A+B = [aij+ bij] = [cij], where Matrix Multiplication: AB = C = [aij][bij] = [cij], where
i = 1,2,..., n,
j = 1,2,..., r.
cij = kaij
bi =
aik xk ,
i = 1,2,..., No.ofrows
x1 x2 x = . , . . xn
b1 b2 b = . , . . bn
a 0 L = b d c e
a U = 0 0 b d 0
0 0 f
c e f
Tri-diagonal matrix: if
nonzero elements only on the diagonal and in the position adjacent to the diagonal
a c T = 0 0 0
b 0 0 0 d e 0 0 f g h 0 0 i j k 0 0 l m
Examples
4 3 1 A = 0 2 3 1 1 2
0 1 3 2 1 AT = 1 4 3 2
If we set pA() = 0, solve for the roots, we get eigenvalues of A If A is n x n, then pA() is polynomial of degree n Eigenvector w is a nonzero vector such that Aw= w, i.e., (A - I)w=0
2 R2 10 R3
4 0 0
15 1 19 77 72 216
Step4: The array in the upper triangular matrix represents the equations which after Back-substitution gives the solution the values of x1,x2,x3
we begin with the previous augmented matrix in a large set of equations multiplications will give very large and unwieldy numbers to overflow the computers register memory, we will therefore eliminate ai1/a11 times the first equation from the i th equation
Step1: Interchanging rows one and four, dividing the first row by 6, and reducing the first column gives
1 0.16667 1 0.83335 1 0 1.66670 5 3.66670 4 0 3.66670 4 4.33340 11 2 0 1 0 0
Step3: We divide the 3rd row by 15.000 and make the other elements in the third column into zeros
Step4: now divide the 4th row by 1.5599 and create zeros above the diagonal in the fourth column
1 0 0 0 0 0 0 0.49999 1 0 0 1.00010 0 1 0 0.33326 0 0 1 1.99990
j 1
j i,
i = 1,2,..., n
li1 = ai1
a1 j l11 a1 j a11
uij =
i j,
j = 2,3,..., n.
u1 j =
lii
Iterative Methods
Point iterative method
Jacobi method Gauss-Siedel Method Gauss-
Some initial guess to the values of the variables Get the new set of values of the variables
i = 1,2,..., n
In this method the latest value of the xi are used in the calculation of further xi
i = 1,2,..., n
Another form
i 1 n w k +1 k k +1 xi = (1 w) xi + (ci aij x j aij x k ) j aii j =1 j =i +1
Matrix Inversion
Sometimes the problem of solving the linear algebraic system is loosely referred to as matrix inversion Matrix inversion means, given a square matrix [A] with nonzero determinant, finding a second matrix [A-1] having the property that [A-1][A]=[I], [I] is the identity matrix
x + y = 3, 2x + 2y = 6 x + y = 3, 2x + 2y = 7
triangularized without having zeros on the diagonal Checking inconsistency, redundancy and singularity of set of equations: Rank of coefficient matrix (rank less than n gives inconsistent, redundant and singular system)
Singular matrix (n x n system, no unique solution) Nonsingular matrix, coefficient matrix can be
x 2 + y 2 = 4; e x + y = 1
Initial guess for both x and y Unknowns on the left hand side are computed iteratively. Most recently computed values are used in evaluating right hand side
In an interval about the root that includes the initial guess This method depends on the arrangement of x and y i.e how x=f(x,y), and y=g(x,y) are written Depending on this arrangement, the method may converge or diverge
x1 = x0
f ( x0 ) f ( x0 )
'
xn +1 = xn
f ( xn ) f ( xn )
'
n = 0,1,2,...
Newton-Raphson method
F(x,y)=0, G(x,y)=0 Expand the equation, using Taylor series about xn and yn
F ( xn + h, yn + k ) = 0 = F ( xn , yn ) + Fx ( xn , yn )h + Fy ( xn , yn )k G ( x n + h, y n + k ) = 0 = G ( x n , y n ) + G x ( x n , y n ) h + G y ( x n , y n ) k
h = xn +1 xn , k = yn +1 yn
Solving for h and k
h=
FG x GFx k= FxG y G x Fy
Assume initial guess for xn,yn Compute functions, derivatives and xn,yn, h and k, Repeat procedure
Newton-Raphson method
For n nonlinear equation
Fi ( x1 + x1, x2 + x2 + ... + xn + xn ) = 0 F F F = Fi ( x1, x2 ,..., xn) + x1 i + x2 i + ... + xn i , x1 x2 xn
i = 1,2,3,..., n
. . .
Fn F F x1 + n x2 + ... + n xn = Fn ( x1, x2 ,..., xn) x1 x2 xn
Using the finite difference approximation at a typical interior node, the above ground water equation reduces to
Bi, j hi, j 1 + Di, j hi 1, j + Ei, j hi, j + Fi, j hi +1, j + H i, j hi, j +1 = Ri, j
Di, j =
Fi, j =
H i, j =
[Txi , j + Txi 1, j ] 2x 2
[Txi , j + Txi +1, j ] 2x 2
[T yi , j + T yi , j +1 ] 2y 2
Ri, j =
Si, j h0i , j t
(Q ) pi , j + ( R) ri , j + ( R ) si , j
Q is a constant
df 1 1/ 2 d = So A j R2 / 3 j dy n dy j 1 1 / 2 2 AR 1 / 3 dR 2 / 3 dA = So +R n dy dy 3 j 1 1/ 2 1 dA 2 / 3 2 dR = So A j R j 3R dy + A dy n j 2 dR 1 dA = Qj 3R dy + A dy j
The subscript j outside the parenthesis indicates that the contents are evaluated for y=yj
y j +1 = y j
f (y j) (df / dy ) j
Iterations are continued until there is no significant change in y, and this will happen when the error f(y) is very close to zero
For a rectangular channel A=Bwy, R=Bwy/(Bw+2y) where Bw is the channel width, after the manipulation, the above equation can be written as
y j +1 = y j 1 Q/Qj 5 Bw + 6 y j 3 y j ( Bw + 2 y j ) j
Assignments
1. Solve the following set of equations by Gauss elimination:
x1 + x2 + x3 = 3 2 x1 + 3x2 + x3 = 6 x1 x2 x3 = 3
Is row interchange necessary for the above equations? 2. Solve the system
9 x + 4 y + z = 17, x 2 y 6 z = 14, x + 6 y = 4,
a. Using the Gauss-Jacobi method b. Using the Gauss-Siedel method. How much faster is the convergence than in part (a).?
Assignments
3. Solve the following system by Newtons method to obtain the solution near (2.5,0.2,1.6)
x2 + y2 + z 2 = 9 xyz = 1 x + y z2 = 0
Assignments
5. Find the roots of the equation to 4 significant digits using Newton-Raphson method
x 4x +1 = 0
3
6. Solve the following simultaneous nonlinear equations using Newton-Raphson method. Use starting values x0 = 2, y0 = 0.
x +y =4
2 2
xy = 1
Contents
Derivatives and integrals Integration formulas Trapezoidal rule Simpsons rule Newtons Coats formula Gaussian-Quadrature Multiple integrals
Derivatives
Derivatives from difference tables
We use the divided difference table to estimate values for derivatives. Interpolating polynomial of degree n that fits at points p0,p1,,pn in terms of divided differences,
f ( x) = Pn ( x) + error = f [ x0 ] + f [ x0 , x1 ]( x x0 ) + f [ x0 , x1, x 2]( x x0 )( x x1 ) + ... + f [ x0 , x1,..., xn ] ( x xi ) + error
Derivatives continued
To get the error term for the above approximation, we have to differentiate the error term for Pn(x), the error term for Pn(x): f ( n +1) ( )
Error = ( x x0 )( x x1)...( x xn )
(n + 1)!
in [x,x0,xn].
Error is not zero even when x is a tabulated value, in fact the error of the derivative is less at some x-values between the points
Derivatives continued
Evenly spaced data
When the data are evenly spaced, we can use a table of function differences to construct the interpolating polynomial. We use in terms of:
( x xi ) s= h
in [x,x0,xn].
Derivatives continued
The derivative of Pn(s) should approximate f(x)
d d ds Pn ( s ) = Pn ( s ) dx ds dx j fi n j 1 j 1 1 . = fi + ( s l ) h j = 2 k = 0 l = 0 j! l k
Where
ds d ( x xi ) 1 = = dx dx h h
(1) n h n ( n +1) Error = f ( ), n +1
in [x1,, xn].
Derivatives continued
Simpler formulas Forward difference approximation
For an estimate of f(xi), we get
f ' ( x) = 1 1 1 1 [f i 2 f i + 3 fi ... n fi ] x = xi h 2 3 n
With one term, linearly interpolating, using a polynomial of degree 1, we have (error is O(h))
f ' ( xi ) = 1 1 [f i ] hf " ( ), h 2
Derivatives cont
Central difference approximation
Assume we use a second degree polynomial that matches the difference table at xi,xi+1 and xi+2 but evaluate it for f(xi+1), using s=1, then
f ' ( xi +1) = 1 1 fi + 2 fi + O(h 2 ), h 2
Derivatives cont
Higher-Order Derivatives We can develop formulas for derivatives of higher order based on evenly spaced data f ( xi ) = f i = f i +1 f i Difference operator: Ef i = f i +1 Stepping operator : Or : E n fi = fi + n Relation between E and : E=1+ Differentiation operator: D( f ) = df / dx, D n ( f ) = d n / dx n ( f ) Let us start with fi + s = E s fi , where s = ( x xi ) / h
Dfi + s = = d d f ( xi + s ) = ( E s fi ) dx dx 1 d 1 ( E s f i ) = (ln E ) E s f i h ds h
Derivatives cont
If s=0, we get
1 D = ln(1 + ) h
Integration formulas
The strategy for developing integration formula is similar to that for numerical differentiation Polynomial is passed through the points defined by the function Then integrate this polynomial approximation to the function. This allows to integrate a function at known values
Newton-Cotes integration
f ( x)dx = Pn ( xs )dx
a
f ( x)dx = ( f 0 + sf 0 )dx
x0 s =1
x1
= h ( f 0 + sf 0 )ds
s =0
1 s 1 = h( f 0 + f 0 ) = hf 0 s 0 + hf 0 2 2 0
1 2
h [2 f0 + ( f1 f0 )] = h ( f0 + f1) 2 2
h f ( )dx = h f (1 )
1
3 "
1 s2 s 0
ds
s 3 s 2 = 1 h3 f " ( ), = h f (1 ) 1 6 4 12 0
f ( x)dx =
h 1 ( f 0 + f1 ) h3 f " ( ) 2 12 h 1 5 iv ( f 0 + 4 f1 + f 2 ) h f ( ), 3 90
f ( x)dx =
f ( x)dx =
3h 3 5 iv ( f 0 + 3 f1 + 3 f 2 + f 3 ) h f ( ). 8 80
Romberg integration
Improve accuracy of trapezoidal rule
Simpsons rule
Newton-Cotes formulas based on quadratic and cubic interpolating polynomials are Simpsons rules Quadratic- Simpsons 1 rule 3 3 Cubic- Simpsons 8 rule
f ( x)dx =
f ( xi ) + f ( xi +1 ) h (x) = ( f i + f i +1 ), 2 2
f ( x)dx =
b
n h
i =12
( f i + f i +1 ) =
h ( f1 + f 2 + f 2 + f 3 + ... + f n + f n +1 ); 2
h f ( x)dx = ( f1 + 2 f 2 + 2 f 3 + ... + 2 f n + f n +1 ). 2 a
f(x)
x1 = a x2
x3
x4
x5
xn+1 = b
Trapezoidal Rule
x0 < 1 < x1
If we assume that f(x) is continuous on (a,b), there is some value of x in (a,b), say x=, at which the value of the sum in above equation is equal to n.f(), since nh=b-a, the global error becomes Global error 1 (b a ) 2 " = h3nf " ( ) = h f ( ) = O(h 2 ).
12 12
Romberg Integration
We can improve the accuracy of trapezoidal rule integral by a technique that is similar to Richardson extrapolation, this technique is known as Romberg integration Trapezoidal method has an error of O(h2), we can combine two estimate of the integral that have hvalues in a 2:1 ratio by Better estimate=more accurate + accurate-less accurate)
1 2n 1
(more
Quadratic- Simpsons
The second degree Newton-Cotes formula integrates a quadratic over two intervals of equal width, h h
f ( x)dx = 3
1 3
rule
[ f0 + 4 f1 + f 2 ].
1 5 ( 4) h f ( ) 90
rule cont
With an error of
Error = (b a ) 4 ( 4) h f ( ) 180
We can see that the error is of 4 th order The denominator changes to 180, because we integrate over pairs of panels, meaning that the local rule is applied n/2 times
rule
Error =
The local order of error is same as 1/3 rd rule, except the coefficient is larger
rule cont
To get the composite rule for [a,b] subdivided into n (n divisible by 3) subintervals of size h,
3h f ( x)dx = [ f (a ) + 3 f1 + 3 f 2 + 2 f 3 + 3 f 4 + 3 f 5 + 2 f 6 8 + ... + 2 f n 3 + 3 f n 2 + 3 f n 1 + f (b)]
With an error of
Error = (b a ) 4 ( 4) h f ( ) 80
x1
f ( x)dx = w1 f1 + w2 f 2 + w3 f 3
The functions f(x)=1, f(x)=x, f(x)=x2, are used to establish w1, w2, w3
Gaussian quadrature
Other formulas based on predetermined evenly spaced x values Now unknowns: 3 x-values and 3 weights; total 6 unknowns For this a polynomial of degree 5 is needed to interpolate These formulas are Gaussian-quadrature formulas Applied when f(x) is explicitly known Example: a simple case of a two term formula containing four unknown parameters 1 f (t ) = af (t ) +bf (t ).
1
If we let
(b a )t + b + a x= 2
1
so that
ba dx = dt 2
then
b a (b a )t + b + a f ( x)dx = 1 f 2 2
Multiple integrals
Weighted sum of certain functional values with one variable held constant Add the weighted sum of these sums If function known at the nodes of a rectangular grid, we use these values
d d b f ( x , y ) d A = f ( x , y ) dy dx = f ( x , y ) dx dy a c c a b
y x 3 2
Multiple integrals
Double integration by numerical means reduces to a double summation of weighted function values
1 n
f ( x)dx = ai f ( xi ).
i =1
1 1 1
1 1 1
f ( x, y, z )dxdydz = ai a j ak f ( xi , yi , z k ).
i =1 j =1 k =1
n n
Assignments
1. Use the Taylor series method to derive expressions for f(x) and f (x) and their error terms using f-values that precede f0. ( These are called backward-difference formulas.) 2. Evaluate the following integrals by (i) Gauss method with 6 points (ii) Trapezoidal rule with 20 points (iii) Simpsons rule with 10 points Compare the results. Is it preferable to integrate backwards or forwards? (a)
e
0
x2
dx
(b)
x 3e x 1dx
0
Assignments
3. Compute the integral of f(x)=sin(x)/x between x=0 and x=1 using
Simpsons 1/3 rule with h=0.5 and then with h=0.25. from these two results, extrapolate to get a better result. What is the order of the error after the extrapolation? Compare your answer with the true answer.
4. Integrate the following over the region defined by the portion of a unit circle that lies in the first quadrant. Integrate first with respect to x holding y constant, using h=0.25. subdivide the vertical lines into four panels.
a. b.
Assignments
5. Integrate with varying values of x and y using the trapezoidal rule in both directions, and show that the error decreases about in proportion to h2:
(x
0 0
1 1
+ y )dxdy
2
6. Since Simpsons 1/3 rule is exact when f(x) is a cubic, evaluation of the following triple integral should be exact. Confirm by evaluating both numerically and analytically.
x 3 yz 2 dxdydz
0 0 1
1 2 0
Contents
Taylor series method Euler and modified Euler methods Rungekutta method and Multistep method Application to higher order equations Example through open channel and pipe flow problems
Introduction
Numerical solution of ordinary differential equations is an important tool for solving a number of physical real world problems which are mathematically represented in terms of ordinary differential equations. Such as spring-mass system, bending of beams, open channel flows, pipe flows etc. The most of the scientific laws are represented in terms of ordinary differential equations, so to solve such systems we need efficient tools
Introduction
If the differential equation contains derivatives of nth order, its called nth order differential equation. The solution of any differential equation should be such that it satisfies the differential equation along with certain initial conditions on the function. For the nth order equation, n independent initial conditions must be specified.
Introduction
These equations can be solved analytically also, but those are limited to certain special forms of equations These equations can be linear or nonlinear. When the coefficients of these equations are constants, these are linear differential equations When the coefficients itself are functions of dependent variables, these are nonlinear differential equations
Introduction
Numerical methods are not limited to such standard cases, it can be used to solve any physical situations. In numerical methods we get solution as a tabulation of values of the function at various values of the independent variable and data can be fit to some functional relationship, instead of exact functional relationship as in the analytical methods. The disadvantage of this method is that we have to recompute the entire table if the initial conditions are changed
Introduction
An equation of the form dy/dx=f(x), with f(x) given and with suitable initial conditions, say y(a), also given can be integrated analytically or numerically by the methods discussed in the previous section, such as Simpsons 1/3 rule.
y ( x) = y (a ) + f (t )dt
a x
If f(t) cannot be integrated analytically a numerical procedure can then be employed. The more general problem is nonlinear and of the form dy/dx=f(x,y), f and y(a) given, the problem is to find y(x) for x>a
Taylor-series method
Taylor series in which we expand y about the point x=x0 is
y '' ( x0 ) y ''' ( x0 ) 2 y ( x) = y ( x0 ) + y ( x0 )( x x0 ) + ( x x0 )3 + ... ( x x0 ) + 3! 2!
'
Error term of the Taylor series after the h4 term can be written as (v )
Error = y
where 0<<h
( ) 5 h , 5!
yn +1 = yn + hy n + O (h ).
'
This assumption gives us an improved estimate for y at xn+1. yn+1 can not be evaluated till the true value of yn+1 is known
We can find out the error in the modified Euler method by comparing with the Taylor series
Runge-Kutta methods
Fourth and fifth order Runge-Kutta methods Increment to the y is a weighted average of two estimates of the increment which can be taken as k1 and k2. Thus for the equation dy/dx=f(x,y)
yn +1 = yn + ak1 + bk 2 k1 = hf ( xn , yn ), k 2 = hf ( xn + h, yn + k1).
We can think of the values k1 and k2 as estimates of the change in y when x advances by h, because they are the product of the change in x and a value for the slope of the curve, dy/dx.
df/dx=fx+fydy/dx==fx+fyf, is
1 1 yn +1 = yn + hf n + h 2 f x + f y f 2 2 n
k1 = hf ( xn , yn ), 1 1 k 2 = hf ( xn + h, yn + k1 ), 2 2 k3 = hf ( xn + 1 1 h, yn + k 2 ), 2 2
k 4 = hf ( xn + h, yn + k3 ),
Multi-step methods
Runge-kutta type methods are called single step method When only initial conditions are available, ability to perform the next step with a different step size Uses past values of y and y to construct a polynomial that approximates the derivative function, and extrapolate this into the next interval The number of past points that are used sets the degree of the polynomial and is therefore responsible for the truncation error. The order of the method is equal to the power of h in the global error term of the formula, which is also equal to one more than the degree of the polynomial.
Multi-step methods
Adams method, we write the differential equation dy/dx=f(x,y) in the form dy=f(x,y)dx, and we integrate between xn and xn+1:
x n +1 xn
dy = yn +1 yn = f ( x, y )dx
xn
x n +1
We approximate f(x,y) as a polynomial in x, deriving this by making it fit at several past points Using 3 past points, approximate polynomial is quadratic, and for 4 points the polynomial is cubic More the past points, better the accuracy, until round-off error is negligible
Multi-step methods
Suppose that we fit a second degree polynomial through the last three points (xn,yn),(xn-1,yn-1) and (xn-2,yn-2), we get a quadratic approximation to the derivative function:
1 2 2 1 f ( x, y ) = h ( f n 2 f n 1 + f n 2 ) x + h(3 f n 4 f n 1 + f n 2 ) x + f n 2 2
Now we integrate between xn and xn+1. The result is a formula for the increment in y
h yn +1 yn = (23 f n 16 f n 1 + 5 f n 2 ) 12
Multi-step methods
We have the formula to advance y:
h yn +1 = yn + [23 f n 16 f n 1 + 5 f n 2 ] + O(h 4 ) 12
This formula resembles the single step formulas, in that the increment to y is a weighted sum of the derivatives times the step size, but differs in that past values are used rather than estimates in the forward direction. We can reduce the error by using more past points for fitting a polynomial
Multi-step methods
In fact, when the derivation is done for four points to get a cubic approximation to f(x,y), the following is obtained
h yn +1 = yn + [55 f n 59 f n 1 + 37 f n 2 9 f n 3 ] + O(h5 ) 24
Multi-step methods
Milnes method first predict a value for yn+1 by extrapolating the values for the derivative, Differs from Adams method, as it integrates over more than one interval The required past values computed by Runge-Kutta or Taylors series method. In this method, the four equi-spaced starting values of y are known, at the points xn, xn-1, xn-2 and xn-3 We may apply quadrature formula to integrate as follows
Multi-step methods
Milnes method
dy = f ( x, y ) dx
dy dx dx = x f ( x, y)dx = x P2 ( x)dx xn3 n 3 n 3
yn +1 yn 3 4h 28 5 v (2 f n f n1 + 2 f n2 ) + h y (1 ) = 3 90
xn+1 xn+1 xn+1
Where
xn 3 < 1 < xn +1
Multi-step methods
The above predictor formula can be corrected by the following
xn+1
xn+1
xn+1
h h5 v yn +1,c yn 1 = ( f n +1 + 4 f n + f n 1 ) y ( 2 ) 3 90
Where
xn 1 < 2 < xn +1
Multi-step methods
Adam-Moulton Method, more stable than and as efficient as Milne method . Adam-Moulton predictor formula:
yn +1 = yn + h 251 5 v [55 f n 59 f n 1 + 37 f n 2 9 f n 3 ] + h y (1 ) 24 720
The efficiency of this method is about twice that of Runge-Kutta and Runge-kutta Fehlberg methods
x(t0 ) = x0,
The initial value of the function x and its derivatives are specified We convert to 1st order equation as
dx = y, dt
x(t0 ) = x0,
dy = f (t , x , y ), dt
' y (t0 ) = x0
This pair of equations is equivalent to the original 2nd order equation For even higher orders, each of the lower derivatives is defined as a new function, giving a set of n first-order equations that correspond to an nth order differential equation. For a system of higher order equations, each is similarly converted, so that a larger set of first order equations results.
( x0 ) = An
. . .
' yn 1 = yn , ' yn = f ( x, y1 , y2 ,..., yn );
The equation describing the variation of the flow depth for any variation in the bottom elevation is given by
dz dy = ( Fr2 1) dx dx
d ds ( p + z )
Assignments
1. Use the simple Euler method to solve for y(0.1) from dy
dx = x + y + xy
y ( 0) = 1
With h=0.01. Repeat this exercise with the modified Euler method with h=0.025. Compare the results. 2. Determine y at x=0.2(0.2)0.6 by the Runge-Kutta technique, given that
1 dy = dx x + y
y (0) = 2
Assignments
3. Solve the following simultaneous differential equations by using (i) A fourth order Runge-Kutta method (ii) A fourth order Milne predictor-corrector algorithm
dy dz = x yz, = y xz, y (0) = 0, z (0) = 1.0 dx dx
For
0.5 x 0.0
Assignments
5. Find y at x=0.6, given that
y '' = yy ' , y (0) = 1, y ' (0) = 1
Begin the solution by the Taylor-series method, getting y(0.1),y(0.2),y(0.3). The advance to x=0.6 employing the Adams-Moulton technique with h=0.1 on the equivalent set of first-order equations. 6. Solve the pair of simultaneous equations by the modified Euler method for t=0.2(0.2)0.6. Recorrect until reproduced to three decimals.
dx dy = xy + t , x(0) = 0, = x t , y (0) = 1, dt dt
Contents
Types of finite difference techniques Explicit and implicit techniques Methods of solution Application of FD techniques to steady and unsteady flows in open channels
Types of FD techniques
Most of the physical situation is represented by nonlinear partial differential equations for which a closed form solution is not available except in few simplified cases Several numerical methods are available for the integration of such systems. Among these methods, finite difference methods have been utilized very extensively Derivative of a function can be approximated by FD quotients.
Types of FD techniques
Differential equation is converted into the difference equation Solution of difference equation is an approximate solution of the differential equation. Example: f(x) be a function of one independent variable x. assume at x0, function be f(x0) , then by using Taylor series expansion, the function f(x0+x) may be written as
(x) 2 '' f ( x0 + x) = f ( x0 ) + xf ' ( x0 ) + f ( x0 ) + O(x)3 2!
Types of FD techniques
f(x0)=dy/dx at x=x0 O(x)3: terms of third order or higher order of x Similarly f(x0- x) may be expressed as
( x ) 2 '' f ( x0 x ) = f ( x0 ) xf ' ( x0 ) + f ( x0 ) + O ( x ) 3 2!
Types of FD techniques
f(x) y=f(x) B
x0-x
x0
x0+x
Types of FD techniques
Similarly
f ( x0 ) f ( x0 x) df = + O(x) dx x = x x 0i
Neglecting O(x) terms in above equation we get Forward difference formula as given below
f ( x0 + x) f ( x0 ) df = dx x = x x 0i
Both forward and backward difference approximation are first order accurate
Forward:
f = x
f ik f ik +1 x
Central:
f ik 1 f ik 1 f = + x 2 x
Central:
f ik +1 f ik +1 f 1 = +1 x 2x
Unstable scheme
For any unsteady situation, we can select the following finite-difference approximations:
fik 1 f ik 1 f = + x 2x
f ik +1 f ik f = t t
In the above f refers to dependent variables Generally the finite difference scheme is inherently unstable; i.e., computation become unstable irrespective of the size of grid spacing, so the stability check is an important part of the numerical methods.
f ik 1 f ik 1 f = + x 2 x
f ik +1 f * f = t t
These approximations are applied to the conservation and non-conservation forms of the governing equations of the physical situations.
f i* 1 f i* f = + x x
f ik 1 f ik fx = + x
Corrector
fi* fi* 1 + fx = x
2 f i* + 3 f i* 1 f i* 2 fx = x
and using the values of different variables computed during the predictor part, we obtain the equations for unknown variables. The values at k+1 time step may be determined from the following equations:
fi
k +1
1 * = ( fi + fi** ) 2
f ik f ik 1 + fx = x
f ik 1 f ik fx = + x
Step2: in this part of the predictor part we use the following finite-difference approximations:
2 f ik 3 f ik 1 + f ik 2 + fx = x
2 f ik + 3 f ik 1 f ik 2 fx = x
The values at k+1 time step may be determined from the following equations:
k +1 k 1 fi = fi + t ( fi* + fi** )
( f ik +1 f ik +1 ) (1 )( f ik 1 f ik ) f +1 + = + x x x
f =
1 1 ( fik +1 + fik +1) + (1 )( fik 1 + fik ) +1 + 2 2
Assignments
1. A large flat steel plate is 2 cm thick. If the initial
temperature within the plate are given, as a function of the distance from one face, by the equations u = 100 x for 0 x 1
u = 100(2 x) for 0 x 1
Find the temperatures as a function of x and t if both faces are maintained at 0 degree centigrade. The one dimensional heat flow equation is given as follows
k 2u u = c x 2 t
Assignments
2. Solve for the temperature at t=2.06 sec in the 2-cm thick steel slab of problem (1) if the initial temperatures are given by
x u ( x , 0 ) = 100 sin 2
Use the explicit method with x=0.25 cm. compare to the analytical solution: 0 . 3738 t
100 e sin( x / 2 )
Contents
Classification of PDEs Approximation of PDEs through Finite difference method Solution methods: SOR ADI CGHS
Introduction
In applied mathematics, partial differential equation is a subject of great significance These type of equations generally involves two or more independent variables that determine the behavior of the dependent variable. The partial differential equations are the representative equations in the fields of heat flow, fluid flow, electrical potential distribution, electrostatics, diffusion of matter etc.
Classification of PDEs
Many physical phenomenon are a function of more than one independent variable and must be represented by a partial differential equation, usually of second or higher order. We can write any second order equation (in two independent variable) as:
2u 2u u u A +B +C + D x, y , u , , = 0 2 2 xy x y x y 2u
2u y
2
= 0
1D wave equation is represented through hyperbolic equation, where B=0, A=1 and C=Tg/w, so B2 - 4AC>0
2 y Tg 2 y =0 2 2 w x t
FD Approximation of PDEs
One method of solution is to replace the derivatives by difference quotients Difference equation is written for each node of the mesh Solving these equations gives values of the function at each node of the grid network Let h=x= spacing of grid work in x-direction Assume f(x) has continuous fourth derivative w.r.t x and y.
FD Approximation of PDEs
When f is a function of both x and y, we get the 2nd partial derivative w.r.t x, 2u/ x2, by holding y constant and evaluating the function at three points where x equals xn, xn+h and xn-h. the partial derivative 2u/ y2 is similarly computed, holding x constant. To solve the Laplace equation on a region in the xy plane, subdivide the region with equi-spaced lines parallel to x-y axes
FD Approximation of PDEs
To solve Laplace equation on a xy plane, consider a region near (xi,yi), we approximate
u=
2
2u x
2
2u y
2
=0
Replacing the derivatives by difference quotients that approximate the derivatives at the point (xi,yi), we get
u ( xi , yi ) = +
2
u ( xi +1, yi ) 2u ( xi , yi ) + u ( xi 1, yi )
(x) 2 u ( xi , yi +1 ) 2u ( xi , yi ) + u ( xi , yi 1 ) (y ) 2
=0
FD Approximation of PDEs
It is convenient to use double subscript on u to indicate the x- and y- values:
ui , j =
2
= 0.
x= y=h
2 ui , j =
1 h
We can notice that five points are involved in the above relation, known as five point star formula
FD Approximation of PDEs
Linear combination of us is represented symbolically as below 1 1 2 ui , j = 1 4 1ui, j = 0. 2 1 h This approximation has error of order O(h2),provided u is sufficiently smooth enough We can also derive nine point formula for Laplaces equation by similar methods to get
4 1 1 1 ui , j = 4 20 4ui, j = 0. 2 4 1 6h 1 In this case of approximation the error is of order O(h6), provided u is sufficiently smooth enough
2
Methods of solution
approximation through FD at a set of grid points (xi,yi), a set of simultaneous linear equations results which needs to be solved by Iterative methods
Liebmanns Method
Rearrange the FD form of Laplaces equation to give a diagonally dominant system This system is then solved by Jacobi or Guass-Seidel iterative method The major drawback of this method is the slow convergence which is acute when there are a large system of points, because then each iteration is lengthy and more iterations are required to meet a given tolerance.
We now both add and subtract uij(k) on the right hand side, getting
u ( k ) + u ( k +1) + u ( k ) + u ( k +1) 4 u ( k ) ij i +1, j i 1, j i , j +1 i , j 1 ( ( u ijk +1) = u ijk ) + 4
Maximum acceleration is obtained for some optimum value of which will always lie in between 1.0 to 2.0 for Laplaces equation
Using above equation, we proceed through the nodes by rows, solving a set of equations (tri-diagonal) that consider the values at nodes above and below as fixed quantities that are put into the RHS of the equations After the row-wise traverse, we then do a similar set of computations but traverse the nodes column-wise:
( ( ( ( ( u ( k + 2) 2u0k + 2) + u Bk + 2) = u Lk +1) + 2u0k +1) u Rk +1) A
CGHS method
The conjugate Gradient (CG) method was originally proposed by Hestens and Stiefel (1952). The gradient method solves N x N nonsingular system of simultaneous linear equations by iteration process. There are various forms of conjugate gradient method The finite difference approximation of the ground water flow governing equation at all the I.J nodes in a rectangular flow region (J rows and I columns) will lead to a set of I.J linear equations and as many unknowns,
CGHS method
The I.J equations can be written in the matrix notations as
AH = Y
Where A = banded coefficient matrix, H= the column vector of unknowns Y= column vector of known quantities Giving an initial guess Hi for the solution vector H, we can write as follow
H i +1 = H i + di
CGHS method
Where di is a direction vector, Hi is the approximation to the solution vector H at the i th iterative step. A CG method chooses di such that at each iteration the B norm of the error vector is minimized, which is defined as
ei +1
B
where
ei +1 = H H i +1 = ei di
CGHS method
In which ei+1 is the error at the (i+1)th iteration. In the above equation angle bracket denotes the Euclidean inner product, which is defined as
< x, y >= xi yi
i =1 n
In the previous equation B is a symmetric positive definite (spd) inner product matrix. In the case of symmetric positive definite matrix A, such as that arising from the finite difference approximation of the ground water flow equation, the usual choice for the inner product matrix is B=A
CGHS method
A symmetric matrix A is said to be positive definite if xTAx>0 whenever x0 where x is any column vector. So the resulting conjugate gradient method minimizes the A norm of the error vector (i.e. ei +1 A ). The convergence of conjugate gradient method depend upon the distribution of eigenvalues of matrix A and to a lesser extend upon the condition number [k(A)] of the matrix. The condition number of a symmetric positive definite matrix is defined as k ( A ) = max / min
CGHS method
Where max and min are the largest and smallest eigenvalues of A respectively. When k(A) is large, the matrix is said to be ill-conditioned, in this case conjugate gradient method may converge slowly. The condition number may be reduced by multiplying the system by a pre-conditioning matrix K-1. Then the system of linear equation given by the equation can be modified as
K 1 A H = K 1Y
CGHS method
Different conjugate methods are classified depending upon the various choices of the preconditioning matrix. The choice of K matrix should be such that only few calculations and not much memory storage are required in each iteration to achieve this. With a proper choice of pre-conditioning matrix, the resulting preconditioned conjugate gradient method can be quite efficient. A general algorithm for the conjugate gradient method is given as follow:
CGHS method
Initialize
CGHS method
Cont
ai =< si , ri > / < A pi , pi > H i +1 = H i + ai pi ri +1 = ri ai A pi si +1 = K 1ri +1 bi =< si +1, ri +1 > / < si , ri > p i +1= si +1 + bi pi i = i +1
End do
CGHS method
Where r0 is the initial residue vector, s0 is a vector, p0 is initial conjugate direction vector, ri+1,si+1 and pi+1 are the corresponding vectors at (i+1)th iterative step, k-1 is the preconditioning matrix and A is the given coefficient matrix. This conjugate algorithm has following two theoretical properties: (a) the value {Hi}i>0 converges to the solution H within n iterations (b) the CG method minimizes H i H for all the values of i
CGHS method
There are three types of operations that are performed by the CG method: inner products, linear combination of vectors and matrix vector multiplications. The computational characteristics of these operations have an impact on the different conjugate gradient methods.
Assignments
1. The equation
2u 2u u 2 2+ 2 =2 x y x
is an elliptic equation. Solve it on the unit square, subject to u=0 on the boundaries. Approximate the first derivative by a centraldifference approximation. Investigate the effect of size of x on the results, to determine at what size reducing it does not have further effect. 2. Write and run a program for poissons equation. Use it to solve
2 u = xy ( x 2)( y 2)
On the region 0 x 2 , 0 y 2 , with u=0 on all boundaries except for y=0, where u=1.0.
Assignments
3. Repeat the exercise 2, using A.D.I method. Provide the
Poisson equation as well as the boundary conditions as given in the exercise 2.
4. The system of equations given here (as an augmented matrix) can be speeded by applying over-relaxation. Make trials with varying values of the factor to find the optimum value. (In this case you will probably find this to be less than unity, meaning it is under-relaxed.)
8 1 1 | 8 1 7 2 | 4 2 1 9 | 12
Contents
Numerical integration methods for solving Gradually varied flows Finite difference methods for Saint Venant-equations Examples
Introduction
For most of the practical implications, the flow conditions in a gradually varied flow are required to calculate. These calculations are performed to determine the water surface elevations required for the planning, design, and operation of open channels so that the effects of the addition of engineering works and the channel modifications on water levels may be assessed Also steady state flow conditions are needed to specify proper initial conditions for the computation of unsteady flows
Introduction
Improper initial conditions introduce false transients into the simulation, which may lead to incorrect results It is possible to use unsteady flow algorithms directly to determine the initial conditions by computing for long simulation time However, such a procedure is computationally inefficient and may not converge to the proper steady state solution if the finite-difference scheme is not consistent
Introduction
Various methods to compute gradually varied flows are required to develop Methods, which are suitable for a computer solution, are adopted Traditionally there are two methods-direct and standard step methods Higher order accurate methods to numerically integrate the governing differential equation are required
V2 H = z + d cos + 2g
H= total head z = vertical distance of the channel bottom above the datum d= depth of flow section = bottom slope angle = energy coefficient V= mean velocity of flow through the section
The energy slope, S f = dH / dx The slope of the channel bottom, S0 = sin = dz / dx Substituting these slopes in above equations and solving for dd/dx ,
S0 S f dd = dx cos + d (V 2 / 2 g ) / dd
Since V=Q/A, and dA/dy=T, the velocity head term may be expressed as
d V 2 Q 2 dA2 Q 2 dA Q 2T = = = 3 dy 2 g 2 g dy dy gA gA3
Z = A3 / T
After substituting
Zc2 d V2 = dy 2 g Z2
In general form,
Sf =
dy
Assuming several values of y, and computing the values of dx/dy A curve of y against dx/dy is constructed
V 2
2g
Where H = elevation of energy line above datum; z =elevation of the channel bottom above the datum; y = flow depth; V = mean flow velocity, and =velocity-head coefficient The rate of variation of flow depth, y, with respect to distance x is obtained by differentiating the above equation.
The above equation is of first order ordinary differential equation, in which x is independent variable and y is the dependent variable.
downward direction) S0 = longitudinal slope of the channel bottom Sf = slope of the energy line B = top water surface width g = acceleration due to gravity A = flow area Q = rate of discharge
In which,
f ( x, y ) =
So S f 1 (Q 2 B) /( gA3 )
We can integrate above differential equation to determine the flow depth along a channel length , where f(x,y) is nonlinear function. So the numerical methods are useful for its integration.
dy = f ( x, y )dx
x1
x2
x2 = x1 + F ( x, y )dy
y1
y2
To compute the water surface profile, we begin the computations at a location where the flow depth for the specified discharge is known We start the computation at the downstream control section if the flow is sub-critical and proceed in the upstream direction.
1V12
2g
E2 = y 2 +
2 2V2
2g
The slope of the energy grade line is gradually varied flow may be computed with negligible error by using the corresponding formulas for friction slopes in uniform flow.
Sf =
S f1 S f 2
Sf =
2 S f1 S f 2 S f1 + S f 2
The flow depth is not computed at predetermined locations. Therefore, interpolations may become necessary, if the flow depths are required at specified locations. Similarly, the cross-sectional information has to be estimated if such information is available only at the given locations. This may not yield accurate results Needs additional effort It is cumbersome to apply to non-prismatic channels
2.
3.
1V12
2g
2Q 2
2Q 2
The above equation is solved for y2 by a trial and error procedure or by using the Newton or Bisection methods
By using y=y1, dy/dx=f(x1,y1) , then the flow depth y* , can be computed from the equation 2
y * = y1 + f ( x1 , y1 )( x 2 x1 ) 2
During subsequent step, however y* may be 2 determined by extrapolating the change in flow depth computed during the preceding step.
If
is less than a specified tolerance, , then is the flow depth y2, at section 2; otherwise, y* 2 set and repeat the steps until a solution y* = y2 2 is obtained
y2 y* 2
1. Euler method: In this method the rate of variation of y with respect to x at distance xi can be estimated as
' dy yi =
dx i
= f ( xi , yi )
All the variables are known in the right hand side, so derivative of y with respect to x can be obtained Assuming that this variation is constant in the interval xi to xi+1, then the flow depth at xi+1 can be computed from the equation
yi +1 = yi + f ( xi , yi )( xi +1 xi )
, in which xi+1/ 2 =
yi +1 = yi + yi' x
By using this value, we can compute the slope of the curve y = y (x) at x = xi +1 , i.e., yi' +1 = f xi +1 , yi*+1 . Let us
use the average value of the slopes of the curve at xi and yi +1 from the xi +1 . Then we can determine the value of equation
yi +1 = yi + 1 ' yi + yi' +1 x 2
yi +1 = yi +
1 yi +1 = yi + (k1 + 2k 2 + 2k3 + k 4 )x 6
j) j yi(+1 yi(+1 1)
, where = specified
Saint-Venant equations
1D gradually varied unsteady flow in an open channel is given by Saint-Venant equations
y y v =0 +w + vw a t x x y v v v = g ( So S f ) + +g x t x
X - distance along the channel, t - time, v- average velocity, y - depth of flow, a- cross sectional area, w - top width, So- bed slope, Sf - friction slope
r - hydraulic radius, n-Mannings roughness coefficient Two nonlinear equations in two unknowns v and y and two dependent variables x and t These two equations are a set of hyperbolic partial differential equations
Saint-Venant equations
Multiplying 1st equation by g / aw and adding it to 2nd equation yields
1 + (v c ) v + (v c ) y = g (S o S f ) t x c t x
Based on the equations used, methods are classified as characteristics methods and direct methods.
In which
a U = va
va F = 2 v a + gay
0 S= ga ( s0 s f )
General formulation
n +1 + fin +1) ( f in + fin 1 ) f ( fi +1 + = t t
(1 )( f in 1 + f in ) + x
1 1 n +1 n +1 f = ( f i +1 + f i ) + (1 )( f in 1 + f in ) + 2 2
U in +1 + U in +1 = 2 +1 t ( Fin +1 Fin +1) + (1 )( Fin 1 Fin ) +1 + x
v=vu= uniform velocity Right boundary y=yc= Critical flow depth v=vc= Critical velocity
Solution procedure
The expansion of the equation
ain +1 + ain +1 + 2 +1 = ain + ain 1 +
n n +1 (va)i +1 + (va)i +1 + 2
{[
]}
{[ ( = gat {1 )[( s
t n +1 n (v 2 a + gay )i +1 (v 2 a + gay )i +1 x
{[
]}
}
n +1 n gat ( s0 s f )i +1 + ( s0 s f )i +1
]}
n n 0 s f )i +1 + ( s0 s f )i
]}
n n + (va)i + (va)i +1 (1 ) 2
t 2 n n (v a + gay )i +1 (v 2 a + gay )i x
The above set of nonlinear algebraic equations can be solved by Newton-Raphson method
Assignments
1. Prove the following equation describes the gradually varied flow in a channel having variable cross section along its length:
2 dy SO S f + V / gA A / x = dx 1 BV 2 / ( gA)
2. Develop computer programs to compute the water- surface profile in a trapezoidal channel having a free overfall at the downstream end. To compute the profile, use the following methods: Euler method (i) (ii) Modified Euler method (iii) Fourth-order Runge-Kutta method
Assignments
3. Using method of characteristics, write a computer program to solve 1D gradually varied unsteady flow in an open channel as given by Saint-Venant equations, assuming initial and boundary conditions.
Contents
Basic equation of transients Method of characteristics for its solution Complex boundary condition Pipe network problems Node based and Loop based models Solution through Newton and Picard techniques
t ( A)dx +( AV )
( AV )1 = 0
Expanding and rearranging various terms, using expressions for total derivatives, we obtain
1 d 1 dA V + + =0 dt A dt x
Area of pipe, A = R , where R is the radius of the pipe. Hence dA / dt = 2RdR / dt. In terms of strain this may be written as dA = 2 A d
2
dt
dt
d D dp = dt 2eE dt
Substituting these equations into continuity equation and simplifying the equation yields V 1 1 dp
x + 1 + eE / DK dt = 0 K
Let us define , where a is wave speed with which pressure waves travel back and forth. Substituting this expression we get the following continuity equation p p V
t +V x + a 2 x =0
a2 =
K/ 1 + ( DK ) / eE
Method of characteristics
The dynamic and continuity equations for flow through a pipe line is given by
L1 =
Q H f + gA + QQ =0 t x 2 DA
2 Q
H =0 + gA L2 = a t x
Where Q=discharge through the pipe H=piezometric head A=area of the pipe g=acceleration due to gravity a=velocity of the wave D=diameter of the pipe x=distance along the pipe t=time
Method of characteristics
These equations can be written in terms of velocity
1 v H f L1 = + + vv = 0 g t x 2 Dg
Where,
H a 2 v L2 = + =0 t g x
k a= e[1 + (kD / E )]
Method of characteristics
Where k=bulk modulus of elasticity =density of fluid E=Youngs modulus of elasticity of the material Taking a linear combination of L1 and L2, leads to
f Q H 1 H 2 Q + a QQ =0 + + gA + x t T x 2 DA
Assume H=H(x,t);Q=Q(x,t)
Method of characteristics
Writing total derivatives ,
dQ Q Q dx = + dt t x dt dH H H dx = + dt t x dt
dx = a 2 dt
1 a
Finally we get
dx = a dt
dQ gA dH f + QQ =0 dt a dt 2 DA
The above two equations are called characteristic equations and 2nd among them is condition along the characteristics
Method of characteristics
Figure
t
P
Positive characteristic line Negative characteristic line
Characteristic lines
Constant head reservoir at x=0, at x=L, valve is instantaneously closed. Pressure wave travels in the upstream direction.
At the downstream end, we have the positive characteristic equation linking the boundary node to the rest of the pipeline. We can write
QPi, n +1 = Cp Ca H rd
At the last node of pipe i, we have the positive characteristics equation. We get
H Pi , n +1 = Cp Ca
Where subscript P denotes values of Q and H at the end of a computational time interval
For the last section on pipe i, we have the positive characteristic equation
2 QPi, n +1 + CvQPi, n +1 C p Cv = 0
Solving for QPi,n+1 and neglecting the negative sign with the radical term, we get
2 Q Pi , n +1 = 0.5( C v + C v + 4C p C v )
2.
The limitation with respect to the number of mains it is economic to analyze means that mains of 150 mm diameter and less are usually not included in the analysis of large systems, so their flow capacity is ignored It is excessively time consuming to work out the nodal demands for a large system
3.
4. 5.
The nodal demands are estimates and may not represent actual demands Losses, which commonly range from 25% to 35% of the total supply, have to be apportioned to the nodal demands in some arbitrary fashion. No diversification factor can be applied to the peak hourly demands representing reduced peaking on the larger mains since the total nodal demands must equal the input to the system The friction coefficients have to be estimated. No account is taken of the influence of pressure at a node on the demand at that node, I.e under high or low pressure the demand is assumed to be constant.
Q( p) + Q( p) + C ( j ) = 0,
p { j} p { j}
j = 1,..., NJ
Where NJ is the number of nodes, Q(p) is the flow in element p (m3/s), C(j) is the consumption at node j (m3/s), p { j} refers to the set of elements connected to node j.
Network Analysis
2. Energy conservation equations the energy conservation equations state that the energy loss along a path equals the difference in head at the starting node and end node of the path.
p {l} p {l} Where h(p) is the head loss in element p(m), s(l) is the starting node of path l, e(l) is the end of path 1, NL is the number of loops, and NPATH is the number of paths other than loops and p {l} refers to the pipes belonging to path l. loop is a special case of path, wherein, the starting node and end node are the same, making the head loss around a loop zero, that is, ( )h( p) + ( )h( p) = 0
l = 1,..., NL + NPATH
Network Analysis
3. Element characteristics the equations defining the element characteristics relate the flow through the element to the head loss in the element. For a pipe element, h(p) is given by, e
h( p ) = R( p )Q( p )
Where R(p) is the resistance of pipe p and e is the exponent in the head loss equation. If Hazen-Williams equation is used, where e=1.852 10.78 L( p ) R( p) = D( p ) 4.87 CHW ( p )1.852 Where L(p) is the length of pipe p(m), D(p) is the diameter of pipe p(m), and CHW (p) is the Hazen-Williams coefficient for pipe p.
Network Analysis
For a pump element, h(p) is negative as head is gained in the element. The characteristics of the pump element are defined by the head-discharge relation of the pump. This relationship may be expressed by a polynomial or in an alternate form. In this study, the following equation is used.
C 3( m ) Q( p) h( p ) = HR(m) C1(m) C 2(m). QR(m)
Where HR(m) is the rated head of the m-th pump (m), QR(m) is the rated discharge of m-th pump (m3/s), C1(m), C2(m) and C3(m) are empirical constants for the m-th pump obtained from the pump charateristics. Here p refers to the element corresponding to the m-th pump. If the actual pump characteristics are available, the constants C1, C2, C3 may be evaluated. C1 is determined from the shutoff head as
C1(m) = HO(m) HR(m)
Network Analysis
Where HO(m) is the shutoff head of the m-th pump. As h(p)=-HR(m) for rated flow,
C1(m) C 2(m) = 1
From which C2(m)is determined. C3 (m) is obtained by fitting the equation to the actual pump characteristics. For a pipe element,
h( p ) Q( p) = R( p)
(1 / e )
H (i ) H ( j ) R( p ) (1/ e ) H (i ) H ( j )
(11 / e )
Network Analysis
Similarly for a pump element
1 H ( j ) H (i ) Q( p ) = ( )QR(m) C1(m) HR(m) C 2( m )
1 C 3( m )
Where outside the parenthesis, + sign is used if flow is towards node j and sign is used if flow is away from node j and, inside the parenthesis, the + sign is used, if i is the node downstream of the pump and the sign is used if j is the node downstream of the pump.
Network Analysis
The network analysis problem reduces to one of solving a set of nonlinear algebraic equations. Three types of formulation are used the nodal, the path and the node and path formulation. Each formulation and method of analysis has its own advantages and limitations. In general path formulation with Newton-Raphson method gives the fastest convergence with minimum computer storage requirements. The node formulation is conceptually simple with a very convenient data base, but it has not been favoured earlier, because in conjunction with Newton-Raphson method, the convergence to the final solution was found to depend critically on the quality of the initial guess solution. The node and path formulation can have a self starting procedure without the need for a guess solution, but this formulation needs the maximum computer storage.
sgn Qij
Where Hi=head at i th node, L Kij= head loss coefficient for pipe from node i to node j Qij= flow in pipe from node i to node j, L3/t nij=exponent in head loss equation for pipe from i-j
Qki = U i
Where Qki=flow into node i from node k, L3/T Ui=consumptive use at node i, L3/T mi=number of pipes connected to node i.
1 / nki
= Ui
The above is a node H equation, there is one such equation for each node, and one unknown Hi for each equation These equations are all nonlinear The node (H) equations are very convenient for systems containing pressure controlled devices I.e. check valves, pressure reducing valves, since it is easy to fix the pressure at the downstream end of such a valve and reduce the value if the upstream pressure is not sufficient to maintain downstream pressure
= dhl
(l=1,2,,L)
Where Qii = initial estimate of the flow in i th pipe, L3/T Ql = correction to flow in l th loop, L3/T ml = number of pipes in l th loop L = number of loops
Qi + Qa Qb + Qc
dF F ( x + x) F ( x) = dx x
Given an initial estimate of x, the solution to the problem is the value of x+x that forces F to 0. Setting F(x+x) to zero and solving for x gives
x =
F ( x) F ' ( x)
1 / nij
Ui = 0
(i = 1,2,..., K )
Where mi= number of pipes connected to node I Ui= consumptive use at node i, L3/T F(i) and F(i+1) is the value of F at ith and (i+1)th iteration, then dF = F (i + 1) F (i )
Where H= change in H between the ith and (i+1)th iterations, L Finding the values of H which forces F(i+1)=0. Setting above two equations equal, results in a system of k linear equations with k unknowns (H) which can be solved by the any linear methods
[ (
)]
1 / nij
=
1 / nij
(nij )(Kij )1 / n
= 1
ij
(H i H j )(1 / n )1
ij
and
H H j d i sgn H i H j dH i K ij
[ (
)]
(nij )(Kij )1 / n
ij
(H i H j )(1 / n )1
ij
dhl = 0
Where Ql=correction to l th loop to achieve convergence, L3/T Qii=initial estimates of flow in i th pipe (satisfies continuity),L3/T ml=number of pipes in loop l
Q(k + 1) = Q i =1
K i (Qii + Ql ) Qii + Ql
ml
n 1
i =1
K i ni Qii + Ql
n 1
Where the k+1 refers to the values of Q in the (k+1) th iteration, and all other values refer to the k th iterations and are omitted from the equation for ease of reading The above equation is equivalent to
Q(k + 1) = Q(k ) F (k ) / F ' (k )
Sign on the Qi terms depend on how that pipe is situated in the loop under consideration.
Assignments
1. How many Q equations must be set up for a network with L loops (and pseudo-loops), N nodes, and P pipes? How many H-equations must be set up? 2. What are the primary differences between the HardyCross and Newton-Raphson method for solving the Q equations? 3. For two pipes in parallel, with K1>K2, what is the relationship between K1, K2, and Ke , the K for the equivalent pipe replacing 1 and 2 (h=KQn)? a. K1>K2>Ke b. K1>Ke>K2 c. Ke>K1>K2
Assignments
4. Derive the following momentum equation by applying conservation of momentum for a control volume for transient flow through a pipe
V 1 p fV V V + =0 + +V 2D x x t
5. Develop the system of equations for the following network (consists of 8 nodes and 9 elements, out of which 8 are pipe elements and the other is a pump element) to find the values of the specified unknowns. Also write a computer program to solve the system of equations.
Assignments continued
1 8 3 2
1 4
- Node with H unknown & C known - Node with H known & C known - Node with H known & C unknown
3 6 7 5
4 7 6
- Node with R unknown - Pump element Unknowns H [2], H [4], H [5] R [4], R [5] C [6], C [7], C [8]
Contents
Contaminant transport Definition of terms Introduction to ADE equation Few simple solutions Solution of ADE through FD methods Problems associated with solution methods Demonstration of methods for open channel and pipe flows
Contaminant transport
Contaminant transport modeling studies are usually concerned with the movement within an aquifer system of a solute. These studies have become increasingly important with the current interest on water pollution. Heat transport models are usually focused on developing geothermal energy resources. Pollutant transport is an obvious concern relative to water quality management and the development of water protection programs
Definition of terms
Terminologies related to contaminant transport Diffusion: It refers to random scattering of particles in a flow to turbulent motion Dispersion: This is the scattering of particles by combined effect of shear and transverse diffusion Advection: The advective transport system is transport by the imposed velocity system
C x
2C x 2
= molecular diffusion +Hydrodynamic dispersion C = time rate of change of concentration t at a point R = reaction term depends on reaction rate and concentration (chemical or biological, not considered in the present study)
Dl
is the distance along the flow path; and v is the average water velocity. For conditions in which the dispersivity Dl of the porous medium is large or when 1 or t is large, the second term on the right-hand side of equation is negligible.
x
( Dl ) 1
i
( Dl ) 1
i+ 2
Ci +1 Ci x 2
Ci Ci 1 C Ci Ci C0 ui i +1 = 2 x t x
( Dl ) 1
( Dl ) 1 ( Dl ) 1 ( Dl ) 1 i+ i i+ i ui ui C 1 2 C 2 + 2 2 Ci + Ci +1 = 0 + i 1 x 2 t x x t x 2 x 2 x 2
The above equation can be written in matrix form as: 1. For internal nodes
AACi 1 + BBCi + CCCi +1 = DD
Ci +1 = Ci + flux(x)
Using backward finite difference formation in the right boundary, flux can be written as follows
Ci Ci 1 = flux x
Assignments
1. Considering the one-dimensional flow of a solute through the soil column, write a computer program for solving the given contaminant transport equation by finite difference technique. The boundary conditions represented by the step function input are described mathematically as:
C (1,0) = 0 C (0, t ) = C0 C ( , t ) = 0
1 0 t0 t0
Compare and discuss the results with the analytical method. 2. Write the governing equation for transport of contaminant in a pipe, neglecting advection and dispersion terms, and solve to get analytical solution of the same.