TFEL/MFront
The latest version of this document is always available at https://thelfer.github.io/tfel/web/install.html.
Note
TFEL
can be installed along withCast3M
(>2019). No extra installation is required.
Note
TFEL
is a part of thecode-aster
(>12.03) andSalome-Meca
(> 2015.1) packages: no extra installation is required if you use one of these products*
Note
TFEL
is available as aspack
package.One easy way to install
TFEL
underLiNuX
andMacOs
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:
cmake
and Visual Studio
.cmake
and MinGW
(as packaged with
Cast3M
2017
). This tutorial can easily be
adapted to other versions of MinGW
, without requiring
Cast3M
to be installed.MSYS2
](https://www.msys2.org/) environment.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:
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:
TFEL
.clang
C and C++
compilers.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.
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:
Official releases sources can be downloaded on TFEL
GitHub
page (see the Download entry of the navigation bar).
TFEL
is based on the cmake
build-system.
build
directoryWe highly recommend to use a separate directory to build the sources.
In the following, we use the following convention:
$srcdir
points to the directory that actually contains
the sources files.$prefix
points to the final installation
directory.Both $srcdir
and $prefix
must contain an
absolute path.
cmake
build systemThe 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
:
-Denable-cyrano=ON
enables the interface for
the Cyrano3
fuel performance code.-Denable-zmat=ON -DZSET_INSTALL_PATH=$ZSETPATH
option,
where $ZSETPATH
points to the installation directory of the
ZeBuLoN finite element solver.Python
language, one may
use the -Denable-python=ON
option.Python
language, notably
for the MTest
tool, one may use the
-Denable-python-bindings=ON
option. This requires pybind11 to be
available.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:
CXX
: name of the C++
compilerCC
: name of the C
compilerFC
: name of the fortran
compilerF77
: name of the fortran
compiler (77
standard)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
Generation of the documentation can be controlled by the following boolean options:
enable-doxygen-doc
, which enables or disables the
generation of the doxygen documentation (disabled by default)enable-reference-doc
, which enables or disables the
reference documentation generation (enabled by default if
latex
or pandoc
is found)enable-website
, which enables or disables the
generation of the TFEL
website (enabled by default if
pandoc
is found)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 ....
The TFEL_APPEND_VERSION
option will append the version
number to the names of:
python
restriction on modules’ names, the characters .
and
-
are replace by _
and that only the first
level modules are affected.share
folder.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:
mfront-3.0.2-dev
executable.libTFELMaterial-3.0.2-dev.so
library.mtest_3_0_2_dev
python
module.tfel_3_0_2_dev.material
python
module.
In this case, the second level (material
) is not
affected.This allows multiple executables to be installed in the same directory.
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.
python
versionA 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 ...
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.
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.
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
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.
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.