Sunday, 16 August 2009

Installation of Code_Saturne 2.0.0 on Ubuntu 9.04

NEW - A post "Installation of Code_Saturne 2.0-rc1 on Ubuntu 10.04 (64 bit)" was recently published and recommended if you have already updated to Ubuntu 10.04.

Code_Saturne version 2.0.0-beta2 was released at the beginning of this August. Since the user routines were changed into FORTRAN95 (.f90 extension) free format, it is suggested to update onto this version.

Code_Saturne 2.0.0 changed its installation onto "autoconf". Therefore, its compilation can be completed by using a typical procedure "configure && make && make install". If you don't mention a target directory for the "configure" scripts, all code will be installed into /usr/local. With respect to the usage, sourcing of a "cs_profile" file is not needed anymore, and you can directly use a unique "cs" script under /usr/local/bin.

The following is an instruction on how to compile Code_Saturne 2.0.0-beta2 on Ubuntu 9.04.

First of all, for CS 2.0.0, install necessary packages by using apt-get.

# for compiling source code
:/$ sudo apt-get install build-essential gfortran libxml2 libxml2-dev
# install BLAS mathematic libraries
:/$ sudo apt-get install libatlas-headers libatlas-base-dev
# for openmpi (support for parallel computing)
:/$ sudo apt-get install openmpi-bin openmpi-dev libibverbs-dev
# for ssh-server (support for parallel computing)
:/$ sudo apt-get install openssh-server
# for GUI
:/$ sudo apt-get install python-qt4
# for GUI, provide pyuic4, pyrcc4 and pylupdate4
:/$ sudo apt-get install pyqt4-dev-tools
# optional, only necessary if compile MEI
:/$ sudo apt-get install bison flex swig python-dev
# for LaTeX documents
:/$ sudo apt-get install tetex-bin tetex-base
# for LaTeX documents, provide fig2dev
:/$ sudo apt-get install transfig
# for LaTeX documents, provide epstopdf
:/$ sudo apt-get install texlive-extra-utils

Download packages bft-111, fvm-0140, ecs-200 and ncs-200 from the official website, and then together with the extra downloaded packages, metis-4.0, hdf5-1.6.9 and med-2.3.5, extract these packages into a temporary directory, in which you can "configure; make; sudo make install" them one by one.

1. Compile metis-4.0, hdf5-1.6.9, med-2.3.5 and bft-1.1.1

# ship into metis-4.0
:/$ make
:/$ cp graphchk kmetis mesh2dual mesh2nodal oemetis onmetis partdmesh partnmesh pmetis /usr/local/bin/
:/$ cp libmetis.a /usr/local/lib/
:/$ cp Lib/*.h /usr/local/include/

# ship into hdf5-1.6.9
:/$ ./configure --prefix=/usr/local
:/$ make
:/$ sudo make install

# ship into med-2.3.5
:/$ ./configure --with-hdf5=/usr/local
:/$ make
:/$ sudo make install

# ship into bft-1.1.1
:/$ ./configure
:/$ make
:/$ sudo make install

2. Compile fvm-0.14.0

# ship into fvm-0.14.0
:/$ ./configure --with-mpi=/usr/lib/openmpi
:/$ make
:/$ sudo make install

3. Compile ecs-2.0.0

# ship into ecs-2.0.0-beta2
:/$ ./configure
:/$ make
:/$ sudo make install

4. Compile ncs-2.0.0

# ship into ncs-2.0.0-beta2
:/$ ./configure --with-mpi=/usr/lib/openmpi --with-prepro=/usr/local LIBS=-lm
:/$ make
:/$ sudo make install
# optional, to produce and install pdf documents
:/S cp ~/fullpage.sty ~/lastpage.sty doc/style/
:/$ make pdf
:/$ sudo make install-pdf

After this is finished, use "cs config" to check the status of the newly installed Code_Saturne 2.0.0 beta2.

Ps, this instruction did not include the compilation of MEI, because I encountered an error during my trying it. I thought it is okay to ignore this error. However, after finishing the whole installation, I found the option "user law" was grey and disabled.

make[1]: Entering directory `/home/salad/Code_Saturne/src/mei-1.0.0/pytests'
cp: `../pytests/' and `../pytests/' are the same file
make[1]: *** [all] Error 1


  1. Hi

    I just tried in a Ubuntu 32bits and I had to use the -lm flag to compile the fvm. Otherwise it complains about undefined referece to 'sqrt' 'cos' and 'sin'


  2. I am not sure about this, but I tried Ubuntu 9.04 32 bit as well as 64 bit versions, I didn't need to specify a -lm flag. Anyway, I didn't try on the latest 9.10 yet.

    Many thanks :)

  3. did you found how to include atlas/blas on 2.0.0beta2 installation ?

  4. I remember I did but found I haven't yet. Thanks for your reminding.

    I guess one can install packages libatlas-headers and libatlas-sse2-dev, and then specify a related option when "./configure" ncs-2.0.0. "./configure --help" could give instructions about this potential option. I will also find time to try.

    You can also refer to my previous poster about 1.3.3. There are parts about atlas/blas. Hope that helps too.

  5. I updated this post by adding the atlas/blas part. Hope your comments on it.

  6. Where can I find the nsc-2.0.0-beta2 package?
    Thanks in advance

  7. This post gave the download links of the packages:

    Or you can go to

    directly to download Code_Saturne.

    Hope it helps :)

  8. The ncs-2.0.0-beta2 is not in the list.
    I had already checked those links, without success. I tried to search also the ncs in debian repository (for example ecs 2.0.0 beta2 is available in debian), ubuntu repository, in EDF web site and google, but ncs seems not to be present.
    Any help?

  9. Well, try to download this

    However, if you are looking for a deb package which can be installed without compilation, the above link is not for you. You have to compile ncs by yourself. With this post, it is not difficult.

    ecs is already in debian repository? I didn't notice this. I know EDF has plans to make deb packages for Code_Saturne, but I've no idea about whether they finished not. I also think a PPA source for Code_Saturne should be very useful.

    Leave your comments if you need help :)