Introduction To Finite Difference Method

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

CURRICULUM - BACHELOR'S DEGREE IN CIVIL ENGINEERING

COMPUTATIONAL TECHNIQUES
IN CIVIL ENGINEERING
CE 751
Lecture: 3 Year : IV
Tutorial : 2 Part :II
Practical: 0
Course Objective:
To provide knowledge of numerical solutions and computational techniques of various civil engineering problems related
to structural and water resources engineering and their computer implementation using algorithms and programs
1.Introduction (4 hours)
1.1 History of numerical computations of civil engineering problems
1.2 Brief description of solution techniques
1.2.1 Finite element method
1.2.2 Finite difference method
1.2.3 Boundary element method
1.2.4Discrete element method
1.2.5 Smoothed particle hydrodynamics
1.3 Review of programming methods: (C or FORTRAN or Matlab)

2. Solutions of linear equation (6 hours)


2.1 System of linear equations
2.2 Banded matrices
2.3 Data storage and memory optimization
2.4 Conjugate gradient method
2.5 Fourier Integral
2.5.1 Discrete Fourier Transform
2.5.2 Fast Fourier Transform
3.Elasticity in solids (6 hours)
3.1 Stress displacement relationship
3.2Stress-strain (constitutive) relations
3.2.1 3D state of solid, Lame constants
3.2.2 Plane stress and plane strain condition
3.2.3 Axi-symmetric stresses
3.3 Equilibrium equations
4. Finite element method (14 hours)
4.1Direct stiffness method
4.1.1 Stiffness matrices for bar, truss and beam elements
4.1.2 Transformation matrices for 2D and 3D cases and assembly
4.1.3 Example of a truss
4.2 Coordinate system – local , global , natural
4.3 Interpolation functions
4.3.1 Pascal triangle
4.3.2 Polynomial function
4.3.3 Lagrangian element
4.3.4 Hermite interpolation of beam element
4.3.5 Serendipity element
4.4 Application in solid and frames
4.4.1 Formulation of stiffness matrices for bars, truss, beams and area(triangle) elements
4.4.2 Isoparametric formulation( linear displacement field only)-2D triangle and quadrilateral
4.4.3 Example of dam: Calculate stresses giving pressure loads using computer programs
4.4.4 Example on wall: Calculate stresses giving vertical loads using computer programs
4.5 General introduction to pre and post processing
5. Finite difference method (7 hours)
5.1Finite differences
5.2 Explicit scheme and Implicit Scheme
5.3 Governing equations of movement of fluid (Momentum and continuity equations)
5.4 Discretization of Kinematic wave Equation (linear and non linear)
5.5 Order of accuracy of the scheme and its applications
5.6 Numerical diffusion, dispersion and stability of scheme
5.7Applications of the schemes in hydraulic channel routing
5.8 Implicit dynamic wave model
5.9 Finite difference scheme for Saint-Venant equations
6. Method of Characteristics (4 hours)
6.1Introduction
6.2 Characteristics
6.3 Initial and boundary conditions
6.4Solution to unsteady flow in pipes
7. Simulation of Ground water flow (4 hours)
7.1 Steady state flow nets and finite difference grid
7.2 Simulation of seepage under a dam
7.3 One dimensional Implicit Model
7.4 Application in river-Ground water system
Tutorial:
There shall be related tutorials exercised in class and given as regular homework exercises
Introduction
• Physical processes in the various field of Civil Engineering are described by differential equations.
• These equations are to be solved to obtain the value of variables
• The analytical solution is possible for simplified governing equations
• For complex problems, it is difficult to get analytical solutions
• Therefore, solutions of the equations are obtained by approximate method using computer.This is known as
Computational Technique. In this approach, Numerical methods are applied for the solution
Terms
Domain
• A domain describes a finite or infinite continuous region i.e. geometry of the system.
Boundary conditions
• The boundary conditions (BC) represent the given or known conditions on some parts of a domain

Procedure of constructing a numerical simulation


