You are on page 1of 30

III Solution of pde’s using variational

principles
4.1 Introduction

• Introduction
• Euler-Lagrange equations
• Method of Ritz for minimising functionals
• Weighted residual methods
• The Finite Element Method
Introduction
Variational principles

• Variational principles are familiar in mechanics


•the ‘best’ approximate wave function for the ground state of a
quantum system is the one with the minimum energy
•The path between two endpoints (t1, t2) in configuration space taken
by a particle is the one for which the action is minimised

•Energy or Action is a function of a function or functions


•Wave function or particle positions and velocities
•A function of a function is called a functional

•A functional is minimal if its functional derivative is zero


•This condition can be expressed as a partial differential equation
Introduction
Hamilton’s principal of least action
t
2 . . .
Action   L(q1 (t), q1 (t),..., q N (t), q1 (t), q1 (t), ..., q N (t)) dt
t
1

q 1(t)
L = T – V is the Lagrangian t2

t1
The path actually taken is the
one for which infinitesimal
variations in the path result in q 2 (t)
no change in the action

q1(t)
Introduction
Hamilton’s principal of least action

• The condition that a particular function is the one that


minimises the value of a functional can be expressed as a
partial differential equation
• We are therefore presented with an alternative method for
solving partial differential equations besides directly seeking
an analytical or numerical solution
• We can solve the partial differential equation by finding the
function which minimises a functional
• Lagrange’s equations arise from the condition that the
action be minimal d L - L  0
dt q i qi
4.2 Euler-Lagrange Equations
  b
dy

