OFELI is an object oriented library of C++ classes
for development of finite element codes. The main feature of this library (called
OFELI as Object Finite Element LIbrary) is that it is not intended
as a finite element code itself but as a toolkit of utility classes and functions. In
particular, mesh classes enable to modify and manipulate finite
element meshes. The numerical solution of the linear system of
equations can be performed either using direct methods or more
sophisticated preconditioned iteration techniques.
The package contains a set of examples of finite element codes
that can be used as prototypes for more elaborated applications.
OFELI (as Object Finite Element
LIbrary) is an object oriented library of classes for finite element
solution of boundary and initial value problems. It provides a
finite element developer tools to write concise and user friendly
codes either for simple finite element programs or for large
scale applications using sophisticated solution techniques like
preconditioned iteration algorithms.
OFELI is written in ANSI C++ and runs already on most actual computers.
As in any C++ code, OFELI is programmed in such a way that a
finite element code developer manipulates objects rather than
data. Hence, a collection of classes is defined. Each class
corresponds to a particular type of information in a Finite
The OFELI package
The OFELI package is not only a library
of classes for Finite Element developments. The library
constitutes the kernel of the package. This package may be used
at different levels. The highest level is that of a finite
element code as a black box presented as a user friendly
application. The lowest level consists in developing new
functions and classes in the kernel.
The current version of the package contains:
- The kernel library: Mesh treatment, Linear
system solvers, finite element equations,
Shape functions, Optimization solvers
- Classes for heat transfer problems
- Classes for solid mechanics problems
- Classes for fluid dynamics problems
- Classes for electromagnetic problems
- A tutorial to initiate new users
- More elaborated finite element demo codes
- Utility programs for mesh and other file conversions
The whole library is contained in a namespace called
OFELI. Therefore any class of the library must be invoked inside this namespace.
The reader is referred to the Tutorial section
to see how it works.
To clarify the programmation all classes have names that start with a capital
letter like Node or Mesh. Moreover, all
public members and attributes share this property, private or protected members having no
capital letters and starting with an "underscore" sign _.
Data validity is controlled as frequently as it is reasonably
possible. This control obviously deteriorates program performance
but we think it necessary especially for a user who is not
familiarized with the OFELI library. If an error in data
is encountered, a message error is displayed. The execution stops
only is the error is classified as fatal.
In order to keep things as simple and clear as possible, we did
not make an extensive use of inheritance between classes. The
only inheritances are from abstract classes and are therefore
transparent for a developer. Of course inheritance advantages can
be exploited by a developer to complete the OFELI classes.
- All matrix classes derive from a template abstract matrix class
called Matrix<>. This was useful for implementing some
general purpose manipulation of matrices that do not depend on the storage
- All finite element equation classes derive from the template
abstract class Equation<>.
- Some classes related to solution methods inherit from an abstract
class that collect common information.
Overloading capabilities of the C++ programming language is
widely used in OFELI. In particular, the output operator <<
is overloaded for practically each class to print out its contents.
We have used as frequently as possible referenced variables as
arguments of the functions of OFELI. Some situations do not work
efficiently with such argument types and pointer to variables are used.
This situation can also be encountered for simple historical reasons where the developers
were not familiar with referenced variables. It is then highly recommended to read
carefully the description of each function before using it.
We have made use of template classes in vector and matrix classes as well as in finite element equation
abstract class. This feature enables implementing for instance complex valued problems.
Pre and Post Processing
At its present stage of development the OFELI library contains no
possibility of mesh generation or graphics post processing. However, the mesh input procedure
is programmed in such a way that a developer can imitate it to read a preprocessor output
Classes in OFELI
To each type of data corresponds a C++ class. For the sake of clarity, we shall
outline hereafter these classes through the steps of execution of a finite element code.
The reader can consult the details of each class and its members in the reference manual.
Mesh data are introduced by a class called Mesh. This class allows to
read, manipulate and store mesh data. Moreover, to each type of mesh data corresponds a class.
Hence, an object of the class Mesh is a collection of objects of classes
Node, Element, Side.
A finite element mesh is defined by a list of nodes given by their coordinates and a list of
elements given by their node numbers. Moreover, to each node is associated its number of
degrees of freedom and a code to each degree of freedom. This code is useful to prescribe node
boundary conditions data Dirichlet). In addition, to take account for Neumann-like
boundary conditions, a mesh can contain a collection of sides. In practice these ones must be
sides on the boundary of the domain but any side can be defined with the help of mesh nodes.
To simplify loops over nodes, elements or sides classes called
Nodes, Elements and Sides are available. Their manipulation will be explained later.
These classes were developed to facilitate basic operations on
vectors. An overloading of operators ( ), [ ]
and = is implemented to simplify this access.
In order to consider several types of storage for finite element matrices, the library OFELI
contains a class for each storage type. Moreover, to handle operations that are independent of these
storage types we have an abstract class called Matrix. The implemented storage
schemes are tridiagonal, skyline and sparse.
Boundary conditions, Forces, ...
A finite element simulation needs several types of data. We have
chosen for a simplified and flexible implementation of finite element codes to supply these
data through user defined functions. Actually, these are not classes but just C functions
that a developer can replace by a more sophisticated implementation.
Material properties can be acquired through material data files. To each material
corresponds a file using the MAF format.
The library contains number of material files and a user can define his own
material files using the MAF format.
Note that a default material called GenericMaterial is defined.
Finite Element Equations
A crucial step in the implementation of the finite element method
consists in building up finite element equations for each element
and then assembling them into a global linear system of
equations. Of course, a nonlinear problem is solved by an
iteration algorithm where each iteration consists in solving a
linear problem. Here at the element level, finite element
equations are to be declared as instances of a class of finite
element equations. Clearly, the finite element equation depends
on the problem one has to solve. For this, some classes of
typical problems (Diffusion, Elasticity, ...) are already
developed and can serve as prototypes for developing classes for
Finite Element Shapes
The above classes need information about finite element
interpolation (choice of element geometry, shape functions, ...).
Here, we have an abstract class called FEShape and classes for
several types for finite element shapes. For instance, class Triang3
corresponds to P1 (or three-node) triangle.
The OFELI library can be installed on
any computer provided with an ANSI C++ compiler. The package is available via the web at the
Two loadable files are located in this directory: ofelixx.tar.gz
and ofelixx.exe (where xx
stands for for the version and release identification). The first one is for Unix
systems and the second is for Windows system.
Installation Procedure on UNIX systems
Expanding the file ofeli-xx.tar.gz creates directories:
tutorial, demos, doc,
Installation Procedure on WINDOWS(TM) systems
- The directory doc contains documentation
files in PDF format. Moreover, a subdirectory of this one is called html
and contains the same documentation in html format
- The directory src contains source files
of the library. In addition, subdirectories corresponding to problem dependent classes
are present in this directory
- The directory include contains header files
of the library. It has also subdirectories with the same name (and same function) as
- The directory tests contains
sub-directories examples that contain simple examples
and demos that contains
subdirectories classifying applications that use the present library
- The main directory contains a script file called configure.
If you are not used with this type of script, type configure --help
to display all the options.
Once this script os executed properly, type make, then
The application ofeli-xx.exe is a classical windows
installator that will lead you through questions to properly install the library.