You are on page 1of 1

135, Avenue de Rangueil UMR 5640, Université Paul Sabatier,

31077 Toulouse cedex 4


FRANCE
Generic Toolbox for Finite Element Methods 118 route de Narbonne, 31 062 TOULOUSE
FRANCE
Yves Renard, Julien Pommier.

1 Introduction
G ET F EM is a finite element library, freely distributed under the terms of the Gnu Lesser General Public
License (LGPL license, http://home.gna.org/getfem/). It aims at providing some standard tools for the
realisation of finite element codes, and in particular:
proposing a generic management of meshes: arbitrary dimension, arbitrary geometric trans-
formations;
providing some generic assembling methods;
implementing many advanced methods (mixed methods, mortar elements, hierarchical ele-
ments, X-FEM,...), and simplify the addition of new methods;
proposing a simple interface under Matlab and Python.
Mode of an oscillating structure (Paolo
View in cut of the tripod.
Bertolo).
2 The G ET F EM ++ toolbox
2.1 The kernel
5
At the bottom level are located the geometric transformations between the reference
5
5 Level-set and XFEM
3 4
element and the real element. The reference elements are build from simplices and
3

0

1 2 tensorial products of simplices.
0


1

The geometric transformations are defined by:


2

A set of tools are proposed for


• a reference element T̄ (triangle, prism, etc..) in RP . managing the geometries implic-
• several reference nodes {x̄i} of this element, and the geometric nodes corresponding on the real ele- itly defined by level-sets. The
ment T ⊂ RN . eXtended Finite Element Method
ng−1 (XFEM) allows to manage the dis-
P N N i(x̄)g i
X
• some polynomials of arbitrary order: τ : T̄ ⊂ R −→ T ⊂ R τ (x) = ontinuities of the fields accross
i=0 these geometries, and the asymp-
totic fields in presence of singular-
2.2 Description of the finite elements (non-exhaustive list) Example of XFEM on 3-dimensional elasticity with an
ities.
Reference element + basis functions + description of the degrees of freedom. angular fracture (the mesh has only one layer of element
in the thickness)
Classical PK and Qk (for arbitrary dimension N and degree K);
Discontinuous PK , tensorial product of methods, additional bubble functions;
Hierarchical/composite elements;
X-FEM (elements enriched by discontinuous/singular shape functions).
Two-dimensional C 1 elements: Argyris, HCT, FVS;
Vectorial elements: Raviart-Thomas, Nedelec;

2.3 Elementary integrals calculations


Integral over an element (or a face) of the tensorial product of an arbitrary number of basis functions, Displacement of a beam whose cracks are treated by XFEM (with the Von Mises criteria).
or their gradients/hessians.
Example: T ∇ψ i(x) ⊗ ∇ψ j (x) ⊗ ϕk (x)dx, this tensor can be a basis for the calculation of elementary
R

matrices of the Poisson’s problem, or linear elasticity. 6 Other examples

3 Meshes and assembling


3.1 Description of meshes
nodes + geometric transformations.
The meshes are built element by element, or imported from Matlab’s
PDE toolbox, GMSH[3], or GiD[4].

3.2 Assembling
Building the final linear system from finite element methods. Some assembling methods are pro-
Stokes problem in 2D. The velocity is P2 and the pressure is discontinuous P1. Left: velocity modulus on
vided for several classical problems: linearized or large strain elasticity, Poisson, Stokes, bilaplacian,
the deformed mesh. Center: velocity (arrows) and pressure (colormap). Right: zoom of center.
linearized plate...
Generic methods: description (independant form the finite element used) of the tensorial opration to
make on each element. For instance, for Poisson problem, the assembling of the term
 
Z Z X
a(x)∇ψ p.∇ψ q dx = aj φj  (∇ψ p)i(∇ψ q )i
X
T T j i
Stokes problem in 3D, in a cylindrical tank
is described by comp(Grad(#1).Grad(#1).Base(#2))(:,i,:,i,j).a(j). crossed by an incompressible fluid. The figure
represents the modulus of the velocity and sev-
eral flux lines
4 Matlab and Python interface
Some easy and widely documented interfaces for Matlab and Python are available (documentation is [2]).
access to all the functionalities of the toolbox;
allow to benefit from the graphical capabilities of Matlab for proposing a few functions of post-
treatment (visualisation of 2D and 3D solutions), for which the quality of the visualisation has been 100

strengthened (careful representation of the discontinuites and the degree of finite elements and geometric 10

transformations). 1

Below, an example of implementation with Matlab interface on a linear elasticity problem. A tripod, 0.1

whose mesh was built with GiD [4], is loaded verticaly. The calculations were done in isoparametric P2. 0.01
L−infinity error

PK(2,1)
0.001
The colormap represents the Von Mises criteria on the surface of the deformed geometry. PK(2,2)
0.0001
gf_workspace(’clear all’);
m=gf_mesh(’import’,’gid’,’tripod.GiD.msh’); 1e−05
PK(2,3)
mfu=gf_mesh_fem(m,3); % mesh-fem supporting a 3D-vector field
PK(2,15)
mfd=gf_mesh_fem(m,1); % scalar mesh˙fem 1e−06 PK(2,4)

% we choose a P2 fem for the main unknown 1e−07 PK(2,6)


PK(2,9)
gf_mesh_fem_set(mfu,’fem’,gf_fem(’FEM_PK(3,2)’), gf_integ(’IM_TETRA(5)’)); PK(2,12)
% the material is homogeneous, hence we use a P0 fem for the data 1e−08
1 10 100 1000 10000 100000
gf_mesh_fem_set(mfd,’fem’,gf_fem(’FEM_PK(3,0)’), gf_integ(’IM_TETRA(1)’));
disp(sprintf(’nbcvs=%d, nbpts=%d, nbdof=%d’,gf_mesh_get(m,’nbcvs’),...
number of degrees of freedom Diffraction of a plane wave by an infinite
gf_mesh_get(m,’nbpts’),gf_mesh_fem_get(mfu,’nbdof’)));
P=gf_mesh_get(m,’pts’); % get list of mesh points coordinates Convergence tests of the high degree finite cylinder, with Q10 element and geometric
pidtop=find(abs(P(2,:)-13)<1e-6); % find those on top of the object
pidbot=find(abs(P(2,:)+10)<1e-6); % find those on the bottom elements on a Laplacian, with a square domain transformations of degree 6, thus allowing to
(whose solution is C ∞).
% assign boundary numbers
gf_mesh_fem_set(mf,’boundary’,1,gf_mesh_get(m,’faces from pid’,pidtop); have two wavelengths per element.
gf_mesh_fem_set(mf,’boundary’,2,gf_mesh_get(m,’faces from pid’,pidbot);
% setup the pde object
pde.type = ’linear elasticity’;
E = 1e3; Nu = 0.3; pde.mf_u=mfu; pde.mf_d=mfd; pde.F = {0,0,0};
pde.lambda={ E*Nu/((1+Nu)*(1-2*Nu)) }; % Lame coefficients
pde.mu={ E/(2*(1+Nu)) };
References
% negative force on the Y axis, applied on boundary 1 (top of the object) [1] Y. R ENARD , J. P OMMIER, Getfem++: Short user documentation ,
pde.bound{1}.type = ’Neumann’; pde.bound{1}.G = {0,-1,0};
% the bottom of the object is fixed on the ground
http://download.gna.org/getfem/doc/getfemuser/getfemuser.html, 2008.
pde.bound{2}.type = ’Dirichlet’; pde.bound{2}.R = {0,0,0};
% solve it (the linear system is a sparse 16000x16000 matrix). [2] Y. R ENARD , J. P OMMIER, Getfem++ documentation,
tic; [U,pde]=gf_solve(pde); disp(sprintf(’solve done in %.2f sec’, toc));
http://home.gna.org/getfem/doc, 2008.
% now that we have the solution, we want to compute the von mises stress
% first, we need to get the gradient of the solution: [3] C. G EUZAINE , J.-F. R EMACLE, Gmsh: a three-dimensional finite element mesh generator with built-in pre- and post-
mfdu=gf_mesh_fem(m,1);
% the P2 fem is not derivable across elements, hence we use a discontinuous processing facilities, http://www.geuz.org/gmsh.
% fem for the derivative of U.
gf_mesh_fem_set(mfdu,’fem’,gf_fem(’FEM_PK_DISCONTINUOUS(3,1)’), ... [4] I NTERNATIONAL C ENTER FOR N UMERICAL M ETHODS IN E NGINEERING, GiD: the personal pre and post-processor,
gf_integ(’IM_TETRAHEDRON(5)’));
% on output size(DU)=[3,3,nbdof(mfdu)] http://gid.cimne.upc.es/.
DU=gf_compute(mfu,U,’gradient’,mfdu);

% from the derivative, we compute the von mises stress


VM=zeros(1,gf_mesh_fem_get(mfdu,’nbdof’));
Von Mises on the surface of a tripod loaded verticaly
(calculations done in isoparametric P2)
for i=1:size(DU,3),
t=DU(:,:,i); E=(t+t’)/2; VM(i) = sum(E(:).ˆ2) - (1./3)*sum(diag(E))ˆ2;
end;
Award
VM = 4*pde.lambda{1}ˆ2*VM;
gf_plot(mfdu,VM,’mesh’,’on’, ’cvlst’,gf_mesh_get(mfdu,’outer faces’),...
Getfem++ has been awarded by the second price at the ”Trophes du Libre 2007” in the category of scientific
’deformation’,U,’deformation_mf’,mfu); softwares (http://www.tropheesdulibre2007.org/).

You might also like