Sie sind auf Seite 1von 37

A Finite Element Method Tutorial

Kathryn Gillow
Computational Biology Group

11th January 2005

A Finite Element Method Tutorial – p. 1/37


Overview
Finite element methods — the basics
Adaptive finite element methods
Applications
Conclusions

A Finite Element Method Tutorial – p. 2/37


Finite element methods — the basics
Model problem:


 

 









 






 






Exact solution .





 

FEM idea: split the interval into subintervals

(elements) and approximate the solution by a polynomial on
each subinterval.
















A Finite Element Method Tutorial – p. 3/37
Solutions
Continuous FEM solution Discontinuous FEM solution
1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6

0.5 0.5

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1



















 


 

















 


where .












 




A Finite Element Method Tutorial – p. 4/37


How can we improve?
Reduce the mesh size

Continuous FEM solution Discontinuous FEM solution


1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6

0.5 0.5

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1














 


 










0 0
10 10

−1 −1
10 10
|| u−uh ||H1

|| u−uh ||H1

−2 −2
10 10

−3 −3
10 10
1 2 1 2
10 10 10 10
number of mesh points number of mesh points

A Finite Element Method Tutorial – p. 5/37


How else can we improve?
Increase the polynomial degree

Continuous FEM solution


1 1 0
10

0.9 0.9

0.8 0.8
−1
10
0.7 0.7

|| u−uDG ||H1
0.6 0.6

−2
10
0.5 0.5

0.4 0.4

0.3 0.3 −3
10

0.2 0.2

0.1 0.1
−4
10
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 polynomial degree

Discontinuous FEM solution


1 1 0
10

0.9 0.9
−1
10
0.8 0.8

−2
0.7 0.7 10

|| u−uh ||H1
0.6 0.6 −3
10

0.5 0.5
−4
10
0.4 0.4

−5
10
0.3 0.3

0.2 0.2 −6
10

0.1 0.1
−7
10
1 1.5 2 2.5 3 3.5 4 4.5 5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 polynomial degree

A Finite Element Method Tutorial – p. 6/37


Convergence
For this problem we have













 







 

In general it can be shown that, for












 








where .





A Finite Element Method Tutorial – p. 7/37


Finite element methods — the details
(Fairly) general reaction–convection–diffusion equation:


in












on





on





Then



 












 






so by Green’s theorem





























A Finite Element Method Tutorial – p. 8/37
Continuous Galerkin FEM




Choose , then










































Continuous finite element formulation: find such





that



















 A Finite Element Method Tutorial – p. 9/37
Discontinuous Galerkin FEM
Apply Dirichlet boundary conditions and inter-element
continuity in a weak sense.

Discontinuous finite element formulation: find





such that






















for all .









A Finite Element Method Tutorial – p. 10/37




  


   
   

 
 
 

   
 
 





  
 

 
  

 

 

 
  
 
 
 



 

 
 
 






 





  

  
  
 


 
  
  



 

Discontinuous Galerkin FEM

 

  

 





  
 

  
 

 


A Finite Element Method Tutorial – p. 11/37
Key idea
Expand as a linear combination of the finite element


basis functions — leads to a (sparse) linear system to solve
for the coefficients:




for a linear PDE.
(Nonlinear PDE nonlinear algebraic system.)


A Finite Element Method Tutorial – p. 12/37


Continuous or discontinuous?
Continuous is simpler.
For a given mesh a continuous method is cheaper.
0.4 0.4

0.35 0.35

0.3 0.3

0.25 0.25

0.2 0.2

0.15 0.15

0.1 0.1

0.05 0.05

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

A discontinuous method allows hanging nodes and the


implementation of a –adaptive strategy is easy.

0.9
1

0.8
0.8
0.7

0.6
0.6

0.4
0.5

0.4 0.2

0.3
0
1
0.2 0.8 1
0.6 0.8
0.1 0.4 0.6
0.4
0.2
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0

A Finite Element Method Tutorial – p. 13/37


Continuous or discontinuous?
For convection–dominated diffusion problems
numerical stabilisation is needed with the continuous
method but not with the discontinuous method.
1.6

