FreeFEM Documentation on GitHub

stars - forks

Installation guide

To use FreeFEM, two installation methods are available: user access (binary package) and access developers (from the source code). Follow the section corresponding to your type of installation.

Note

Since the version 4.5, FreeFEM relese provides with the last version of PETSc.



Using binary package

First, open the following web page download page and choose your platform: Linux, MacOS or Windows.

Note

Binary packages are available for Microsoft Windows, MacOS and some Linux distributions. Since the release 4.5, FreeFEM binaries provide with the current version of PETSc.

Install FreeFEM by double-clicking on the appropriate file. Under Linux and MacOS the install directory is one of the following /usr/local/bin, /usr/local/share/freefem++, /usr/local/lib/ff++

Windows installation

Note

The windows package is build for Window 7 64bits. The support ended for all releases under Windows 32 bits since the V4.

First download the windows installation executable, then double click to install FreeFEM. Install MSMPI for parallel version under window64 MS MPI V10.1.2, and install both msmpisdk.msi and MSMpiSetup.exe.

In most cases just answer yes (or type return) to all questions.

Otherwise in the Additional Task windows, check the box “Add application directory to your system path.” This is required otherwise the program ffglut.exe will not be found.

By now you should have two new icons on your desktop:

  • FreeFem++ (VERSION).exe, the freefem++ application.

  • FreeFem++ (VERSION) Examples, a link to the freefem++ examples folder.

where (VERSION) is the version of the files (for example 4.5).

By default, the installed files are in C:\Programs Files\FreeFem++. In this directory, you have all the .dll files and other applications: FreeFem++-nw.exe, ffglut.exe, … The syntax for the command-line tools are the same as those of FreeFem.exe.

To use FreeFEM binaries under Windows, two methods are possible:

  • Use the FreeFEM launcher (launchff++.exe)

Warning: if you launch FreeFEM without filename script by double-clicking, your get a error due (it is bug of usage GetOpenFileName in win64).

  • In shell terminal (cmd, powershell, bash, … ):

    • To launch sequential version:

    1C:\>"Program Files (x86)\FreeFem++\FreeFem++.exe" <mySequentialScript.edp>
    
    • To launch parallel version:

    1C:\>"Program Files\Microsoft MPI\Bin\mpiexec.exe" -n <nbProcs> C:\>"Program Files (x86)\FreeFem++\FreeFem++-mpi.exe" <myParallelScript.edp>
    

macOS X installation

Download the macOS X binary version file, extract all the files by double clicking on the icon of the file, go the the directory and put the FreeFem++.app application in the /Applications directory. And read the README.md file. If you want terminal access to FreeFEM just copy the file FreeFem++ in a directory of your $PATH shell environment variable.

We make a small move to explain how to by pass the security problem see FreeFEM install movie <https://www.ljll.fr/hecht/pkg/Install-FreeFEM-MacOS.mov>`

Ubuntu installation

Note

The Debian package is built for Ubuntu 16.04

Beforehand, install the following dependances libraries using the apt tool:

1sudo apt-get install libgsl-dev libhdf5-dev
2             liblapack-dev libopenmpi-dev freeglut3-dev

Download the package FreeFEM .deb, install it by the command

1dpkg -i FreeFEM_VERSION_Ubuntu_withPETSc_amd64.deb

FreeFEM is directly available in your terminal by the command “FreeFem++”.

Arch AUR package

An up-to-date package of FreeFEM for Arch is available on the Archlinux user repository.

To install it:

1git clone https://aur.archlinux.org/freefem++-git.git
2cd freefem++-git
3makepkg -si

Note

Thanks to Stephan Husmann

Fedora installation

Packages are available in the Fedora Repositories, and they are managed by the Fedora SciTech special interest group. The packages are usually recent builds, but may not be the latest released version.

You can install them using the dnf tool, for both the serial and parallel (MPI) versions. :

1sudo dnf install freefem++
2sudo dnf install freefem++-openmpi
3sudo dnf install freefem++-mpich

FreeFEM is directly available in your terminal by the command “FreeFem++”. To use the OpenMPI version, in your terminal first load the OpenMPI module, for example using

1module load mpi/openmpi-x86_64

and then the command “FreeFem++-mpi_openmpi” will be available in your terminal. To use the MPICH version, in your terminal first load the MPICH module using

