Galerkin Method in 1D Finite Element Analysis
Galerkin Method in 1D Finite Element Analysis
1
INTRODUCTION
Direct stiffness method is limited for simple 1D problems
FEM can be applied to many engineering problems that are
governed by a differential equation
Need systematic approaches to generate FE equations
Weighted residual method
Energy method
Ordinary differential equation (second-order or fourth-order)
can be solved using the weighted residual method, in
particular using Galerkin method
Principle of minimum potential energy can be used to derive
finite element equations
2
EXACT VS. APPROXIMATE SOLUTION
Exact solution
Boundary value problem: differential equation + boundary conditions
Displacements in a uniaxial bar subject to a distributed force p(x)
d 2u
2
+ p( x ) = 0, 0 x 1
dx
u(0) = 0
Boundary conditions
du
(1) = 1
dx
If it satisfies for any W(x), then R(x) will approaches zero, and the
approximate solution will approach the exact solution
Depending on choice of W(x): least square error method, collocation
method, Petrov-Galerkin method, and Galerkin method
4
GALERKIN METHOD
Approximate solution is a linear combination of trial functions
N
u%( x ) = ci f i ( x ) Trial function
i =1
Accuracy depends on the choice of trial functions
The approximate solution must satisfy the essential BC
Galerkin method
Use N trial functions for weight functions
1
0 R( x )f i ( x )dx = 0, i = 1,K , N
1d 2u%
0 dx 2
+ p( x )
f i ( x )dx = 0, i = 1,K , N
%
1 d 2u 1
0 dx 2 fi ( x )dx = - 0 p( x ) i ( x )dx, i = 1,K , N
5
GALERKIN METHOD cont.
Galerkin method cont.
Integration-by-parts: reduce the order of differentiation in u(x)
1
du% %d f
1 du 1
0 dx dx dx = - 0 p( x )
i
f - i ( x )dx, i = 1,K , N
dx i 0
1 df du% 1 du du
0 dx = p( x )fi ( x )dx + (1) i (1) -
i
(0)f i (0), i = 1,K , N
dx dx 0 dx dx
Same order of differentiation for both trial function and approx. solution
Substitute the approximate solution
N
1 df df j 1 du du
0 i
c j
dx j =1 dx
dx = 0
p( x )fi ( x )dx +
dx
(1) i (1) -
dx
(0)f i (0), i = 1,K , N
6
GALERKIN METHOD cont.
Galerkin method cont.
Write in matrix form
N
1 df i df j
K ij = dx
0 dx dx
1 du du
Fi = p( x )fi ( x )dx + (1) i (1) - (0)f i (0)
0 dx dx
Coefficient matrix is symmetric; Kij = Kji
N equations with N unknown coefficients
7
EXAMPLE1
Differential equation Trial functions
d 2u f1( x ) = x 1
(x) =1
2
+ 1 = 0,0 x 1
dx f2 ( x ) = x 2 2( x ) = 2x
u(0) = 0
Boundary conditions
du
(1) = 1
dx
Approximate solution (satisfies the essential BC)
2
u%( x ) = ci f i ( x ) = c1x + c2 x 2
i =1
Approximate solution
x2
u%( x ) = 2 x -
2
Approximate solution is also the exact solution because the linear
combination of the trial functions can represent the exact solution
9
EXAMPLE2
Differential equation Trial functions
d 2u f1( x ) = x 1
(x) =1
2
+ x = 0, 0 x 1
dx f2 ( x ) = x 2 2( x ) = 2x
u(0) = 0
Boundary conditions
du
(1) = 1
dx
16
Coefficient matrix is same, force vector: {F} = 1
12 15
19 19 x2
{c} = [K] {F} = 121
- 1
u%( x ) = x-
- 4
12 4
Exact solution
3 x3
u( x ) = x -
2 6
The trial functions cannot express the exact solution; thus,
approximate solution is different from the exact one
10
EXAMPLE2 cont.
Approximation is good for u(x), but not good for du/dx
11
HIGHER-ORDER DIFFERENTIAL EQUATIONS
w (0) = 0
Fourth-order differential equation Essential BC
dw
(0) = 0
d 4w dx
- p( x ) = 0, 0 x L
dx 4 d 2w
( L ) = M
Beam bending under pressure load dx 2 Natural BC
d 3w
Approximate solution (L ) = - V
3
dx
N
w%( x ) = ci f i ( x )
i =1
Weighted residual equation (Galerkin method)
Ld 4w%
0 dx 4
- p( x )
f i ( x )dx = 0, i = 1,K , N
In order to make the order of differentiation same, integration-by-parts
must be done twice
12
HIGHER-ORDER DE cont.
After integration-by-parts twice
L L
d w%
3
d w%d fi
2 %d 2
L d 2w L
f
3 i
- + i
dx = p( x ) i ( x )dx, i = 1,K , N
dx 0 dx 2 dx 0
0 dx 2
dx 2 0
L L
%d 2fi
L d 2w L d w% 3 2%
d wd i
0 2
dx 2
dx
dx =
0
p( x )fi ( x )dx -
dx 3
i +
dx 2 dx
, i = 1,K , N
0 0
Substitute approximate solution
N L L
L d 2f j d 2fi L d 3w% d 2w%d i
0 j =1 c j dx 2 dx 2 dx = 0 p( x )fi ( x )dx - dx 3 i + dx 2 dx , i = 1,K , N
0 0
Do not substitute the approx. solution in the boundary terms
Matrix form
L d 2f d 2f j
K ij = 2
i
2
dx
[K ] {c} = {F}
0 dx dx
N N N 1 N 1 L L
3 2
L d w d w df i
Fi = p( x )fi ( x )dx - i +
0 dx 3 0 dx 2 dx 0
13
EXMAPLE
Fourth-order DE dw
w (0) = 0 (0) = 0
dx
d 4w d 2w d 3w
4
- 1 = 0, 0 x L (1) = 2 (1) = - 1
dx dx 2 dx 3
Two trial functions
f1 = x 2 , 2 = x3 f1= 2, 2
= 6x
Coefficient matrix
1 2
K11 = ( f 1) dx = 4
0
1 4 6
K12 = K 21 = ( f1
2) dx = 6 [K ] =
0
6 12
1 2
K 22 = ( f 2) dx = 12
0
14
EXAMPLE cont.
RHS
3 2
1 d w (0) d w (0) 16
F1 = 2
x dx +V f1(1) +
1(0) + M f1(1) -
1(0) =
0 dx 3
dx 2 3
1 d 3w (0) d 2w (0) 29
F2 = 3
x dx + V f2 (1) + 2 (0) + M f
2 (1) -
2 (0) =
0 dx 3 dx 2 4
Approximate solution
41
- 1 24 41 2 1 3
{c} = [K] {F} = 1 w%( x ) = x - x
- 4
24 4
Exact solution
1 4 1 3 7 2
w(x) = x - x + x
24 3 4
15
EXAMPLE cont.
16
FINITE ELEMENT APPROXIMATION
Domain Discretization
Weighted residual method is still difficult to obtain the trial functions
that satisfy the essential BC
FEM is to divide the entire domain into a set of simple sub-domains
(finite element) and share nodes with adjacent elements
Within a finite element, the solution is approximated in a simple
polynomial form
1D 2D 3D
One element
18
TRIAL SOLUTION
Solution within an element is approximated using simple polynomials.
u%( xi ) = ui = a0 + a1xi
u%( xi +1 ) = ui +1 = a0 + a1xi +1
xi xi+1
21
GALERKIN METHOD
Relation between interpolation functions and trial functions
1D problem with linear interpolation
0, 0 x xi - 1
( i - 1) x- x
Ni ( x ) = ( i - 1)i - 1 , xi - 1 < x xi
ND L
u%( x ) = ui f i ( x ) f i ( x ) =
( i ) xi +1 - x
i =1 i N ( x ) = (i )
, xi < x xi +1
L
0, xi +1 < x xND
23
EXAMPLE cont.
Derivatives of interpolation functions
d f1( x ) - 2, 0 x 0.5 d 2(x) 2, 0 x 0.5
= =
dx 0, 0.5 < x 1 dx - 2, 0.5 < x 1
d f 3 ( x ) 0, 0 x 0.5
=
dx 2, 0.5 < x 1
Coefficient matrix
d f1 d 2
1 0.5 1
K12 = dx = (- 2)(2)dx + (0)(- 2)dx = - 2
0 dx dx 0 0.5
1 df d 0.5 1
K 22 = 2 2
dx = 4dx + 4dx = 4
0 dx dx 0 0.5
RHS
0.5 1 du du du
F1 = 1 (1 - 2x )dx + 1 (0)dx + (1)f1(1) - (0) 1(0) = 0.25 - (0)
0 0.5 dx dx dx
0.5 1 du du
F2 = 2 xdx + (2 - 2 x )dx + (1)f 2 (1) - (0)f 2 (0) = 0.5
0 0.5 dx dx
24
EXAMPLE cont.
Matrix equation
2 - 2 0 u1
F1 Consider it as unknown
- 2 4 - 2 u2 = 0.5
0 - 2 2 u3 1.25
Striking the 1st row and striking the 1st column (BC)
4 - 2 u2 0.5
=
- 2 2 u3
1.25
Solve for u2 = 0.875, u3 = 1.5
Approximate solution
1.75 x, 0 x 0.5
%
u( x ) =
0.25 + 1.25 x, 0.5 x 1
Piecewise linear solution
25
EXAMPLE cont.
Solution comparison
Approx. solution has about
8% error
Derivative shows a large
discrepancy
Approx. derivative is
constant as the solution is
piecewise linear
26
FORMAL PROCEDURE
Galerkin method is still not general enough for computer code
Apply Galerkin method to one element (e) at a time
Introduce a local coordinate
x - xi x- x
x = xi (1 - x) + x j x x= = (e ) i
x j - xi L
Approximate solution within the element
N 1(x) N 2(x)
u%( x ) = ui N1( x ) + u j N2 ( x )
N1(x) = ( 1 - x) Element e
N2 (x) = x xi xj
x
x - xi L(e)
dN1 dN1 d x 1
N1( x ) =
1- = = - (e )
L( e ) dx d x dx L
x - xi dN2 dN2 d x 1
N2 ( x ) = ( e ) = = + (e )
L dx d x dx L
27
FORMAL PROCEDURE cont.
Interpolation property
N1( xi ) = 1, N1( x j ) = 0 u%( xi ) = ui
N2 ( xi ) = 0, N2 ( x j ) = 1 u%( x j ) = u j
Derivative of approx. solution
du% dN1 dN2
= ui +uj
dx dx dx
du% dN1 dN2 u1 1 dN1 dN2 u1
= = ( e )
dx dx dx u2
L d x dx
u2
Apply Galerkin method in the element level
xj dNi du% xj du du
x i dx dx
dx = p( x )Ni ( x )dx + ( x j )Ni ( x j ) -
xi dx
( x )N ( x ), i = 1,2
dx i i i
28
FORMAL PROCEDURE cont.
Change variable from x to
L( e ) 0 d x
d xg = L p( x )Ni (x)d x
(e )
d x
dx
u2
0
du du
+ ( x j )Ni (1) - ( x )N (0), i = 1,2
dx dx i i
Do not use approximate solution for boundary terms
Element-level matrix equation
du
- ( xi ) 1 N1(x)
dx
[k( e ) ]{u( e ) } = { f ( e ) } +
du
{f (e ) (e )
} =L 0 p( x ) d x
N2 (x)
+ ( x )
dx j
dN 2 dN1 dN2
1
1 1
d x
dx dx 1 - 1
k = d x = 1
L( e ) 0
( e )
2 L - 1 1
(e )
2 2 dN2 dN1 dN2
dx d x
dx
29
FORMAL PROCEDURE cont.
Need to derive the element-level equation for all elements
Consider Elements 1 and 2 (connected at Node 2)
du
k11 (1)
(1) - ( x )
k12 u1 f1 dx 1
= +
k21 u
k22 2 f
2 + ( x2 )
du
dx
du
k11 (2) (2) - ( x )
k12 u2 f2
dx 2
= +
k21 u
k22 3 f
3 du
+ ( x )
dx 3
Assembly
Vanished
du
k (1) (1)
k12 0
u
f (1) - dx ( x1) unknown term
11
1 1
k (1) (1)
k22 (2)
+ k11 (2)
k12 = f2(1) + f2(2) +
21 u2
0
(2) u
0 (2)
k21 k 22 3 f (2) du
3 ( x3 )
dx
30
FORMAL PROCEDURE cont.
Assembly of NE elements (ND = NE + 1)
(1) du
k11 (1)
k12 0 K 0 u f (1)
- ( x1)
1 1 dx
k (1) k (1) + k (2) (2) (1) (2)
21 22 11 k12 L 0 u2 f2 + f2 0
(2)
(2) (2) (2) = (3) + 0
+ k11 L u
0 f3 + f3
k221 k22 0 3
M M M O M M M M
0 ( NE ) ( NE ) u
k22 N fN ( NE )
du
0 0 k21
( ND 1) + ( xN )
( ND 1) dx
( ND ND ) ( ND 1)
[K ]{q} = {F}
31
EXAMPLE
Use three equal-length elements
d 2u
2
+ x = 0, 0 x1 u(0) = 0, u(1) = 0
dx
All elements have the same coefficient matrix
1 - 1 3 - 3
k ( e ) = 1
2 2 L( e ) - 1 1
= , (e = 1,2,3)
- 3 3
Change variable of p(x) = x to p(): p(x) = xi (1 - x) + x j x
RHS
1 N1(x) 1 1 - x
0 d x = L [ xi ( 1 - x) + x j x ]
(e ) (e) (e)
{f } =L p( x ) d x
N2 (x)
0 x
xi xj
+
3 6
= L( e ) , (e = 1,2,3)
xi x j
+
6 3
32
EXAMPLE cont.
RHS cont. f (1) f (2)
f (3)
1 = 1 1
, 2 1
=
4
, 3 1 7
=
f (1) 54
2 f (2) 54 5 f (3) 54 8
2 3 4
Assembly
1 du
- (0)
54 dx Element 1
3 - 3 0
0 u1
2 4
+ Element 2
- 3 3 +3 - 3 0 u2 54 54
= Element 3
0 - 3 3 +3 - 3 u3 7 5
+
0 0 - 3 3 u4 54 54
8 du
+ (1)
Apply boundary conditions 54 dx
Deleting 1st and 4th rows and columns
4
u2 = 81
6 - 3 u2 1 1
=
- 3 6 u3 9
2 5
u3 = 81
33
EXAMPLE cont.
Approximate solution
4 1
x, 0 x
27 3
4 1
1 1 2
u%( x ) = + x- , x
81 27 3
3 3
5 5 2
2
- x - , x1
81 27 3
3
Exact solution
1
u( x ) = x ( 1 - x 2 )
6
Three element solutions are poor
Need more elements
34
ENERGY METHOD
Powerful alternative method to obtain FE equations
Principle of virtual work for a particle
for a particle in equilibrium the virtual work is identically equal to zero
Virtual work: work done by the (real) external forces through the virtual
displacements
Virtual displacement: small arbitrary (imaginary, not real) displacement
that is consistent with the kinematic constraints of the particle
Force equilibrium
Fx = 0, Fy = 0, Fz = 0
Virtual displacements: u, v, and w
Virtual work
dW = du Fx + dv Fy + dw Fz = 0
If the virtual work is zero for arbitrary virtual displacements,
then the particle is in equilibrium under the applied forces
35
PRINCIPLE OF VIRTUAL WORK
Deformable body (uniaxial bar under body force and tip force)
x
E, A(x)
F
Bx
dWe - dWi
dWe + dWi = 0
37
PVW cont.
in equilibrium, the sum of external and internal virtual work is
zero for every virtual displacement field
3D PVW has the same form with different expressions
With distributed forces and concentrated forces
38
VARIATION OF A FUNCTION
Virtual displacements in the previous section can be
considered as a variation of real displacements
Perturbation of displ u(x) by arbitrary virtual displ u(x)
ut ( x ) = u( x ) + tdu( x )
Variation of displacement
dut ( x )
= du( x ) Displacement variation
dt t =0
du
d (du )
dex = d =
dx
dx
39
PRINCIPLE OF MINIMUM POTENTIAL ENERGY
Strain energy density of 1D body
1 1
U0 = s x ex = E ex2
2 2
dU = - dWi
40
PMPE cont.
Potential energy of external forces
Force F is applied at x = L with corresponding virtual displ u(L)
Work done by the force = Fu(L)
The potential is reduced by the amount of work
dV = - F du(L ) F is constant
dV = - d( Fu(L ) )
virtual displacement
With distributed forces and concentrated force
L
V = - Fu(L ) - 0 bxu( x )dx dV = - dWe
dU + dV = 0 or d( U + V ) = 0
PVW
P = U +V
Define total potential energy
dP = 0
41
EXAMPLE: PMPE TO DISCRETE SYSTEMS
Express U and V in terms of u2
displacements, and then F3
1 2 3
differential w.r.t displacements
k(1) = 100 N/mm, k(2) = 200 N/mm 1 3 F3
k(3) = 150 N/mm, F2 = 1,000 N 2 u3
F3 = 500 N u1
Strain energy of elements (springs)
(1) 1 2 1 k (1) - k (1) u1
U = k (1) ( u2 - u1 ) U (1)
= u u
2 2 1( 1 2 ) 2 (1) u
- k
(1)
k 2
( 2 2 ) ( 2 1)
(2) 1 k (2) - k (2) u1
U = u u
2 1 3 (2) u
3
(2)
- k k
1 k (3) - k (3) u2
U (3)
= u u
22 3
(3) u
3
(3)
- k k
42
EXAMPLE cont.
3
Strain energy of the system U = U ( e )
e=1
1
P = U +V = {Q }T [K ]{Q } - {Q }T {F}
2
43
EXAMPLE cont.
Total potential energy is minimized with respect to the DOFs
P P P P
= 0, = 0, =0 or, =0
u1 u2 u3 { Q }
u1 F
1
[ K ] u2 = F2 [K]{Q } = {F}
u3 F3
Finite element equations
Global FE equations
300 - 100 - 200 0
F1 u2 = 6.538mm
- 100 250 - 150 u2 = 1,000 u3 = 4.231mm
- 200 - 150 350 u3 500 F1 = - 1,500N
47