The latest version of this document is always available at https://thelfer.github.io/tfel/web/install.html.

Note TFEL can be installed along with Cast3M (>2019). No extra installation is required.

Note TFEL is a part of the code-aster (>12.03) and Salome-Meca (> 2015.1) packages: no extra installation is required if you use one of these products*

Note TFEL is available as a spack package.

One easy way to install TFEL under LiNuX and MacOs is to use the following instructions:

$ git clone --single-branch -b develop https://github.com/spack/spack.git 
$ . spack/share/spack/setup-env.sh
$ spack install tfel@master

The TFEL package can then be loaded as follows:

$ spack load tfel@master

It refers to the current development sources, instructions for specific released versions are included with the sources and detailed in the INSTALL and the INSTALL-cmake files located at the root directory of the sources.

This document describes the generic installation procedure for TFEL from the sources on posix-compliant systems. Please note that the main systems on which TFEL was developed is Linux. Extensive testing on other posix-compliant operating systems, notably FreeBSD, is lacking, although compilation and unit testing is known to work. A page dedicated to FreeBSD is available here.

The installation on Windows platform is described in the following pages:

The creation of binary packages are detailed here.

A quick way of installing TFEL on Ubuntu systems is given in Section 7.

TFEL is known to work on standard architectures implemented by the Intel and AMD processors, either 32 or 64 bits. As no specific instructions relative to the underlying architecture is used in the code, other architectures shall work as well.

You must have the cmake build system (version greater than \(2.8\)) installed on your system, installing ̀TFEL basically boils down to the following simple commands:

$ cmake [options]
$ make 
$ make install

The optional parameters of cmake allows you to:

The rest of this document is dedicated to giving all the details related to the installation process. For completeness, we will break the installation procedure down into five steps:

1 Prerequisites

1.1 Compilers

TFEL version 5.0 requires a C++-20 compliant compiler, a C compiler and optionally a fortran compiler. The following compilers suite are officially supported:

1.2 Third party libraries

TFEL has been designed to have no dependencies to third parties libraries with the very exception of the pybind11 library used to create optional bindings for the Python language.

1.3 Third party tools

The best way to build the TFEL is to use the cmake build system (see this section). We only support cmake versions greater than \(2.8\).

To build TFEL documentation, one may need:

2 Downloading the source

Official releases sources can be downloaded on TFEL GitHub page (see the Download entry of the navigation bar).

3 Configuration

TFEL is based on the cmake build-system.

3.1 Creating a build directory

We highly recommend to use a separate directory to build the sources.

In the following, we use the following convention:

Both $srcdir and $prefix must contain an absolute path.

3.2 Using the cmake build system

The use of the cmake build system is described in depth in the INSTALL-cmake file that is located in the top directory of TFEL sources. We only support cmake versions greater than \(2.8\), so please check the version available on your system:

$ cmake --version

A typical usage of cmake is the following:

$ cmake $srcdir -DCMAKE_BUILD_TYPE=Release -Dlocal-castem-header=ON -Denable-fortran=ON -Denable-aster=ON -DCMAKE_INSTALL_PREFIX=$prefix

This will build TFEL with the support of interfaces for the Cast3M and Code-Aster finite element solvers.

Various other options can be passed to cmake:

Some default compiler settings are detected by cmake, depending on your system. To explicitly specify the compilers to be used, one may define one of the following variables:

For example, we can use the following command to select the Intel compilers suite:

$ CXX=icpc CC=icc FC=ifort F77=ifort cmake $srcdir -DCMAKE_BUILD_TYPE=Release -Dlocal-castem-header=ON -Denable-fortran=ON -Denable-aster=ON -DCMAKE_INSTALL_PREFIX=$prefix

3.2.1 Controlling the generation of the documentation

Generation of the documentation can be controlled by the following boolean options:

3.2.2 Localisation of the libraries

Some LiNuX distributions install libraries in lib64 on \(64\) bits architectures and in lib. This can be changed by defining a LIB_SUFFIX variable like this:

$ cmake -DLIB_SUFFIX=64 ....

3.2.3 Appending the version number

The TFEL_APPEND_VERSION option will append the version number to the names of:

The headers are installed in a subfolder named TFEL-${TVEL_VERSION}.

For example, if the TFEL version is 3.0.2-dev, using TFEL_APPEND_VERSION option will generate:

This allows multiple executables to be installed in the same directory.

3.2.4 Specifying a version flavour

The TFEL_VERSION_FLAVOUR lets the user define a string that will be used to modify the names of executables, libraries and so on (see the previous paragraph for details).

For example, using -DTFEL_VERSION_FLAVOUR=dbg at the cmake invocation, will generate an executable called mfront-dbg.

This option can be combined with the TFEL_APPEND_VERSION option.

3.2.5 Selecting the python version

A specific python version can be selected by setting the Python_ADDITIONAL_VERSIONS, as follows:

cmake ../master/ -Denable-python-bindings=ON -DPython_ADDITIONAL_VERSIONS=2.7 ...

4 Building

The configuration step created a compilation environment based on the make tool.

To build TFEL libraries and binaries, just type:

$ make

To reduce compilation times, one may want to build TFEL libraries and binaries in parallel. In this case, just type:

$ make -j X

X being the number of processors available.

5 Testing (optional)

TFEL is delivered with many unit tests (more than 500 if you are using the cmake build system and all the interfaces available). To build them and execute them, just type:

$ make check

Again, compilation time can be reduced using the -j option of the make command.

5.1 Building the documentation

If a valid LaTeX distribution is available, reference manuals can be built through:

$ make doc-pdf

If the doxygen tool is available, code source documentation can be built through:

$ make doc-html

If pandoc is build and if you are using the cmake build system, the previous command will also install a local version of the TFEL website.

$ make website

All the documentation will be built with the following command:

$ make doc

6 Final install

To install TFEL binaries and libraries in the directory pointed by $prefix, just type:

$ make install

The previous command also installs the documentation if built.

7 A Quick installation procedure on Ubuntu

The following steps show a quick way of installing TFEL on Ubuntu systems. The configuration described in this section only compiles the generic interface, which makes it suitable for use with solvers using the MFrontGenericInterfaceSupport project, e.g. with OpenGeoSys, FEniCS, MoFEM, etc…

The compilation requires that gcc, git and python3 are installed, as well as the python module numpy and the pybind11 library to build the python bindings. Those packages can be installed using:

$ sudo apt install python3 python3-numpy pybind11-dev cmake g++ gfortran

The next step is to get the TFEL source code:

$ cd <where_you_want_to_download_the_source>
$ mkdir -p TFEL && cd TFEL
$ git clone https://github.com/thelfer/tfel.git

This will download the current development version of TFEL.

Then we create a build directory and call ccmake.

$ mkdir build && cd build
$ ccmake ../tfel

ccmake allows to select various options. In this tutorial, we choose the following options:

  CMAKE_INSTALL_PREFIX    ~/.local
  TFEL_APPEND_VERSION           ON
  enable-numpy-support          ON
  enable-python                 ON
  enable-python-bindings        ON

The TFEL_APPEND_VERSION allows to install different versions of TFEL at the same location.

Then configure twice [c],[c] and generate [g]. Once done, just type:

$ make
$ make install

Finally, add the paths in your local .bashrc file:

export PATH=$PATH:~/.local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:~/.local/lib
export PYTHONPATH=${PYTHONPATH}:~/.local/lib/python3.8/site-packages

Now you can use the local TFEL binaries such as mfront-X.Y.Z-dev and mtest-X.Y.Z-dev or define some global alias names for them.