Professional Documents
Culture Documents
Module 1
3 lectures
Topics to be covered
Basic Concepts
Conservation Laws
Critical Flows
Uniform Flows
Unsteady Flows
Basic Concepts
Open Channel flows deal with flow of water in open channels
Datum head = z
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
Conservation of Energy
This law states that neither the energy can be created or
destroyed. It only changes its form.
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
Inthe context of open channel flow the total energy due these factors
between any two sections is conserved
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.
Types of Open Channel Flows
Depending on the Froude number (Fr) the flow in an open
channel is classified as Sub critical flow, Super Critical
flow, and Critical flow, where Froude number can be defined
as F = V
r
gy
Sub-
Sub-critical flow Critical flow Super critical flow
Unsteady Steady
Gradually Gradually
Rapidly Rapidly
Types of Open Channel Flow Cont
Steady Flow
Flow is said to be steady when discharge does not
change along the course of the channel flow
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
Types of Open Channel Cont
Gradually Varied Flow
Flow is said to be gradually varied when ever the
depth changes gradually along the channel
E=y
Depth of water Surface (y)
E-y curve
1
Emin
y1
C
Alternate Depths
yc
2
45
2
Critical Depth
Specific Energy (E) y
Q 2Tc Ac Q2 Ac VC2
=1 = 2 =
gAc
3
Tc gAc Tc g
Characteristics of Critical Flow
For a rectangular channel Ac /Tc=yc
hf
Sf
v22/2g
y1
Control Volume
y2
So
1
z1
z2
Datum
1
Q = AR 2 / 3 S 1/ 2
n
Uniform Flow
Thisis a non linear equation in y the depth of flow for which
most of the computations will be made
W sin 0 Px = 0
Or Ax sin 0 Px = 0
A
Or 0 = sin
P
V2 2g
Or cf = RS 0 V = RS 0 = C RS 0
2 cf
dy S 0 S f
=
dx 1 Fr 2
v2/2g
Water surface (slope = Sw)
Datum
dy 2 g gA 2 D
Vw = V c
Module2
3 lectures
Contents
General introduction
Energy equation
p1 V12 p2 V22
+ 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
p/y
hp
z1
z
Pump
z=0 Datum
0 = f V 2 / 8
p L V2
h = = f
D 2g
64
f =
VD
Also we can write in terms of Reynolds number
64
f =
Nr
MINOR LOSSES
18.5 106 D 4V 2
h=
Cv2 2 g
( AV 2 ) in = ( AV 2 ) out
Transient flow through long pipes
Substituting for all the forces acting on the control
volume
d
pA + AL sin 0DL = (V AL )
dt
Where
p =(h-V2/2g)
=pipe slope
D=pipe diameter
L=pipe length
=specific weight of fluid
0=shear stress at the pipe wall
Transient flow through long pipes
Frictional force is replaced by hfA, and H0=h+Lsin and hf
from Darcy-weisbach friction equation
The resulting equation yields:
fL V 2 V 2 L dV
H0 = .
D 2g 2g g dt
(V + a ) (V + a ) A
V
=
V +a
We may approximate (V+a) as a, because V<<a
V
=
a
Since p = gH we can write as
a
H = V
g
Module 3
2 lectures
Contents
Numerical computing
Computer arithmetic
Parallel processing
Examples of problems
needing numerical
treatment
What is computational hydraulics?
It is one of the many fields of science in which the
application of computers gives rise to a new way
of working, which is intermediate between purely
theoretical and experimental.
0
1 + cos 2 ( x ) dx
n = 4 n!
Computer arithmetic
Round-off error : digital computers always use floating point
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.
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.
Introduction to numerical analysis
Any physical problem in hydraulics is represented
through a set of differential equations.
Euler method
Modified Euler method
Runge-Kutta method
Predictor-Corrector method
Introduction to numerical analysis
The following methods have been used for
numerical integration of the PDEs
Characteristics method
Finite difference method
Finite element method
Finite volume method
Spectral method
Boundary element method
Problems needing numerical treatment
Computation of normal depth
Computation of water-surface profiles
Contaminant transport in streams through
an advection-dispersion process
Steady state Ground water flow system
Unsteady state ground water flow system
Flows in pipe network
Computation of kinematic and dynamic
wave equations
Solution of System of
Linear and Non Linear
Equations
Module 4
(4 lectures)
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
Sets of linear equations
Real world problems are presented through a set of
simultaneous equations
F1 ( x1, x2 ,..., xn ) = 0
F2 ( x1, x2 ,..., xn ) = 0
.
.
.
Fn ( x1, x2 ,..., xn ) = 0
Solving a set of simultaneous linear equations needs
several efficient techniques
We need to represent the set of equations through matrix
algebra
Matrix notation
Matrix : a rectangular array (n x m) of numbers
a11 a12 . . . a1m
a21 a22 . . . a2 m
.
[ ]
A = aij = .
. .
. .
an1 an 2 . . . anm
nxm
Matrix Addition:
C = A+B = [aij+ bij] = [cij], where cij = aij + bij
Matrix Multiplication:
AB = C = [aij][bij] = [cij], where
m
cij = aik bkj i = 1,2,..., n, j = 1,2,..., r.
k =1
Matrix notation cont
*AB BA
kA = C, where cij = kaij
No.ofcols.
bi = aik xk , i = 1,2,..., No.ofrows
k =1
Matrix notation cont
Matrix multiplication gives set of linear equations as:
a11x1+ a12x2++ a1nxn = b1,
a21x1+ a22x2++ a2nxn = b2,
. . .
. . .
. . .
an1x1+ an2x2++ annxn = bn,
1 0 0 0
0 1 0 0 = I .
0 0 1 0 4
0 0 0 1
Matrix notation cont
Lower triangular matrix: a 0 0
if all the elements above the L = b d 0
c e f
diagonal are zero
Tri-diagonal matrix: if a b 0 0 0
nonzero elements only on c d e 0 0
the diagonal and in the T = 0 f g h 0
0 0 i j k
position adjacent to the 0
0 0 l m
diagonal
Matrix notation cont
Determinant of a square 3 1 4
A = 0 2 3
matrix A is given by: 1 1 2
a a 3 0 1
A = 11 12 T
a21 a22 A = 1 2 1
4 3 2
det( A) = a11a22 a21a12
Matrix notation cont
Characteristic polynomial pA() and eigenvalues
of a matrix:
Note: eigenvalues are most important in applied
mathematics
For a square matrix A: we define pA() as
pA() = A - I = det(A - I).
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
Methods of solution of set of equations
Direct methods are those that provide the solution in a finite and pre-
determinable number of operations using an algorithm that is often
relatively complicated. These methods are useful in linear system of
equations.
4 2 1 15 4 2 1 15
3 1 4 8 , 3R1 + 4 R2 0 10 19 77
1 1 3 13 (1) R1 + 4 R3 0 2 11 37
4 2 1 15
0 10 19 77
2 R2 10 R3 0 0 72 216
Gauss-Jordan method
In this method, the elements above the diagonal
are made zero at the same time zeros are
created below the diagonal
Method of solution cont
Usually diagonal elements are made unity,
at the same time reduction is performed,
this transforms the coefficient matrix into
an identity matrix and the column of the
right hand side transforms to solution
vector
0 2 0 1 0
2 2 3 2 2
4 3 0 1 7
6 1 6 5 6
1 0 0 0.04000 0.58000
0 1 0 0.27993 1.55990
0 0 1 0.82667 1.32000
0 0 0 1.55990 3.11970
Step4: now divide the 4th row by 1.5599 and create zeros
above the diagonal in the fourth column
1 0 0 0 0.49999
0 1 0 0 1.00010
0 0 1 0 0.33326
0 0 0 1 1.99990
Method of solution cont
j 1
aij lik ukj a1 j a1 j
uij = k =1 i j, j = 2,3,..., n. u1 j = =
l11 a11
lii
Method of solution cont
Iterative methods consists of repeated application
of an algorithm that is usually relatively simple
Iterative method of solution
coefficient matrix is sparse matrix ( has many
zeros), this method is rapid and preferred over
direct methods,
Iterative Methods
x1 + 2 x2 5 x3 = 1,
2 x1 + 7 x2 + 2 x3 = 5.
1 n
xi = ci aij x j ,
aii
i = 1,2,..., n
j =1
j i
~ k +1 1 i 1 k +1 n k
xi = ci aij x j aij x j ,
aii j =1 j =i +1
xik +1 = xik + w( ~
xik +1 xik ) i = 1,2,..., n
Methods of solution cont
Successive over-relaxation method cont
Where ~xik +1 determined using standard
Gauss-Siedel algorithm
k=iteration level,
w=acceleration parameter (>1)
Another form
k +1 k w i 1 k +1 n
xi = (1 w) xi + (ci aij x j aij x kj )
aii j =1 j =i +1
Methods of solution cont
Successive over-relaxation method cont..
Where 1<w<2: SOR method
0<w<1: weighted average Gauss
Siedel method
Previous value may be needed in nonlinear
problems
It is difficult to estimate w
Matrix Inversion
Sometimes the problem of solving the linear
algebraic system is loosely referred to as matrix
inversion
[A]x=c
x= [A-1]c
[A-1][A]=[I]=[A][A-1]
Pathology of linear systems
Any physical problem modeled by a set of linear
equations
Method of iteration
Nonlinear system, example: x 2 + y 2 = 4; e x + y = 1
Assume x=f(x,y), y=g(x,y)
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
Solution of nonlinear systems
Sufficient condition for convergence of this
procedure is
f f g g
+ <1 + <1
x y x y
x2 = f 2 ( x1, x2 ,..., xn )
.
.
.
xn = f n ( x1, x2 ,..., xn )
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
F1 F F
x1 + 1 x2 + ... + 1 xn = F1 ( x1, x2 ,..., xn)
x1 x2 xn
F2 F F
x1 + 2 x2 + ... + 2 xn = F2 ( x1, x2 ,..., xn)
x1 x2 xn
.
.
.
Fn F F
x1 + n x2 + ... + n xn = Fn ( x1, x2 ,..., xn)
x1 x2 xn
Picards technique of linearization
Nonlinear equation is linearized through:
Picards technique of linearization
h h h
Tx + T
y = S + Q p Rr Rs Q1
x x y y t
Is negligibly small
The gradient of f w.r.t y is
df dQ j
=
dy j dy j
Q is a constant
Mannings equation by Newtons technique
Assuming Mannings n constant
df 1
= So1 / 2
dy j n
d
dy
( )
A j R 2j / 3
1 1 / 2 2 AR 1 / 3 dR 2 / 3 dA
= So +R
n 3 dy dy
j
1 1/ 2 2 / 3 2 dR 1 dA
= So A j R j +
n 3R dy A dy j
2 dR 1 dA
= Q j +
3R dy A dy j
The subscript j outside the parenthesis indicates that the contents are
evaluated for y=yj
Mannings equation by Newtons technique
Now the Newtons method is as follows
df 0 f ( y) j
=
dy
j y j +1 y j
f (y j)
y j +1 = y j
(df / dy ) j
1 Q/Qj
y j +1 = y j
2 dR 1 dA
3R dy + A dy
j
x2 + y2 = 4
xy = 1
Numerical Differentiation
and Numerical Integration
Module 5
3 lectures
Contents
Derivatives and integrals
Integration formulas
Trapezoidal rule
Simpsons rule
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
s ( s 1) 2 s ( s 1)( s 2) 3
Pn ( s ) = f i + sf i + fi + fi
2! 3!
n 1 n f i
+ ... + ( s j ) + error ;
j =0 n!
n f ( n +1) ( )
Error = ( s j ) ,
j = 0 (n + 1)! 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
1 n j 1 j 1 j fi
= fi + ( s l ) .
h j = 2 k = 0 l = 0 j!
l k
ds d ( x xi ) 1
Where = =
dx dx h h
(1) n h n ( n +1)
When x=xi, s=0 Error = f ( ), in [x1,, xn].
n +1
Derivatives continued
Simpler formulas
Forward difference approximation
For an estimate of f(xi), we get
1 1 1 1
f ' ( x) = [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))
' 1 1 "
f ( xi ) = [f i ] hf ( ),
h 2
1
error = h 2 f (3) ( ) = O(h 2 )
6
Derivatives cont
Higher-Order Derivatives
We can develop formulas for derivatives of higher order
based on evenly spaced data
Difference operator: f ( xi ) = f i = f i +1 f i
Stepping operator : Ef i = f i +1
Or : E n fi = fi + n
Relation between E and : E=1+
1 2 11 4 5 5
f i" = f i 3
f i + f i f i + ... ,
2 12 6
h
Divided differences
Central-difference formula
Extrapolation techniques
Second-derivative computations
Richardson extrapolations
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
b b
f ( x)dx = Pn ( xs )dx
a a
s =1
= h ( f 0 + sf 0 )ds
s =0
1
2
s 1
= hf 0 s ]10 + hf 0 = h( f 0 + f 0 )
2 2
0
h h
= [2 f 0 + ( f1 f 0 )] = ( f 0 + f1 )
2 2
Newton-Cotes integration formula
cont...
Error in the above integration can be given as
x1 s ( s 1) 1 s2 s
Error = h f ( )dx = h3 f " (1 )
2 "
ds
x0 2 0 2
1
s 3 s 2 1 3 "
3 "
= h f (1 ) = h f (1 ),
6 4 12
0
x2 h 1 5 iv
f ( x)dx = ( f 0 + 4 f1 + f 2 ) h f ( ),
x0 3 90
x3 3h 3 5 iv
f ( x)dx = ( f 0 + 3 f1 + 3 f 2 + f 3 ) h f ( ).
x0 8 80
Trapezoidal and Simpsons rule
Trapezoidal rule-a composite formula
Approximating f(x) on (x0,x1) by a straight line
Romberg integration
Improve accuracy of trapezoidal rule
Simpsons rule
Newton-Cotes formulas based on quadratic and
cubic interpolating polynomials are Simpsons rules
1
Quadratic- Simpsons 3 rule
3
Cubic- Simpsons 8 rule
Trapezoidal and Simpsons rule cont
Trapezoidal rule-a composite formula
The first of the Newton-Cotes formulas, based on
approximating f(x) on (x0,x1) by a straight line, is
trapezoidal rule
xi +1 f ( xi ) + f ( xi +1 ) h
f ( x)dx = (x) = ( f i + f i +1 ),
xi 2 2
b h
f ( x)dx = ( f1 + 2 f 2 + 2 f 3 + ... + 2 f n + f n +1 ).
a 2
Trapezoidal and Simpsons rule cont
f(x)
x1 = a x2 x3 x4 x5 xn+1 = b x
Trapezoidal Rule
Trapezoidal and Simpsons rule cont
Trapezoidal rule-a composite formula cont
1 3 "
Local error = h f (1 ), x0 < 1 < x1
12
1
Better estimate=more accurate + (more
2n 1
accurate-less accurate)
Trapezoidal and Simpsons rule
Simpsons rule
The composite Newton-Cotes formulas based on
quadratic and cubic interpolating polynomials are
known as Simpsons rule
1
Quadratic- Simpsons 3
rule
The second degree Newton-Cotes formula
integrates a quadratic over two intervals of equal
width, h h
f ( x)dx = [ f0 + 4 f1 + f 2 ].
3
This formula has a local error of O(h5):
1 5 ( 4)
Error = h f ( )
90
Trapezoidal and Simpsons rule
Quadratic- Simpsons 1
3 rule cont
For [a,b] subdivided into n (even) subintervals of
size h,
h
f ( x)dx = [ f (a ) + 4 f1 + 2 f 2 + 4 f 3 + 2 f 4 + ... + 4 f n 1 + f (b)].
3
With an error of
(b a ) 4 ( 4)
Error = 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
Trapezoidal and Simpsons rule
Cubic- Simpsons 3
8
rule
The composite rule based on fitting four points
with a cubic leads to Simpsons 3 rule
8
For n=3 from Newtons Cotes formula we get
3h
f ( x)dx = [ f0 + 3 f1 + 3 f 2 + f3 ].
8
3 5 ( 4)
Error = h f ( )
80
With an error of
(b a ) 4 ( 4)
Error = h f ( )
80
Extension of Simpsons rule to Unequally
spaced points
When f(x) is a constant, a straight line, or a
second degree polynomial
x2
f ( x)dx = w1 f1 + w2 f 2 + w3 f 3
x1
(b a )t + b + a ba
x= dx = dt
If we let 2 so that 2 then
b 1
b a (b a )t + b + a
a
f ( x)dx = f
2 1 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
b
d d
b
A
f ( x , y ) d A = f ( x , y ) dy dx = f ( x , y ) dx dy
a c c a
1 n
f ( x)dx = ai f ( xi ).
1 i =1
1 1 1 n n n
f ( x, y, z )dxdydz = ai a j ak f ( xi , yi , z k ).
1 1 1 i =1 j =1 k =1
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.)
e dx
3 x 1
dx
2
x
e x
(a) (b)
0 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.
cos( x) sin(2 y)dxdy
a. Use the trapezoidal rule
b. Use Simpsons 1/3 rule
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:
1 1
+
2 2
( x y )dxdy
0 0
3 2
x yz dxdydz
0 0 1
Numerical Solution of
Ordinary Differential
Equations
Module 6
(6 lectures)
Contents
Taylor series method
If we assume x x0 = h
Since y( x0 ) is initial condition, first term is known
' y '' ( x0 ) 2 y ''' ( x0 ) 3
y ( x) = y ( x0 ) + y ( x0 )h + h + h + ...
2! 3!
" 2
y ( ) h
y ( x0 + h) = y ( x0 ) + y ' ( x0 ) + ,
2
yn +1 = yn + hy 'n + O (h 2 ).
Euler and modified Euler methods
cont
Problem is lack of accuracy, requiring an extremely small
step size
If we use the arithmetic mean of the slopes at the
beginning and end of the interval to compute yn+1:
yn ' + yn +1'
yn +1 = yn + h .
2
1 1
yn +1 = yn + h y 'n + y 'n +1 y 'n + O(h3 ),
2 2
y 'n + y 'n +1
yn +1 = yn + h + O(h3 ).
2
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).
1 1
k 2 = hf ( xn + h, yn + k1 ),
2 2
1 1
k3 = hf ( xn + 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
The number of past points that are used sets the degree of
the polynomial and is therefore responsible for the
truncation error.
x n +1 x n +1
dy = yn +1 yn = f ( x, y )dx
xn xn
We approximate f(x,y) as a polynomial in x, deriving this by making it
fit at several past points
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 1
f ( x, y ) = h ( f n 2 f n 1 + f n 2 ) x 2 + h(3 f n 4 f n 1 + f n 2 ) x + f n
2 2
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
4h 28 5 v
yn +1 yn 3 = (2 f n f n1 + 2 f n2 ) + h y (1 )
3 90
5
h h 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:
h 251 5 v
yn +1 = yn + [55 f n 59 f n 1 + 37 f n 2 9 f n 3 ] + h y (1 )
24 720
w d 2x dx
+b + kx = f ( x, t )
g dt 2 dt
System of equations and higher-order
equations
Reduce to a system of simultaneous first order equations
d 2x dx
= f t , x, , x(t0 ) = x0, x ' (t0 ) = x0'
dt 2 dt
dy
= f (t , x , y ), y (t0 ) = x0'
dt
y1' = y2 ,
y2' = y3 ,
.
.
.
yn' 1 = yn ,
yn' = f ( x, y1 , y2 ,..., yn );
Systems of equations and higher-order
equations
With initial conditions
y1 ( x0 ) = A1 ,
y2 ( x0 ) = A2 ,
.
.
.
yn ( x0 ) = An
Now the Taylor-Series method, Euler Predictor-Corrector method,
Runge-Kutta method, Runge-Kutta Fehlberg method, Adams-Moulton
and Milne methods can be used to derive the various derivatives of the
function
Examples of Open Channel Problems
Steady flow through open channel
dVs d
Vs + ( p + z ) = 0
ds ds
Where p = pressure intensity
Steady, uniform flow through open channel
d
( p + z ) = 0
ds
dy gB ( SoC 2 B 2 y 3 Q 2 )
=
dx C 2 ( gBy 3 BQ 2 )
Examples of Pipe Flow Problems
Laminar flow, velocity distribution
r02 r 2 d
u=
4 ds ( p + z )
d
pA + AL sin 0DL = (V AL )
dt
Module 7
6 lectures
Contents
Types of finite difference
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
2
( x )
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!
f(x)
y=f(x)
Q
A
x0-x x0 x0+x x
k+1
k
t
k-1
i-1 i i+1 x
Finite Difference Grid Approximation
Explicit and implicit techniques
There are several possibilities for approximating the partial
derivatives
Forward:
f f ik+1 f ik
=
x x
Central: f f k
f k
= i +1 i 1
x 2 x
Explicit and implicit techniques
Forward: f f ik++11 f ik +1
=
x x
k +1 k +1
f f f
Central: = i +1 i 1
x 2x
Explicit and implicit techniques
By the known time level we mean that the
values of different dependent variables are
known at this time
Unstable scheme
f ik +1 f *
k k
f f f f
= i +1 i 1 =
x 2 x t t
Explicit finite difference schemes
where
1 k
f = ( f i 1 f ik+1 )
*
2
f f i* f ik f f i
k
f k
i 1
= =
t t x x
Explicit finite difference schemes
MacCormack Scheme cont
The subscript * refers to variables computed during
the predictor part
The corrector
f f i** f ik f f i*+1 f i*
= =
t t x x
Corrector
+ fi* fi*1 * * *
2 f i + 3 f i 1 f i 2
fx = fx =
x x
Explicit finite difference schemes
By using the above FD s and
f f i** fik
=
t t
and using the values of different variables
computed during the predictor part, we obtain the
equations for unknown variables.
k k k k
+ f i f i 1 f i + 1 f i
fx = fx =
x x
Explicit finite difference schemes
Gabutti scheme cont
By substituting
f f i** f ik
=
t t
k k k k k k
2 f i 3 f + f 2 f + 3 f f
f x+ = i 1 i2
f x =
i i 1 i 2
x x
Explicit finite difference schemes
Gabutti scheme cont
Corrector: in this part the predicted values are used
and the corresponding values of coefficients and
approximate the spatial derivatives by the following
finite differences:
* * * *
f f f f
f x+ = i i 1 f x = i +1 i
x x
f ( f ik +1 + f ik++11 ) ( f ik + f ik+1 )
=
t 2 t
f ( f ik++11 f ik +1 ) (1 )( f ik+1 f ik )
= +
x x x
1 k +1 k +1 1
f = ( fi +1 + fi ) + (1 )( fik+1 + fik )
2 2
Implicit finite difference schemes
Preissmann Scheme
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
u k 2u
=
t c x 2
Module 8
6 lectures
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
2u 2u 2u u u
A +B +C
+ D x, y, u , , = 0
x 2 xy y 2 x y
Classification of PDEs cont
The above partial differential equation can be classified
depending on the value of B2 - 4AC,
Elliptic, if B2 - 4AC<0;
parabolic, if B2 - 4AC=0;
hyperbolic, if B2 - 4AC>0.
2u 2u
+ = 0
2 2
x y
Classification of PDEs cont
1D advective-dispersive transport process is
represented through parabolic equation, where
B=0, C=0, so B2 - 4AC=0
2C C C
Dl +u =0
2 t x
x
2u 2u
2u = + =0
2 2
x y
1 1 4 1
2 ui , j = 4 20 4ui, j = 0.
6h 2 1 4 1
In this case of approximation the error is of order O(h6),
provided u is sufficiently smooth enough
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
u ( k ) + u ( k +1) + u ( k ) + u ( k +1) 4u ( k )
( k +1) (k ) i +1, j i 1, j i, j +1 i, j 1 ij
uij = uij +
4
2 u L 2u0 + u R u A 2u0 + u B
u= + =0
2 2
(x) ( y )
Where the subscripts L,R,A, and B indicate nodes left, right, above, and
below the central node 0. If x= y, we can rearrange to the iterative
form
ADI method of solution
Iterative form is as:
u (Ak + 2) 2u0( k + 2) + u B
( k + 2)
= u L( k +1) + 2u0( k +1) u R
( k +1)
ADI method of solution
This removes the bias that would be present if we use only
the row-wise traverse
The name ADI comes from the fact that we alternate the
direction after each traverse
It is implicit, because we do not get u0 values directly but
only through solving a set of equations
As in other iterative methods, we can accelerate
convergence. We introduce an acceleration factor, , by
rewriting equations
( k + 2) 1 ( k + 2)
( k + 2) ( k +1) 1 ( k +1) ( k +1)
uA + + 2 u0 uB = uL 2 u0 + uR .
CGHS method
The conjugate Gradient (CG) method was
originally proposed by Hestens and Stiefel (1952).
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
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
n
< x, y >= xi yi
i =1
K 1 A H = K 1Y
CGHS method
Different conjugate methods are classified
depending upon the various choices of the pre-
conditioning matrix.
ri +1 = ri ai A pi
si +1 = K 1ri +1
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.
8 1 1 | 8
1 7 2 | 4
2 1 9 | 12
Computation of Gradually
Varied and Unsteady Open
Channel Flows
Module 9
6 lectures
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
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
Equation of gradually varied flow
Differentiating
dH dz dd d V 2
= + cos +
dx dx dx dx 2 g
dy So S f
=
dx 1 (Q 2 B ) /( gA3 )
This is due to the fact that the flow depth is known at only
control section, we proceed in either the upstream or
downstream direction.
1V12 2V22
E1 = y1 + E2 = y 2 +
2g 2g
2 S f1 S f 2
Harmonic mean friction slope Sf =
S f1 + S f 2
Solution of gradually varied flows
The friction loss may be written as
1
hf = ( S f1 + S f 2 )( x2 x1)
2
From the energy equation we can write,
1
z1 + E1 = z 2 + E 2 + ( S f1 + S f 2 )( x 2 x1 )
2
1V12
H 1 = z1 + y1 +
2g
Solution of gradually varied flows
Total head at section 2
H 2 = H1 h f
2Q 2 1 1
F ( y2 ) = y2 + + S f 2 ( x 2 x1 ) + z 2 H 1 + S f1 ( x 2 x1 ) = 0
2 2 2
2 gA2
2Q 2 n 2 dA2 4 Q 2 n 2 1 dR2
=
Co2 A22 R24 / 3 dy2 3 Co2 A22 R24 / 3 R2 dy2
B2 2 S f 2 dR2
= 2 S f 2 +
A 3 R2 dy2
2
Solution of gradually varied flows
Here dA2/dy2 is replaced by B2 in the above
equation and substituting for this expression
dF 2 Q 2 B2 B 2 S f 2 dR 2
=1 ( x 2 x1 ) S f 2 2 +
dy 2 gA23 A2 3 R2 dy 2
1. Single-step methods
2. Predictor-corrector methods
Solution of gradually varied flows
The single step method is similar to direct step method and
standard step method
Single-step methods
Euler method
' dy
yi = = f ( xi , yi )
dx i
Solution of gradually varied flows
The rate of change of depth of flow in a gradually varied
flow is given as below
S o S fi
f ( xi , y i ) =
1 ( Q 2 Bi ) /( gAi3 )
1
y = yi +1/ 2 , in which xi+1/ 2 = (xi + xi+1 ) and yi +1/ 2 = yi + 1 yi' x .
2 2
yi +1 = yi + yi' +1/ 2 x
or
yi +1 = yi + f ( xi +1/ 2 , yi +1/ 2 )x
This method, called the modified Euler method, is second-
order accurate.
Solution of gradually varied flows cont..
3. Improved Euler method
Let us call the flow depth at xi +1 obtained by using Euler
method as y * i.e.,
i +1
*
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
xi +1 . Then we can determine the value of yi +1 from the
equation yi +1 = yi +
2
(
1 '
)
yi + yi' +1 x . This equation may be
yi +1 = yi +
1
[ ]
f ( xi , yi ) + f ( xi +1 , yi*+1 ) x
written as 2 . This method
called the improved Euler method, is second order accurate.
Solution of gradually varied flows cont..
4. Fourth-order Runge Kutta Method
k1 = f ( xi , yi )
1 1
k 2 = f ( xi + x, yi + k1x)
2 2
1 1
k3 = f ( xi + x, yi + k 2 x)
2 2
k 4 = f ( xi + x, yi + k3x)
1
yi +1 = yi + (k1 + 2k 2 + 2k3 + k 4 )x
6
Solution of gradually varied flows cont..
Predictor-corrector methods
In this method we predict the unknown flow depth first,
correct this predicted value, and then re-correct this
corrected value. This iteration is continued till the desired
accuracy is met.
In the predictor part, let us use the Euler method to
predict the value of yi+1, I.e
yi(+01) = yi + f ( xi , yi )x
we may correct using the following equation
1
yi +1 = yi + [ f ( xi , yi ) + f ( xi +1, yi(+01) )]x
(1)
2
Solution of gradually varied flows cont..
Now we may re-correct y again to obtain a better
value:
1
yi(+21) = yi + [ f ( xi , yi ) + f ( xi +1, yi(1+)1 )]x
2
v y v
v +g + = g ( So S f )
x x t
General formulation
n +1 n +1 n n
f ( f i + f i +1 ) ( f i + f i +1 )
=
t t
FD methods for Saint Venant equations
Continued
n +1 n +1 n n
f ( f i +1 + f i ) (1 )( f i +1 + f i )
= +
x x x
1 1
f = ( f in++11 + fin +1 ) + (1 )( f in+1 + f in )
2 2
U in +1 + U in++11 = 2
t
x
[
( Fin++11 Fin +1) + (1 )( Fin+1 Fin ) ]
[
+ t ( Sin +1 + Sin++11 ) + (1 )( Sin+1 + Sin ) ]
= U in + U in+1
FD methods for Saint Venant equations
Downstream boundary:
(va)in +1 + (va)in++11 + 2
t
x
{[
(v 2 a + gay )in++11 (v 2 a + gay )in +1 ]}
{[
gat ( s0 s f )in++11 + ( s0 s f )in +1 ]}
= gat {(1 )[( s 0 s ) n
f i +1 + ( s0 s )
f i
n
]}
+ (va)in + (va)in+1 (1 ) 2
t 2
x
{
(v a + gay )in+1 (v 2 a + gay )in }
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:
( )
dy SO S f + V / gA A / x
=
2
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:
(i) Euler method
(ii) Modified Euler method
1. daily cycles
2. transient fluctuations
Basic equations of transients
Continuity equation: applying the law of
conservation of mass to the control volume (x1
and x2) x2
t ( A)dx +( AV )
x1
2 ( AV )1 = 0
d D dp
Now using hoop stress, we obtain =
dt 2eE dt
Basic equations of transients
Following the above equations one can write,
1 dA D dp
=
A dt eE dt
K/
a2 =
Let us define , where a is wave speed
1 + ( DK ) / eE
with which pressure waves travel back and forth.
1 v H f
L1 = + + vv = 0
g t x 2 Dg
H a 2 v
L2 = + =0
t g x
Where,
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
Assume H=H(x,t);Q=Q(x,t)
Method of characteristics
Writing total derivatives ,
dQ Q Q dx dH H H dx
= + = +
dt t x dt dt t x dt
Defining the unknown multiplier as
1 dx 1
= = a 2 =
dt a
Finally we get
dx dQ gA dH f
= a + QQ =0
dt dt a dt 2 DA
P
Negative characteristic
Positive characteristic
line
line
A C B
x
Characteristic lines
QPi, n +1 = Cp Ca H rd
Complex boundary condition
Dead end
At a dead end located at the end of pipe i, the
discharge is always zero:
Q Pi , n +1 = 0
Cp
H Pi , n +1 =
Ca
Complex boundary condition
Downstream valve
In the previous boundaries, either the head or
discharge was specified,
However for a valve we specify a relationship
between the head losses through the valve and the
discharge
Denoting the steady-state values by subscript 0,
the discharge through a valve is given by the
following equation:
Q0 = C d Av 0 2gH 0
Complex boundary condition
Where
Cd=coefficient of discharge
Av0=area of the valve opening
H0=the drop in head
Q0= a discharge
By assuming that a similar relationship is valid for
the transient state conditions, we get
Q Pi , n +1 = (C d Av ) P 2 gH Pi , n +1
= (C d Av ) P /(C d Av ) 0
Q Pi , n +1 = 0.5( C v + C v2 + 4C p C v )
Pipe network problems
The network designing is largely empirical.
The main must be laid in every street along which
there are properties requiring a supply.
Mains most frequently used for this are 100 or
150mm diameter
The nodes are points of junction of mains or where
a main changes diameter.
The demands along each main have to be
estimated and are then apportioned to the nodes at
each end in a ratio which approximated
Pipe network problems
There are a number of limitations and difficulties
with respect to computer analysis of network
flows , which are mentioned below:
Q( p)
C 3( m )
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
HO(m)
C1(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
1
1 H ( j ) H (i ) C 3( m )
Q( p ) = ( )QR(m) C1(m)
C 2 ( m ) HR ( m )
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 and path formulation can have a self starting procedure
without the need for a guess solution, but this formulation needs the
maximum computer storage.
Node based models
The node (H) equations
The number of equations to be solved can be reduced from
L+J-1 to J by combining the energy equation for each pipe
with continuity equation.
The head loss equation for a single pipe can be written as
h = KQ n
nij
H i H j = K ij Qij sgn Qij
Then correct the flow in each loop in such a way that the
continuity equations are not violated.
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
Loop based models
The Qi terms are fixed for each pipe and do not change
from one iteration to the next.
Qi + Qa Qb + Qc
Loop based models
The negative sign in front of b term is included
merely to illustrate that a given pipe may be
situated in positive direction in one loop and in
negative direction in another loop.
V V 1 p fV V
+V + + =0
t x x 2D
1
2
8 2 1 - Node with H unknown & C known
- Node with H known & C known
3 4
- Node with H known & C unknown
Unknowns
6 7
H [2], H [4], H [5]
R [4], R [5]
C [6], C [7], C [8]
7 5 6
8 9
Contaminant Transport in
Open Channels and Pipes
Module 11
5 lectures
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.
C
u = advection of tracer with fluid
x
2C
Dl = molecular diffusion +Hydrodynamic
x 2
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)
Few simple solutions
Bear discussed several analytical solutions to relatively
simple, one-dimensional solute transport problems.
However, even simple solutions tend to get overwhelmed
with advanced mathematics.
C (1,0) = 0 1 0
C (0, t ) = C0 t0
C ( , t ) = 0 t0
Few simple solutions
For these boundary conditions the solution to ADE
equation for a saturated homogeneous porous
medium is:
vl 1 + vt
C 1 (1 v t )
= erfc + exp erfc
Co 2 Dl 2 Dt
2 Dl t l
erfc represents the complimentary error function; l
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.
Few simple solutions
This equation can be used to compute the shapes of the
breakthrough curves and concentration profiles
Ci +1 Ci Ci Ci 1 Ci +1 Ci Ci C0
( Dl ) 1 ( Dl ) 1 ui =
i+ x 2 i x 2 x t
2 2
( Dl ) 1 ( Dl ) 1 ( Dl ) 1 ( Dl ) 1
i i i+ i+
2 C 2 + u
2 i + 1 C + u
2 i C C0
i 1 i i +1 =
x 2
x 2
x 2 x t x 2 x t
Solution of ADE through FD methods
Continued
( Dl ) 1 ( Dl ) 1 ( Dl ) 1 ( Dl ) 1
i i i+ i+
u 1 u C
2 C
i 1 + 2 + 2 i + C
i
2 i C
i +1 = 0
x 2 x 2 x 2 x t x 2 x t
Ci +1 = Ci + flux(x)
C (0, t ) = C0 t > 0;
Continued Ci 1 = Ci flux(x )
C (0, t ) = C0 t0
C ( , t ) = 0 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.