FreeFEM Documentation on GitHub

stars - forks

Installation guide

Easy installation

First, go to the download page and choose your platform: Linux, MacOS or Windows.

Note

Binary packages are available for Microsoft Windows, MacOS and some Linux distributions.

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 binary installation

First download the windows installation executable, then double click to install FreeFEM.

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 3.59).

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.

MacOS X binary 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.

If you want terminal access to FreeFEM just copy the file FreeFem++ in a directory of your $PATH shell environment variable.

Arch AUR package

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

To install it:

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

Note

Thanks to Stephan Husmann

Text-editor

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
5
6
7
8
"*":
   ...

   runner:
      extensions:
         edp: "FreeFem++"
      scopes:
         "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/.

Compilation

Branches / OS status

Branch Linux MacOSX Windows 7
Develop Build Status01 Build Status02 Build Status03 Build Status04 Build Status05 Build Status06
Master Build Status07 Build Status08 Build Status09 Build Status10 Build Status11 Build Status12

Using autotools

Compilation on OSX (>=10.13)

Remark: Blocks of code are shell commands in terminal.

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

  2. Install gcc from http://hpc.sourceforge.net

    1
    2
    curl -O http://prdownloads.sourceforge.net/hpc/gfortran-8.1-bin.tar.gz?download
    sudo tar zxvf gfortran-8.1-bin.tar.gz -C /
    
  3. Install autoconf and automake from macport or with Homebrew

    1
    2
    sudo port install autoconf
    sudo port install automake
    
    1
    2
    brew install autoconf
    brew install automake
    
  4. Install mactex from ctan

  5. Install the openmpi source code

    1
    2
    3
    ./configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ F77=/usr/local/bin/gfortran FC=/usr/local/bin/gfortran
    make
    sudo make install
    
  6. Install gsl

    1
    2
    3
    4
    5
    6
    curl -O http://mirror.cyberbits.eu/gnu/gsl/gsl-2.5.tar.gz
    tar zxvf gsl-2.5.tar.gz
    cd gsl-2.5
    ./configure
    make
    sudo make install
    
  7. Install git

  8. Download the FreeFEM source from the repository

    1
    git clone https://github.com/FreeFem/FreeFem-sources.git
    
  1. Compile FreeFEM. Don’t forget to update the MacOS SDK version with your own in the command below:

    1
    2
    3
    4
    5
    6
    cd FreeFem-sources
    autoreconf -i
    ./configure '-with-suffix=macos-10.13' '-without-fltk' '--enable-download' '--enable-optim' 'MPIRUN=/usr/local/bin/mpirun' '--enable-m64' '--without-x' 'CC=clang -isysroot /Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' 'CFLAGS=-mmacosx-version-min=10.13' 'CXXFLAGS=-mmacosx-version-min=10.13 -std=c++11' 'CXX=clang++ -isysroot /Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' 'F77=/usr/local/bin/gfortran' 'FC=/usr/local/bin/gfortran' 'MPICXX=/usr/local/bin/mpic++' 'MPICC=/usr/local/bin/mpicc' 'MPIFC=/usr/local/bin/mpif90' 'MPIF77=/usr/local/bin/mpif90' '--enable-maintainer-mode'
    make
    make check
    sudo make install
    

Compilation on Ubuntu

  1. Install the following dependencies

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install cpp freeglut3-dev g++ gcc gfortran \
        ghostscript m4 make patch pkg-config wget python unzip \
        libopenblas-dev liblapack-dev libhdf5-dev libgsl-dev \
        libscotch-dev libfftw3-dev libarpack2-dev libsuitesparse-dev \
        libmumps-seq-dev libnlopt-dev coinor-libipopt-dev libgmm++-dev libtet1.5-dev \
        gnuplot-qt autoconf automake autotools-dev bison flex gdb valgrind git cmake
    
    # mpich is required for the FreeFem parallel computing version
    sudo apt-get install mpich
    

    Warning

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

  2. Download FreeFEM source from the repository

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

    1
    2
    cd FreeFem-sources
    autoreconf -i
    

    Note

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

  4. Configure

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

    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. Compile petsc & slepc

    1
    2
    3
    cd 3rdparty/ff-petsc
    make petsc-slepc SUDO=sudo
    cd -
    
  7. Reconfigure with petsc and slepc

    1
    ./reconfigure
    
  8. Build

    1
    make
    

    Note

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

    Note

    Optionnally, check the compilation with make check

  9. Install

    1
    sudo make install
    

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:

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

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

    1
    2
    cd FreeFem-sources
    autoreconf -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. Compile petsc & slepc

    1
    2
    3
    cd 3rdparty/ff-petsc
    make petsc-slepc SUDO=sudo
    cd -
    
  7. Reconfigure with petsc and slepc

    1
    ./reconfigure
    
  8. Build

    1
    make
    

    Note

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

    Note

    Optionnally, check the compilation with make check

  9. Install

    1
    sudo make install
    