( a) Conceptualization of Physical phenomenon
• Various laws describing physics, simplification and extraction of important physics
(b)Mathematical model
• Formulation of governing equations: Ordinary differential equations (ODE) or Partial differential equations
(PDE)
(c) Domain discretization
• Representing domain by mesh/grid, cell, node or particle
(d) Numerical algorithms
• Initial condition, boundary conditions
• Numerical discretization: converting continuous ODE/PDE to discrete form
• Solution steps for resulting equations
(c) Coding and implementation
(f) Numerical simulation
1.2 Introduction to different types of numerical methods
(1) Finite element method (FEM)
In Finite element method, the domain is divided into a finite number of small, interconnected elements/mesh
called finite elements. Nodes are assigned to each element. Over each finite element, the unknown variables are
approximated using known functions, known as approximating functions/interpolation functions.
• These functions are defined in terms of the field variable at specified nodes. The unknowns at a node are
magnitude of field variables and its derivative.
• The governing equations are integrated over each finite element and the solution is summed up over each
element.
• A set of finite linear equations are obtained in terms of unknown parameters over each element and these
equations are solved by linear algebraic techniques.
• Once the unknowns at nodes are found, the field variables at any point can be found by interpolation
functions.
• It is more versatile method and useful for irregular geometry, but it cannot model discontinuous structures.

2. Finite difference method (EDM)


In Finite difference method, the domain is represented by an array of regularly spaced grid points (rows and
columns) .
• The differential equation is converted to algebraic difference equation at a grid point. Hence, the method
approximates the governing equation pointwise
• The value of a function at a point is related to value of nearby points
• The method is simple and easy to implement, but it is difficult to apply for irregular geometry

Comparison of FEM/FDM
• In FDM, field variable is computed at specified points, but in FEM, the variation of field variable is integral
part of the problem formulation
• The FDM models the differential equation only, but FEM models the entire domain of the problem
Similarities: In both methods, differential equation is converted to algebraic equation.

(3)Boundary Element method(BEM)


In Boundary element method, only the boundary of the solution domain is discretized into elements.
The idea of boundary element methods is that we can approximate the solution of a differential equation by looking
at the solution on the boundary and then use that information to get the solution inside the domain. This method
reduces the preprocessing time and the dimensionality. In BEM, the differential equation is converted into an
integral equation on the boundary of the domain (boundary integral). Integration over the boundary surface is
carried out over a boundary element and the contributions of all elements describing the boundary are added. Once
the solution at the boundary is obtained, then the solution inside the domain is obtained.
(4)Discrete Element method(DEM)
In Discrete Element method, a granular material is modelled as an assembly of separate, discrete particles. These
particles may have different shapes and properties. This method is used to compute the stresses and displacements
in a volume containing a large number of particles such as grains of sand. In DEM simulation, all particles are
oriented spatially and an initial velocity is assigned. The forces which act on each particle are computed from the
initial data and the relevant physical laws and contact models. All forces are added up to find the total force acting
on each particle. An integration method is employed to compute the change in the position and the velocity of each
particle during a certain time step from Newton's laws of motion. Then, the new positions are used to compute the
forces during the next step, and this loop is repeated until the simulation ends. The method is computationally
intensive.
(5) Smoothed particle Hydrodynamics(SPH)
Smoothed particle Hydrodynamics (SPH) is a mesh free method based on Lagrangian concept of Fluid dynamics. It
is a particle method, in which the system/domain is represented by a set of arbitrarily distributed particles. No
connectivity of particles is needed. The physical quantity of any particle is taken by computing average over
neighbouring particles (smoothing).
Steps
• Integral representation of a function
• Integral representation of a function converted to particle approximation
• Particle approximation performed at every time step
• Particle approximation performed to all terms related to field functions in partial differential
• equations to produce a set of ODES in discretized form with respect to time only.
• Solving ODES
History of numerical computations in Civil Engineering
FDM history
• Oldest method
• Foundation of FDM: Fundamental paper by Courant, Friedrichs and Lewy (1928) on the solutions of the
problems of mathematical physics
• A number of schemes developed after 1950s, which were applied in the field of Civil engineering
• Wide applications due to the emergence of high speed computer after 1980