1module load mpi/mpich-x86_64

and then the command “FreeFem++-mpi_mpich” will be available in your terminal.

Compiling source code

Various versions of FreeFEM are possible:
  • sequential and without plugins (contains in 3rdparty)

  • parallel with plugins (and with PETSc).

Note

We advise you to use the package manager for macOS Homebrew to get the different packages required avalaible here

Compilation on OSX (>=10.13)

  1. Install Xcode, Xcode Command Line tools and Xcode Additional Tools from the Apple website

  2. Install gfortran from Homebrew

    1 brew --cask install gfortran
    

Note

If you have installed gcc via brew, gfortran comes with it and you do not need this line

  1. To use FreeFEM parallel version, install openmpi or mpich

    1 # to install openmpi
    2 curl -L https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz --output openmpi-4.0.1.tar.gz
    3 tar xf openmpi-4.0.1
    4 cd openmpi-4.0.1/
    5 # to install mpich
    6 curl -L https://www.mpich.org/static/downloads/4.0.2/mpich-4.0.2.tar.gz --output mpich-4.0.2.tar.gz
    7 tar xf mpich-4.0.2.tar.gz
    8 cd mpich-4.0.2
    
    4 # with brew gcc gfortran compilers
    5 FFLAGS=-fallow-argument-mismatch FCFLAGS=-fallow-argument-mismatch ./configure CC=clang CXX=clang++ FC=gfortran-11 F77=gfortran-11 --prefix=/where/you/want/to/have/files/installed
    6
    7 # with LLVM gcc and brew gfortran compilers
    8 FFLAGS=-fallow-argument-mismatch FCFLAGS=-fallow-argument-mismatch ./configure CC=gcc-11 CXX=g++-11 FC=gfortran-11 F77=gfortran-11 --prefix=/where/you/want/to/have/files/installed
    
    5 make -j<nbProcs>
    6 make install
    
  2. Install the minimal libraries for FreeFEM

    1brew install m4 git flex bison
    
  3. If you want build your own configure according your system, install autoconf and automake from Homebrew (optional, see note in step 10)

    1brew install autoconf automake
    
  4. To use FreeFEM with its plugins, install from Homebrew suitesparse, hdf5, cmake, wget

    1brew install suitesparse hdf5 cmake wget
    
  5. Install gsl

    1curl -O https://mirror.ibcp.fr/pub/gnu/gsl/gsl-2.7.tar.gz
    2tar zxvf gsl-2.7.tar.gz
    3cd gsl-2.7
    4./configure
    5make -j<nbProcs>
    6make install --prefix=/where/you/want/to/have/files/installed
    
  6. Download the latest Git for Mac installer git and the FreeFEM source from the repository

    1git clone https://github.com/FreeFem/FreeFem-sources.git
    
  7. Configure your source code

    1 cd FreeFem-sources
    2 autoreconf -i
    

    Note

    if your autoreconf version is too old, do tar zxvf AutoGeneratedFile.tar.gz

    • following your compilers

    3// with brew gcc gfortran compilers
    4./configure --enable-download -enable-optim CC=clang CXX=clang++ F77=gfortran-11
    5    FC=gfortran-11 --prefix=/where/you/want/to/have/files/installed
    6
    7// with LLVM gcc and brew gfortran compilers
    8./configure --enable-download -enable-optim CC=gcc CXX=g++ F77=gfortran-11
    9    FC=gfortran-11 --prefix=/where/you/want/to/have/files/installed
    
  8. Download the 3rd party packages to use FreeFEM plugins

1./3rdparty/getall -a

Note

All the third party packages have their own licence

  1. If you want use PETSc/SLEPc and HPDDM (High Performance Domain Decomposition Methods)

1cd 3rdparty/ff-petsc
2make petsc-slepc // add SUDO=sudo if your installation directory is the default /usr/local
3cd -
4./reconfigure
  1. Build your FreeFEM library and executable

1make -j<nbProcs>
2make -j<nbProcs> check

Note

make check is optional, but advised to check the validity of your FreeFEM build

  1. Install the FreeFEM apllication

    make install // add SUDO=sudo might be necessary

Note

