0% found this document useful (0 votes)
76 views

Computational Techniques in Civil Engineering: 5. Finite Difference Method (FDM)

The document discusses numerical techniques for solving partial differential equations (PDEs) using finite difference methods (FDM). It covers: 1) Approximating derivatives using forward, backward, and central finite differences and discretizing PDEs. 2) Explicit and implicit finite difference schemes for solving the resulting finite difference equations over time. 3) The kinematic wave model, which is used to simulate open-channel flow by neglecting inertia terms and balancing gravity and friction forces. Numerical solutions of the kinematic wave model use the continuity equation and Manning's equation.

Uploaded by

yeee boiii
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Computational Techniques in Civil Engineering: 5. Finite Difference Method (FDM)

The document discusses numerical techniques for solving partial differential equations (PDEs) using finite difference methods (FDM). It covers: 1) Approximating derivatives using forward, backward, and central finite differences and discretizing PDEs. 2) Explicit and implicit finite difference schemes for solving the resulting finite difference equations over time. 3) The kinematic wave model, which is used to simulate open-channel flow by neglecting inertia terms and balancing gravity and friction forces. Numerical solutions of the kinematic wave model use the continuity equation and Manning's equation.

Uploaded by

yeee boiii
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Computational Techniques in Civil Engineering

B.E. (Civil), Year/Part: IV/II


-

5. Finite Difference Method (FDM)

5.1 Introduction

FDM is a technique of solving PDES by replacing them with difference equations over a small step.

f(x)
Real
derivative

f(x1)

Approximate
f(x2) derivative

x
x1 x2

Real derivative is represented by tangent to a point on a curve. For example, the approximate derivative
can be represented as
( ) ( )

Finite difference equations (FDE) are obtained by using Taylor’s series approximation to PDE.

( )

f(x)
( )

x
x
Forward difference approximation of derivative
Taylor’s series expansion of f(x) at is
( ) ( ) (a)
Neglecting second and higher order terms
( ) ( )

Dropping the higher order terms is known as truncation.


Backward difference approximation of derivative
Taylor’s series expansion of f(x) at is
( ) ( ) (b)
Neglecting second and higher order terms
( ) ( )

Central difference approximation of derivative


Subtracting eq. (b) from eq. (a), and neglecting third and higher order terms
( ) ( )
( ) ( )

Steps in FDM
I. Discretization of domain: Replacing the continuous spatial and temporal domain by grid points
or cells and time levels
II. Discretization of PDE: Replacing PDE by a set of algebraic equations known as Finite difference
equations
III. Specification of solution algorithm: Step by step procedure for solving FDE at each point/grid.

Consistency, convergence and stability

If continuous PDES (real) are obtained from FDEs as and approaches to zero, then the resulting
solution is said to be consistent. (Consistency related to equations). Taylor’s series expansion is
applicable for consistency analysis.

If solution of FDM approaches the true solution as and approaches to zero, then the resulting
solution is said to be convergent. (Convergence related to solution of equations).

If the round-off and truncation errors do not accumulate to cause the solution to diverge, then the
solution is said to be stable. Fourier analysis is performed for stability analysis.
5.2 Explicit and implicit schemes

If the solution at t = n+1 is obtained from the conditions at t = n, the scheme is known as explicit
scheme. In such scheme, the equations are solved sequentially. The explicit scheme is simpler to
implement, but it can be unstable. It is also convenient because results are given at grid points and it can
treat slightly varying channel geometry from section to section. It is less efficient than implicit method
and hence not suitable for simulation over long time period.

If the solution at t = n+1 is obtained from the conditions at t = n and n+1, the scheme is known as
implicit scheme. In such scheme, the equations are solved simultaneously. Implicit scheme is
mathematically more complicated. The method is stable for large computation steps and hence works
much faster than explicit scheme. The method can handle channel geometry varying significantly from
one section to the next.

Discretization
finding . /
dx
n+1
dt
n
i-1 i i+1
Explicit FDEs
Forward difference:

Backward difference:

Central difference:

Implicit FDEs
Forward difference:

Backward difference:

Central difference:

Second order derivative: Example of discretization

( ) 6( ) ( ) 7 6 7

( )
5.3 Stability and order of accuracy
A necessary condition for explicit scheme to be stable is the Courant condition.

Courant no.
| |
Courant no. =
V = velocity, c = celerity of wave

