Source Pack Installation

Source Pack Installation

Version 1.7.1, released 26/08/10

Packs

The following tar-zipped gtgz source packs are available for download.

Pack File md5sum
OpenFOAM OpenFOAM-1.7.1.gtgz  2454728d946ee773c963fac15be9ca84
Third-Party ThirdParty-1.7.1.gtgz  22877bc0b1f2640cd09f175cfc5729b5

Unpacking the Sources

The user should choose a directory location to unpack these files, which will become the installation directory of OpenFOAM. If the installation is for a single user only, or if the user does not have root access to the machine, we would recommend the installation directory is $HOME/OpenFOAM (i.e. a directory OpenFOAM in the user’s home directory). If the installer has root permissions and the installation is for more than one user, one of the ‘standard’ locations can be used, e.g. /usr/local/OpenFOAM, /opt/OpenFOAM, or just /opt.

After the installation directory is chosen (and, if necessary, created), simply copy the 2 source pack files into the directory and unpack using tar xzf <filename>, e.g. from the installation directory:

  • tar xzf OpenFOAM-1.7.1.gtgz
  • tar xzf ThirdParty-1.7.1.gtgz

The files unpack to produce directories OpenFOAM-1.7.1 and ThirdParty-1.7.1.

System Requirements

OpenFOAM is developed and tested on Linux, but should work with other POSIX systems. OpenFOAM-1.7.1 and ThirdParty-1.7.1 have been tested on standard Ubuntu 10.04 and OpenSuSE 11.1, 11.2 and 11.3 Linux distributions. OpenFOAM-1.7.1 also builds on many other and older Linux distributions but the ParaView-3.8.0 version supplied in ThirdParty requires cmake-2.6.4 or higher and Qt-4.5 or higher which can be obtained from various repositories for many Linux distributions. To check your system setup, you can execute the foamSystemCheck script, described in “Checking the System” (below).

Setting Environment Variables

The environment variable settings are contained in files in an OpenFOAM-1.7.1/etc directory in the OpenFOAM release. e.g. for the case where the installation is in $HOME/OpenFOAM, in:

  • $HOME/OpenFOAM/OpenFOAM-1.7.1/etc

EITHER
if running bash or ksh (if in doubt type echo $SHELL), source the etc/bashrc file by adding the following line to the end of your $HOME/.bashrc file:
  • . $HOME/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc

then type “. $HOME/.bashrc” in the current terminal window

OR
if running tcsh or csh, source the etc/cshrc file by adding the following line to the end of your $HOME/.cshrc file:
  • source $HOME/OpenFOAM/OpenFOAM-1.7.1/etc/cshrc

then type “source $HOME/.cshrc” in the current terminal window

Setting environment variables for alternative locations

OpenFOAM may also be installed in alternative locations. However, the installation directory should be network available (e.g. NFS) if parallel calculations are planned.

The environment variable FOAM_INST_DIR can be used to find and source the appropriate resource file. Here is a bash/ksh/sh example:

  • export FOAM_INST_DIR=/data/app/OpenFOAM
  • foamDotFile=$FOAM_INST_DIR/OpenFOAM-1.7.1/etc/bashrc
  • [ -f $foamDotFile ] && . $foamDotFile

and a csh/tcsh example:

  • setenv FOAM_INST_DIR /data/app/OpenFOAM
  • foamDotFile=$FOAM_INST_DIR/OpenFOAM-1.7.1/etc/cshrc
  • if ( -f $foamDotFile ) source $foamDotFile

The value set in $FOAM_INST_DIR will be used to locate the remaining parts of the OpenFOAM installation.

Checking the System

To check your system is ready to build the sources, execute the foamSystemCheck script (in the OpenFOAM-1.7.1/bin directory). If any critical software is missing, or needs updating to a newer version, please contact the system administrator to install the required software before proceeding to the build.

In particular your system will need to include a recent version of gcc (check with gcc --version, we recommend gcc-4.4.? but gcc-4.3.? is sufficient). If the installed version is not recent source pack for newer versions are available from http://gcc.gnu.org/.