it isn’t necessary to execute this last command, FreeFEM executable is avalaible here your_installation/src/nw/FreeFem++ and mpi executable here your_installation/src/mpi/ff-mpirun.

Compilation on Ubuntu

  1. Install the following packages on your system

    1sudo apt-get update && sudo apt-get upgrade
    2sudo apt-get install cpp freeglut3-dev g++ gcc gfortran \
    3    m4 make patch pkg-config wget python unzip \
    4    liblapack-dev libhdf5-dev libgsl-dev \
    5    autoconf automake autotools-dev bison flex gdb git cmake
    6
    7# mpich is required for the FreeFEM parallel computing version
    8sudo apt-get install mpich
    

    Warning

    In the oldest distribution of Ubuntu, libgsl-dev does not exist, use libgsl2-dev instead

  2. Download FreeFEM source from the repository

    1git clone https://github.com/FreeFem/FreeFem-sources.git
    
  3. Autoconf

    1cd FreeFem-sources
    2autoreconf -i
    

    Note

    if your autoreconf version is too old, do tar zxvf AutoGeneratedFile.tar.gz

  4. Configure

    1./configure --enable-download --enable-optim
    2    --prefix=/where/you/want/to/have/files/installed
    

    Note

    To see all the options, type ./configure --help

  5. Download the 3rd party packages

    1./3rdparty/getall -a
    

    Note

    All the third party packages have their own licence

  6. If you want use PETSc/SLEPc and HPDDM (High Performance Domain Decomposition Methods) for massively parallel computing

    1cd 3rdparty/ff-petsc
    2make petsc-slepc // add SUDO=sudo if your installation directory is the default /usr/local
    3cd -
    4./reconfigure
    
  7. Build your FreeFEM library and executable

    1make -j<nbProcs>
    2make -j<nbProcs> check
    

    Note

    make check is optional, but advised to check the validity of your FreeFEM build

  8. Install the executable

    1make install
    

    Note

    it isn’t necessary to execute this last command, FreeFEM executable is avalaible here your_installation/src/nw/FreeFem++ and mpi executable here your_installation/src/mpi/ff-mpirun

Compilation on Arch Linux

Warning

As Arch is in rolling release, the following information can be quickly outdated !

Warning

FreeFEM fails to compile using the newest version of gcc 8.1.0, use an older one instead.

  1. Install the following dependencies:

    1pacman -Syu
    2pacman -S git openmpi gcc-fortran wget python
    3    freeglut m4 make patch gmm
    4    blas lapack hdf5 gsl fftw arpack suitesparse
    5    gnuplot autoconf automake bison flex gdb
    6    valgrind cmake texlive-most
    
  2. Download the FreeFEM source from the repository

    1git clone https://github.com/FreeFem/FreeFem-sources.git
    
  3. Autoconf

    1cd FreeFem-sources
    2autoreconf -i
    
  4. Configure

    1./configure --enable-download --enable-optim
    

    Note

    To see all the options, type ./configure --help

  5. Download the packages

    1./3rdparty/getall -a
    

    Note

    All the third party packages have their own licence

  6. If you want use HPDDM (High Performance Domain Decomposition Methods) for massively parallel computing, install PETSc/SLEPc

    1cd 3rdparty/ff-petsc
    2make petsc-slepc SUDO=sudo
    3cd -
    4./reconfigure
    
  7. Compile the FreeFEM source

    1make
    

    Note

    If your computer has many threads, you can run make in parallel using make -j16 for 16 threads, for example.

    Note

    Optionally, check the compilation with make check

  8. Install the FreeFEM application

    1sudo make install
    