FEM history
• Basic idea originated from the framed structures like truss, aircraft structural analysis and flow
network analysis
• Aircraft engineers in 1940s developed flexibility method (unknown force, known displacements)
• 1940s: Courant developed methods for solving torsion problems
• FEM: stems concept from displacement method (known force, unknown displacements)
• 1955: Argyris published a book on Structural analysis which provides foundation for FEM
• 1956: Turner and others developed stiffness matrices for truss , beam and other elements
• The term FEM was first used by Clough in 1960 in the context of plane strain analysis
• 1960 and 1970s: FEM applied to plate bending, shell bending, pressure vessels, 3d problems in structural
analysis, fluid flow and heat transfer
• 1980: Zienkiewicz and Cheung published first book on FEM
• 1980: Graphical and computational development
• 1990: emergence of low cost, powerful computers, possibility of analysis of large structures
BEM history
• The term was first used in the 1977 paper "Boundary element methods for potential problems"by Brebbia
and Dominguez.
• Ideas obtained from famous Mathematicians like Laplace, Gauss, Fredholm, Betti.
DEM history
• First applied to rock mechanics and soils by Cundall and Strack in 1979
SPH history
• Introduced in 1977 to solve astrophysical problems
• Applied to Fluid dynamics related area in the early phase
Softwares/applications
FEM softwares
Structure. STAAD, ANSYS, NISA, RAM
Geotech: STAAD Foundation/RAM Foundation, CRISP
Fluid Mechanics: ANSYS CFX, FEFLOW, FEMWATER

FDM softwares: HEC-RAS, MikeShe

Applications of different methods in civil engineering


FEM Applications
Structural analysis
Computation of deflection, stress, strain, force, displacements, energy
Fluid flow analysis
Computation of velocity, pressure Groundwater flow analysis
FDM applications
• Hydraulics, surface water and groundwater hydrology
BEM applications
• Fluid flow analysis, structural analysis
DEM applications
• Mechanical behaviour of soil, rock and concrete
SPH applications
• Fluid flow analysis
5. Finite Difference Method (FDM)
5.1 Introduction
Finite difference method is a numerical technique of solving differential equation(DE) in which the domain is
represented by an array of regularly spaced grid points (rows and columns), and the DE is converted to difference
equation at a grid point.
Hence, the method approximates the governing equation pointwise. The value of a function at a point is related to
value of nearby points. The method is simple and easy to implement, but it is difficult to apply for irregular
geometry

Mathematical concept of FDM


Mathematically, DE is replaced them with difference equations over a small step in FDM
Real derivative is represented by tangent to a point on a curve. In FDM, the derivative is evaluated
approximately by taking the slope of line joining two points.

Finite difference equations (FDE) are obtained by using Taylor's series approximation to DE

Finite difference approximation of first derivative, df/dx


a. Forward difference approximation
Taylor's series expansion of f(x) at x+∆x is
Neglecting second and higher order term

Dropping the higher order terms is known as truncation.


b. Backward difference approximation of derivative
Taylor’s Series expansion of f(x) at x-∆x is

Neglecting second and higher order term

C . Central difference approximation of derivative


Subtracting eq.(II) from eq.(I)and neglecting third and higher order terms
Finite difference approximation of second derivative
Adding eq.(I) and eq.(II) ,solving for ∂2f/∂x2 and neglecting higher order terms

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

Order of accuracy of schemes


Order of accuracy represents how well the solution of finite difference method approximates the real
solution of differential equations.
Consider the forward scheme.
From eq. (I)
Neglecting second and higher order terms

RHS = truncation error


The lowest power of ∆x in the truncation error determines the order of accuracy. This scheme is first
order accurate. As ∆x tends to zero, the error in the higher order scheme tends to zero more rapidly
than lower order scheme.
Similarly, backward scheme is also first order accurate.
Consider central difference scheme.
Subtracting eq. (II) from eq. (I)

Dividing by 2∆x and rearranging

This is second order accurate scheme


Concept of Consistency, convergence and stability
Consistency: If continuous PDES (real) are obtained from FDEs as ∆x and ∆t approaches to zero, then
the resulting solution is said to be consistent. Hence, consistency is related to equations. Taylor’s series
expansion is applicable for consistency analysis.
Example:

