Saturday 19 June 2010

Installation of Code_Saturne 2.0-rc1 on Ubuntu 10.04 (64 bit)

Based on the previous posts, "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04" and "Installation of Code_Saturne 2.0-rc1 on Ubuntu 9.10", and David's comments, I double checked the installation of Code_Saturne onto Ubuntu 10.04 LTS (long-time support version) and record the procedure here.

1. Install prerequisites

Using apt-get install the packages as

:/$ sudo apt-get install build-essential gfortran libxml2 libxml2-dev libatlas-headers libatlas-base-dev openmpi-bin openmpi-dev libibverbs-dev openssh-server python-qt4 pyqt4-dev-tools swig python-dev

2. Install HDF5 and MED libraries

Thanks to David's help, I used apt-get to install the 2 packages

:/$ sudo apt-get install libhdf5-serial-dev libmedc-dev

On Ubuntu 10.04, this installs HDF5 1.8.4 and MED 2.3.5. What Code_Saturne really needs is a MED 2.3 mesh format, and thus the minimum version of MED required must be 2.3.0.

I am also glad to see that Code_Saturne supports to use HDF5 1.8.x now.

3. Compile METIS

Download a patched version of Metis-4.0 from my link, and extract it. Compile as

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

Indeed, it is annoying to install METIS due to prototypes redefinition, non-standard directories installation, ... which probably make you don't want to use METIS, even though my patched version. As suggested, you can use the SCOTCH library instead (perhaps a bit less performant for many-processors calculation, but sufficient for standard ones), or only use the internal partioner of Code_Saturne (based on a Space-Filling Curve algorithm, which is good-enough for few-processors calculation, e.g. several-core but mono-processor computers).

4. Configure and compile bft, fvm, ecs and mei sequentially

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

# ship into fvm-0.15.0
:/$ ./configure --with-mpi=/usr/lib/openmpi
...
Configuration options:
 use debugging code: false
 MPI (Message Passing Interface) support: yes
   MPI I/O support: yes
   MPI2 one-sided communication support: yes
 HDF (Hierarchical Data Format) support: yes
 CGNS (CFD General Notation System) support: no
 MED (Model for Exchange of Data) support: yes
...
:/$ make
:/$ sudo make install

# ship into ecs-2.0.0-rc1
:/$ ./configure
...
Configuration options:
 use debugging code: false
 use long integers: false
 ADF support: no
 CCM support: no
 HDF5 (Hierarchical Data Format) support: yes
 CGNS (CFD General Notation System) support: no
 MED (Model for Exchange of Data) support: yes
 METIS (Graph Partitioning) support: yes
 SCOTCH (Graph Partitioning) support: no
...
:/$ make
:/$ sudo make install

MEI is not compulsory, but strongly recommended, as long as you want to define function expressions handily in the GUI.

# ship into mei-1.0.1
:/$ ./configure --with-bft=/usr/local
...
Configuration options:
 use debugging code: false
 Python bindings: true
...
:/$ make
:/$ sudo make install

5. Patch and compile ncs

Extract the patch patches-portability-ncs-20rc1.tgz to the ncs directory.

# ship into ncs-2.0.0-rc1
:/$ tar xzvf ../patch/patches-portability-ncs-20rc1.tgz

Extract the patch rho_mu-tar.gz to a directory. There are 2 files contained, cs_gui.c and FluidCharacteristicsView.py, and copy them accordingly.

# in ncs-2.0.0-rc1
:/$ find . -name cs_gui.c
./src/base/cs_gui.c
:/$ cp ../patch/rho_mu/cs_gui.c src/base/
:/$ find . -name FluidCharacteristicsView.py
./gui/Pages/FluidCharacteristicsView.py
:/$ cp ../patch/rho_mu/FluidCharacteristicsView.py gui/Pages/

Configure and compile ncs, as

# in ncs-2.0.0-rc1
:/$ ./configure --with-mpi=/usr/lib/openmpi --with-prepro=/usr/local --with-mei=/usr/local
...
Configuration options:
 use debugging code: false
 use graphical user interface: yes
 MPI (Message Passing Interface) support: yes
 OpenMP support: no
 BLAS (Basic Linear Algebra Subprograms) support: yes
 Libxml2 (XML Reader) support: yes
 MEI (Mathematical Expressions Interpreter) support: yes
 SYRTHES 3 coupling support: no
 IP socket support (for SYRTHES 3 or CFD_Proxy): yes
 Dynamic loader support (for YACS): yes
...
:/$ make
:/$ sudo make install

6. (optional) Compile latex documents

If you don't use latex, you don't have to bother to compile the documents. I already prepared my compiled documents (pdf files) for you to use directly.

If you want to do it manually, please follow

# for processing LaTeX documents
:/$ sudo apt-get install tetex-bin tetex-base transfig
# in ncs-2.0.0-rc1
:/S cp ~/fullpage.sty ~/lastpage.sty doc/style/
:/$ make pdf
:/$ sudo make install-pdf