For computational purposes in an explicit scheme, is specified and kept fixed throughout the
computations, while is determined at each time step. at each point on a time line is computed
satisfying Courant condition and the smallest one is used.

Order of accuracy of schemes

Order of accuracy of represents how well the solution of finite difference method approximates the resl
solution of differential equations. It is an extension of consistency concept.

Consider the forward scheme.

Taylor’s series expansion of f(x) at is


( ) ( )
Neglecting second and higher order terms
( ) ( )

RHS = truncation error


The lowest power of in the truncation error determines the order of accuracy. This scheme is first
order accurate. As tends to zero, the error in the higher order scheme tends to zero more rapidly
than lower order scheme.

5.3 Unsteady flow equation (Saint Venant Equations)

The equation of unsteady non-uniform flow in 1D is known as Saint Venant Equations. These equations
are based on continuity and momentum principle.

Assumptions
 The channel is prismatic.
 The flow is 1D, i.e. the velocity is uniform in a cross-section.
 Hydrostatic pressure prevails and vertical accelerations are negligible.
 Bottom slope of the channel is small.
 Manning’s equation is used to describe resistance effects (to evaluate friction slope).
 The fluid is incompressible.
Full equations

Continuity equation: Using the principle inflow-outflow = rate of change of storage

Momentum equation: Based on Newton’s second law

Net force = rate of change of mometum

( )
. /

Q = discharge at x, A= Cross-sectional area at x, q= lateral flow per unit width, = momentum


coefficient, Sf = energy slope, S0 = bed slope, Se = eddy loss slope, Wf = wind shear factor, b = top width,
vx = velocity of lateral flow in x direction

Simplified equations

The most common form of equation (taking Neglecting eddy loss, wind shear and lateral flow)

Continuity:

( )
Momentum: ( )

Terms in momentum equation


Effect of inertia force: first and second terms
First term: local acceleration
Second term: convective acceleration
Third term: pressure force
Fourth term: gravity force
Fifth term: friction force

In the Saint Venant equations, all the flow variables are functions of both time and distance along the
channel. The unknowns are Q and y in conservative forms of equations, and V and y in non-conservation
form. The other flow variables, such as the area, A, and the friction slope, Sf, can be expressed in terms
of Q and y. The independent variables are time, t, and distance along the channel, x. An initial condition
and two boundary conditions are needed to solve the Saint Venant equations. The initial condition is
described by the variation of the unknowns, Q and y (or V and y), along the channel at time zero.

Simplifications of St. Venant equations


a. Dynamic wave model: Full momentum equation is considered in Dynamic wave model.
Continuity:
( )
Momentum: ( )
Application
– Flood wave in a wide river
– For rivers in which flood is modified by developments and structures

b. Diffusive wave model


Neglecting first two terms (inertia) of momentum eq., diffusive wave eq. is obtained. Acceleration terms
are small compared to water surface slope for slow rising of flood wave, which can be neglected.
Continuity:
Momentum:
• Application
– To represent backwater effect, steep slope channel and flow influenced by bed
roughness

c. Kinematic wave model


Neglecting first three terms of momentum eq., kinematic wave equation is obtained.
Continuity: (a)
Momentum: (b)
In this model, gravity force and friction force balance each other. The wave motion is described
principally by the equation of continuity. No force term is included (kinematic).
 No applicable to simulate backwater effect
 Applicable for steep slope channel
 Equivalent to uniform flow

Momentum equation in kinematic wave model can be expressed as


(c)
Differentiating eq. (c) w.r.t. t
(d)
From eq. (a) and (d)

This is the kinematic wave model in terms of Q.


Numerical solution of kinematic wave model
Finding Q(x,t) at each point on the x-t grid:
Given: channel properties, initial and boundary conditions
from Manning’s equation

. /

Comparing to
. /

5.5 Numerical scheme for kinematic wave model

a. Linear scheme for kinematic wave model

dx
n+1
dt
n

i i+1 x
: known points
Discretization
: backward difference

: backward difference
Non-derivative terms
: average along diagonal for linearity

: average on i+1 distance line


Substituting above values in

. /

4 . / 5 . / . /

4 5 4 5
(a)
( 4 5 )

Solution technique for linear kinematic wave model for channel routing

1. Supply initial condition at time t = 0 on time line n=1.


