Professional Documents
Culture Documents
Name-363 FDM - Fem
Name-363 FDM - Fem
Prepared by
Dr. Md. Shahjada Tarafder
Course Outcomes:
Upon completion of the course, the students will be able
• To formulate and solve computational problems arising in the flow of fluids
• To assess the accuracy of a numerical solution by comparison to known solutions of
simple test problems and by mesh refinement studies.
• To predict forces on the airfoils, ship hulls etc.
• To interpret computational results and to write a report conveying the result of the
computational analysis
Course Outcomes:
After successful completion of this course the student should be able:
• To be familiar with the differential equations for flow phenomena and numerical
methods for their solution
• To use and develop flow simulation software for the most important classes of flows in
engineering and science
• To analyze different mathematical models and computational methods for flow
simulations critically
• To undertake flow computations using current best practice for model and method
selection, and assessment of the quality of results obtained.
A fluid is said to be a continuous substance (continuum) that begins to form when a shear
force is applied and continues to deform as long as force is applied. Forces imposed on a
fluid may be either surface forces or body forces. A continuum prevails if the number of
molecules in a volume much smaller than the sphere’s sufficiently great so that the
average effects on the fluid properties like pressure, density etc. within the volume are
constant or change smoothly with time.
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.
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. Now-a-days
the various types of CFD techniques have been developed to simulate the fluid flows
involving a wide range of applications. These include
(a) Finite Difference Method (FDM)
(b) Finite Element Method (FEM)
(c) Finite Volume Method (FVM)
(d) Boundary Element Method (BEM)
(e) Spectral Method (SM) and so on.
(a) Potential flow theory: The fluid is continuum, inviscid and obeying Newton’s
law.
(b) Viscous flow theory: The fluid is continuum, viscous and obeys Stokes
postulations for stress and Fourier’s postulation for heat conduction.
(c) Turbulent flow theory: The fluid is continuum, viscous and obeys a set of
turbulent postulations for turbulent Reynolds stress and heat flux respectively.
Discretization method
This is a method of approximating the differential equations by a system of algebraic
equations for the variables at some sent of discrete locations in space and time. The most
common discretization methods are finite difference method, finite volume method, finite
element method and the boundary element method.
Solution method:
2.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.2)
𝜕𝑥 𝑖 2! 𝜕𝑥 𝑖 3! 𝜕𝑥 3 𝑖
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)
𝜕𝑥 𝑖 Δ𝑥
𝜕𝑢 (2 Δ𝑥)2 𝜕2 𝑢 (2 Δ𝑥)3 𝜕3 𝑢
𝑢𝑖+2 = 𝑢𝑖 + 2 Δ𝑥 ( ) + ( 2
) + ( ) + ⋯⋯⋯ (2.11)
𝜕𝑥 𝑖 2! 𝜕𝑥 𝑖 3! 𝜕𝑥 3 𝑖
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
+ ⋯ ⋯ ⋯ ∞]
(∆𝑥)2
= (𝑎 + 𝑏 + 𝑐 )𝑢𝑖 − (2𝑐 + 𝑏)∆𝑥 (𝑢𝑥 )𝑖 + (4𝑐 + 𝑏)(𝑢𝑥𝑥 )𝑖 + ⋯ ⋯ ⋯ ∞
2
Taking the coefficients of similar terms from both sides of above equation we obtain
𝑎+𝑏+𝑐 =0
2𝑐 + 𝑏 = −1
4𝑐 + 𝑏 = 0
After solving we get
3 1
𝑎= ; 𝑏 = −2 and 𝑐 =
2 2
(∆𝑦)2 𝜕2 𝑢
+ + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.31)
2! 𝜕𝑦 2
Using indices i and j to represent a grid point at x and y plane one obtains
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖+1,𝑗+1 = 𝑢𝑖,𝑗 + ∆𝑥 (𝑢𝑥 )𝑖,𝑗 + ∆𝑦(𝑢𝑦 )𝑖,𝑗 + (𝑢𝑥𝑥 )𝑖,𝑗 + 2 (𝑢𝑥𝑦 )
2! 2! 𝑖,𝑗
(∆𝑦)2
+ (𝑢𝑦𝑦 ) + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.32)
2! 𝑖,𝑗
(∆𝑦)2
+ (𝑢𝑦𝑦 ) + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.33)
2! 𝑖,𝑗
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖+1,𝑗−1 = 𝑢𝑖,𝑗 + ∆𝑥 (𝑢𝑥 )𝑖,𝑗 − ∆𝑦(𝑢𝑦 )𝑖,𝑗 + (𝑢𝑥𝑥 )𝑖,𝑗 − 2 (𝑢𝑥𝑦 )
2! 2! 𝑖,𝑗
(∆𝑦)2
+ (𝑢𝑦𝑦 ) + 𝑂[(∆𝑥)3 , (∆𝑦)3 ] (2.34)
2! 𝑖,𝑗
(∆𝑥)2 ∆𝑥∆𝑦
𝑢𝑖−1,𝑗+1 = 𝑢𝑖,𝑗 − ∆𝑥 (𝑢𝑥 )𝑖,𝑗 + ∆𝑦(𝑢𝑦 )𝑖,𝑗 + (𝑢𝑥𝑥 )𝑖,𝑗 − 2 (𝑢𝑥𝑦 )
2! 2! 𝑖,𝑗
𝜕𝑢
Substituting a central differencing scheme of of order (x)2we have
𝜕𝑥
𝜕2 𝑢 1 𝑢𝑖+1,𝑗+1 −𝑢𝑖−1,𝑗+1 𝑢𝑖+1,𝑗−1 −𝑢𝑖−1,𝑗−1
= [ − ] + 𝑂[(Δx)2 , (Δy)2 ] (2.38)
𝜕𝑥𝜕𝑦 2 Δy 2 Δx 2 Δx
Thus
𝜕2 𝑢 𝑢𝑖+1,𝑗+1 −𝑢𝑖−1,𝑗+1 −𝑢𝑖+1,𝑗−1 +𝑢𝑖−1,𝑗−1
=[ ] + 𝑂[(Δx)2 , (Δy)2 ] (2.39)
𝜕𝑥𝜕𝑦 4 ΔxΔy
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. 2.2 The steady state two-dimensional heat flow in a metal plate is given by
𝜕2 𝑇 𝜕2 𝑇
2
+ =0 (2.44)
𝜕𝑥 𝜕𝑦 2
Node 3: 4 𝑇3 = 0 + 𝑇1 + 𝑇4 + 50
𝑇1 + 0 ∙ 𝑇2 − 4𝑇3 + 𝑇4 = −50 (2.48)
Ex. 2.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.
3.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 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
𝑥2 −𝑥 𝑥−𝑥1
∑2𝑖=1 Ni = + =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 , we get from Eq. (3.5)
𝑥 𝑥
= (1 − ) 𝑢1 + 𝑢2 (3.7)
ℎ ℎ
u1 u2
h
x/h
1 2 x
0 1
1 2
x2
Fig. 3.2 Linear interpolation in
natural coordinate system Fig. 3.2 Linear interpolation in natural
coordinate system
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 = (𝑢 +𝑢 )
2 1 2
1
𝛼1 = (𝑢2 −𝑢1 )
2
Substituting the values of 𝛼0 and 𝛼1in 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)
N 2 = (1 + 𝜉 )
2
1 1
N1 + 𝑁2 = (1 − 𝜉 ) + (1 + 𝜉 ) = 1
2 2
u= 0 1 2
h=2l
x/l
1 2 3
-1 0 1
1 2 3
= N1 𝑢1 + N2 𝑢2 + N3 𝑢3 (3.17)
Where the interpolation functions are
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
Placing the origin of the co-ordinate system is at node 1 so that x1= 0 and defining x2 = h,
we have
𝑥−ℎ 𝑥
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 )
2
u= 0 1 2
h=2l
x/l
1 2 3
0 1/2 1
1 2 3
L2 = (1 − ξ2 ); (3.32)
1
L3 = ξ ( ξ + 1 ) (3.33)
2
1
[(𝑥 𝑦 − 𝑥1 𝑦3 ) + 𝑥 (𝑦3 − 𝑦1 ) + 𝑦(𝑥1 − 𝑥3 )]𝑢2 +
2Δ 3 1
1
[𝑥 𝑦 − 𝑥1 𝑦2 ) + 𝑥 (𝑦1 −𝑦2 ) + 𝑦(𝑥2 − 𝑥1 )]𝑢3
2Δ 2 1
u = 𝑁1 𝑢1 + 𝑁2 𝑢2 + 𝑁3 𝑢3
where
1
𝑁1 (𝑥, 𝑦) = [(𝑥 𝑦 − 𝑥3 𝑦2 ) + 𝑥 (𝑦2 −𝑦3 ) + 𝑦(𝑥3 − 𝑥2 )]
2Δ 2 3
1
𝑁2 (𝑥, 𝑦) = [(𝑥 𝑦 − 𝑥1 𝑦3 ) + 𝑥 (𝑦3 − 𝑦1 ) + 𝑦(𝑥1 − 𝑥3 )]
2Δ 3 1
1
𝑁3 (𝑥, 𝑦) = [(𝑥 𝑦 − 𝑥2 𝑦1 ) + 𝑥 (𝑦1 − 𝑦2 ) + 𝑦(𝑥2 − 𝑥1 )]
2Δ 1 2 }
Defining
𝑎1 = 𝑥2 𝑦3 − 𝑥3 𝑦2 𝑏1 = 𝑦2 −𝑦3 𝑐1 = 𝑥3 − 𝑥2
𝑎2 = 𝑥3 𝑦1 − 𝑥1 𝑦3 𝑏2 = 𝑦3 − 𝑦1 𝑐2 = 𝑥1 − 𝑥3
𝑎3 = 𝑥1 𝑦2 − 𝑥2 𝑦1 𝑏3 = 𝑦1 −𝑦2 𝑐3 = 𝑥2 − 𝑥1
1 𝑥 𝑦
1 Δ
𝑁2 = |1 𝑥3 𝑦3 | = 2
2Δ Δ
1 𝑥1 𝑦1
1 𝑥 𝑦
1 Δ
𝑁3 = |1 𝑥1 𝑦1 | = 3
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.
3.3.2 Natural Co-ordinate Triangular element
Let us consider a triangle with the natural co-ordinate 𝐿𝑁 whose values are zero along the
sides and one on the vertices with a linear variation in between ash shown in Fig. 5.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
Referring to Fig. () 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 𝐼= (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
12
𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=3 𝐼= (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
30
𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=4 𝐼= (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
60
2𝐴 𝑝 𝑞 𝑝 𝑞 𝑝 𝑞
𝑛=4 𝐼= (𝑥1 𝑦1 + 𝑥2 𝑦2 + 𝑥3 𝑦3
105
For one-dimensional element with two co-ordinates L1 and L2 takes the form
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)!
𝐴
obtain
1
𝑁1 = (1 − 𝜉 )(1 − 𝜂 ) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
4
1
𝑁2 = (1 + 𝜉 )(1 − 𝜂 ) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
4
1
𝑁3 = (1 + 𝜉 )(1 + 𝜂 ) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
4
1
𝑁4 = (1 − 𝜉 )(1 − 𝜂 ) with −1 < 𝜉 ≤ 1 𝑎𝑛𝑑 − 1 < 𝜂 ≤ 1
4
[𝑢] = [𝐷 ][𝛼]
[𝑎] = [𝐷 ]−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
4
+ (1 − 𝜉 + 𝜂 − 𝜉𝜂 )𝑢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 = (1 − 𝜉 )(1 − 𝜂 ) 𝑁2 = (1 + 𝜉)(1 − 𝜂)
4 4
1 1
𝑁3 = (1 + 𝜉)(1 + 𝜂) 𝑁4 = (1 − 𝜉)(1 + 𝜂)
4 4
𝑥 = 𝑁1 𝑥1 + 𝑁2 𝑥2 + 𝑁3 𝑥3 + 𝑁4 𝑥4 = ∑ 𝑁𝑖 𝑥𝑖
𝑖=1
4
𝑦 = 𝑁1 𝑦1 + 𝑁2 𝑦2 + 𝑁3 𝑦3 + 𝑁4 𝑦4 = ∑ 𝑁𝑖 𝑦𝑖
𝑖=1
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.
(x0,y0) P0
y(x)
x0 x1 x
𝜕𝐹 𝜕𝐹 𝜕𝐹 𝜕𝐹
𝛿𝐹 = 𝜖 ( 𝜂 + ′ 𝜂′ ) = 𝜖𝜂 + ′ 𝜖𝜂 ′
𝜕𝑢 𝜕𝑢 𝜕𝑢 𝜕𝑢
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) (𝛿𝑢) = 𝛿 ( )
𝑑𝑥 𝑑𝑥
𝑑 𝑑 𝑑𝜂
(𝛿𝑢) = (𝜖𝜂 ) = 𝜖
𝑑𝑥 𝑑𝑥 𝑑𝑥
𝑑𝑢 𝑑 𝑑𝑢 𝑑𝜂
𝛿( )= (𝑢 + 𝜖𝜂 ) − =𝜖
𝑑𝑥 𝑑𝑥 𝑑𝑥 𝑑𝑥
𝑑 𝑑𝑢
(𝛿𝑢) = 𝛿 ( )
𝑑𝑥 𝑑𝑥
𝑏 𝑏 𝑏
(f) 𝛿 ∫𝑎 𝑢(𝑥)𝑑𝑥 = ∫𝑎 (𝑢 + 𝜖𝜂 ) 𝑑𝑥 − ∫𝑎 𝑢 𝑑𝑥
𝑏 𝑏 𝑏
= ∫ 𝑢𝑑𝑥 + ∫ 𝜖𝜂𝑑𝑥 − ∫ 𝑢 𝑑𝑥
𝑎 𝑎 𝑎
= ∫ 𝜖𝜂𝑑𝑥
𝑎
𝑏 𝑏
𝛿 ∫ 𝑢(𝑥)𝑑𝑥 = ∫ 𝛿𝑢𝑑𝑥
𝑎 𝑎
𝑏 𝑏 𝑏
(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
4.3 Functional
The definite integral of the form
𝑏 𝑑𝑢
𝐼(𝑢) = ∫𝑎 𝐹(𝑥, 𝑢, 𝑢́ ) 𝑑𝑥, 𝑢 = 𝑢 (𝑥 ) , 𝑢́ =
𝑑𝑥
(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 3.1 Determine the functional of the following boundary value problem
d2 u
= 𝑓(𝑥) with 𝑢(𝑎) = 𝑢(𝑏) = 0
dx2
Solution:
𝑏 𝑏
𝛿 ∫ 𝑓 (𝑥) 𝑢 𝑑𝑥 = ∫ 𝑓 (𝑥) 𝛿𝑢 𝑑𝑥
𝑎 𝑎
𝑏
= ∫ 𝑓 (𝑥) 𝛿𝑢 𝑑𝑥
𝑎
𝑏
d2 u
=∫ 2
𝛿𝑢 𝑑𝑥
𝑎 dx
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
Example 3.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 𝛿𝑢 𝑑𝑥 𝑑𝑦
𝑆 𝑆
Vector identity: ∇ ∙ (𝐹 ∇𝐺 ) = ∇𝐹 ∙ ∇𝐺 + 𝐹 ∇2 G
Replacing F by u and G by u, we get ∇ ∙ (𝛿𝑢∇u) = ∇𝛿𝑢 ∙ ∇u + 𝛿𝑢∇2 u and hence
𝛿 ∬ 𝑓𝑢 𝑑𝑥 𝑑𝑦 = ∬ ∇𝛿𝑢 ∙ ∇u 𝑑𝑥 𝑑𝑦 − ∬ ∇ ∙ (𝛿𝑢∇u) 𝑑𝑥 𝑑𝑦
𝑆 𝑆 𝑆
1
Applying Gauss divergence theorem and ∇(𝛿𝐹 ) ∙ ∇ 𝐹 = = 𝛿 |∇ 𝐹 |2 we have
2
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
𝑆
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 𝑑𝑢
+ 𝑘𝑢 = 𝑓(𝑥) with 𝑢(0) = 0, | =1
dx2 𝑑𝑥 𝑥=1
b
1 du 2
𝐼(𝑢) = ∫ [( ) − k u2 + 2 u x 2 ] 𝑑𝑥 − 𝑢(1)
2 dx
a
1 ∂u 2 ∂u 2
I(u) = ∬ [ {( ) + ( ) }] dx dy
2 ∂x ∂y
S
1 ∂u 2 ∂u 2
I(u) = ∬ [ {( ) + ( ) } − u 𝑓] dx dy
2 ∂x ∂y
S
(e) 𝑑4 𝑢 𝑑2 𝑢
𝐸𝐼 4 + 𝑘𝑢 = 𝑓 (𝑥) 𝑤𝑖𝑡ℎ 𝑢 = 2 = 0 𝑎𝑡 𝑥 = 0, 1
𝑑𝑥 𝑑𝑥
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 becomes 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 𝐹
𝐹 (𝑥, 𝑢, 𝑢′ ) = 𝐹 (𝑥, 𝑢0 , 𝑢0′ ) + [ 𝜀𝜂+ ′
′ 𝜀 𝜂 ]+
(𝜀𝜂 )2 (
2 + 𝜀𝜂 𝜀𝜂
′)
+
𝜕𝑢0 𝜕𝑢0 2 𝜕𝑢0 𝜕𝑢0 𝜕𝑢0′
1 𝜕2 𝐹
(𝜀𝜂 ′ )2 2 + ⋯⋯
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
𝜕𝑢 𝜕𝑢
𝐼(𝑢) = ∫ 𝐹 (𝑥, 𝑦, 𝑢, , ) 𝑑𝑥𝑑𝑦
𝜕𝑥 𝜕𝑦
𝑅
Example: Find out the Euler Lagrange equation that extremizes the following functional
1 𝑏
du 2 𝑑𝑢
𝐼(𝑢) = ∫ [( ) + u2 + 2 u x] 𝑑𝑥 = ∫ 𝐹 (𝑥, 𝑢, ) 𝑑𝑥
dx 𝑑𝑥
0 𝑎
𝑑𝑢 du 2
Now 𝐹 (𝑥, 𝑢, ) = ( ) + u2 + 2 u x
𝑑𝑥 dx
condition of the square (0 < 𝑥 ≤ 1, 0 < 𝑦 ≤ 1). The functional of the Poisons equation
is given by
𝜕𝑢 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.
∫ u2 𝑑𝑥 = ∫[𝛼12 (𝑥 2 − 2𝑥 3 + 𝑥 4 ) + 2 𝛼1 𝛼2 (𝑥 3 − 2𝑥 4 + 𝑥 5 ) + 𝛼22 (𝑥 4 − 2𝑥 5 + 𝑥 6 ) ] 𝑑𝑥
0 0
1 1 1 1
2 2
𝑥3 𝑥4 𝑥5 𝑥4 𝑥5 𝑥6 2
𝑥5 𝑥6 𝑥7
∫ u 𝑑𝑥 = 𝛼1 [ − 2 + ] + 2 𝛼1 𝛼2 [ − 2 + ] + 𝛼2 [ − 2 + ]
3 4 5 0 4 5 6 0 5 6 7 0
0
1 1
∫ u x 𝑑𝑥 = ∫[𝛼1 𝑥 (1 − 𝑥) + 𝛼2 𝑥 2 (1 − 𝑥)] x 𝑑𝑥
0 0
1 1 1
𝑥3 𝑥4 𝑥4 𝑥5
∫ u x 𝑑𝑥 = 𝛼1 [ − ] + 𝛼2 [ − ]
3 4 0 4 5 0
0
𝑠𝑖𝑛𝑥
𝑢= −𝑥
𝑠𝑖𝑛1
Solution:
The functional of the problem is given by
1
d2 u
𝐼(𝑢) = − ∫ u [2x + ] 𝑑𝑥
dx 2
0
𝑢(𝑥) ≈ ∑ 𝛼𝑖 𝜙𝑖 (𝑥)
𝑖=1
Defining
1
𝑝𝑖 = ∫ 𝑥 𝜙𝑖 𝑑𝑥
0
𝑖 = 1: 𝑝1 + 𝛼1 𝑞11 + 𝛼2 𝑞12 = 0
𝑖 = 2: 𝑝2 + 𝛼1 𝑞21 + 𝛼2 𝑞22 = 0
For n = 2
we have 𝑢(𝑥) ≈ 𝛼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
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 3.4:
𝑑2 𝑢
+𝑢+𝑥 =0 with 𝑢(𝑥) = 0 𝑎𝑡 𝑥 = 0, 1
𝑑𝑥
𝑑𝑢 1 1
𝑑𝑢 𝑑𝑁1 (𝑥) 1 1
[𝑁1 (𝑥) ] − ∫ 𝑑𝑥 + ∫ 𝑢 𝑁1 (𝑥) 𝑑𝑥 + ∫ 𝑁1 (𝑥) 𝑥 𝑑𝑥 = 0
𝑑𝑥 0 0 𝑑𝑥 𝑑𝑥 0 0
3 13 1
𝛼1 + 𝛼2 =
20 105 20
Solving Eq. () and () we obtain
71 7
𝛼1 = and 𝛼2 =
369 41
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
Prepared by Dr. Md. Shahjada Tarafder Page 60
𝑛
(𝑖) (𝑖) (𝑖)
∑ 𝐾𝑖𝑗 𝑢𝑗 = 𝐹𝑖
𝑗=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 𝑢𝑗 .
Solution:
In order to get an approximate solution, the discretized form of the above differential
equation can be expressed as
𝑛
(𝑖) (𝑖) (𝑖)
∑ 𝐾𝑖𝑗 𝑢𝑗 = 𝐹𝑖
𝑗=1
Where
𝑥𝑖+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 −𝑥 𝑥−𝑥𝑖
Ni (x) = Ni+1 (x) =
𝑥𝑖+1 −𝑥𝑖 𝑥𝑖+1 −𝑥𝑖
[𝑠𝑖𝑛𝑐𝑒 𝑁𝑖 = 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
[ ][ ]=
−2 2 𝑢(1) 1 𝑑𝑢 (1)
2
+ |
[2 𝑑𝑥 2 ]
1
Similarly, for element 2: 𝑥𝑖 = and 𝑥𝑖+1 = 1
2
The components of the stiffness matrix and the force vectors are
(2) (2) (2) (2)
𝐾21 = 2, 𝐾22 = 2, 𝐾21 = 2, 𝐾22 = 2
(2) 1 𝑑𝑢 (2) 1 𝑑𝑢
𝐹1 = −[ ] , 𝐹2 = +[ ]
2 𝑑𝑥 𝑥𝑖 2 𝑑𝑥 𝑥𝑖+1
boundary condition. The 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 = , 𝑢3 = 1
4
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
Prepared by Dr. Md. Shahjada Tarafder Page 64
𝜕2 𝑢 𝜕2 𝑢
Example 3.7 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) ∙ 𝑛 𝑑𝑥 𝑑𝑦 = ∬ 𝑁 𝑓 (𝑥, 𝑦)𝑑𝑠
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
Ω 𝐶 Ω
𝜕𝑢 𝜕𝑁 𝜕𝑢 𝜕𝑁
∬( + ) 𝑑𝑥 𝑑𝑦 = ∫ 𝑞𝑛 𝑁 𝑑𝑠 + ∬ 𝑁𝑓 𝑑𝑥 𝑑𝑦
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
Ω 𝐶 Ω
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
𝑛
𝜕𝑁𝑖 𝜕𝑁𝑗 𝜕𝑁𝑖 𝜕𝑁𝑗 (𝑖)
∑∬( + ) 𝑢 𝑑𝑥 𝑑𝑦 = ∬ 𝑓 𝑁𝑖 𝑑𝑥 𝑑𝑦 + ∫ 𝑞𝑛 𝑁𝑖 𝑑𝑆
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝑗
𝑗=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 = ∬Ω ( + ) 𝑑𝑥 𝑑𝑦
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦
(𝒊) (𝒊)
Calculation of 𝑲𝒊𝒋 and 𝑭𝒊 for Element 1:
Area of the triangular element 1 is
1 𝑥1 𝑦1 1 0 0
1 1 1
∆ = |1 𝑥2 𝑦2 | = |1 1/2 0 |=
2 2 8
1 𝑥3 𝑦3 1 1/2 1/2
And the corresponding shape functions for this element are
1 𝑥 𝑦 1 𝑥 𝑦
1
𝑁1 = |1 𝑥2 𝑦2 | = 4 |1 1/2 0 | = (1 − 2𝑥)
2∆ 1 𝑥3 𝑦3 1 1/2 1/2
1 𝑥 𝑦 1 𝑥 𝑦
1
𝑁2 = |1 𝑥3 𝑦3 | = 4 |1 1/2 1/2| = 2(𝑥 − 𝑦)
2∆ 1 𝑥1 𝑦1 1 0 0
1 𝑥 𝑦 1 𝑥 𝑦
1
𝑁3 = |1 𝑥1 𝑦1 | = 4 |1 0 0| = 2𝑦
2∆ 1 𝑥2 𝑦2 1 1/2 0
The components of the stiffness for element 1 can be obtained as
1 1
𝐾11 = ∬Ω 4 𝑑𝑥 𝑑𝑦 = 𝐾12 = 𝐾21 = − ∬Ω 4 𝑑𝑥 𝑑𝑦 = − 𝐾13 = 𝐾31 = 0
2 2
1 1
𝐾22 = 1 𝐾23 = 𝐾32 = − 𝐾33 =
2 2
0 −
1 1
0 = +
0 0 u 12 0 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 = +
u4 12 1 0
1 1 1 l2(4)
0 0 − 0 1 − u5
2 2 (4 )
u6 0 l3
1 1
0 0 0 0 −
2 2
3
0 0 0 0 − 1 1 u6 1 l3(4)
-----------------------------------------------------------------------------------------------------------
Alternative derivation:
The stiffness matrix can also be derived as:
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
𝑏1 𝑏1 + 𝑐1 𝑐1 𝑏1 𝑏2 + 𝑐1 𝑐2 𝑏1 𝑏3 + 𝑐1 𝑐3
𝐾
= 2 [𝑏2 𝑏1 + 𝑐2 𝑐1 𝑏2 𝑏2 + 𝑐2 𝑐2 𝑏2 𝑏3 + 𝑐2 𝑐3 ]
4𝐴
𝑏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
5.1 Introduction
The FV method uses the integral form of the conservation equations as its starting point.
The solution domain is subdivided into a finite number of control volumes and the
consecration equations are applied to each CV. At the centroid of each CV lies a
computational node at which the variable values are to be calculated. An interpolation is
used to express variable values the CV surface in terms of the nodal values. Surface and
volume integrals are approximated using suitable quadrature formulae.
1. Consider the computation of the heat transfer in a trapezoidal plate with a constant
heat source q all over the plate. At three sides the temperature T is prescribed and at
the fourth side the heat flux is given equal to zero. The problem of heat conduction of
the plate is given by
2T 2T
−k 2 − k 2 = q
x y
with the boundary conditions prescribed as shown in Fig. 1
For the discretization employ a grid with only two control volumes (CVs) as illustrated in
Fig. 2. The required coordinates for the distinguished points for both Cvs are indicated in
Table 1 below:
Table 1. Coordinates of distinguished points for discretized trapezoidal plate
→ →
cd = (6 − 5)i + (0 − 4) j = i − 4 j da = (0 − 6)i + (0 − 0) j = −6i + 0 j
→ i j → i j
en = − = 4i + j sn = − = 0i + 6 j
1 −4 −6 0
4 1 nˆs = 0i + j
nˆe = i+ j
17 17
(c) Discretization of governing differential equation
2T 2T
−k − k = q
x 2 y 2
2T 2T
− k 2 + k 2 dV = q dV
x y
Denoting the unit normal vector nˆe = ne i + ne j and then applying Gauss divergence
x y
T T
−k ne + ne dS = q dV
C S
x yx
y
East face:
4 T 1 T 4 TE − TP 1 Tne − Tse
Fe = −k + dSe = −k
+
Se
S
e 17 x 17 y 17 x 17 y
= De (TE − TP ) + N e (Tne − Tse )
17
=− (TE − TP ) − 0.5 ( 20 − 0 )
9
17
= − (TE − TP ) − 10
9
West face:
2 T 1 T
Fw = −k − + dSw
S w5 x 5 y
5
For the west side 𝑇 = 𝑦3
16
The equation of the line passing through the points (0, 0) and (2, 4) on the west boundary
is
4−0
y= x = 2x
2−0
5 3 5 40 3
T= y = (2 x)3 = x
16 16 16
T 120 2
= x
x 16
T 15
= y2
x 16
2 4
2 120 1 15 2
Fw = −2 − + y dx dy
0 0 5 16
2
5 x
= 60
South face:
North face:
T T − TP
Fn = −k dS n = −k N ( xne − xnw )
S y −
s N
y y P
20 − TP
= −2 (5 − 2)
4−2
= 3TP − 60
Fe + Fw + Fn + Fs = q V
17
− (T2 − T1 ) − 10 + 6T1 + 3T1 − 60 = 8 18
9
98 17
T1 − T2 = 154
9 9
For CV 2
Fe + Fw + Fn + Fs = q V
17
0+ (T2 − T1 ) − 10 + 6T2 + 3T2 − 60 = 8 18
9
98 17
T2 − T1 = 194
9 9
After solving we get
T1 = 17.77
T2 = 20.90
The direction is determined by the connecting line between points P and E, and the
direction is determined by the direction of the CV face. Note that and , because of a
distortion of the grid, can deviate from the directions and which are defined by the connecting lines
of P with the CV face centers e and n.
T T k y x T x y T
k nex + ne = ne − ne + ne − ne
x y J y
x y y x
With the Jacobi determinant
x y y x
J= −
The metric quantities can approximated according to
x xE − xP x xne − xse
= and =
E − P Se
This results for the Jacobi determinant in the approximation as
xE − xP y y xne − xse xE − xP yne − yse yE − yP xne − xse
J= − = −
E − P Se E − P Se E − P Se
=
(x E
− xP )( yne − yse ) − ( yE − yP )( xne − xse )
( E
− P ) Se
^
The vector normal to dS e is
i j
dSn = − = − ( yne − yse ) i + ( xne − xse ) j
xne − xse yne − yse
^
The unit vectors tangential and normal to dS e are
tˆe =
( xne − xse ) ( yne − yse )
i+ j
Se Se
nˆe = −
(y − yse ) ( xne − xse )
ne
i+ j = ne i + ne j
Se Se x y
Where
(y − yse ) ( x − xse ) and S =
ne = − ; ne = ne (x − xse ) + ( yne − yse )
ne 2 2
x
Se Se
y e ne
Now
T T
k ne +
y
ne
x
x y
k y x T x y T
= ne − ne + ne −
ne
J
x y y x
+
(
k E − P Se ) xE − xP y − yP
ne − E
Tne − Tse
n
( xE − xP )( yne − yse ) − ( yE − yP )( xne − xse ) E − P E − P e y x
Se
Putting the value of ne and ne we obtained x y
T T
k ne + ne = De (TE − TP ) + Ne (Tne − Tse )
x y x
y
Where
(x − x ) + ( y − y )
2 2
De = −k ne se ne se
( x − x )( y − y ) − ( y − y )( x − x )
ne se E P ne se E P
Ne =k
( y − y )( x − x ) + ( x − x )( y − y )
ne se E P ne se E P
( y − y )( x − x ) − ( x − x )( y − y )
ne se E P ne se E P
(x − x ) + ( y − y )
2 2
De = −k ne se ne se
(x ne
− xse )( y − y ) − ( y − y )( x
E P ne se E
− xP )
(5 − 6) + ( 4 − 0)
2 2
= −2.0
( 5 − 6 )( 2 − 2 ) − ( 4 − 0 )
31 13
−
4 4
17
9
Ne = k
( y − y )( x − x ) + ( x − x )( x − x )
ne se E P ne se E P
( y − y )( x − x ) − ( x − x )( y − y )
ne se E P ne se E P
= 2.0
( 4 − 0 )( 2 − 2 ) + ( 5 − 6 )( 31 / 4 − 13 / 4 )
( 4 − 0 )( 31 / 4 − 13 / 4 ) − ( 5 − 6 )( 2 − 2 )
1
=−
2