1
1.4

1.2
0.8

0.6
0.8

0.6 0.4

0.4

0.2
0.2

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0.8

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

A Finite Element Method Tutorial – p. 14/37


Adaptive finite element methods
Consider an elliptic PDE of the form




and an approximation to given by












We may wish to approximate a linear functional of the





solution by .





Aim: Design & implementation of a reliable and efficient


adaptive algorithm to deliver quantitative error control:






TOL or TOL.









A Finite Element Method Tutorial – p. 15/37


Ingredients of an adaptive algorithm
1. An a posteriori error bound — a computable upper




bound on depending on , , and






the input data but not on .


Then if TOL we automatically have





TOL (provides a stopping criterion for





adaptive algorithm).
2. Mesh refinement strategy — uniform mesh refinement
is inefficient.

A Finite Element Method Tutorial – p. 16/37


Example
Solution mesh mesh

 

 














 




 






0.07 0.06

0.8
0.06 0.05
0.7
0.05
0.6 0.04
0.04
0.5
0.03
0.4 0.03
0.02
0.3 0.02
0.2 0.01
0.01
0.1
0 0
0 2 2
2
1.5 2 1.5 2
1.5 2
1.5 1.5 1.5
1 1 1
1 1 1
0.5 0.5 0.5
0.5 0.5 0.5
0 0 0 0 0 0

Refined mesh








 




1.8

0.06
1.6

0.05
1.4
0.04
1.2
0.03
1
0.02

0.8
0.01

0.6
0
2
0.4
1.5 2
1.5
1 0.2
1
0.5
0.5
0
0 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

A Finite Element Method Tutorial – p. 17/37


Automatic mesh refinement
Write in the form .


Equidistribution of error:


Refine elements for which TOL nele


Derefine elements for which TOL nele , for



some .





Fixed fraction method: arrange elements into a list in


decreasing order of error then


Refine elements in top of list;


Derefine elements in bottom of list.

A Finite Element Method Tutorial – p. 18/37


An adaptive algorithm

  
Given TOL , an initial mesh and an initial distribution

 


of polynomial degrees , set and


1. Calculate the finite element solution .


2. Calculate the contributions to the error bound, and
the total error bound .


3. If TOL then STOP.


4. Otherwise mark elements for refinement and


derefinement.
5. Decide whether marked elements should be - or


-refined or derefined.



6. Construct the new -mesh consisting of and








, set and go to 1.






A Finite Element Method Tutorial – p. 19/37


The a posteriori error bound

 
Finite element formulation: find such that




























Weak formulation: find such that

















 



In particular










 





and so we have Galerkin orthogonality

















 A Finite Element Method Tutorial – p. 20/37


The a posteriori error bound





Let satisfy for all suitable .



Then




































which is independent of the exact solution .

 A Finite Element Method Tutorial – p. 21/37


Bound for continuous FEM




































A Finite Element Method Tutorial – p. 22/37


Bound for discontinuous FEM
Define

in element





 

 on

 






 


on







 




Then













A Finite Element Method Tutorial – p. 23/37



where

 





      
 

 


 
  
   
  


 








 

 




    

  


    




 
   



 


 




 
  



 

      


 
 

Bound for discontinuous FEM cont’d

A Finite Element Method Tutorial – p. 24/37


Example 1


known







known










0





1





















A Finite Element Method Tutorial – p. 25/37


Final adaptive mesh ( DGFEM)


Choose . Final mesh has 287 degrees of











freedom. Error in = .



 





Final mesh with -refinement has 1396 degrees of freedom.


Final mesh using continuous FEM has 11728 degrees of
freedom.
Primal Mesh Number 6 Polynomial degree
2

5
1.8

1.6
4
1.4

1.2 3

0.8 2

0.6
1
0.4

0.2
0

0
0 0.5 1 1.5 2

A Finite Element Method Tutorial – p. 26/37


Comparison with -refinement
3
10
hp−DGFEM
h−DGFEM
h−CGFEM

