Lecture Notes Name-363 (FDM & Fem)
Lecture Notes Name-363 (FDM & Fem)
Prepared by
Dr. Md. Shahjada Tarafder
Table of Contents
Chapter 1 Introduction 4
Chapter 4 Interpolation 17
Chapter 1
Introduction
(b) Fluid flows are governed by the partial differential equation or integral equation (PDE)
which is derived on the basis of the conservation laws of mass, momentum, and energy.
Computational Fluid Dynamics (CFD) is the art of replacing such PDE systems by a set
of algebraic equations which is be solved by using digital computers.
Source: Lecture note - Kuzmin
(c) CFD is a branch of fluid mechanics that uses numerical analysis and data structures to
analyze and solve problems that involve fluid flows. Computers are used to perform the
calculations required to simulate the free-stream flow of the fluid, and the interaction of
the fluid (liquids and gases) with surfaces defined by boundary conditions. With high-
speed supercomputers, better solutions can be achieved, and are often required to solve the
largest and most complex problems.
Ongoing research yields software that improves the accuracy and speed of complex
simulation scenarios such as transonic or turbulent flows. Initial validation of such
software is typically performed using experimental apparatus such as wind tunnels. In
addition, previously performed analytical or empirical analysis of a particular problem can
be used for comparison. A final validation is often performed using full-scale testing, such
as flight tests.
CFD is applied to a wide range of research and engineering problems in many fields of
study and industries, including aerodynamics and aerospace analysis, weather simulation,
natural science and environmental engineering, industrial system design and
analysis, biological engineering, fluid flows and heat transfer,
and engine and combustion analysis.
Source: Wikipedia
Chapter 2
Governing Equations of Fluid Flows
Fluid flow is caused by the action of externally applied forces like pressure differences, gravity, shear force,
rotation and surface tension. Surface force and body force. The properties of fluids include density,
viscosity, specific heat and surface tension. While all fluids behave similarly under action of forces, their
macroscopic properties differ considerably. The effects of viscosity are important only near walls, so that
the flow in the largest part to the domain can be considered as inviscid. Fluid obeying Newton’s law of
viscosity is called Newtonian fluid.
Many other phenomena affect fluid flow. These include temperature differences which lead to heat transfer
and density differences which give rise to buoyancy. They and differences in concentration of solutes may
affect flows significantly or even be the sole cause of the flow. Phase changes (boiling, condensation,
melting and freezing) when they always lead to important modifications for the flow and give rise to
multiphase flow. Variation of other properties such as viscosity, surface tension may also play important
role in determining the nature of the flow. The basic conservation principles and laws used to derive the
governing equations of fluid flow and the techniques for the numerical solution of the governing equations.
The flow within a certain spatial region is called a control volume and the method analysis is called the
control volume approach.
The non-conservative form of equations is often used in finite difference method. To obtain an approximate
solution numerical we have to use a discretization method which approximates the differential equations
by a system of algebraic equations which can be solved on a computer. The approximations are applied to
small domains in space and or time so the numerical solutions provide results at discrete locations in space
and time. Much as the accuracy of experimental data depends on the quality of the tools used, the accuracy
of numerical solutions is dependent on the quality of discretization used.
If the fluid is inviscid, there exists a potential function (x) such that
𝑑𝜙
𝑢=
𝑑𝑥
Hence Eq. () becomes
𝑑 𝑑𝜙
(𝜌𝐴 ) = 0
𝑑𝑥 𝑑𝑥
Conservation form
Equation of continuity
+ div ( u ) = 0
t
x-momentum equation ( u) p
+ div ( uu ) = − + div ( grad u ) + S Mx
t x
y-momentum equation ( v) p
+ div ( vu ) = − + div ( grad v) + S My
t x
z-momentum equation ( w) p
+ div( wu ) = − + div( grad w) + S Mz
t z
Energy equation ( i)
+ div( iu ) = − p div u + div (k grad T ) + + Si
t
Chapter 3
Finite Difference Method
3.1 Introduction
The derivatives of the dependent variables appearing in the governing partial differential equation of fluid
flows are replaced by algebraic finite difference approximations which change the differential equation into
an algebraic equation that can be solved by simple arithmetic.
The starting point is the conservation equation in differential form. The solution domain is covered by a
grid. At each grid point, the differential equation is approximated by replacing the partial derivatives by
approximations in terms of the nodal values of the functions. The result is a system of algebraic equations
per grid node in which the variable value at a certain number of nodes appear as unknowns. Taylor’s series
expansion or polynomial is used to obtain approximations to the first and second derivatives of the variables
with respect to the co-ordinates.
(b)
(a)
If the points are numbered as i and i+1 as shown in Fig. 2.1(b), Eq. (2.1) can be written as
𝜕𝑢 (Δ𝑥)2 𝜕2 𝑢 (Δ𝑥)3 𝜕3 𝑢
𝑢𝑖+1 = 𝑢𝑖 + Δ𝑥 (𝜕𝑥 ) + 2!
(𝜕𝑥 2 ) + 3!
(𝜕𝑥 3 ) + ⋯⋯⋯ (2.2)
𝑖 𝑖 𝑖
The terms with factors of Δ𝑥 and its higher order can be written as 𝑂(Δ𝑥) and is referred to as the truncation
error and is defined as the difference between the exact value and its numerical approximations.
𝜕𝑢 𝑢𝑖+1 −𝑢𝑖
( ) = + 𝑂(Δ𝑥) (2.4)
𝜕𝑥 𝑖 Δ𝑥
This is known as forward difference formula as the derivative is approximated at point i using the forward
value 𝑢𝑖+1 at point 𝑖 + 1. Similarly, the function 𝑢(𝑥 − Δ𝑥) can be expressed as
Δ𝑥 𝜕𝑢 (Δ𝑥)2 𝜕 2 𝑢 (Δ𝑥)3 𝜕 3 𝑢
𝑢(𝑥 − Δ𝑥) = 𝑢(𝑥) − ( )+ ( 2) − ( 3) + ⋯ ⋯ ⋯
1! 𝜕𝑥 2! 𝜕𝑥 3! 𝜕𝑥
Writing in terms of node number yields
𝜕𝑢 (Δ𝑥)2 𝜕2 𝑢 (Δ𝑥)3 𝜕3 𝑢
𝑢𝑖−1 = 𝑢𝑖 − Δ𝑥 ( ) + ( 2) − ( 3) + ⋯⋯⋯ (2.5)
𝜕𝑥 𝑖 2! 𝜕𝑥 𝑖 3! 𝜕𝑥 𝑖
This is known as backward difference formula as the derivative is evaluated at point i using the backward
value 𝑢𝑖−1 . Subtracting Eq. (2.5) from Eq. (2.2) one obtains
𝜕𝑢 (Δ𝑥)3 𝜕3 𝑢
𝑢𝑖+1 − 𝑢𝑖−1 = 2 Δ𝑥 (𝜕𝑥 ) + 2 3!
(𝜕𝑥 3 ) + ⋯⋯⋯ (2.8)
𝑖 𝑖
This is known as central difference formula as the derivative is approximated at the central point i using the
forward functional value 𝑢𝑖+1 and the backward functional value 𝑢𝑖−1.
Multiplying Eq. (2.10) by 2 and then subtracting it from Eq. (2.11) we obtain
𝜕2 𝑢 𝜕3 𝑢
𝑢𝑖+2 − 2 𝑢𝑖+1 = −𝑢𝑖 + (Δ𝑥)2 ( ) + 2 (Δ𝑥)3 ( ) + ⋯⋯⋯ (2.12)
𝜕𝑥 2 𝑖 𝜕𝑥 3 𝑖
This equation represents the forward difference approximation for the second derivative of order Δ𝑥 . A
similar approximation for the second derivative for backward difference approximation can be produced
by using the Taylor series expansions of 𝑢𝑖−1 𝑎𝑛𝑑𝑢𝑖−2 as
𝜕2 𝑢 𝑢𝑖 −2𝑢𝑖−1 +𝑢𝑖−2
( ) = + 𝑂(Δ𝑥) (2.14)
𝜕𝑥 2 𝑖 (Δ𝑥)2
Solving Eq. 2.18, Eq. 2.19 and Eq. 2.20 one obtains
𝑎0 = 𝑢𝑖 (2.21)
−𝑢𝑖+2 +4𝑢𝑖+1 −3𝑢𝑖
𝑎1 = 2 ∆x
(2.22)
𝑢𝑖+2 −2𝑢𝑖+1 +𝑢𝑖
𝑎2 = 2 (∆x)2
(2.23)
(∆𝑦)2 𝜕2 𝑢
+ 2! 𝜕𝑦 2
+ 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.31)
Using indices i and j to represent a grid point at x and y plane one obtains
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖+1,𝑗+1 = 𝑢𝑖,𝑗 + ∆𝑥(𝑢𝑥 )𝑖,𝑗 + ∆𝑦(𝑢𝑦 )𝑖,𝑗 + 2!
(𝑢𝑥𝑥 )𝑖,𝑗 + 2
2!
(𝑢𝑥𝑦 )𝑖,𝑗
(∆𝑦)2
+ 2!
(𝑢𝑦𝑦 )𝑖,𝑗 + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.32)
(∆𝑦)2
+ 2!
(𝑢𝑦𝑦 )𝑖,𝑗 + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.33)
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖+1,𝑗−1 = 𝑢𝑖,𝑗 + ∆𝑥(𝑢𝑥 )𝑖,𝑗 − ∆𝑦(𝑢𝑦 )𝑖,𝑗 + 2!
(𝑢𝑥𝑥 )𝑖,𝑗 − 2
2!
(𝑢𝑥𝑦 )𝑖,𝑗
(∆𝑦)2
+ 2!
(𝑢𝑦𝑦 )𝑖,𝑗 + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.34)
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖−1,𝑗+1 = 𝑢𝑖,𝑗 − ∆𝑥(𝑢𝑥 )𝑖,𝑗 + ∆𝑦(𝑢𝑦 )𝑖,𝑗 + 2!
(𝑢𝑥𝑥 )𝑖,𝑗 − 2
2!
(𝑢𝑥𝑦 )𝑖,𝑗
(∆𝑦)2
+ (𝑢𝑦𝑦 )𝑖,𝑗 + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.35)
2!
Thus
𝜕2 𝑢 𝑢𝑖+1,𝑗+1 −𝑢𝑖−1,𝑗+1 −𝑢𝑖+1,𝑗−1 +𝑢𝑖−1,𝑗−1
𝜕𝑥𝜕𝑦
=[ 4 ΔxΔy
] + 𝑂[(Δx)2 , (Δy)2 ] (2.39)
Example 3.1 Derive the discretized form of Laplace equation in a region of xy-plane as shown in Fig.
𝜕2 𝑢 𝜕2 𝑢
+ =0 (2.40)
𝜕𝑥 2 𝜕𝑦 2
We can observe from above equation that the function value at the grid point is the average of the values at
the four adjoining points. To evaluate numerically the solution of Laplace’s equation at the grid points we
can apply Eq. () at the grid points where 𝑢𝑖,𝑗 is unknown, thus obtaining a system of linear equations. The
system of linear equations may be solved using either direct methods or iterative methods.
Ex. 3.2 The steady state two-dimensional heat flow in a metal plate is given by
𝜕2 𝑇 𝜕2 𝑇
𝜕𝑥 2
+ 𝜕𝑦2 = 0 (2.44)
Find the temperatures T1, T2, T3 and T4 using the boundary conditions as shown in Fig. below:
Node 3: 4 𝑇3 = 0 + 𝑇1 + 𝑇4 + 50
𝑇1 + 0 ∙ 𝑇2 − 4𝑇3 + 𝑇4 = −50 (2.48)
Ex. 3.3 Using finite difference method solve the Poisson equation ∇2 𝑢 = 2𝑥 2 𝑦 2 over the square domain 0
≤ x ≤3 and 0 ≤ y ≤3 with u = 0 on the boundary. The domain is to be divided into squares of unit sizes.
∇2 𝑢 = 2𝑥 2 𝑦 2 (2.51)
𝜕2𝑢 𝜕2𝑢
+ = 2𝑥 2 𝑦 2
𝜕𝑥 2 𝜕𝑦 2
𝑢𝑖+1,𝑗 −2𝑢𝑖,𝑗 +𝑢𝑖−1,𝑗 𝑢𝑖,𝑗+1 −2𝑢𝑖,𝑗 +𝑢𝑖,𝑗−1
(Δ𝑥)2
+ (Δy)2
= 2𝑥 2 𝑦 2 (2.52)
Problems
Derive a forward difference approximation of order (∆𝑥) with the use of second order polynomial.
Chapter 4
Interpolation
4.1 Introduction
The basic idea of the finite element method is to seek a piecewise approximate solution by dividing the
region of interest into small regions called elements. The functions used to represent the behavior of the
solution within an element are called the interpolation functions.
The choice of the finite element shown in Fig. 3.1 depends on the geometry of the global domain. A one-
dimensional domain is discretized by line elements where linear elements are restricted to straight sides and
quadratic and higher-order elements can have curved surfaces. Two-dimensional domain is subdivided into
triangular, rectangular and quadrilateral elements. The most common types of three-dimensional elements
are the tetrahedron and the hexahedron. The finite element interpolations are characterized by the shape of
the finite element and order of approximations.
= N1 𝑢1 + N2 𝑢2
𝑥2 −𝑥 𝑥−𝑥1
Where N1 = and N2 =
𝑥2 −𝑥1 𝑥2 −𝑥1
1 at x = 𝑥1 1 at x = 𝑥2
Note that N1 = { and N2 = {
0 at x = 𝑥2 0 at x = 𝑥1
The terms 𝑁1 and 𝑁2 are called the interpolation function (also known as trial function, shape function and
base function). The property of the shape function is given by
𝑥 −𝑥 𝑥−𝑥1
∑2𝑖=1 Ni = 2 + =1 (3.6)
𝑥 −𝑥 𝑥 2 1 2 −𝑥1
Local co-ordinate system: Let the origin of the co-ordinate system placed at node of the element so that
x1 = 0 and defining ℎ = 𝑥2 − 𝑥1 = 𝑥2 as shown in Fig. 3.3, we get from Eq. (3.5)
𝑥 𝑥
u = (1 − ℎ) 𝑢1 + ℎ 𝑢2 (3.7)
Natural or non-dimensional co-ordinate system: The co-ordinate system where the interpolation
functions are derived in terms of non-dimensional spatial variables is called a natural co-ordinate system.
(a) Origin is at node 1
u = (1 − 𝜉) 𝑢1 + 𝜉 𝑢2
written as
𝑢 = 𝛼0 + 𝛼1 𝜉 + 𝛼2 𝜉 2 + ⋯ ⋯ ⋯ + 𝛼𝑛 𝜉 𝑛 (3.8)
= 𝛼0 + 𝛼1 𝜉 for linear variation
Let ℎ = 2𝑙 and = 0 at the centre of the element as shown Fig. 3.4, we obtain from Eq. (3.8)
u= 0 1
U u u = u(x)
u1 u2
h
x/h
1 2 x
0 1
1 2
x2
Fig. 3.3 Origin is at node 1
Fig. 3.4 Origin is at the centre of the element
Node 1: 𝑢 = 𝑢1 𝑤𝑖𝑡ℎ 𝜉 = −1
𝑢1 = 𝛼0 − 𝛼1 (3.9)
Node 2: 𝑢 = 𝑢2 𝑤𝑖𝑡ℎ 𝜉 = +1
𝑢2 = 𝛼0 + 𝛼1 (3.10)
Solving Eq. (3.9) and Eq. (3.10) we get
1
𝛼0 = (𝑢1 +𝑢2 )
2
1
𝛼1 = (𝑢2 −𝑢1 )
2
Substituting the values of 𝛼0 and 𝛼1 in Eq. (3.8) we get
1 1
𝑢 = (1 − 𝜉)𝑢1 + (1 + 𝜉)𝑢2
2 2
= N1 𝑢1 + N2 𝑢2 (3.11)
where
1
N1 = (1 − 𝜉)
2
1 } (3.12)
N2 = (1 + 𝜉)
2
1 1
N1 + 𝑁2 = (1 − 𝜉) + (1 + 𝜉) = 1
2 2
Quadratic variation: Referring to Fig. 3.5, the polynomial approximation n for a variable u in non-
dimensional co-ordinate system can be written as
2
u= 0 1 2
h=2l
x/l
1 2 3
-1 0 1
1 2 3
𝑢 = 𝛼0 + 𝛼1 𝜉 + 𝛼2 𝜉 2 (3.13)
Node 1: 𝑢 = 𝑢1 𝑤𝑖𝑡ℎ 𝜉 = −1
𝑢1 = 𝛼0 − 𝛼1 + 𝛼2 (3.14)
Node 2: 𝑢 = 𝑢2 𝑤𝑖𝑡ℎ 𝜉 = 0
𝑢2 = 𝛼0 (3.15)
Node 3: 𝑢 = 𝑢3 𝑤𝑖𝑡ℎ 𝜉 = +1
𝑢3 = 𝛼0 + 𝛼1 + 𝛼2 (3.16)
Solving Eq. (3.14), (3.15) and (3.16) we get
𝛼0 = 𝑢2
1
𝛼1 = (𝑢3 − 𝑢1 )
2
1
𝛼2 = (𝑢1 + 𝑢3 ) − 𝑢2
2
Substituting the values of α0 , α1 and α2 in Eq. (3.13) and then rearranging we get
𝑢 = 𝛼0 + 𝛼1 𝜉 + 𝛼2 𝜉 2
1 1
𝑢 = 𝑢2 + 2 (𝑢3 − 𝑢1 ) 𝜉 + [2 (𝑢1 + 𝑢3 ) − 𝑢2 ]𝜉 2
1 1 1
𝑢 = 𝜉(𝜉 − 1) 𝑢1 + (1 − 𝜉 2 )𝑢2 + 𝜉(1 + 𝜉) 𝑢3
2 2 2
= N1 𝑢1 + N2 𝑢2 + N3 𝑢3 (3.17)
Where the interpolation functions are
1
N1 = 𝜉(𝜉 − 1)
2
N2 = (1 − 𝜉 2 ) (3.18)
1
𝑁3 = 2
𝜉(1 + 𝜉)}
The element is divided into equal length segments with m and n equal to order of approximations and the
number of nodes in an element respectively. Let us consider a first order approximation of a dependent
variable u such as Eq. (3.5)
u = L1 𝑢1 + L2 𝑢2 (3.20)
Where L1 and L2 from Eq. (3.19) as
𝑥−𝑥2
L1 = 𝑥
1 −𝑥2
𝑥−𝑥1 } (3.21)
L2 = 𝑥2 −𝑥1
Placing the origin of the co-ordinate system is at node 1 so that x1= 0 and defining x2 = h, we have
Prepared by Dr. Md. Shahjada Tarafder February 2023 Page 21
BUET NAME 363 – CFD (FDM & FEM)
𝑥−ℎ 𝑥
L1 = =1−
−ℎ ℎ
𝑥
L2 =
ℎ
𝑥
If 𝜉 = , the interpolation function in natural co-ordinate system can be written as
ℎ
𝜉−𝜉𝑀
𝐿𝑁 = ∏𝑛𝑀=1 𝑀≠𝑁 𝜉 (3.22)
𝑁 −𝜉𝑀
Where
𝜉−𝜉2
L1 = 𝜉 = (1 − 𝜉); (3.23)
1 −𝜉2
𝜉−𝜉1
L2 = 𝜉 =𝜉 (3.24)
2 −𝜉1
Quadratic approximation: n = 3
(𝜉−𝜉2 )(𝜉−𝜉3 )
L1 = (𝜉 ; (3.25)
1 −𝜉2 )(𝜉1 −𝜉3 )
(𝜉−𝜉1 )(𝜉−𝜉3 )
L2 = (𝜉 ; (3.26)
2 −𝜉1 )(𝜉2 −𝜉3 )
(𝜉−𝜉1 )(𝜉−𝜉2 )
L3 = (𝜉 (3.27)
3 −𝜉1 )(𝜉3 −𝜉2 )
u= 0 1 2
h=2l
x/l
1 2 3
0 1/2 1
1 2 3
1
L3 = 2ξ (ξ − ) (3.30)
2
L2 = (1 − ξ2 ); (3.32)
1
L3 = 2 ξ(ξ + 1) (3.33)
where
𝐴11 = (𝑥2 𝑦3 − 𝑥3 𝑦2 ) 𝐴12 = (𝑦2 − 𝑦3 ) 𝐴13 = (𝑥3 − 𝑥2 )
𝐴21 = (𝑥3 𝑦1 − 𝑥1 𝑦3 ) 𝐴22 = (𝑦3 − 𝑦1 ) 𝐴23 = (𝑥1 − 𝑥3 )
𝐴31 = (𝑥1 𝑦2 − 𝑥2 𝑦1 ) 𝐴32 = (𝑦1 − 𝑦2 ) 𝐴33 = (𝑥2 − 𝑥1 )
1 1 𝑥 𝑦 Δ
𝑁1 = |1 𝑥2 𝑦2 | = 1
2Δ 1 𝑥3 𝑦3 Δ
1 𝑥 𝑦
1 Δ
𝑁2 = 2Δ |1 𝑥3 𝑦3 | = 2
Δ
1 𝑥1 𝑦1
Prepared by Dr. Md. Shahjada Tarafder February 2023 Page 25
BUET NAME 363 – CFD (FDM & FEM)
1 𝑥 𝑦
1 Δ3
𝑁3 = |1 𝑥1 𝑦1 | =
2Δ 1 𝑥2 𝑦2 Δ
Where Δ1 , Δ2 and Δ3 are the areas of PCB, PAC and PAB which are opposite to nodes 1, 2 and 3
respectively.
The global co-ordinate (x, y) are related the natural co-ordinate through the expressions:
𝑥 = 𝐿1 𝑥1 + 𝐿2 𝑥2 + 𝐿3 𝑥3
𝑦 = 𝐿1 𝑦1 + 𝐿2 𝑦2 + 𝐿3 𝑦3
Now
1 = 𝐿1 + 𝐿2 + 𝐿3
𝑥 = 𝐿1 𝑥1 + 𝐿2 𝑥2 + 𝐿3 𝑥3
𝑦 = 𝐿1 𝑦1 + 𝐿2 𝑦2 + 𝐿3 𝑦3
1 1 1 1 𝐿1
[𝑥 ] = [𝑥1 𝑥2 𝑥3 ] [𝐿2 ]
𝑦 𝑦1 𝑦2 𝑦3 𝐿3
1 1 1 −1 1 1 1 1 −1 1 1 1 𝐿1
[𝑥1 𝑥2 𝑥3 ] [𝑥 ] = [𝑥1 𝑥2 𝑥3 ] [𝑥1 𝑥2 𝑥3 ] [𝐿2 ]
𝑦1 𝑦2 𝑦3 𝑦 𝑦1 𝑦2 𝑦3 𝑦1 𝑦2 𝑦3 𝐿3
1 1 1 −1 1 𝐿1
[𝑥1 𝑥2 𝑥3 ] [𝑥 ] = [𝐿2 ]
𝑦1 𝑦2 𝑦3 𝑦 𝐿3
𝐿1 = 𝑁1
𝐿2 = 𝑁2 }
𝐿3 = 𝑁3
Fig. 3.9 Natural co-ordinate triangular element Fig. 3.10 Natural co-ordinate triangular element
with quadratic variation with cubic variation
Referring to Fig. 3.11 with three additional nodes installed at mid-sides of the triangle, we may write at
each corner and mid-side node
𝑥1 = 𝑎1 𝑥2 = 𝑎2 𝑥3 = 𝑎3
1 1 1 1 1 1 1 1 1
𝑥4 = 𝑎1 + 𝑎2 + 𝑎4 𝑥5 = 𝑎2 + 𝑎3 + 𝑎5 𝑥6 = 𝑎1 + 𝑎3 + 𝑎6
2 2 4 2 2 4 2 2 4
Solving for the constant and substituting into Eq. (3.34) we obtain
𝑁1 = (2𝐿1 − 1)𝐿1 𝑁2 = (2𝐿2 − 1)𝐿2 𝑁3 = (2𝐿3 − 1)𝐿3
𝑁4 = 4𝐿1 𝐿2 𝑁5 = 4𝐿2 𝐿3 𝑁6 = 4𝐿3 𝐿1
∬ 𝑓(𝑁) 𝑑𝑥 𝑑𝑦 = ∬ 𝑓(𝑥, 𝑦) 𝑑𝑥 𝑑𝑦
If the functions 𝑓(𝑥, 𝑦) are of higher order, the explicit integration becomes extremely cumbersome. Let
us consider an integral
𝐼 = ∬ 𝑥 𝑝 𝑦 𝑞 𝑑𝑥 𝑑𝑦
The limit of this integral must be calculated from the slope of each side of the triangle oriented from the
reference Cartesian coordinates. The final form of the integral consists of the sum of the integrals performed
along all three sides of the triangle. With the origin of the Cartesian co-ordinates at the centroid the
following results are obtained:
𝑛=1 𝐼 = ∬ 𝑥 𝑑𝑥 𝑑𝑦 = ∬ 𝑦 𝑑𝑥 𝑑𝑦 = 0
𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=2 𝐼= (𝑥 𝑦 + 𝑥2 𝑦2 + 𝑥3 𝑦3
12 1 1
𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=3 𝐼 = 30 (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=4 𝐼 = 60 (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
2𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=4 𝐼 = 105 (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
For one-dimensional element with two co-ordinates L1 and L2 takes the form
𝑚! 𝑛!
𝐼 = ∫ 𝐿𝑚 𝑛
1 𝐿2 𝑑𝐴 = 𝐿
(𝑚 + 𝑛 + 1)!
𝐴
The integration of the interpolation function over the two-dimensional triangular element with co-ordinate
L1, L2 and L3can be represented as
∫ 𝑓(𝑁) 𝑑𝐴 = ∫ 𝑓(𝐿𝑁 ) 𝑑𝐴
𝐴 𝐴
𝑝 𝑚! 𝑛! 𝑝!
𝐼 = ∫ 𝐿𝑚 𝑛
1 𝐿2 𝐿3 𝑑𝐴 = 2𝐴
(𝑚 + 𝑛 + 𝑝 + 2)!
𝐴
1
𝑁4 = (𝑏 − 𝑥)(𝑎 − 𝑦)
4𝑎𝑏
𝑥 𝑦
The shape functions can also be expressed in terms of length ratio 𝜉 = and 𝜂 = , we obtain
𝑏 𝑎
1
𝑁1 = (1 − 𝜉)(1 − 𝜂) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
4
1
𝑁2 = 4 (1 + 𝜉)(1 − 𝜂) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
1
𝑁3 = 4 (1 + 𝜉)(1 + 𝜂) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
1
𝑁4 = 4 (1 − 𝜉)(1 − 𝜂) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
The variation of the variable u over the element may also be written as
𝑢 = 𝛼0 + 𝛼1 𝜉 + 𝛼2 𝜂 + 𝛼3 𝜉𝜂
𝛼0
𝛼
= [1 𝜉 𝜂 𝜉𝜂] [𝛼1 ]
2
𝛼3
= [1 𝜉 𝜂 𝜉𝜂][𝛼]
Applying the boundary conditions in terms of nodal values we obtain
Node 1: 𝑢1 = 𝛼0 − 𝛼1 − 𝛼2 + 𝛼3
Node 2: 𝑢2 = 𝛼0 + 𝛼1 − 𝛼2 − 𝛼3
Node 3: 𝑢3 = 𝛼0 + 𝛼1 + 𝛼2 + 𝛼3
Node 4: 𝑢4 = 𝛼0 − 𝛼1 + 𝛼2 − 𝛼3
The above equations can be written into a matrix form as
𝑢1 1−1 −1 1 𝛼0
𝑢2 𝛼
[𝑢 ] = [1 1 −1 −1 ] [𝛼1 ]
3 1 1 1 1 2
𝑢4 1 −1 1 −1 𝛼3
[𝑢] = [𝐷][𝛼]
[𝑎] = [𝐷]−1 [𝑢]
1 1 1 1
1
[𝐷]−1 = [−1 1 1 −1 ]
4 −1 −1 1 1
1 −1 1 −1
𝑢 = [1 𝜉 𝜂 𝜉𝜂][𝐷]−1 [𝑢]
1 1 1 1 𝑢1
1 −1 1 1 −1 𝑢2
= [1 𝜉 𝜂 𝜉𝜂] [ ][ ]
4 −1 −1 1 1 𝑢3
1 −1 1 −1 𝑢4
1
= [(1 − 𝜉 − 𝜂 + 𝜉𝜂)𝑢1 + (1 + 𝜉 − 𝜂 − 𝜉𝜂)𝑢2 +(1 + 𝜉 + 𝜂 + 𝜉𝜂)𝑢3 + (1 − 𝜉 + 𝜂 − 𝜉𝜂)𝑢4 ]
4
1
= [(1 − 𝜉)(1 − 𝜂)𝑢1 + (1 + 𝜉)(1 − 𝜂)𝑢2 +(1 + 𝜉)(1 + 𝜂)𝑢3 + (1 − 𝜉)(1 + 𝜂)𝑢4 ]
4
= 𝑁1 𝑢1 + 𝑁2 𝑢2 + 𝑁3 𝑢3 + 𝑁4 𝑢4
Now the shape functions for quadrilateral element are
1 1
𝑁1 = 4 (1 − 𝜉)(1 − 𝜂) 𝑁2 = 4 (1 + 𝜉)(1 − 𝜂)
1 1
𝑁3 = 4 (1 + 𝜉)(1 + 𝜂) 𝑁4 = 4 (1 − 𝜉)(1 + 𝜂)
𝑥 = 𝑁1 𝑥1 + 𝑁2 𝑥2 + 𝑁3 𝑥3 + 𝑁4 𝑥4 = ∑ 𝑁𝑖 𝑥𝑖
𝑖=1
4
𝑦 = 𝑁1 𝑦1 + 𝑁2 𝑦2 + 𝑁3 𝑦3 + 𝑁4 𝑦4 = ∑ 𝑁𝑖 𝑦𝑖
𝑖=1
Chapter 5
Finite Element Method
5.1 Introduction
In finite element method, the fluid domain under consideration in divided into finite number of sub-domain
known as elements. A simple function assumed for the variation of each dependent variable inside each
element. The summation of variation of the dependent variable in each element used to describe the whole
flow field. If u is assumed to vary linearly inside an element, we can define a second derivative for it. Since
most fluid problems include second derivative, the following techniques is designed to over this problem.
The partial differential equation is multiplied by an unknown function and then the whole equation can be
integrated over the domain which it applies. Finally, the terms that need to have the order of their derivatives
reduced are integrated by parts. This is known as producing a variation formulation.
The governing equations are multiplied by a weight function before they are integrated over the entire
domain. The solution is approximated by a linear shape function within each in a way that guarantees
continuity of the solution across element boundaries. Such a function can be constructed from its values the
corners of the element.
This approximation is then substituted into the weighted integral of the conservations law and the equations
to be solved are derived by requiring the derivative of the integral with respect to each nodal value to be
zero. This corresponds to selecting the best solution with the set of the allowed functions.
Calculus of variations, branch of mathematics concerned with the problem of finding a function for which
the value of a certain integral is either the largest or the smallest possible. Many problems of this kind are
easy to state, but their solutions commonly involve difficult procedures of the
differential calculus and differential equations.
The calculus of variations is a field of mathematical analysis that uses variations, which are small changes
in functions and functionals, to find maxima and minima of functionals: mappings from a set
of functions to the real numbers. Functionals are often expressed as definite integrals involving functions
and their derivatives. Functions that maximize or minimize functionals may be found using the Euler–
Lagrange equation of the calculus of variations.
Fig. 4.1
Since x is fixed varied during the variation from u to 𝑢 + 𝛿𝑢, 𝑑𝑥 = 0. Now from Eq. (4.3)
𝜕𝐹 𝜕𝐹
𝑑𝐹 = 𝑑𝑢 + ′ 𝑑𝑢′
𝜕𝑢 𝜕𝑢
= 𝛿𝐹
The operator acts as differential operation with respect to dependent variables and the laws of variation
of sums, products, ratios and powers are completely analogous to the corresponding laws of differentiation
as follows:
(a) 𝛿(𝐹1 ± 𝐹2 ) = 𝛿𝐹1 ± 𝛿𝐹2
(b) 𝛿(𝐹1 ∙ 𝐹2 ) = 𝐹2 𝛿𝐹1 + 𝐹1 𝛿𝐹2
𝐹 𝐹2 𝛿𝐹1 −𝐹1 𝛿𝐹2
(c) 𝛿 ( 1 ) =
𝐹2 𝐹22
𝑑 𝑑𝑢
(e) (𝛿𝑢) = 𝛿( )
𝑑𝑥 𝑑𝑥
Proof
𝑑 𝑑 𝑑𝜂
(𝛿𝑢) = (𝜖𝜂) = 𝜖
𝑑𝑥 𝑑𝑥 𝑑𝑥
𝑑𝑢 𝑑 𝑑𝑢 𝑑𝜂
𝛿( ) = (𝑢 + 𝜖𝜂) − =𝜖
𝑑𝑥 𝑑𝑥 𝑑𝑥 𝑑𝑥
𝑑 𝑑𝑢
(𝛿𝑢) = 𝛿 ( )
𝑑𝑥 𝑑𝑥
𝑏 𝑏
(f) 𝛿 ∫𝑎 𝑢(𝑥)𝑑𝑥 = ∫𝑎 𝛿𝑢𝑑𝑥
Proof
𝑏 𝑏 𝑏 𝑏 𝑏 𝑏
𝛿 ∫𝑎 𝑢(𝑥)𝑑𝑥 = ∫𝑎 (𝑢 + 𝜖𝜂) 𝑑𝑥 − ∫𝑎 𝑢 𝑑𝑥 = ∫𝑎 𝑢𝑑𝑥 + ∫𝑎 𝜖𝜂𝑑𝑥 − ∫𝑎 𝑢 𝑑𝑥
𝑏
= ∫ 𝜖𝜂𝑑𝑥
𝑎
𝑏 𝑏
∫ 𝛿𝑢𝑑𝑥 = ∫ 𝜖𝜂𝑑𝑥
𝑎 𝑎
𝑏 𝑏
𝛿 ∫ 𝑢(𝑥)𝑑𝑥 = ∫ 𝛿𝑢𝑑𝑥
𝑎 𝑎
𝑏 𝑏 𝑏
(g) 𝛿 ∫𝑎 𝑥 𝑢(𝑥)𝑑𝑥 = ∫𝑎 𝑥 (𝑢 + 𝜖𝜂)𝑑𝑥 − ∫𝑎 𝑥𝑢𝑑𝑥
𝑏 𝑏 𝑏 𝑏
= ∫𝑎 𝑥 𝑢 𝑑𝑥 + ∫𝑎 𝑥 𝜖𝜂𝑑𝑥 − ∫𝑎 𝑥 𝑢 𝑑𝑥 = ∫𝑎 𝑥 𝜖𝜂𝑑𝑥
𝑏 𝑏
𝛿 ∫ 𝑥 𝑢 (𝑥)𝑑𝑥 = ∫ 𝑥 𝛿𝑢𝑑𝑥
𝑎 𝑎
= 𝛿(∇𝐹)
1
(i) 𝑔𝑟𝑎𝑑(𝛿𝐹) ∙ 𝑔𝑟𝑎𝑑𝐹 = 2 𝛿|𝑔𝑟𝑎𝑑𝐹|2
𝜕 𝜕 𝜕𝐹 𝜕𝐹
∇(𝛿𝐹) ∙ ∇𝐹 = [𝑖 𝜕𝑥 𝛿𝐹 + 𝑗 𝜕𝑦 𝛿𝐹] ∙ [𝑖 𝜕𝑥 + 𝑗 𝜕𝑦]
𝜕𝐹 𝜕𝐹 𝜕𝐹 𝜕𝐹
= [𝑖𝛿 (𝜕𝑥 ) + 𝑗𝛿 (𝜕𝑦)] ∙ [𝑖 𝜕𝑥 + 𝑗 𝜕𝑦]
𝜕𝐹 𝜕𝐹 𝜕𝐹 𝜕𝐹
=𝛿( ) +𝛿( )
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
𝜕𝐹 𝜕𝐹
Applying the formula 𝛿𝐹 = 𝛿𝑢 + 𝛿𝑢′
𝜕𝑢 𝜕𝑢′
𝜕 𝜕𝐹 𝜕 𝜕𝐹 𝜕𝐹 𝜕 𝜕𝐹 𝜕 𝜕𝐹 𝜕𝐹
∇(𝛿𝐹) ∙ ∇𝐹 = [𝜕𝑥 (𝜕𝑥 ) 𝛿𝑥 + 𝜕𝑦 (𝜕𝑥 ) 𝛿𝑦] 𝜕𝑥 + [𝜕𝑥 (𝜕𝑦) 𝛿𝑥 + 𝜕𝑦 (𝜕𝑦) 𝛿𝑦] 𝜕𝑦
𝜕𝐹 𝜕 𝜕𝐹 𝜕𝐹 𝜕 𝜕𝐹 𝜕𝐹 𝜕 𝜕𝐹 𝜕𝐹 𝜕 𝜕𝐹
= [𝜕𝑥 𝜕𝑥 (𝜕𝑥 ) + 𝜕𝑦 𝜕𝑥 (𝜕𝑦)] 𝛿𝑥 + [𝜕𝑥 𝜕𝑦 (𝜕𝑥 ) + 𝜕𝑦 𝜕𝑦 (𝜕𝑦)] 𝛿𝑦
1 𝜕 𝜕𝐹 2 𝜕𝐹 2 1 𝜕 𝜕𝐹 2 𝜕𝐹 2
= [( ) + ( ) ] 𝛿𝑥 + [( ) + (𝜕𝑦) ] 𝛿𝑦
2 𝜕𝑥 𝜕𝑥 𝜕𝑦 2 𝜕𝑦 𝜕𝑥
𝜕𝐹 𝜕𝐹
Applying the formula 𝛿𝐹 = 𝜕𝑢 𝛿𝑢 + 𝜕𝑢′ 𝛿𝑢′
1 𝜕𝐹 2 𝜕𝐹 2
= 2
𝛿 [( 𝜕𝑥
) + (𝜕𝑦) ]
1
= 𝛿|∇ 𝐹|2
2
5.3 Functional
The definite integral of the form
𝑏 𝑑𝑢
𝐼(𝑢) = ∫𝑎 𝐹(𝑥, 𝑢, 𝑢́ ) 𝑑𝑥, 𝑢 = 𝑢(𝑥), 𝑢́ = 𝑑𝑥
𝑑𝑢
is called a functional in which the integrand 𝐹(𝑥, 𝑢, 𝑢́ ) is a function of the argument x, u and 𝑑𝑥
.
Mathematically, a functional is an operator mapping u into a scalar 𝐼(𝑢)and the functions 𝑢 = 𝑢(𝑥) maps
u with respect to x. The integrand 𝐹(𝑥, 𝑢, 𝑢́ ) is a function of functions of u(x).
(a) A functional 𝐼(𝑢) is said to be linear in u if and only if it satisfies the following relation.
for any scalars and and dependent variables u and v. An example for a linear functional is
𝐿
dv
𝐼(𝑣) = ∫ 𝑣 𝑓 𝑑𝑥 + 𝐿 𝑀0
0 dx
(b) A functional 𝐵(𝑢, 𝑣) is said to be bilinear if it is linear in each of its arguments u and v.
(c) A bilinear functional is said to be symmetric its u and v if 𝐵(𝑢, 𝑣) = 𝐵(𝑣, 𝑢). An example of a
symmetric functional is as follows:
𝑏 du dv
𝐼(𝑢, 𝑣) = ∫𝑎 𝐸𝐴 dx dx
𝑑𝑥
Example 5.1 Determine the functional of the following boundary value problem
d2 u
dx2
= 𝑓(𝑥) with 𝑢(𝑎) = 𝑢(𝑏) = 0
Solution:
𝑏 𝑏 𝑏 𝑏
𝛿 ∫ 𝑓(𝑥) 𝑢 𝑑𝑥 = ∫ 𝑓(𝑥) 𝛿𝑢 𝑑𝑥 𝑆𝑖𝑛𝑐𝑒 𝛿 ∫ 𝑥 𝑢(𝑥) 𝑑𝑥 = ∫ 𝑥 𝛿𝑢 𝑑𝑥
𝑎 𝑎 𝑎 𝑎
𝑏
= ∫ 𝑓(𝑥) 𝛿𝑢 𝑑𝑥
𝑎
𝑏
d2 u
=∫ 𝛿𝑢 𝑑𝑥
𝑎 dx 2
du 𝑏 𝑏 du d
= [𝛿𝑢 dx ] − ∫𝑎 (𝛿𝑢) 𝑑𝑥
𝑎 dx dx
𝑏 du du
= − ∫𝑎 dx 𝛿 (dx ) 𝑑𝑥
1 𝑏 du 2
= − ∫ 𝛿 ( ) 𝑑𝑥
2 𝑎 dx
𝑏
1 du 2
= −𝛿 ∫ ( ) 𝑑𝑥
𝑎 2 dx
𝑏
1 du 2
𝛿 ∫ [𝑓(𝑥) 𝑢 + ( ) ] 𝑑𝑥 = 0
𝑎 2 dx
Now the functional defined by the minimum value of the integral can be obtained as
b
1 du 2
𝐼(𝑢) = ∫ [ ( ) + u(x)𝑓(𝑥)] 𝑑𝑥
2 dx
a
Example 5.2 Determine the functional of the following boundary value problem
∇2 u = −𝑓(𝑥, 𝑦) with u = 0 on the boundary C of the region S.
Solution:
Method 1:
𝛿 ∬ 𝑓 𝑢 𝑑𝑥 𝑑𝑦 = ∬ 𝑓 𝛿𝑢 𝑑𝑥 𝑑𝑦
𝑆 𝑆
𝛿 ∬ 𝑓𝑢 𝑑𝑥 𝑑𝑦 = − ∬ ∇2 u 𝛿𝑢 𝑑𝑥 𝑑𝑦
𝑆 𝑆
𝛿 ∬ 𝑓𝑢 𝑑𝑥 𝑑𝑦 = ∬ ∇𝛿𝑢 ∙ ∇u 𝑑𝑥 𝑑𝑦 − ∬ ∇ ∙ (𝛿𝑢∇u) 𝑑𝑥 𝑑𝑦
𝑆 𝑆 𝑆
1
Applying Gauss divergence theorem and ∇(𝛿𝐹) ∙ ∇ 𝐹 = = 2
𝛿|∇ 𝐹|2 we have
1
𝛿 ∬ 𝑓 𝑢 𝑑𝑥 𝑑𝑦 = ∬ δ|∇u|2 dx dy − ∫ 𝛿𝑢(∇u ∙ n) dS
2 𝐶
𝑆 𝑆
1
𝛿 ∬𝑆 𝑓 𝑢 𝑑𝑥 𝑑𝑦 = δ ∬𝑆 |∇u|2 dx dy
2
1 ∂u 2 ∂u 2
δ ∬ [ {( ) + ( ) } − 𝑓𝑢] dx dy = 0
2 ∂x ∂y
𝑆
1 ∂u 2 ∂u 2
𝐼(𝑢) = ∬ [ {( ) + ( ) } − 𝑓𝑢] dx dy
2 ∂x ∂y
𝑆
Method 2:
Let us consider a function v(x, y) that satisfies the boundary condition 𝑣 = 0 𝑜𝑛 𝐶.
∇2 u = −𝑓(𝑥, 𝑦)
Multiplying both sides by v(𝑥, 𝑦) and then integrating we obtain
∬ 𝑣 ∇2 u dx dy = − ∬ 𝑣 𝑓𝑑𝑥 𝑑𝑦
S S
∬ ∇v ∙ ∇u 𝑑𝑥 𝑑𝑦 − ∬ ∇ ∙ (𝑣∇u) 𝑑𝑥 𝑑𝑦 = ∬ 𝑣 𝑓𝑑𝑥 𝑑𝑦
S S S
∂v ∂u ∂v ∂u
∬( + ) dx dy − ∫ 𝑣(∇u ∙ n)𝑑𝑠 = ∬ 𝑣 𝑓𝑑𝑥 𝑑𝑦
∂x ∂x ∂y ∂y C
S S
Where n is the unit normal vector on the arc and the terms inside the first bracket of Eq. () are bilinear and
setting 𝑣 = 𝑢 in the bilinear terms and then multiplying by ½ we get the functional as
1 ∂u 2 ∂u 2
I(u) = ∬ [ {( ) + ( ) } − u 𝑓] dx dy
2 ∂x ∂y
S
(b) d2 u 𝑑𝑢
dx2
+ 𝑘𝑢 = 𝑓(𝑥) with 𝑢(0) = 0, |
𝑑𝑥 𝑥=1
=1
b
1 du 2
𝐼(𝑢) = ∫ [( ) − k u2 + 2 u x 2 ] 𝑑𝑥 − 𝑢(1)
2 dx
a
2
(c) ∇ u = 0 with u = 0 on the boundary C of R
1 ∂u 2 ∂u 2
I(u) = ∬ [ {( ) + ( ) }] dx dy
2 ∂x ∂y
S
2
(d) ∇ u = −𝑓(𝑥, 𝑦) with u = 0 on the boundary C of R
1 ∂u 2 ∂u 2
I(u) = ∬ [ {( ) + ( ) } − u 𝑓] dx dy
2 ∂x ∂y
S
4
(e) 𝑑 𝑢 𝑑2 𝑢
𝐸𝐼 + 𝑘𝑢 = 𝑓(𝑥) 𝑤𝑖𝑡ℎ 𝑢 = = 0 𝑎𝑡 𝑥 = 0, 1
𝑑𝑥 4 𝑑𝑥 2
2
1 𝑑2𝑢
I(u) = ∬ [( 2 ) + 𝑘𝑢2 − 2𝑢𝑓] dx
2 𝑑𝑥
S
The relation between u and x is not known and the problem consists of finding the relation so that I become
either a maximum or a minimum. The necessary condition for extremum of the function is
𝑑𝐼
| =0
𝑑𝜀 𝜀=0
Let 𝑢 = 𝜂(𝑥) be any function with continuous second derivative which vanishes at the end points of the
interval (𝑥0 , 𝑥1 ) and 𝑢 = 𝑢0 (𝑥) + 𝜀 𝜂(𝑥) represents a family of curves passing through(𝑥0 , 𝑢0 )and
(𝑥1 , 𝑢1 ). Now from Eq. () one obtains
𝑏
𝐼 = ∫ 𝐹(𝑥, 𝑢0 + 𝜀 𝜂, 𝑢0′ + 𝜀 𝜂 ′ ) 𝑑𝑥
𝑎
The Taylor’s series expansion for a multivariable function 𝐹(𝑥, 𝑢0 + 𝜀 𝜂, 𝑢0′ + 𝜀 𝜂 ′ )about a point
(𝑥0 , 𝑢0 , 𝑢0′ ) can be expressed as
𝜕𝐹 𝜕𝐹 1 𝜕2 𝐹 𝜕2 𝐹 1 𝜕2 𝐹
𝐹(𝑥, 𝑢, 𝑢′ ) = 𝐹(𝑥, 𝑢0 , 𝑢0′ ) + [ 𝜀 𝜂+ 𝜀 𝜂 ′ ] + (𝜀𝜂)2 +(𝜀𝜂 𝜀𝜂 ′ ) + (𝜀𝜂 ′ )2 2 + ⋯⋯
𝜕𝑢0 𝜕𝑢0′ 2 𝜕𝑢02 𝜕𝑢0 𝜕𝑢0′ 2 𝜕𝑢0′
Integrating Eq. () between a and b and taking the derivative with respect to , we obtain
𝑏
𝑑𝐼 𝜕𝐹 𝜕𝐹 𝜕2𝐹 𝜕2𝐹 𝜕2𝐹
= ∫ [0 + ( 𝜂 + ′ 𝜂 ′ ) + (𝜀𝜂 2 + 2𝜀 𝜂𝜂 ′ + 𝜀𝜂 ′
2 ) + ⋯ ⋯ ] 𝑑𝑥
𝑑𝜀 𝑎 𝜕𝑢0 𝜕𝑢0 𝜕𝑢0 𝜕𝑢0 𝜕𝑢0′ 𝜕𝑢0′
𝜕𝑢 𝜕𝑢
𝐼(𝑢) = ∫ 𝐹 (𝑥, 𝑦, 𝑢, , ) 𝑑𝑥𝑑𝑦
𝜕𝑥 𝜕𝑦
𝑅
𝜕𝐹 𝜕 𝜕𝐹 𝜕 𝜕𝐹
− [ 𝜕𝑢 ] − [ 𝜕𝑢 ] = 0
𝜕𝑢 𝜕𝑥 𝜕 ( ) 𝜕𝑦 𝜕 ( )
𝜕𝑥 𝜕𝑥
Example 5.3 Find out the Euler Lagrange equation that extremizes the following functional
1 𝑏
du 2 𝑑𝑢
𝐼(𝑢) = ∫ [( ) + u2 + 2 u x] 𝑑𝑥 = ∫ 𝐹 (𝑥, 𝑢, ) 𝑑𝑥
dx 𝑑𝑥
0 𝑎
𝑑𝑢 du 2
Now 𝐹 (𝑥, 𝑢, 𝑑𝑥 ) = (dx ) + u2 + 2 u x
𝜕𝑢 2 𝜕𝑢 2
𝐼(𝑢) = ∬ {( ) + ( ) − 2𝑢𝑓} 𝑑𝑥𝑑𝑦
𝜕𝑥 𝜕𝑦
2 2
𝜕𝜙𝑖 𝜕𝜙𝑖
𝐼(𝑢) = ∬ {(∑ 𝛼𝑖 ) + (∑ 𝛼𝑖 ) − 2 ∑ 𝛼𝑖 𝜙𝑖 𝑓} 𝑑𝑥𝑑𝑦
𝜕𝑥 𝜕𝑦
−2 ∬ ∑ 𝛼𝑖 𝜙𝑖 𝑓 𝑑𝑥 𝑑𝑦
𝜕𝐼
= 2𝐴𝑖𝑖 𝛼𝑖 + 2 ∑ 𝐴𝑖𝑗 𝛼𝑗 − 2 ℎ𝑖
𝜕𝛼𝑖
𝑗≠𝑖
Where
And
ℎ𝑖 = ∬ 𝜙𝑖 𝑓 𝑑𝑥 𝑑𝑦
Now the variation parameters are to be chosen such that 𝐼(𝛼𝑖 ) is a minimum. Thus
𝜕𝐼
=0
𝜕𝛼𝑖
2𝐴𝑖𝑖 𝛼𝑖 + 2 ∑ 𝐴𝑖𝑗 𝛼𝑗 − 2 ℎ𝑖 = 0
𝑗≠𝑖
𝑛
∑ 𝐴𝑖𝑗 𝛼𝑗 = ℎ𝑖
𝑗=0
The above equation is a system of linear algebraic equations for the unknown parameters 𝛼𝑗 which has a
unique solution.
1
1 du 2
𝐼(𝑢) = ∫ [− ( ) + u2 + 2 u x] 𝑑𝑥
2 dx
0
∫ u 𝑑𝑥 = ∫[𝛼12 (𝑥 2 − 2𝑥 3 + 𝑥 4 ) + 2 𝛼1 𝛼2 (𝑥 3 − 2𝑥 4 + 𝑥 5 ) + 𝛼22 (𝑥 4 − 2𝑥 5 + 𝑥 6 ) ] 𝑑𝑥
2
0 0
1 1 1 1
𝑥3 𝑥4 𝑥5 𝑥4 𝑥5 𝑥6 𝑥5 𝑥6 𝑥7
2
∫ u 𝑑𝑥 = 𝛼12 [ 2
− 2 + ] + 2 𝛼1 𝛼2 [ − 2 + ] + 𝛼2 [ − 2 + ]
3 4 5 0 4 5 6 0 5 6 7 0
0
1 1
𝜕𝐼 3 3 1
= − 𝛼1 − 𝛼2 + = 0
𝜕𝛼1 5 10 6
𝜕𝐼 3 26 1
= − 𝛼1 − 𝛼2 + =0
𝜕𝛼2 10 105 10
Solving these two equations we get
1988 7
𝛼1 = 10332 = 0.1924 and 𝛼2 = 41 = 0.1707
𝑠𝑖𝑛𝑥
𝑢= −𝑥
𝑠𝑖𝑛1
Solution:
The functional of the problem is given by
1
d2 u
𝐼(𝑢) = − ∫ u [2x + ] 𝑑𝑥
dx 2
0
1 𝑛 1 𝑛 𝑛
d2 𝜙𝑗
≈ − [2 ∫ ∑ 𝛼𝑖 𝑥 𝜙𝑖 𝑑𝑥 + ∫ ∑ ∑ 𝛼𝑖 𝛼𝑗 𝜙𝑖 𝑑𝑥]
dx 2
0 𝑖=1 0 𝑖=1 𝑗=1
Defining
1
𝑝𝑖 = ∫ 𝑥 𝜙𝑖 𝑑𝑥
0
𝐼(𝑢) ≈ − [2 ∑ 𝛼𝑖 𝑝𝑖 + ∑ ∑ 𝛼𝑖 𝛼𝑗 𝑞𝑖𝑗 ]
𝑖=1 𝑖=1 𝑗=1
𝑖 = 1: 𝑝1 + 𝛼1 𝑞11 + 𝛼2 𝑞12 = 0
𝑖 = 2: 𝑝2 + 𝛼1 𝑞21 + 𝛼2 𝑞22 = 0
Let 𝑢(𝑥) ≈ 𝛼1 𝜙1 (𝑥) + 𝛼2 𝜙2 (𝑥) with 𝜙1 (𝑥) = 𝑥(1 − 𝑥) and 𝜙2 (𝑥) = 𝑥 2 (1 − 𝑥)
𝜙1′ (𝑥) ≈ (1 − 2𝑥) and 𝜙2′ (𝑥) ≈ (2𝑥 − 3𝑥 2 )
Now
1 1
1
𝑝1 = ∫ 𝑥 𝜙1 𝑑𝑥 = ∫ 𝑥 2 (1 − 𝑥) 𝑑𝑥 =
12
0 0
1 1
1
𝑝2 = ∫ 𝑥 𝜙2 𝑑𝑥 = ∫ 𝑥 3 (1 − 𝑥) 𝑑𝑥 =
20
0 0
1 1
𝑑𝜙1 2 1
𝑞11 = −∫( ) 𝑑𝑥 = ∫(1 − 2𝑥)2 = −
𝑑𝑥 3
0 0
1 1
𝑑𝜙2 2 2
𝑞22 = −∫( ) 𝑑𝑥 = − ∫(2𝑥 − 3𝑥 2 )2 𝑑𝑥 = −
𝑑𝑥 15
0 0
1
1
𝑞12 = 𝑞21 = − ∫(1 − 2𝑥) (2𝑥 − 3𝑥 2 ) 𝑑𝑥 = −
6
0
1 1
≈ 𝑥(1 − 𝑥) + 𝑥 2 (1 − 𝑥)
6 6
1
≈ 𝑥(1 − 𝑥 2 )
6
Choosing different weighting functions and replacing each of them in Eq. (), we can generate a system of
linear equations in the unknown parameters αi that will determine an approximation of 𝜙 in form of finite
series given in Eq. (). The type of weighting function chosen depends on the type of weighted residual
technique selected. In the Galerkin method, the weights are set equal to the shape functions 𝑁𝑖 (𝑥).
Example 5.6
𝑑2 𝑢
+𝑢+𝑥 =0 with 𝑢(𝑥) = 0 𝑎𝑡 𝑥 = 0, 1
𝑑𝑥
Let us consider an approximate solution given by 𝑢(𝑥) ≈ 𝛼1 𝑁1 (𝑥) + 𝛼2 𝑁2 (𝑥). The interpolation functions
N1(x) and N2(x) are defined by
𝑁1 (𝑥) = 𝑥(1 − 𝑥) and
𝑁2 (𝑥) = 𝑥 2 (1 − 𝑥) in such a way that satisfies the boundary conditions,
𝑁1 (x) = 𝑁2 (𝑥) = 0 𝑎𝑡 𝑥 = 0, 1.
Now the approximate solution and the residual R(x) are respectively written as
𝑢 = 𝛼1 𝑥(1 − 𝑥) + 𝛼2 𝑥 2 (1 − 𝑥) = 𝛼1 𝑁1 + 𝛼2 𝑁2
𝑑2 𝑢
𝑅(𝑥) = +𝑢+𝑥
𝑑𝑥
Setting the integrals of the product of the Residual and the weighted functions 𝑁1 (𝑥) and 𝑁2 (𝑥) gives
1
∫ 𝑅(𝑥) 𝑁1 (𝑥) = 0
0
1
∫ 𝑅(𝑥) 𝑁2 (𝑥) = 0
0
1
𝑑2 𝑢
∫ [ + 𝑢 + 𝑥] 𝑁1 (𝑥) = 0
0 𝑑𝑥2
𝑑𝑢 1 1
𝑑𝑢 𝑑𝑁1 (𝑥) 1 1
[𝑁1 (𝑥) ] − ∫ 𝑑𝑥 + ∫ 𝑢 𝑁1 (𝑥) 𝑑𝑥 + ∫ 𝑁1 (𝑥) 𝑥 𝑑𝑥 = 0
𝑑𝑥 0 0 𝑑𝑥 𝑑𝑥 0 0
Multiplying both sides by the shape function N(x) and then integrating over the element we get
𝑥𝑖+1 𝑥𝑖+1
𝑑2 𝑢
∫ 𝑁(𝑥) 2 𝑑𝑥 = − ∫ 𝑁(𝑥) 𝑓(𝑥) 𝑑𝑥
𝑑𝑥
𝑥𝑖 𝑥𝑖
𝑥𝑖+1 𝑥𝑖+1
𝑑𝑢 𝑥𝑖+1 𝑑𝑁(𝑥) 𝑑𝑢
[𝑁(𝑥) ] −∫ 𝑑𝑥 = − ∫ 𝑁(𝑥) 𝑓(𝑥) 𝑑𝑥
𝑑𝑥 𝑥𝑖 𝑑𝑥 𝑑𝑥
𝑥𝑖 𝑥𝑖
in which 𝑁𝑗 are the shape functions and j represents the number of nodes over the element. Substituting Eq.
() into Eq. () we obtain
𝑛 𝑥𝑖+1 𝑥𝑖+1
(𝑖) 𝑑𝑁𝑖 (𝑥) 𝑑𝑁𝑗 (𝑥) 𝑑𝑢 (𝑖) 𝑑𝑢 (𝑖)
∑ 𝑢𝑗 ∫ 𝑑𝑥 = ∫ 𝑁𝑖 (𝑥) 𝑓(𝑥)𝑑𝑥 + [𝑁(𝑥) ] − [𝑁(𝑥) ]
𝑑𝑥 𝑑𝑥 𝑑𝑥 𝑥𝑖+1 𝑑𝑥 𝑥𝑖
𝑗=1 𝑥𝑖 𝑥𝑖
(𝑖 = 1, 2, 3 ⋯ ⋯ 𝑛)
Eq. () for the i-th element can be finally written into a matrix form as
𝑛
(𝑖) (𝑖) (𝑖)
∑ 𝐾𝑖𝑗 𝑢𝑗 = 𝐹𝑖
𝑗=1
(𝑖) (𝑖)
Where 𝐾𝑖𝑗 and 𝐹𝑖 are called the stiffness matrix and force vector respective and are given by
𝑥𝑖+1
(𝑖) 𝑑𝑁𝑖 (𝑥) 𝑑𝑁𝑗 (𝑥)
𝐾𝑖𝑗 = ∫ 𝑑𝑥
𝑑𝑥 𝑑𝑥
𝑥𝑖
𝑥𝑖+1
(𝑖) 𝑑𝑢 (𝑖) 𝑑𝑢 (𝑖)
𝐹𝑖 = ∫ 𝑁𝑖 (𝑥) 𝑓(𝑥)𝑑𝑥 + [𝑁(𝑥) ] − [𝑁(𝑥) ]
𝑑𝑥 𝑥𝑖+1 𝑑𝑥 𝑥𝑖
𝑥𝑖
Eq. () is a system of linear algebraic equations and can be solved by Cramer’s rule or L-U decomposition
(𝑖)
method for the value of 𝑢𝑗 .
𝑑2 𝑢 𝑑𝑢
Example 5.7 Solve the boundary value problem 𝑑𝑥 2 = −2 with 𝑢(𝑥) = 0 𝑎𝑡 𝑥 = 0 𝑎𝑛𝑑 𝑑𝑥
= 0 𝑎𝑡 𝑥 = 1
by finite element method and then compare the numerical result with the analytical one.
Solution:
Let the solution over 𝑖-th element be approximated by
𝑛
(𝑖)
𝑢(𝑥) ≈ ∑ 𝑁𝑗 (𝑥) 𝑢𝑗
𝑗=1
And the discretized form of the above differential equation can be expressed as
𝑛
(𝑖) (𝑖) (𝑖)
∑ 𝐾𝑖𝑗 𝑢𝑗 = 𝐹𝑖
𝑗=1
where (i) denotes the element number, i is the node number over the element and
𝑥𝑖+1
(𝑖) 𝑑𝑁𝑖 (𝑥) 𝑑𝑁𝑗 (𝑥)
𝐾𝑖𝑗 = ∫ 𝑑𝑥
𝑑𝑥 𝑑𝑥
𝑥𝑖
𝑥𝑖+1
(𝑖) 𝑑𝑢 (𝑖) 𝑑𝑢 (𝑖)
𝐹𝑖 = ∫ 𝑁𝑖 (𝑥) 𝑓(𝑥)𝑑𝑥 + [𝑁(𝑥) ] − [𝑁(𝑥) ]
𝑑𝑥 𝑥𝑖+1 𝑑𝑥 𝑥𝑖
𝑥𝑖
If the region of interest [0, 1] is divided into two equal intervals as shown in Fig the shape functions at node
𝑖 and 𝑖 + 1can be obtained as
1
𝑥 −𝑥 𝑥−𝑥𝑖 −𝑥 𝑥−0
Ni (x) = 𝑥 𝑖+1−𝑥 ; Ni+1 (x) = 𝑥 N1 (x) = 21 ; N2 (x) = 1
𝑖+1 𝑖 𝑖+1 −𝑥𝑖 −0 −0
2 2
Where
(1) 1/2 𝑑𝑁1 𝑑𝑁1 (1) 1/2 𝑑𝑁1 𝑑𝑁2
𝐾11 = ∫0 𝑑𝑥 𝑑𝑥
𝑑𝑥 𝐾12 = ∫0 𝑑𝑥 𝑑𝑥
𝑑𝑥
(1) 1/2 𝑑𝑁2 𝑑𝑁1 (1) 1/2 𝑑𝑁2 𝑑𝑁2
𝐾21 = ∫0 𝑑𝑥 𝑑𝑥
𝑑𝑥 𝐾22 = ∫0 𝑑𝑥 𝑑𝑥
𝑑𝑥
(𝒊) (𝒊)
(i) Calculation of 𝑲𝒊𝒋 and 𝑭𝒊 for Element 1:
(1) (1)
𝐾11 = 2 𝐾12 = −2,
(1) (1)
𝐾21 = −2, 𝐾22 = 2
And the force vectors at nodes 1and 2 are
𝑥𝑖+1
(1) 𝑑𝑢 (1) 𝑑𝑢 (1) 1 𝑑𝑢 (1)
𝐹1 = −2 ∫ 𝑁1 𝑑𝑥 + [𝑁(𝑥) ] − [𝑁(𝑥) ] = − [𝑁(𝑥) ]
𝑑𝑥 𝑥𝑖+1 𝑑𝑥 𝑥𝑖 2 𝑑𝑥 𝑥𝑖
𝑥𝑖
[𝑠𝑖𝑛𝑐𝑒 𝑁𝑖 = 1, 𝑁𝑖+1 = 0]
𝑥𝑖+1
(1) 𝑑𝑢 (1) 𝑑𝑢 (1) 1 𝑑𝑢 (1)
𝐹2 = −2 ∫ 𝑁2 𝑑𝑥 + [𝑁(𝑥) ] − [𝑁(𝑥) ] = + [𝑁(𝑥) ]
𝑑𝑥 𝑥𝑖+1 𝑑𝑥 𝑥𝑖 2 𝑑𝑥 𝑥𝑖+1
𝑥𝑖
[𝑠𝑖𝑛𝑐𝑒 𝑁𝑖 = 0, 𝑁𝑖+1 = 1]
Now the matrix for element 1 can be expressed as
1 𝑑𝑢 (1)
(1) − |
2 −2 𝑢1 2 𝑑𝑥 1
[ ] [ (1) ] =
−2 2 𝑢
2
1 𝑑𝑢 (1)
+ |
[2 𝑑𝑥 2 ]
(𝒊) (𝒊)
(ii) Calculation of 𝑲𝒊𝒋 and 𝑭𝒊 for Element 2:
(2) (2)
𝐾11 = 2, 𝐾12 = −2,
(2) (2)
𝐾21 = −2, 𝐾22 = 2
Prepared by Dr. Md. Shahjada Tarafder February 2023 Page 54
BUET NAME 363 – CFD (FDM & FEM)
(2) 1 𝑑𝑢 (2) 1 𝑑𝑢
𝐹1 = −[ ] , 𝐹2 = +[ ]
2 𝑑𝑥 𝑥𝑖 2 𝑑𝑥 𝑥𝑖+1
solution from the boundary condition gives 𝑢1 = 0 and the global matrix can finally be written as
1
4 −2 𝑢2
[ ] [𝑢 ] = [1]
−2 2 3
2
Now the solution of the matrix system is
3
𝑢2 = 4, 𝑢3 = 1
The approximate solution throughout the interval [0, 1]is finally obtained as
2 (1) (1) 1
𝑁1 (𝑥)𝑢1 + 𝑁2 (𝑥)𝑢2 0<𝑥≤
𝑢(𝑥) ≈ ∑ 𝑁𝑗 (𝑥) 𝑢𝑗 = { 2
(2) (2) 1
𝑗=1 𝑁1 (𝑥)𝑢1 + 𝑁2 (𝑥)𝑢2 <𝑥≤ 1
2
3 1
𝑥 0<𝑥≤
={ 2 2
𝑥+1 1
<𝑥≤ 1
2 2
𝜕2 𝑢 𝜕2 𝑢
Example 5.8 Solve the poisons equation by the finite element method (𝜕𝑥 2 + 𝜕𝑦2 ) = −𝑓(𝑥, 𝑦)
with u = 0 on the boundary condition of the square (0 < 𝑥 ≤ 1, 0 < 𝑦 ≤ 1)
Solution:
∇2 𝑢 = −𝑓(𝑥, 𝑦)
Multiplying both sides of the equation by the shape function−𝑁(𝑥, 𝑦) and integrating, we obtain
𝜕𝑢 𝜕𝑁 𝜕𝑢 𝜕𝑁
∬( + ) 𝑑𝑥 𝑑𝑦 − ∫ (𝑁 ∇u) ∙ 𝑛 𝑑𝑠 = ∬ 𝑁 𝑓(𝑥, 𝑦)𝑑𝑠
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
Ω 𝐶 Ω
𝜕𝑢 𝜕𝑁 𝜕𝑢 𝜕𝑁
∬( + ) 𝑑𝑥 𝑑𝑦 = ∫ 𝑞𝑛 𝑁 𝑑𝑠 + ∬ 𝑁𝑓 𝑑𝑥 𝑑𝑦
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
Ω 𝐶 Ω
𝜕𝑢 𝜕𝑢
Where 𝑞𝑛 = ∇u ∙ 𝑛 = 𝑛 + 𝑛𝑦 and n is the unit normal vector on the boundary C and dS is the arc
𝜕𝑥 𝑥 𝜕𝑦
length of an infinitesimal element along the boundary. Let the solution 𝑢 be approximated as
𝑛
(𝑖)
𝑢 ≈ ∑ 𝑁𝑗 𝑢𝑗
𝑗=1
in which 𝑁𝑗 are the the shape functions and j represents the number of nodes over the element. Eq. () for i-
th element can be expressed as
Prepared by Dr. Md. Shahjada Tarafder February 2023 Page 56
BUET NAME 363 – CFD (FDM & FEM)
𝑛
𝜕𝑁𝑖 𝜕𝑁𝑗 𝜕𝑁𝑖 𝜕𝑁𝑗 (𝑖)
∑∬( + ) 𝑢 𝑑𝑥 𝑑𝑦 = ∬ 𝑓 𝑁𝑖 𝑑𝑥 𝑑𝑦 + ∫ 𝑞𝑛 𝑁𝑖 𝑑𝑆
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝑗
𝑗=1 Ω Ω 𝐶
(𝑖)
𝐹𝑖 = ∬ 𝑓 𝑁𝑖 𝑑𝑥 𝑑𝑦 + ∫ 𝑞𝑛 𝑁𝑖 𝑑𝑠
Ω 𝐶
We apply Eq. () at each of three nodes of element 1 and write these equations into a matrix form as
(1) (1) (1) (1) (1)
𝑘11 𝑘12 𝑘13 𝑢1 𝐹1
(1) (1) (1) (1) (1)
𝑘21 𝑘22 𝑘23 [𝑢2 ] = [𝐹2 ]
(1) (1) (1) (1) (1)
[𝑘31 𝑘32 𝑘33 ] 𝑢3 𝐹3
Where
(1) 𝜕𝑁1 𝜕𝑁1 𝜕𝑁1 𝜕𝑁1 (1) (1) 𝜕𝑁1 𝜕𝑁2 𝜕𝑁1 𝜕𝑁2
𝑘11 = ∬Ω ( + ) 𝑑𝑥 𝑑𝑦; 𝑘12 = 𝑘21 = ∬Ω ( + ) 𝑑𝑥 𝑑𝑦
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
𝜕2 𝑢 𝜕2 𝑢
Now solution for (𝜕𝑥 2 + 𝜕𝑦 2 ) = −2 with u = 0 on the boundary of the square (0 < 𝑥 ≤ 1, 0 < 𝑦 ≤ 1)
(𝒊) (𝒊)
(i) Calculation of 𝑲𝒊𝒋 and 𝑭𝒊 for Element 1:
1 𝑥 𝑦 1 𝑥 𝑦
∆2 1
𝑁2 = = |1 𝑥3 𝑦3 | = 4 |1 1/2 1/2| = 2(𝑥 − 𝑦)
∆ 2∆ 1 𝑥 𝑦1
1 1 0 0
1 𝑥 𝑦 1 𝑥 𝑦
∆3 1
𝑁3 = = |1 𝑥1 𝑦1 | = 4 |1 0 0| = 2𝑦
∆ 2∆ 1 𝑥 𝑦2 1 1/2 0
2
Matrix solution:
Let the global solutions be 𝑢1 , 𝑢2 , 𝑢3 , 𝑢4 , 𝑢5 𝑎𝑛𝑑 𝑢6 at the respective six vertices. Now the matrix with
respect to global co-ordinate system can be written as
1 1
2 − 0 0 0 0
2 1 l1(1)
u1
1 1 (1)
0 0 u2
1
1 − 0 l2
2 2
u3 1 1 l3
(1)
0 0 u = 12 0 + 0
0 1 1
− 0
2 2 4
0 0 0 0
0 0 u5 0 0
0 0 0 0 0 0 u6 0 0
0 0 0
0 0 0
0 0 0 0 0
0
0 1
0 −
1
0 0 u1 0 0
2 2 u 1 (2)
0 0 0 0 0 0 2 l1
u3 1 0 0
0 − 1 = +
0 u4 12 1 l2(2)
1
0 1 −
2 2
u5 1 l3(2)
0 0 0
1 1
0 u
2 2 6 0 0
0 0 0
0 0 0
0 0 0 0 0 0
0 0 u
0 0 0 0
1 0 0
1 1 1
0 0 0 − 0 u2 0
2 2 u3 1 0 l1
(4)
0 0 0 0 0 0 = +
u4 12 1 0
1 1 1 l2(4)
0 0 − 0 1 − u5
2 2 (4 )
u
0 l3
1 1 6
0 0 0 0 −
2 2
0 0 0 0 0 0
0 1
−
1
0 0 0 u1 1 0
2 2
u 1 (3)
1 1 2 l3
0 − 1 0 − 0 u3 1 1 l2(3)
2 2 u = 12 0 + 0
0 0 0 1 0 0 4
u5 0 l1(3)
0 0 −
1
0
1
0 u
2 2 6 0 0
0 0 0
0 0 0
1 −1 0 0 0 0 u1 1 l1(1)
(3)
−1
4 −2 −1 0 0 u2 3
l (1)
2 + l1
(2)
+ l3
0 −2 4 0 −2
0 u3 1 3 l3 + l2 + l1
(1) (3) (4)
= +
0 −1 0 2 −1 0 u4 12 1 l2(2)
0 0 −2 −1 4 −1 u5
3 l3 + l1 + l2
(2) (3) (4 )
0 0 0 0 −1 1 u6 1 l3(4)
From the boundary conditions we have 𝑢1 = 𝑢2 = 𝑢4 = 𝑢5 = 𝑢6 = 0. Now Eq. () gives
1 (1) (2) (3)
−2 𝑢3 = + 𝑙2 + 𝑙1 + 𝑙3
4
1 (1) (3) (4)
2 𝑢3 = 4 + 𝑙3 + 𝑙2 + 𝑙1
1 (2) (3) (4)
−2 𝑢3 = + 𝑙3 + 𝑙1 + 𝑙2
4
From Eq. () we obtain
1 1 (1) (3) (4)
𝑢3 = + [𝑙 + 𝑙2 + 𝑙1 ]
8 2 3
(1) (1)
But 𝑙3 = ∫𝐶123 𝑞𝑛 2𝑦 𝑑𝑠
0.5 0.5 0
(1) (1) (1)
=∫ [𝑞𝑛 2𝑦] 𝑑𝑥 + ∫ [𝑞𝑛 2𝑦] 𝑑𝑥 + ∫ [𝑞𝑛 2𝑦] 𝑑𝑥 = 0
𝑦=0 𝑥=0.5 𝑦=𝑥
0 0 0.5
(3) (4)
Similarly, 𝑙2 = 𝑙1 = 0
1
So, the final solution is 𝑢3 = 8
The shape functions for a linear triangular element at node 1, 2 and 3 are as follows:
1
𝑁1 (𝑥, 𝑦) = [𝑎 + 𝑏1 𝑥 + 𝑐1 𝑦]
2Δ 1
1
𝑁2 (𝑥, 𝑦) = [𝑎 + 𝑏2 𝑥 + 𝑐2 𝑦]
2Δ 2
1
𝑁3 (𝑥, 𝑦) = [𝑎 + 𝑏3 𝑥 + 𝑐3 𝑦]
2Δ 3
(𝑖)
𝐾𝑖𝑗 is symmetric and all terms under the integral are constant. Differentiating the shape functions with
respect to x and y we have from Eq. () as
(𝑖) 𝐾
𝐾𝑖𝑗 = ∬(𝑏𝑖 𝑏𝑗 + 𝑐𝑖 𝑐𝑗 ) 𝑑𝐴
4𝐴2
Ω
𝐾 𝑏1 𝑏1 + 𝑐1 𝑐1 𝑏1 𝑏2 + 𝑐1 𝑐2 𝑏1 𝑏3 + 𝑐1 𝑐3
= [𝑏2 𝑏1 + 𝑐2 𝑐1 𝑏2 𝑏2 + 𝑐2 𝑐2 𝑏2 𝑏3 + 𝑐2 𝑐3 ]
4𝐴2
𝑏3 𝑏1 + 𝑐3 𝑐1 𝑏3 𝑏2 + 𝑐3 𝑐2 𝑏3 𝑏3 + 𝑐3 𝑐3
And the co-efficient values of the shape functions of a linear triangular element are
i 𝑎𝑖 𝑏𝑖 𝑐𝑖
1 𝑥2 𝑦3 − 𝑥3 𝑦2 𝑦2 −𝑦3 𝑥3 − 𝑥2
2 𝑥3 𝑦1 − 𝑥1 𝑦3 𝑦3 − 𝑦1 𝑥1 − 𝑥3
3 𝑥2 𝑦1 − 𝑥1 𝑦2 𝑦1 −𝑦2 𝑥2 − 𝑥1