To build OpenFOAM you will also need the flex software installed on your system. If that is missing (type flex --version to check), then install it.

Building the Sources

Go to the top-level source directory $WM_PROJECT_DIR and execute the top-level build script ./Allwmake. In principle this will build everything, but if problems occur with the build order it may be necessary to update the environment variables and re-execute ./Allwmake.

If you experience difficulties with building the source-pack, or your platform is not currently supported, please contact software support to arrange a support contract and we will do the port and maintain it for future releases.

wmake

OpenFOAM uses wmake to perform compilation (building, linking) of its C++ source code into executable code. wmake is called from the Allwmake scripts during the initial build of the complete OpenFOAM project but can be executed directly to update the compilation of any of the OpenFOAM components:

  • all invocations can have an optional directory:
    • wmake $FOAM_UTILITIES/mesh/manipulation/checkMesh
    • wmake libso $FOAM_SRC/finiteVolume
  • recursively build all applications in current or specified directory:
    • wmake all
    • wmake all <dir>
  • build any single object or executable:
    • wmake Make/linux64Gcc4DPOpt/<object>.o
    • wmake <executable>
  • build any single shared library:
    • wmake libso
    • wmake libso <lib dir>

wmakeScheduler for faster compilation

wmake comes with a parallel compilation scheduler, wmakeScheduler, which spawns compilation jobs on free machines. These machines need password-less network access, e.g. using SSH, and a network mounted installation, e.g. using NFS.

wmakeScheduler is set up with environment variables:

  • WM_SCHEDULER : the name of the scheduler to use
  • WM_HOSTS : the list of cores to use
  • WM_NCOMPROCS : the number of parallel builds (usually the size of WM_HOSTS)
  • WM_COLOURS : Optional list of colours for the compilation output from the cores.

For example to build on 1 processor of dm and 4 processors of noisy:

  • export WM_SCHEDULER=wmakeScheduler
  • export WM_HOSTS="dm:1 noisy:4"
  • export WM_NCOMPPROCS=$($WM_SCHEDULER -count)
  • export WM_COLOURS="black blue green cyan red magenta yellow"

wmakeScheduler uses ssh to spawn jobs on the listed machines so needs passwordless access and a network mounted installation

Compiling Paraview 3.8.0 and the PV3FoamReader Module

Paraview is the third-party software that we provide for graphical post-processing in OpenFOAM. It’s compilation is automated using a script called makeParaView in the ThirdParty-1.7.1 directory. Installation of Paraview 3.8.0 requires a version of QT that is 3.5.? or newer and cmake which is 2.6.4 or newer, so again make sure that this is on your system.

To install Paraview, execute the following:

  • cd $WM_THIRD_PARTY_DIR
  • ./Allclean
  • ./makeParaView

The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled as usual for OpenFOAM utilities:

  • cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader
  • ./Allwclean
  • ./Allwmake

Testing the Installation

To check your installation setup, execute the foamInstallationTest script (in the OpenFOAM-1.7.1/bin directory). If no problems are reported, proceed to getting started with OpenFOAM; otherwise, go back and check you have installed the software correctly and/or contact your system administrator.

Getting Started

Create a project directory within the $HOME/OpenFOAM directory named <USER>-1.7.1 (e.g. chris-1.7.1 for user chris and OpenFOAM version 1.7.1) and create a directory named run within it, e.g. by typing:

mkdir -p $FOAM_RUN
Copy the tutorial examples directory in the OpenFOAM distribution to the run directory. If the OpenFOAM environment variables are set correctly, then the following command will be correct:

cp -r $FOAM_TUTORIALS $FOAM_RUN
Run the first example case of incompressible laminar flow in a cavity:

cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
blockMesh
icoFoam
paraFoam
Refer to the OpenFOAM User Guide to get started.

Reporting Bugs in OpenFOAM

We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM bugs pages to report bugs.