Compilation on Fedora

  1. Install the following packages on your system

     1sudo dnf update
     2sudo dnf install freeglut-devel gcc-gfortran gcc-c++ gcc \
     3                  m4 make wget python2 python3 unzip \
     4                  lapack-devel hdf5-devel gsl gsl-devel \
     5                  autoconf automake bison flex gdb git cmake
     6
     7# MPICH or OpenMPI is required for the FreeFEM parallel computing version
     8sudo dnf install mpich-devel
     9sudo dnf install openmpi-devel
    10
    11# Then load one of the modules, for example
    12module load mpi/mpich-x86_64
    13# or
    14module load mpi/openmpi-x86_64
    
  2. Download FreeFEM source from the repository

    1git clone https://github.com/FreeFem/FreeFem-sources.git
    
  3. Autoconf

    1cd FreeFem-sources
    2autoreconf -i
    

    Note

    if your autoreconf version is too old, do tar zxvf AutoGeneratedFile.tar.gz

  4. Configure

    1./configure --enable-download --enable-optim
    2    --prefix=/where/you/want/to/have/files/installed
    

    Note

    To see all the options, type ./configure --help

  5. Download the 3rd party packages

    1./3rdparty/getall -a
    

    Note

    All the third party packages have their own licence

  6. If you want use PETSc/SLEPc and HPDDM (High Performance Domain Decomposition Methods) for massively parallel computing

    1cd 3rdparty/ff-petsc
    2make petsc-slepc // add SUDO=sudo if your installation directory is the default /usr/local
    3cd -
    4./reconfigure
    
  7. Build your FreeFEM library and executable

    1make -j<nbProcs>
    2make -j<nbProcs> check
    

    Note

    make check is optional, but advised to check the validity of your FreeFEM build

  8. Install the executable

    1make install
    

    Note

    it isn’t necessary to execute this last command, FreeFEM executable is avalaible here your_installation/src/nw/FreeFem++ and mpi executable here your_installation/src/mpi/ff-mpirun

Compilation on Linux with Intel software tools

Follow the guide

Compilation on Windows

Warning

The support ended for all releases under Windows 32 bits since the V4. We assume your development machine is 64-bit, and you want your compiler to target 64-bit windows by default.

  1. Install the Microsoft MPI v10.1.2 (archived) (msmpisdk.msi and MSMpiSetup.exe)

  2. Download msys2-x86_64-latest.exe (x86_64 version) and run it.

  3. Install the version control system Git for Windows

4. In the MSYS2 shell, execute the following. Hint: if you right click the title bar, go to Options -> Keys and tick “Ctrl+Shift+letter shortcuts” you can use Ctrl+Shift+V to paste in the MSYS shell.

1pacman -Syuu

Close the MSYS2 shell once you’re asked to. There are now 3 MSYS subsystems installed: MSYS2, MinGW32 and MinGW64. They can respectively be launched from C:devmsys64msys2.exe, C:devmsys64mingw32.exe and C:devmsys64mingw64.exe Reopen MSYS2 (doesn’t matter which version, since we’re merely installing packages). Repeatedly run the following command until it says there are no further updates. You might have to restart your shell again.

1pacman -Syuu
  1. Now that MSYS2 is fully up-to-date, install the following dependancies

    • for 64 bit systems:

    1pacman -S autoconf make automake-wrapper bison git \
    2  mingw-w64-x86_64-freeglut mingw-w64-x86_64-toolchain \
    3  mingw-w64-x86_64-openblas patch python perl pkg-config pkgfile \
    4  rebase tar time tzcode unzip which mingw-w64-x86_64-gsl \
    5  --ignore mingw-w64-x86_64-gcc-ada --ignore mingw-w64-x86_64-gcc-objc \
    6  --ignore mingw-w64-x86_64-gdb mingw-w64-x86_64-cmake --noconfirm
    
    • for 32 bit systems (FreeFEM lower than version 4):

    1pacman -S autoconf automake-wrapper bash bash-completion \
    2  bison bsdcpio bsdtar bzip2 coreutils curl dash file filesystem \
    3  findutils flex gawk gcc gcc-fortran gcc-libs grep gzip inetutils \
    4  info less lndir make man-db git mingw-w64-i686-freeglut \
    5  mingw-w64-i686-toolchain mingw-w64-i686-gsl mingw-w64-i686-hdf5 \
    6  mingw-w64-i686-openblas mintty msys2-keyring msys2-launcher-git \
    7  msys2-runtime ncurses pacman pacman-mirrors pactoys-git patch pax-git \
    8  perl pkg-config pkgfile rebase sed tar tftp-hpa time tzcode unzip \
    9  util-linux which
    
  2. Open a MingW64 terminal (or MingW32 for old 32 bit FreeFEM version) and compile the FreeFEM source

    1git clone https://github.com/FreeFem/FreeFem-sources
    2cd FreeFem-sources
    3autoreconf -i
    4./configure --enable-generic --enable-optim \
    5  --enable-download --enable-maintainer-mode \
    6  CXXFLAGS=-mtune=generic CFLAGS=-mtune=generic \
    7  FFLAGS=-mtune=generic --enable-download --disable-hips
    8          --prefix=/where/you/want/to/have/files/installed
    
  3. If you want use HPDDM (High Performance Domain Decomposition Methods) for massively parallel computing, install PETSc/SLEPc

    1cd 3rdparty/ff-petsc
    2make petsc-slepc SUDO=sudo
    3cd -
    4./reconfigure
    
  4. Download the 3rd party packages and build your FreeFEM library and executable

    1./3rdparty/getall -a
    2make
    3make check
    4make install
    

    Note

    The FreeFEM executable (and some other like ffmedit, …) are in C:\msys64\mingw64\bin (or C:\msys32\mingw32\bin).