2
sqrt(degrees of freedom)

10

1
10

0
10
0 0.01 0.02 0.03 0.04 0.05 0.06
TOL

A Finite Element Method Tutorial – p. 27/37


Comparison with -refinement
4
10
hp−DGFEM
h−DGFEM
h−CGFEM
3
10

2
10
CPU time

1
10

0
10

−1
10
0 0.01 0.02 0.03 0.04 0.05 0.06
TOL

A Finite Element Method Tutorial – p. 28/37


Example 2























0 1























A Finite Element Method Tutorial – p. 29/37


Final adaptive mesh
Choose and . Final mesh has 617 degrees


 








of freedom. Error in = .




Primal Solution on Mesh Number 2
Primal Mesh Number 2 Polynomial degree
4

5
3.5 1

3 4 0.8

2.5 0.6
3

2 0.4

2 0.2
1.5

0
1 1 4
3 4
0.5 2 3
0 2
1
1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 0 0

A Finite Element Method Tutorial – p. 30/37


Final adaptive mesh
Choose and . Final mesh has 1001














degrees of freedom. Error in = .








Primal Solution on Mesh Number 5
Primal Mesh Number 5 Polynomial degree
4

5
3.5 1

3 4 0.8

2.5 0.6
3

2 0.4

2 0.2
1.5

0
1 1 4
3 4
0.5 2 3
0 2
1
1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 0 0

A Finite Element Method Tutorial – p. 31/37


Example 3







 

sample:








membrane:








electrolyte:





0 1























A Finite Element Method Tutorial – p. 32/37


Solutions:


1

0.8

0.6

0.4

0.2

0
10
8 10
6 8
4 6
4
2
2
0 0

polynomial degree

Primal Mesh Number 3 with 7253 degrees of freedom


5 5

4.5

4 4

3 3.5

3 3
2.5

2.5
2
2 2

1.5 1.5

1 1 1

0.5
0.5
0 0
0 1 2 3 4 5 6
0
0 1 2 3 4 5 6

A Finite Element Method Tutorial – p. 33/37


Solutions:


1

0.8

0.6

0.4

0.2

0
10
8 10
6 8
4 6
4
2
2
0 0

polynomial degree

Primal Mesh Number 6 with 8836 degrees of freedom


5 5

4.5

4 4

3 3.5

3 3
2.5

2.5
2
2 2

1.5 1.5

1 1 1

0.5
0.5
0 0
0 1 2 3 4 5 6
0
0 1 2 3 4 5 6

A Finite Element Method Tutorial – p. 34/37


Comparison of results


Approx CGFEM DGFEM




 
Current Current DOF Current DOF






0.5 1.0 24.45 0.5141 0.5301 34811 0.5216 6996
0.5 1.0 1.22 0.9665 1.0157 14668 0.9935 7253
2.0 4.0 84.11 0.6672 0.6833 41914 0.6788 7030
2.0 4.0 24.45 0.7530 0.7758 16007 0.7611 7054
2.0 4.0 1.53 0.9683 1.0113 13291 0.9805 7166
2.0 2.5 19.00 0.8667 0.8847 24132 0.8776 26226
2.0 2.5 1.22 0.9942 1.0185 21644 1.0070 26282

A Finite Element Method Tutorial – p. 35/37


Summary
Described an adaptive finite element algorithm for
computing solutions of PDE’s (or linear functionals of
these solutions) to within a specified tolerance.
Seen that for most examples -refinement



outperforms -refinement.

Seen that for particular examples the discontinuous
method outperforms the continuous method.

A Finite Element Method Tutorial – p. 36/37


References
K ENNETH E RIKSSON , D ON E STEP, P ETER H ANSBO &
C LAES J OHNSON .
Introduction to Adaptive Methods for Differential Equations.
Acta Numerica (1995) 105–158.

C LAES J OHNSON .
A New Paradigm for Adaptive Finite Element Methods.
The Mathematics of Finite Elements and Applications
(1994) Chapter 6.

A Finite Element Method Tutorial – p. 37/37

Das könnte Ihnen auch gefallen