Considering forward difference scheme

Taylor’s series expansion

Hence the real PDE is obtained and the numerical scheme is consistent
Convergence
If solution of FDM approaches the true solution as ∆x and ∆t approaches to zero, then the resulting solution is
said to be convergent. Hence, convergence is related to the solution of equations . Comparison of analytical
solution if exists with numerical solution provides a way to see the convergence.
Stability
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.

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.
Example of Discretization in space domain
Unsteady non-uniform flow equation in open channel: 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
I. Continuity equation: Using the principle inflow-outflow = rate of change of storage

II. Momentum equation: Based on Newton’s second law


Net force = rate of change of momentum
Where , 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 and most widely used form of St. Vt. equations
The most common form of equation (taking β = 1,Neglecting eddy loss, wind shear and lateral flow)

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.
Equations (I) and (II) represent equations for dynamic wave model.
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.
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.

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, applicable to overland flow where lateral flow is continuously added, flow
from small basin
• Equivalent to uniform flow (momentum equation): flow remaining approximately uniform over a channel reach,
no visible surface wave
Momentum equation in kinematic wave model can be expressed as
From eq. (a) and (d)

This is the kinematic wave model in terms of Q.


Numerical scheme for kinematic wave model
Second order accurate for linear kinematic wave (Central difference scheme: explicit)
Second order accurate scheme for non-linear kinematic wave (Central difference scheme: explicit)
Finite difference scheme for Saint Venant equations (Dynamic wave model)
Example-1:A river which is generalized as trapezoidal channel is 300m wide with side slope 5:1, has bed slope
1% and manning’s n=0.04. Initially discharge through the river is 100m3/s. Due to a flood discharge observed at
the upstream section of the river is 300 m3/s , compute discharge at 2650m downstream from upstream section.
Take ∆x = 2650m and ∆t =1hr.Use linear kinematic wave solution .
Solution:
Example-2: Using any explicit finite differences scheme for full saint venant equations, compute discharge and flow
depth at grid (i, n + 1) for the following data :Rectangular channel width = 10 m, Bed slope = 0.0002, Manning's n =
0.04, No lateral inflow, ∆x = 1.0 km and ∆t = 5 min. Discharge: Qni-1 = 40 m3 / sec, Qn i = 38m3 / sec Qni+1=37.5 m3 /
sec. Flow depth: yn i-1= 1.9m, yni =1.85m, yni+1 = 2.0m.
Example-3: The value flow rate Q at four points in the space time grid are shown in the figure below. Determine the
value of first-order derivatives ∂Q/∂t and ∂Q/∂x by using four-point implicit method.
Given:∆t=1.0 hour, ∆x=600m and θ=0.55.
Example-4:
Assignment
1. Explain the concept of finite difference method. What do you mean explicit and implicit scheme in finite difference
method? For the grids given below discretize using explicit and implicit scheme using forward, backward and central
difference approach for space and time derivatives.

2. Write down the governing equations used for analyzing the movement of fluid . What are the Kinematic wave
approximation of these governing equations?
3. With appropriate expressions and graphs, explain first and second order accurate schemes of finite differences of partial
differential equations.
4. Derive the expression for second-order accurate explicit finite difference equation for dynamic wave model (saint venant
equations).
5. A channel having width of 30m carries a discharge of 110m3/sec through a section. The bed slope and the manning’s ‘n’
value arc 3% and 0.035 respectively and the hydraulic radius is equal to flow depth. Recommend the maximum time step
required for stable solution of kinematic wave routing in is condition if the value of ∆x is considered as 1400 meters .
6. Describe courant number. Also discuss the stability of explicit scheme for the numerical solution of Saint-Venant
equations.
7. Describe numerical dispersion, diffusion and stability of finite Difference schemes .
8. Derive a second order accurate finite difference scheme of linear kinematic wave equation which computes discharge
for unknown time and location.
9. Develop finite difference model for full Saint-Venant equations representing the fluid flow using second order
accurate explicit scheme.
10. What do you know about the implicit four point scheme ? Explain with the help of expressions.

You might also like