FreeFEM continuous integration

The Inria Jenkins platform is used for the CI/CD integration of the source code.

Compilation results of the develop branch by OS type and configuration of FreeFEM are here

Branch

Linux 16.04

Linux 18.04

MacOS 10.10.5

MacOS 10.13.5

Windows 7

Develop

Build Status01

Build Status02

Build Status03

Build Status04

Build Status05

Develop mpich and PETSc/SLEPc

Build Status06

Build Status07

Build Status08

Build Status09

Build Status10 MSMPI V10.1.2

Develop openmpi and PETSc/SLEPc

Build Status11

Build Status12

Build Status13

Build Status14

Environment variables and init file

FreeFEM reads a user’s init file named freefem++.pref to initialize global variables: verbosity, includepath, loadpath.

Note

The variable verbosity changes the level of internal printing (0: nothing unless there are syntax errors, 1: few, 10: lots, etc. …), the default value is 2.

The included files are found in the includepath list and the load files are found in the loadpath list.

The syntax of the file is:

1verbosity = 5
2loadpath += "/Library/FreeFem++/lib"
3loadpath += "/Users/hecht/Library/FreeFem++/lib"
4includepath += "/Library/FreeFem++/edp"
5includepath += "/Users/hecht/Library/FreeFem++/edp"
6# This is a comment
7load += "funcTemplate"
8load += "myfunction"
9load += "MUMPS_seq"

The possible paths for this file are

  • under Unix and MacOs

1/etc/freefem++.pref
2$(HOME)/.freefem++.pref
3freefem++.pref
  • under windows

1freefem++.pref

We can also use shell environment variables to change verbosity and the search rule before the init files.

1export FF_VERBOSITY=50
2export FF_INCLUDEPATH="dir;;dir2"
3export FF_LOADPATH="dir;;dir3"

Note

The separator between directories must be “;” and not “:” because “:” is used under Windows.

Note

To show the list of init of FreeFEM , do

1export FF_VERBOSITY=100;
2./FreeFem++-nw


Coloring Syntax FreeFem++

Atom

In order to get the syntax highlighting in Atom, you have to install the FreeFEM language support.

You can do it directly in Atom: Edit -> Preferences -> Install, and search for language-freefem-offical.

To launch scripts directly from Atom, you have to install the atom-runner package. Once installed, modify the Atom configuration file (Edit -> Config…) to have something like that:

1"*":
2   ...
3
4   runner:
5      extensions:
6         edp: "FreeFem++"
7      scopes:
8         "Freefem++": "FreeFem++"

Reboot Atom, and use Alt+R to run a FreeFem++ script.

Gedit

In order to get the syntax highlighting in Gedit, you have to downlaod the Gedit parser and copy it in /usr/share/gtksourceview-3.0/language-specs/.

Textmate 2, an editor under macOS

To use the coloring FreeFEM syntax with the Textmate 2 editor on Mac 10.7 or better, download from macromates.com and download the textmate freefem++ syntax here (version june 2107). To install this parser, unzip Textmate2-ff++.zip and follow the explanation given in file How_To.rtf.

rom www.freefem.org/ff++/Textmate2-ff++.zip (version june 2107) unzip Textmate2-

Notepad++,an editor under windows

Read and follow the instruction, FREEFEM++ COLOR SYNTAX OF WINDOWS .

Emacs editor

For emacs editor you can download ff++-mode.el .

Table of content