L04 - 2D Finite Difference Method
L04 - 2D Finite Difference Method
Lecture 4:
FDM - Multidimensional Problems
Instructor: Samah Alghoul
Outlines
➢Multidimensional Problems
➢2D Poisson
➢Introduction to 3D
➢ Higher-order Approximations
6/29/2019
Two Dimensional Finite Difference
› Finite difference
approximations to the
derivatives will now be derived
on the orthogonal grid,
› Assume that the nodes are uniformly spaced both in the x and y directions, such that
cross-derivative
› It is worth emphasizing that the reduction was possible because the grid is
orthogonal.
› If the grid were not orthogonal, the cross-derivative containing terms would
remain, making the derivation of the finite difference approximation
considerably more complicated.
6/29/2019 ME 626 ADVANCED NUMERICAL METHODS 8
Two Dimensional Finite Difference
› Following the same procedure for deriving the central difference scheme, we
also expand φi-1, j about φi, j, yielding
› Expanding φi,j + 1 and φi, j-1 about φi, j and following the same procedure yields
› As in the 1D case, this equation is valid only for the interior nodes, i.e., for i =
2, 3,..., N-1 and M = 2, 3,..., M-1.
∅ = ∅𝑇
∅ = ∅𝐿 ∅′ = 𝐽𝑅
𝛼∅ + 𝛽∅′ = 𝛾
6/29/2019 ME 626 ADVANCED NUMERICAL METHODS 11
Two Dimensional Finite Difference: BC
› Use the same procedure described before, with the exception that the expansion
in y direction instead of in x direction.
›
› As shown, any node on the bottom boundary, with the exception of the two
corners, has nodes both to its right as well as to its left.
› Therefore, the same procedure that was used earlier to derive the second
derivative in x can still be applied to these boundary nodes. Therefore, we
obtain
› Substitute the boundary equation into previous equations for the first derivative
and use the same procedure to cancel the third derivative.
› This yields,
› Once the nodes have been numbered uniquely, all nodal equations must first be
rearranged in the following general form:
Multidimensional Problems: 3D
› In 3D, the stencil extends in the third
direction and includes two additional nodes,
F (for forward) and B (for backward).
› Global index, k, is:
Higher-order Approximations
› So far we used second order accurate schemes.
› In many applications second-order accuracy is often considered inadequate,
such as computation of :
▪ turbulent flow
▪ acoustics calculations.
Derive this
formula
› In the event that the boundary condition is not of the symmetry or periodic
type, it is customary to revert back to a lower-order scheme for nodes adjacent
to the boundary.
› It goes without saying that such an approach will contaminate the accuracy of
the nodes where the fourth-order scheme is being used.
› As to how much the solution will be contaminated is problem dependent
(depending on the nonlinearity of the solution).
› =0 at x =0
› =1 at x=1
› S = ex
› The Analytical Solution (x) = ex + (2-e) x -1
Cylindrical Coordinate System
› As in the case of Cartesian coordinates, one can formulate 1D, 2D, and 3D
problems in the cylindrical coordinate system.
› Formulating a 1D problem in the z direction is no different than formulating a
1D problem in the Cartesian coordinate system.
› In order to derive finite difference approximations for the first and second
derivatives, we perform two Taylor series expansions as before – one forward
and one backward – as follows:
› where ∆r = r0 / (N -1)
6/29/2019 ME 626 ADVANCED NUMERICAL METHODS 45
Cylindrical Coordinate System
› Substituting in Poisson yields the necessary finite difference equation for the
interior nodes:
› The procedure for the treatment of the boundary conditions is almost identical
to the Cartesian coordinate system.
› A boundary condition at the axis, i.e., at r=0 represents the axis of symmetry,
the symmetry boundary condition is appropriate at that location and is written
as
Curvilinear Coordinates
› If the nodes are not placed along the Cartesian grid lines, Taylor series expansions
result in nonzero cross-derivative containing terms.
› Derivation of finite difference approximations becomes quite complicated and tedious.
› The basic is to transform the governing differential equation written in Cartesian
coordinates to a new coordinate system.
› This new coordinate system may have axes that are either straight lines or curves.
› For the general case of curved axes, the new coordinate is known as a curvilinear
coordinate system.
› When these curved axes align exactly with the outer contour of the computational
domain (or body), the resulting mesh is called a body-fitted mesh or body-fitted grid.
Curvilinear Coordinates
› Figure shows a Cartesian coordinate system (x1, x2, x3) and a general
curvilinear coordinate system (ξ1, ξ2, ξ3).
› In the case of the Cartesian coordinate system, the unit vectors 𝑥ො1 𝑥ො2 𝑥ො3 are
global, while in the case of the curvilinear coordinate system, the unit vectors
𝜉1 , 𝜉2 , 𝜉3 are local.
› The transformation from (x1, x2, x3) to (ξ1, ξ2, ξ3) is called forward
transformation and may be written as
› Since PDEs contain derivatives, our first task is to express each partial
derivative in the Cartesian coordinate system in terms of partial derivatives in
the curvilinear coordinate system.
› Using the chain rule of partial derivatives, we may write Jacobian of the backward
Chain rule of calculus transformation
❖ Cartesian tensor notations have been used for the sake of compactness ( it corresponds to summation for i=1,2,3).
6/29/2019 ME 626 ADVANCED NUMERICAL METHODS 57
Curvilinear Coordinates
› Therefore,
› Since [J] is at most a 3 × 3 matrix, its inverse can be determined easily using
Cramer’s rule, and subsequently, last equation may be written as
› where ij are the cofactors of the matrix [J], and J its determinant.
› It can be shown that the cofactors can be inserted inside the derivatives [see
derivation of Eq. (C.12) in Appendix C]
21 22 23 24 25
16 17 18 19 20
11 12 13 14 15
6 7 8 9 10
1 2 3 4 5