• Let J[y(x)] be the functional J[y]  F(x, y, y' ) dx y' 
dx
  a
• Denote the function that minimises J[y] and satisfies
boundary conditions specified in the problem by y

• Let (x) be an arbitrary function which is zero at the


boundaries in the problem so that y + (x) is an arbitrary
function that satisfies the boundary conditions

•  is a number which will tend to zero


Euler-Lagrange Equations
Functionals
Functional y(x)
b y(x)  (x)
J[y   (x)]   F(x, y   , y' ' ) dx B y(x)
a A
Boundary conditions
y(a) = A (x)
y(b) = B
a b x
Function J( )
b
dJ( ) d
d
 
d a
F(x, y   , y' ' ) dx

b

  F(x, y   , y   ' ) dx
a  0 
Euler-Lagrange Equations
Functionals
F F x F y F y'
  
 x  y  y' 
F F • y  y  
 0    '
y y'
b • y is the solution to a pde as
dJ  F F  well as being the function
      ' dx
d a  y y'  which minimises F[x,y,y’]
b
 F d F  • We can therefore solve a
     dx
a  y dx y'  pde by finding the function
dJ F d F which minimises the
 0 if  0 corresponding functional
d y dx y'
4.3 Method of Ritz for minimising functionals
• Electrostatic potential u(x,y) inside region D SF p 362

• Charges with density f(x,y) inside the square

• Boundary condition zero potential on boundary

•Potential energy functional


 
J[u]   u 2x  u 2y  2uf dxdy
D
•Euler-Lagrange equation D

 2 u(x, y)  f(x, y)
Method of Ritz for minimising functionals
Electrostatic potential problem
Basis set which satisfies boundary conditions
1 (x, y)  xy(1 - x)(1 - y)
 2 (x, y)  x1 (x, y)
0.06
0.04 1
0.02 0.8

1
0 0.6

3 (x, y)  y1 (x, y)


0
0.2 0.4
0.4
0.6 0.2
0.8
10

 4 (x, y)  x 21 (x, y)


2
5 (x, y)  y 1 (x, y) 0.03
0.02
1
0.8

 6 (x, y)  xy1 (x, y)


0.01
0 0.6

2
0
0.2 0.4
0.4
0.6 0.2

etc.
0.8
10
Method of Ritz for minimising functionals
Electrostatic potential problem
• Series expansion of solution
N
u(x, y)   c i i (x, y)
i 1

•Substitute into functional


  N   2  N   2  N  

J(c i )      c i i     c i i   2 f   c i  i 
dx dy
 i  1 x  i  1 y 
D
i  1  

•Differentiate wrt cj
J  N    j   j  
 2     i  i  c i  f j  dx dy
c j D
i  1 x x y y  
Method of Ritz for minimising functionals
Electrostatic potential problem
• Functional minimised when
J
0
c j
• Linear equations to be solved for ci
Aij.cj = bi
 
where    j   j 
A ij    i  i  dx dy
D  x x y y 

 
b i  -  f(x, y) i (x, y) dx dy
D
4.4 Weighted residual methods
• For some pde’s no corresponding functional can be found

• Define a residual (solution error) and minimise this

• Let L be a differential operator containing spatial derivatives


D is the region of interest bounded by surface S

• An IBVP is specified by
Lu  u t x  D t  0 PDE
u(x,0)   (x) xD IC
u(x, t)  f s (x, t) x S BC
Weighted residual methods
Trial solution and residuals

•Trial solution
n
u T (x, t)  u s (x, t)   c i (t) u i (x) ui(x) are basis functions
i 1
u s (x, t)  f s (x, t)
u i (x)  0 x S

•Define pde and IC residuals


R E (x, t)  Lu T (x, t) - (u T (x, t)) t
n
R I (x)   (x) - u s (x,0) -  c i (0) u i (x)
i 1
• RE and RI are zero if uT(x,t) is an exact solution
Weighted residual methods
Weighting functions

• The weighted residual method generates and


approximate solution in which RE and RI are minimised

• Additional basis set (set of weighting functions) wi(x)

• Find ci which minimise residuals according to


D w i (x)R E (x, t)dx  0
D w i (x)R I (x)dx  0
• RE and RI then become functions of the expansion
coefficients ci
Weighted residual methods
Weighting functions
• Bubnov-Galerkin method
wi(x) = ui(x) i.e. basis functions themselves

• Least squares method


J E (c i )   R 2E (x, t)dx  0
D Positive definite functionals u(x) real
J I (c i )   R 2I (x)dx  0
D
J E (c i )
0 R E
c i Conditions for minima  w i (x)  2
c i
J I (c i )
0
c i
4.5 The Finite Element Method

• Variational methods that use basis functions that extend over


the entire region of interest are

•not readily adaptable from one problem to another


•not suited for problems with complex boundary shapes

• Finite element method employs a simple, adaptable basis set


The finite element method
Computational fluid dynamics websites

• Gallery of Fluid Dynamics


• Introduction to CFD
• CFD resources online
• CFD at Glasgow University

Computational fluid dynamics (CFD) websites


Vortex shedding illustrations by CFDnet

Vortex Shedding around a Square Cylinder


Centre for Marine Vessel Development and Research
Department of Mechanical Engineering
Dalhousie University, Nova Scotia
The finite element method
Mesh generation

Finer mesh elements in


regions where the
solution varies rapidly

Meshes may be regular


or irregular polygons

1
Definition of local and global
coordinate axes and node numberings
3 2
Local coordinate axes and
node numbers

Global coordinate axes


The finite element method
Example: bar under stress

F1 Ti Ti 1 F2

• Define mesh
• Define local and global node numbering
• Make local/global node mapping
• Compute contributions to functional from each element
• Assemble matrix and solve resulting equations
The finite element method
Example: bar under stress
• Variational principle

• W = virtual work done on system by external forces (F)


and load (T)

• U = elastic strain energy of bar

• W = U or (U – W) =  = 0
x2 x2 2
AE  du 
Π  F2 u 2  F1 u 1   T(x)u(x)dx     dx
2  dx 
x1 x1
The finite element method
Example: bar under stress
Π(u   )  F1 (u 1  1 )  F2 (u 2   2 ) 
x2 x2 2
AE  d(u   ) 
 T(x)(u   )dx   2  dx  dx
x1 x1
x2 x2
dΠ du d
  F11  F2 2   T  dx   AE dx
d dx dx
x1 x1

• Eliminate d/dx using integration by parts


The finite element method
Example: bar under stress
x2 x2
du d du x 2 d du
 AE dx  AE  |x   AE  dx
dx dx dx 1 dx dx
x1 x1
x2
du d du
 AE  2  1    AE  dx
dx dx dx
x1
du du
 F1  AE |  0  F2  AE |  0 Boundary
dx x 1 dx x 2 conditions
d  du 
 AE   T(x)  0 Differential equation being solved
dx  dx 
The finite element method
Example: bar under stress

• Introduce a finite element basis to solve the minimisation


problem [u(x)] = 0
• Assume linear displacement function   u(X)
u(X) =  + X

ui(X) =  + Xi

uj(X) =  + Xj
•Solve for coefficients  i X j
u X -u X u -u
1  i j j i  2
 j i
X is the local
X -X X -X
j i j i displacement variable
The finite element method
Example: bar under stress
•Substitute to obtain finite elements

u(X) = u1 + u2


N1
X -X X-X
N1  j N2  i
X -X X -X
j i j i N2

• u1 and u2 are coefficients of the


basis functions N1 and N2
u(X) = [N1 N2] (u)
The finite element method
Example: bar under stress

• Potential energy functional Grandin pp91ff


x x
2 2 2
AE  du 
 [u(x)]  - F1u1 - F2 u 2     dx   T(x)u(x) dx
x 2  dx  x
1 1
du u j - u i
 
1  ui 
 - 1 1  u  
  1
ui   1
u j  
dx X j - X i X j - X i  j  X j - Xi  - 1
2
2  u -u   ui 
 
du  j i  1 u  1 - 1
      i u    
 dx   X j - Xi  2  j  -1 1  u 
X - X    j
   j 
 i 
The finite element method
Example: bar under stress
x
2 2
AE  du 
• Strain energy strain energy     dx
x 2  dx 
1
Xj
EA 1  1 - 1  u i 
U

2 X -X 2

[ ui u j ]  
- 1 1   u j  X
dX per element
j i i
EA 1  1 - 1  u i 
 [ uiu j ] 
2 X j - Xi - 1 1   u j 
1 T
 q . [k]. q
2
EA 1  1 - 1
[k]    Element stiffness matrix
2 X j - X i - 1 1 
The finite element method
Example: bar under stress
• Node force potential energy
 ui 
Node force potential energy VNF  - [Fi Fj ]  
u j 
 

• Distributed load potential energy


x
2
Distribute d load potential energy VT   x T(x)u(x) dx
Xj 1
 Xj -X X - X i  u i 
VT  -  T(X)    dX
 X j - X i X j - X i  u j 
Xi 
The finite element method
Example: bar under stress
• Energy functional for one element
Xj
1  ui   ui   ui 
  [ u i u j ] .  k .    [ Fi Fj ] .     dX T(X) [N1 N 2 ] .  
2 u j  u j  u j 
    Xi  
• Equilibrium condition 
 0 for all i
u i
 1 u  1 1  1
 [ 1 0] .  k .  i
 [u u ] .  k .    [ F F ] .  
u u
 j 2 i j 0 i j
i
2      0
X
j  1
  dX T(X) [N N ] .  
1 2
X  0
i
The finite element method
Example: bar under stress

• Equilibrium condition for one element


Xj
 ui   Fi   N1 
 k .  u      dX T(X) 
 Fj   N 

 j   Xi  2

• Assemble matrix for global displacement vector


 k . u  FT
The finite element method
Example: bar under stress
 1 1 0 0   u1 
   
1 2 1 0   u3 
 K   u 
0  1 2  1 u3
 
 
 0 0  1 ...   
   ... 
 F1 
  Xj
0  N1n 
F  Tn   dX n T(X n )   n labels element

0 N
 2n 
  Xi
 ... 
 

• Solve resulting linear equations for u

You might also like