lecture_01_fenics_introduction
lecture_01_fenics_introduction
Contributors
Anders Logg
1 / 14
What is FEniCS?
2 / 14
FEniCS is an automated programming
environment for differential equations
• C++/Python library
• Initiated 2003 in Chicago
• 1000–2000 monthly downloads
• Part of Debian and Ubuntu
• Licensed under the GNU LGPL
http://fenicsproject.org/
Collaborators
Simula Research Laboratory, University of Cambridge,
University of Chicago, Texas Tech University, KTH Royal
Institute of Technology, . . .
3 / 14
FEniCS is automated FEM
• Automated generation of basis functions
• Automated evaluation of variational forms
• Automated finite element assembly
• Automated adaptive error control
4 / 14
What has FEniCS been used for?
5 / 14
Computational hemodynamics
u̇ + u · ∇u − ∇ · σ(u, p) = f
∇·u=0
# Pressure correction
a2 = inner ( grad ( q ) , k * grad ( p ) ) * dx
L2 = inner ( grad ( q ) , k * grad ( p0 ) ) * dx -
q * div ( u1 ) * dx
# Velocity correction
a3 = inner (v , u ) * dx
L3 = inner (v , u1 ) * dx + inner (v , k * grad ( p0 -
p1 ) ) * dx
material = StVenantKirchhoff ( [ mu ,
lmbda ] )
return material
9 / 14
Hello World in FEniCS: problem formulation
Poisson’s equation
−∆u = f in Ω
u=0 on ∂Ω
10 / 14
Hello World in FEniCS: implementation
mesh = UnitSquare ( 32 , 32 )
bc = DirichletBC (V , 0 .0 , DomainBoundary () )
u = Function ( V )
solve ( a = = L , u , bc )
plot ( u )
11 / 14
Basic API
12 / 14
Installation
13 / 14
The FEniCS challenge!
http://fenicsproject.org/download/
14 / 14