Gerris is written in C and uses two other C libraries which you need to install on your system first: the Glib library and the GTS library. If you want to run the parallel version of Gerris, you will also need some implementation of the MPI (Message Passing Interface) library. If you are using a parallel machine, MPI is very likely to be already on your machine.
If you are using a Linux system the Glib library is most probably already installed on your system. To be sure try this:
% glib-config --versionor this
% pkg-config glib-2.0 --modversionIf you get a result, you have the Glib library on your system, otherwise you will need to install it following the instructions on the Glib web site.
If you are using one of the Debian-based distribution (e.g. Debian, Knoppix, Ubuntu, etc...), you can install GTS and Gerris using your favourite Debian package management tool. Be aware however that the most recent version of Gerris may not be packaged yet for Debian (especially if you are using the ``testing'' or ``stable'' branches of Debian). To install Gerris using apt-get just type as root:
% apt-get install gerrisIf you want to install only the Debian packages for GTS (and then compile Gerris from source) type:
% apt-get install libgts-devIn all cases, this will also install the required version of Glib.
If you don't want to wait for an updated version of the official Debian package for Gerris, you can follow the development version of Gerris by using the unofficial Debian packages which are built every night automatically (see next section for more info). To do this just add the following lines to your apt-get repository list (usually /etc/apt/sources.list):
# GTS deb http://gts.sourceforge.net/debian/ ./ # Gerris deb http://gfs.sourceforge.net/debian/ ./then do:
% apt-get update % apt-get install libgts-snapshot gerris-snapshot gfsview-snapshotthis will install all the required libraries. When a new development version becomes available, doing an apt-get upgrade will automatically upgrade your versions of GTS, Gerris and GfsView.
When installing from source, you will need to decide which version of Gerris you want to install. Installing from the current official release (by following the Download Gerris x.x.x link on the Gerris web site) should be safe. If you don't want to wait for official releases, you can install more current versions of Gerris by following the Gerris snapshot link. These snapshots are generated automatically every night (when the code changes). They are more experimental than the official release but are tested both for correct compilation and correct execution by runnning the automated test suite. If you choose to install from the snapshot, you will also need to install and regularly update GTS from the corresponding snapshots on the GTS web site.
If you choose to install everything from source, you will need to install the GNU Triangulated Surface Library (GTS). To do that, go on the GTS web site and download a recent source file package. Move it to your preferred location for unpacking source files and type:
% gunzip gts.tar.gz % tar xvf gts.tar % cd gtsYou now need to decide where you want to install the library, if you have access to the root account, you can simply type:
% ./configure % make % su % make install % exitwhich will install everything in /usr/local by default.
If you don't have access to the root password or want to install the library somewhere else like /home/joe/local for example, you can type instead:
% ./configure --prefix=/home/joe/local % make % make installYou can also type
% ./configure --helpto get a summary of the options taken by configure.
You probably want to add /home/joe/local/bin to your PATH, /home/joe/local/lib to your LD_LIBRARY_PATH and /home/joe/local/lib/pkgconfig to your PKG_CONFIG_PATH.
The next step is installing Gerris itself, do the same, go to the Gerris web site download a recent source file package and type:
% gunzip gerris.tar.gz % tar xvf gerris.tar % cd gerris % ./configure --prefix=/home/joe/local % make % make installBoth the 2D and 3D versions of the code are built. In this tutorial, we will for convenience only work with 2D simulations. However, all we will learn can be applied directly to 3D simulations.
We are now ready to start. Just to check that everything is okay try:
% gerris2D -V
Installing from the version control system is the preferred way of installing Gerris if you want to change the code and submit changes for inclusion in the main Gerris distribution. I currently use darcs, a very nice distributed version control system. I will just give a recipe on how to install Gerris from the central darcs repository. You should consult the darcs manual if you want to learn more about darcs.
After installing darcs, to get the current stable version of Gerris using darcs do:
% darcs get http://gfs.sf.net/darcs/gerris/gerris-stablewhich will create a gerris-stable directory containing the source code. To build Gerris you will need the autoconf, automake toolsuite. The version of Automake must be > =
% cd gerris-stable % sh autogen.shwhich will generate the configure script. Then follow the instructions of section 1.1.3.
The darcs repository is updated regularly with patches submitted by developers. To synchronise your current version with the most recent one type:
% cd gerris-stable % darcs pull % make % make install
If you make changes to the source code and want to record these in darcs type:
% darcs record
You will also need to track the changes made to the GTS library if they are used by the current version of Gerris. I also use darcs to store GTS changes. To install GTS just repeat the instructions using http://gts.sf.net/darcs/gts-mainline as source repository.
Note that whenever you update/re-install GTS, you will need to rebuild Gerris. Just changing to the source directory of Gerris and typing make will rebuild Gerris if GTS has been reinstalled.