Well posed problem & Types of boundary conditions
The problem is a well posed problem if the solution ;
exist,
unique, and
depend continuously on the data of the problem (initial and
boundary conditions)
Types of the boundary conditions:-
Dirichlet boundary condition (the dependent variable along the
boundary is prescribed)
Neumann boundary condition (the normal derivative of the
dependent variable along the boundary is prescribed)
Robin boundary condition (if the imposed boundary condition is
a linear combination of the Dirichlet and Neumann types)
Mixed boundary condition (the boundary condition along a
certain portion of the boundary is the Dirichlet type and, on the
another portion of the boundary, a Neumann type)
Finite Difference Method
Finite difference method utilizes
the Taylor series expansion to
express the derivatives of a
variable as the differences
between values of the variable at
various points in space or time.
Consider the curve in figure
which represent the variation of
“u” with “x”, i.e.,u(x). The curve
u(x) can be represented by a set
of discrete points, ui’s. These
discrete points can be related to
each other using a Taylor series
expansion.
Thus the variable “ui” can be expressed in
terms of Taylor series expansion about
point (i) as;
These equations are mathematically exact if the number of terms are infinite and
“Δx” is small. Ignoring higher order terms leads to a source of error in the
numerical calculations as the equation for the derivatives is truncated. This error
is known as the truncation error.
By subtracting or adding the two equations (1& 2), the first and second
derivatives at the central position, as
These equations are known as the second order central difference equations for
the first and second derivatives.
The first order derivative can be obtained using one of the two equations (1 or 2).
Equation (1) gives the forward difference as
Equation (2) gives the backward difference as
The second order forward finite difference for 1st derivative
𝜕𝑢 ∆𝑥 2 𝜕2 𝑢 ∆𝑥 3 𝜕3 𝑢
𝑢𝑖+1 = 𝑢𝑖 +∆𝑥 + + + …. 1
𝜕𝑥 2! 𝜕𝑥 2 3! 𝜕𝑥 3
𝜕𝑢 4 ∆𝑥 2 𝜕2 𝑢 8 ∆𝑥 3 𝜕3 𝑢
𝑢𝑖+2 = 𝑢𝑖 +2∆𝑥 + + + …. 3
𝜕𝑥 2! 𝜕𝑥 2 3! 𝜕𝑥 3
Multiply eqn (1) by 4
𝜕𝑢 4 ∆𝑥 2 𝜕2 𝑢 4 ∆𝑥 3 𝜕3 𝑢
4𝑢𝑖+1 = 4𝑢𝑖 +4∆𝑥 + + + …. 4
𝜕𝑥 2! 𝜕𝑥 2 3! 𝜕𝑥 3
eqn (4) - eqn (3)
𝜕𝑢 2 ∆𝑥 3 𝜕3 𝑢
4𝑢𝑖+1 - 𝑢𝑖+2 =3𝑢𝑖 + 2∆𝑥 −
𝜕𝑥 3 𝜕𝑥 3
𝜕𝑢 4𝑢𝑖+1 −3𝑢𝑖 −𝑢𝑖+2 2
= + o ∆𝑥
𝜕𝑥 2∆𝑥
Similarly, the second order backward finite difference for 1st derivative
𝜕𝑢 3𝑢𝑖 −4𝑢𝑖−1 +𝑢𝑖−2 2
= + o ∆𝑥
𝜕𝑥 2∆𝑥
Example
It is required to find the numerical solution of the following equation
At point x=0.2 use the step size ∆𝑥=0.02
compare the results obtained with the exact solution
Solution
𝑑𝑢 𝑑𝑢
=2𝜋𝑐𝑜𝑠 2𝜋𝑥 =2𝜋𝑐𝑜𝑠 2𝜋 × 0.2
𝑑𝑥 𝐸𝑥𝑎𝑐𝑡 𝑑𝑥 𝐸𝑥𝑎𝑐𝑡
𝑥=0.2
𝑑𝑢
=1.9416
𝑑𝑥 𝐸𝑥𝑎𝑐𝑡
𝑥=0.2
𝑑𝑢
=2𝜋𝑐𝑜𝑠 2𝜋𝑥 By integration 𝑢 =sin 2𝜋𝑥 + const.
𝑑𝑥 𝐸𝑥𝑎𝑐𝑡
Using B.Cs const.=0
i-1 i i+1
𝑢 =sin 2𝜋𝑥
x 0.18 0.2 0.22
u 0.9048 0.9511 0.9823
Using central difference
𝑑𝑢 𝑢𝑖+1 −𝑢𝑖−1
= + o(∆𝑥 2 )
𝑑𝑥 𝑐𝑒𝑛𝑡𝑟𝑎𝑙 2∆𝑥
𝑑𝑢 𝑁𝑢𝑚𝑒𝑟𝑖𝑐𝑎𝑙 𝑣𝑎𝑙𝑢𝑒 −𝐴𝑛𝑎𝑙𝑦𝑡𝑖𝑐𝑎𝑙 𝑣𝑎𝑙𝑢𝑒
=1.9375 𝐸𝑟𝑟𝑜𝑟= × 100%
𝑑𝑥 𝑐𝑒𝑛𝑡𝑟𝑎𝑙 𝐴𝑛𝑎𝑙𝑦𝑡𝑖𝑐𝑎𝑙 𝑣𝑎𝑙𝑢𝑒
𝑥=0.2
𝐸𝑟𝑟𝑜𝑟𝑐𝑒𝑛𝑡𝑟𝑎𝑙 =0.211%
Using forward difference 𝑑𝑢 𝑢𝑖+1 −𝑢𝑖
𝑑𝑢 = + o(∆𝑥)
=1.56 𝑑𝑥 forward ∆𝑥
𝑑𝑥 𝑓𝑜𝑟𝑤𝑎𝑟𝑑
𝑥=0.2 𝐸𝑟𝑟𝑜𝑟𝑓𝑜𝑟𝑤𝑎𝑟𝑑 =19.65%
Using backward difference 𝑑𝑢 𝑢𝑖 −𝑢𝑖−1
𝑑𝑢 = + o(∆𝑥)
=2.315 𝑑𝑥 backward ∆𝑥
𝑑𝑥 𝑏𝑎𝑐𝑘𝑤𝑎𝑟𝑑
𝑥=0.2 𝐸𝑟𝑟𝑜𝑟𝑏𝑎𝑐𝑘𝑤𝑎𝑟𝑑 =19.23%
H.W. 1
𝑑𝑢
Draw versus x for exact & numerical solution for 0≤ 𝑥 ≤ 1 using
𝑑𝑥
step size 0.02
i 𝒙𝒊 𝒖𝒊 𝑑𝑢 𝑑𝑢 𝑑𝑢 𝑑𝑢
𝑑𝑥 𝐸𝑥𝑎𝑐𝑡 𝑑𝑥 𝑐𝑒𝑛𝑡𝑟𝑎𝑙 𝑑𝑥 forward 𝑑𝑥 backward
1 0 0 × √ ×
2 ∆𝑥 0.1253
3 2∆𝑥
imax × × √