2. Apply Courant condition to each grid point on time line and choose the smallest value as .
3. Advance to next time step, t= and n=n+1.
3.1 Apply upstream boundary conditions (flow hydrograph) to obtain at i=1.
3.2 Move to next point on time line n+1 by (x= ).
3.3 Solve for using eq. (a).
3.4 Repeat steps 3.2-3.3 for all points on the grid
4. Repeat steps 3.1-3.4 for the remaining time periods.

Stability of kinematic wave


Courant condition: where ck = kinematic wave celerity
Apply Courant condition to each grid point on time line and choose the smallest.

Diffusion and Dispersion


Diffusion: Numerical damping caused by the truncation error is called diffusion. It is related to
amplitude error, in which the peak computed by numerical scheme reduces but the timing of peak is
same and the shape of function becomes wide.

Error in timing of peak in the numerical solution is called dispersion. It is related to phase error, in which
timing of the peak computed by numerical scheme is shifted from the real solution.

f(x) f(x)

x
Diffusion Dispersion

b. Non-linear scheme for kinematic wave model


t

dx
n+1
dt
n

i i+1 x
: known points

: backward

: backward
Non-derivative terms
: average on i+1 distance line
Substituting in continuity equation
With
( ) and ( )
Substituting
( ) ( )

Solving for

( ) ( ) . / (a)
It is non-linear in . The above equation can be solved by iteration technique, such as Newton-
Raphson method.
Let RHS = C which is known.
Residual error is ( ) ( ) (b)

( ) ( ) (c)
The objective is to find that forces ( ) to become zero.

Newton-Raphson formula

( )
( ) ( ) ( )
(d)

Use linear scheme, compute and use it as an initial value.

Solution technique for linear kinematic wave model for channel routing
1. Supply initial condition at time t = 0 on time line n=1.
2. Advance to next time step, t= and n=n+1.
2.1 Apply upstream boundary conditions (flow hydrograph) to obtain at i=1.
2.2 Move to next point on time line n+1 by (x= ).
2.3 Solve for initial estimate of at k=1 using linear scheme. Find ( ) using eq. (b).
2.4 Find ( ) from eq. (c).
2.5 Find ( ) using eq. (b).
2.6 If ( ) , move to next grid point. Else repeat steps 2.4-2.5 until the condition is
satisfied.
2.7 Repeat steps 2.2-2.6 until the last grid point is reached.
3. Repeat steps 2.1-2.7 for the remaining time periods.

5.6 Finite difference scheme for Saint Venant equations


Example of explicit scheme: Leap-frog scheme

dx
n+1
dt
n

n-1
i-1 i i+1
Central difference for space and time derivatives

Non-derivative term
or or
Continuity equation

(I)
Momentum equation
( )
( )

,( ) ( ) - ( )

0 *( ) ( ) + ( ) 1 (II)
Example of implicit scheme
(Implicit dynamic wave model)

Implicit four point scheme (Preissman scheme)

In Preissmann scheme, four points are used to evaluate the derivatives. The scheme is forward
difference scheme with weight.
θ
n+1
dt
0.5 0.5
n

i 1-θ
i+1
dx

( ) ( )
Space derivative: ( )

Time derivative: . /
( )
Non-derivative term: ( ) ( )
= 0.5: box scheme
= 0: fully explicit
= 1: fully implicit
For implicit scheme, should be between 0.5 to 1.
For in between 0.5 to 1, the scheme is unconditionally stable.

Continuity equation

( ) ( )
. / ( ) (I)
Momentum equation
( )
( )
{( ) ( ) } *( ) ( ) +
4 5 ( )

( ) ( ) ( )
8 ( ) ( )9 8 ( ) 9
( ) ( )
2 ( ) ( )3 2 .( ) ( ) / .( )
( ) /3 (II)
The unknown quantities in implicit finite difference equations are and . (The terms and
should also be computed simultaneously). The area and the friction slope ( ) can be
expressed in terms of are and .All the other terms are known either from the initial conditions
or from the previous time step computations.
For i = 1, 2,…….,N, there are N-1 reaches. For each reach, 2 equations (continuity and momentum) can
be written. So, there are 2N-2 equations. Additional 2 equations are provided from boundary conditions.
f(x)=0
Solution technique of resulting equations: Newton-Raphson iteration technique (forcing the residuals to
become zero)
Start with values of unknowns from initial condition, previous time step or from extrapolation.
Compute residuals (0-value of f(x)).
Find the corrections. (Matrix inversion)
Apply the correction to previous value. Repeat the procedure until two values of corrections do not
change significantly.
Value at next time step = value at previous time step+correction

You might also like