Compilation on Linux with Intel software tools

Follow the guide

Compilation on Windows

  1. Install MS MPI v7 (msmpisdk.msi and MSMpiSetup.exe)

  2. Install Msys2 (x86_64 version)

  3. Start MSYS2 MSYS

  4. Open MSYS2 MSYS terminal to install dependancies

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

    1
    2
    3
    4
    5
    6
    7
    8
    git clone https://github.com/FreeFem/FreeFem-sources
    cd FreeFem-sources
    autoreconf -i
    ./configure --enable-download --disable-hips
    ./3rdparty/getall -a
    make -j4
    make check
    make install
    

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

Using CMake (FreeFEM without plugins)

Compilation on OSX (>=10.13)

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

  2. Install gcc from http://hpc.sourceforge.net

    1
    2
    curl -O http://prdownloads.sourceforge.net/hpc/gfortran-8.1-bin.tar.gz?download
    sudo tar zxvf gfortran-8.1-bin.tar.gz -C /
    
  3. Install cmake from macport or with Homebrew

    1
    sudo port install cmake
    
    1
    brew install cmake
    
  4. Install mactex from ctan

  5. Install the openmpi source code

    1
    2
    3
    ./configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ F77=/usr/local/bin/gfortran FC=/usr/local/bin/gfortran
    make
    sudo make install
    
  6. Install gsl

    1
    2
    3
    4
    5
    6
    curl -O https://fr.mirror.babylon.network/gnu/gsl/gsl-2.4.tar.gz
    tar zxvf gsl-2.4.tar.gz
    cd gsl-2.4
    ./configure CC=/usr/local/bin/gcc
    make
    sudo make install
    
  7. Install git

  8. Install SparseSuite and Arpack from macport or with Homebrew

    1
    sudo port install arpack SuiteSparse
    
    1
    brew install arpack suite-sparse
    
  9. Download the FreeFEM source from the repository

    1
    git clone https://github.com/FreeFem/FreeFem-sources.git
    
  10. Compile FreeFEM. Don’t forget to update the MacOS SDK version with your own in the command below:

1
2
3
4
5
6
7
cd FreeFem-sources
mkdir build
cd build
cmake ..
make
make test
sudo make install

Compilation on Ubuntu

  1. Install the following dependencies

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install cpp freeglut3-dev g++ gcc gfortran \
        ghostscript m4 make patch pkg-config wget python unzip \
        libopenblas-dev liblapack-dev libhdf5-dev libgsl-dev \
        libscotch-dev libfftw3-dev libarpack2-dev libsuitesparse-dev \
        libmumps-seq-dev libnlopt-dev coinor-libipopt-dev libgmm++-dev libtet1.5-dev \
        gnuplot-qt autoconf automake autotools-dev bison flex gdb valgrind git cmake
    
    # mpich is required for the FreeFem parallel computing version
    sudo apt-get install mpich
    

    Warning

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

  2. Download FreeFEM source from the repository

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

    1
    2
    3
    4
    cd FreeFem-sources
    mkdir build
    cd build
    cmake ..
    
  4. Build

    1
    make
    

    Note

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

    Note

    Optionnally, check the compilation with make test

  5. Install

    1
    sudo make install
    

Compilation on Windows

  1. Install MS MPI v7 (msmpisdk.msi and MSMpiSetup.exe)

  2. Install Msys2 (x86_64 version)

  3. Start MSYS2 MSYS

  4. Open MSYS2 MSYS terminal to install dependancies

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

    1
    2
    3
    4
    5
    6
    7
    8
    git clone https://github.com/FreeFem/FreeFem-sources
    cd FreeFem-sources
    mkdir build
    cd build
    cmake ..
    make -j4
    make test
    make install
    

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

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:

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

The possible paths for this file are

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

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

1
2
3
export FF_VERBOSITY=50
export FF_INCLUDEPATH="dir;;dir2"
export 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

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