7. Run Code_Saturne

After finished the procedure without rebooting the system, I tried to run Code_Saturne but encountered an error as

  ********************************************
    Starting calculation
  ********************************************

Error running the preprocessor.
Check preprocessor log (listpre) for details.

Error running the partitioner.
Check partitioner log (listpart) for details.

  ********************************************
    Error in partitioning stage.
  ********************************************

In listpart it was written that

/usr/local/bin/cs_partition: error while loading shared libraries: libbft.so.1: cannot open shared object file: No such file or directory

Don't worry. Update the dynamic library database to avoid it.

:/$ sudo ldconfig
[sudo] password for salad:
:/$ sudo updatedb

21 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hello,
    I have followed all your instructions and everything was fine, but when I launch code saturne ("code_saturne gui" in my terminal), I can't open "identity and paths"

    I have this error message in my terminal

    "UnicodeEncodeError: 'ascii' codec can't encode characters in position 14-15: ordinal not in range(128)"

    "mesh selection" is not working as well, the error message is :

    Traceback (most recent call last):
    File "/usr/local/lib/python2.6/dist-packages/ncs/Base/MainView.py", line 950, in displayNewPage
    self.Browser)
    File "/usr/local/lib/python2.6/dist-packages/ncs/Base/BrowserView.py", line 574, in display
    return displaySelectedPage(name, root, case, stbar, study, tree)
    File "/usr/local/lib/python2.6/dist-packages/ncs/Base/Toolbox.py", line 101, in displaySelectedPage
    thisPage = Page.SolutionDomainView(root, case, stbar)
    File "/usr/local/lib/python2.6/dist-packages/ncs/Pages/SolutionDomainView.py", line 633, in __init__
    if mesh not in os.listdir(self.case['mesh_path']):
    OSError: [Errno 2] Aucun fichier ou dossier de ce type: ''

    everything else is working (mesh quality criteria, thermophysical models [...] prepare batch calculation).



    If I try to open code_saturne with "code_saturne gui -f exemple1.xml", I have the following message :

    "XML file reading error. This file is not in accordance with XML specifications. Please correct it and verify it with XMLcheck tool."

    But I know that my file is fine, I can open it at work.

    Any idea ?
    It would be great if you could help me because I am really stuck with those problems...

    ReplyDelete
  4. Hello Romain,

    Actually I don't use 'code_saturne gui'. The way I am using can be found in a previous post

    http://code-saturne.blogspot.com/2010/02/cfd-example-laminar-flow-along-2d_06.html

    You can try but I am not sure if it can solve your problems. The error UnicodeEncodeError seems to be related to unicode or language. What is your system language? Can you try to change it to English and see? I remember someone encountered a unicode problem in RedHat, see the comments of the post

    http://code-saturne.blogspot.com/2010/01/compile-codesaturne-with-salome-binary.html

    His problem is in the compilation procedure. I am not sure if it helps on yours, but you can see.

    Regarding the xml file error, I assume you are using a Code_Saturne 2.0-rc1 to open an xml file produced by an older version of Code_Saturne, are you?

    Good luck :)

    Best regards,

    ReplyDelete
  5. small question:

    I looke into the EDF website, and I can only find :
    BFT 1.1.1 (434 Ko)
    FVM 0.14.0 (759 Ko)
    MEI 1.0.0 (414 Ko)

    You are using newer packages, and actually I was following this guide, but my installation failed due to the same reason.

    What should I do?

    Thank you and best regards

    ReplyDelete
  6. Hello Wernher,

    I suggest to use the latest packages. Try to find them from

    https://code-saturne.info/products/code-saturne/forums/announces/918391265

    If you still encounter problems, please let me know.

    Good luck :)

    Best regards,

    ReplyDelete
  7. The installation seems to be ok now, thank you for this guide!. Do you know how to verify it (installation)?

    The only thing, is that the installation of mei failed. Any advice?

    Thank you again

    ReplyDelete
  8. Hi Wernher,

    You can use the following command to check the installation.

    :~$ code_saturne config

    What is the problem you met with regarding the mei installation? Probably you can also refer to a previous post at

    http://code-saturne.blogspot.com/2010/03/installation-of-codesaturne-20-rc1-on.html

    The section 2.b is about MEI. Besides, there is another demonstration post at

    http://code-saturne.blogspot.com/2010/03/mei-is-easy-to-use-and-works-like-charm.html

    Good luck :)

    Best regards,

    ReplyDelete
  9. thank you again!,

    Now I did not have any problems with mei!. It seems that the source of the error was just a missing dependency.

    Regards

    ReplyDelete
  10. Hello Salad
    I have installed Code_Saturne 2.0-rc2 on Ubuntu 10.04 64 bits. The installation seems to be OK. However the calculations cannot be run on 2 processors. I receive this message:
    runcase: line 815: 11601 Abandon ${ecs_bindir}/cs_partition $nproc_kernel > listpart 2>&1
    Error running the partitioner.
    Check partitioner log (listpart) for details.


    ********************************************
    Error in partitioning stage.
    ********************************************

    Then the check of the installation gives what follows

    ~$ code_saturne config
    Directories:
    dirs.prefix = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2
    dirs.exec_prefix = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2
    dirs.bindir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/bin
    dirs.includedir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/include
    dirs.libdir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/lib
    dirs.datarootdir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/share
    dirs.datadir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/share
    dirs.pkgdatadir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/share/ncs
    dirs.docdir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/share/doc/ncs
    dirs.pdfdir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/share/doc/ncs

    Auxiliary information:
    dirs.ecs_bindir = /home/oguerri/Programmes/Saturne2/cs-2.0-rc2/bin
    dirs.syrthes_prefix =

    MPI library information:
    mpi_lib.type = OpenMPI
    mpi_lib.bindir = /usr/lib/openmpi/bin
    mpi_lib.libdir = /usr/lib/openmpi/lib

    Compilers and associated options:
    cc = gcc
    fc = gfortran
    cppflags = -D_POSIX_SOURCE -DNDEBUG -I/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/include -I/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/include -I/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/include -I/usr/lib/openmpi/include -I/usr/include/libxml2
    cflags = -std=c99 -funsigned-char -pedantic -W -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wunused -Wfloat-equal -funroll-loops -O2 -Wuninitialized
    fcflags = -x f95-cpp-input -Wall -Wno-unused -D_CS_LANG_FR -D_CS_FC_HAVE_FLUSH -O
    ldflags = -L/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/lib -L/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/lib -L/home/oguerri/Programmes/Saturne2/cs-2.0-rc2/lib -L/usr/lib/openmpi/lib -Wl,-export-dynamic -O
    libs = -lfvm -lm -lcgns -lmedC -lhdf5 -lfvm_coupl -lmei -lbft -lz -lmpi -lxml2 -lcblas -latlas -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../.. -L/usr/lib/x86_64-linux-gnu -lgfortranbegin -lgfortran -lm -ldl
    rpath = -Wl,-rpath -Wl,

    Compilers and associated options for SYRTHES build:
    cc =
    fc =
    cppflags =
    cflags =
    fcflags =
    ldflags =
    libs =

    Can you help me?

    ReplyDelete
  11. Hello there,

    I am stuck in the step number 4: Configure and compile bft, fvm, ecs and mei sequentially. I've tried your link https://code-saturne.info/products/code-saturne/forums/announces/918391265

    However, due to internet security reason I couldn't access it. Any suggestions?

    Thank you and kind regards,
    Robert

    ReplyDelete
  12. Hello Robert,

    I tried the link address

    https://code-saturne.info/products/code-saturne/forums/announces/918391265

    again and found it works properly. Maybe you can try it later, or figure out if it is due to your internet connection.

    Good luck :)

    Best regards,

    ReplyDelete
  13. Hello Salad,
    I have installed code_Saturne_2.0-rc2 on Ubuntu 10.04 64 bits.
    The installation seems OK. However the code cannot be run on more than 1 processor
    Can you help me
    Thank you and Best Regards

    ReplyDelete
  14. Hi Guerri,

    Can you check your openmpi packages - openmpi-bin openmpi-dev libibverbs-dev? You must make sure that you have installed them properly.

    Otherwise can you show the error msg you got for more information?

    Best regards,

    ReplyDelete
  15. Hello Salad,
    I have installed METIS and the installation is OK know.
    Thank you and Best regards

    ReplyDelete
  16. Hi Guerri,

    I am glad to hear that. You are welcome.

    Best regards,

    ReplyDelete
  17. Many thanks Salad
    your blog is very helpful.
    I'm trying to popularize Code-Saturne based CFD computations.
    So I have to install this code on different PC and your installation procedure is straightforward.
    Best Regards

    ReplyDelete
  18. Hi Ouahiba,

    I am glad to see the blog helps :)

    Best regards,

    ReplyDelete
  19. @salad

    Thank you for your post about "Installation of Code_Saturne 2.0-rc1 on Ubuntu 10.04 (64 bit)", with it and because Code Saturne package is not available on Mandriva Linux, I wrote an article in the Mandrivas's wiki here : http://wiki.mandriva.com/fr/index.php?title=Code_Saturne

    ReplyDelete
  20. Hello,

    I would like to write another post to let people know your instruction on the installation to Mandriva, if you don't mind :)

    Let me know your ideas. Thanks.

    Best regards,

    ReplyDelete
  21. Hello, I'm called Stéphane and i want to install code_saturne 2.0.4 on ubuntu 11.04
    I have followed all your instructions and everything was fine, but when I launch code saturne
    I have this error message in my terminal
    hdf5-1.8.8.tar.gz is not a tar archive
    i don't know how to solve it

    ReplyDelete