CFD,  OpenFOAM

Installing OpenFOAM 2.1.x on openSUSE 12.1

OpenFOAM® 2.1.x has just been released, and brings an interesting number of new functions concerning arbitrary mesh interface (AMI), multiphase solvers, turbulence modeling, improved run-time control and new numerical methods.

Assuming that OpenFOAM will be installed in the user’s home directory, the procedure to install OpenFOAM 2.1.x (git version) on openSUSE 12.1 is then as follows:

  1. Install the C/C++ development pattern:
    • zypper install -t pattern devel_C_C++
  2. Install other dependencies (gnuplot is optional, but useful):
    • zypper install cmake libqt4-devel gnuplot openmpi openmpi-devel git-core
  3. Make sure git is installed
    • zypper install git-core
  4. Check that openmpi 1.4.3 is selected as default with:
    • mpi-selector --list
    • The output should read: “openmpi-1.4.3”. If not, use mpi-selector to configure the default version of openmpi (this can be done for the individual user or system-wide, acquiring administrative rights)
  5. Create the OpenFOAM directory in your home directory:
    • mkdir ~/OpenFOAM
  6. Move to the OpenFOAM directory:
    • cd ~/OpenFOAM
  7. Download the source code from the git repository:
    • git clone http://github.com/OpenFOAM/OpenFOAM-2.1.x.git
  8. Download the ThirdParty package from here (command on a single line) :
    • wget -c http://downloads.sourceforge.net/foam/ThirdParty-2.1.0.tgz?use_mirror=mesh -O ThirdParty-2.1.0.gtgz
  9. Extract the ThirdParty package and rename it as follows:
    • tar xzf ThirdParty-2.1.0.gtgz
    • mv ThirdParty-2.1.0 ThirdParty-2.1.x
  10. Add this  prefs.sh file to the directory:
    • ~/OpenFOAM/OpenFOAM-2.1.x/etc/
  11. Add the following line to your ~/.bashrc file:
    • [Optional for multi-core compilation, replace 4 with the number of cores you want to use]: export WM_NCOMPPROCS=4
    • source $HOME/OpenFOAM/OpenFOAM-2.1.x/etc/bashrc
  12. Open a new terminal and execute this sequence of commands to compile the whole OpenFOAM suite
    • source ~/.bashrc
    • cd ~/OpenFOAM/OpenFOAM-2.1.x
    • ./Allwmake
  13. To build paraview and its reader:
    • cd ~/OpenFOAM/ThirdParty-2.1.x
    • ./makeParaView
    • cd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers/
    • ./Allwclean
    • ./Allwmake
  14. At this point OpenFOAM 2.1.x should be fully functional on your openSUSE 12.1. The installation can be updated, as usual, with:
    • cd ~/OpenFOAM/OpenFOAM-2.1.x
    • git pull
    • wcleanLnIncludeAll
    • ./Allwmake

Note: If you have an accelerated video card, like nVidia or ATI, it is strongly recommended to install the corresponding proprietary driver.

Enjoy 🙂

This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. Alberto Passalacqua is not associated to OpenCFD Ltd.

9 Comments

  • JonW

    Just grate, thanks, works like a charm 🙂

    I have just installed openSUSE 12.1 64 bit and OpenFOAM 2.1.x according to your instructions. Everything works great.
    A minor point, There is a misspell in step 8 (in the wget thingi). ThirdParty-2.0.1.gtgz should be replaced with ThirdParty-2.1.0.gtgz

    • Alberto

      Hi, you can install various versions of OpenFOAM in the OpenFOAM directory, and then use foamJob with the -version option to run the specific version.

      If this was not supported in 1.6, you can create two scripts to source the appropriate bashrc file to configure the environment.

  • Anica

    Hello,

    I tried to install OpenFOAM-2.1.x on openSUSE 12.1 64 bit. I followed your instructions but I get a lot of error messages, like:
    make[2]: mpicc: Command not found
    make[2]: *** [dummysizes] Error 127
    make[2]: Leaving directory `/home/linux/OpenFOAM/ThirdParty-2.1.x/scotch_5.1.11/src/libscotch’
    make[1]: *** [ptscotch] Error 2
    make[1]: Leaving directory `/home/linux/OpenFOAM/ThirdParty-2.1.x/scotch_5.1.11/src/libscotch’
    make: *** [ptscotch] Error 2

    and later on:

    fatal error: mpi.h: No such file or directory

    and:

    collect2: ld returned 1 exit status
    make[3]: *** [/home/linux/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64Gcc46DPOpt/bin/autoRefineMesh] Error 1
    make[3]: Leaving directory `/home/linux/OpenFOAM/OpenFOAM-2.1.x/applications/utilities/mesh/advanced/autoRefineMesh’
    make[2]: *** [autoRefineMesh] Error 2

    Could you please help me to resolve these problems?

    Best regards,

    Anica