Additional information for installation (optional)

Install OpenFOAM® from git

It is possible to compile OpenFOAM® instead of using the precompiled version as shown in Install OpenFOAM® (packaged) . Please use the version “OpenFOAM-8-commit-bf4ad0d352207176fc7df3fccf7dcb3fad7d3e6a” and the corresponding ThirdParty-8 version “Thirdparty-8 commit c91adf7c241afcfb79a9bcbfee13ff73ff64cff2”.


Download OpenFOAM® directly via zip

Download the recommended OpenFOAM® version together with OpenFOAM®’s ThirdParty software.

Please unzip those folders to $HOME/OpenFOAM and follow the instructrions here.


Alternatively download OpenFOAM® using git

git installation is here.

cd $HOME
mkdir OpenFOAM
cd OpenFOAM
git clone git://github.com/OpenFOAM/OpenFOAM-8.git
git clone git://github.com/OpenFOAM/ThirdParty-8.git
cd OpenFOAM-8
git checkout bf4ad0d352207176fc7df3fccf7dcb3fad7d3e6a
cd ../ThirdParty-8
git checkout c91adf7c241afcfb79a9bcbfee13ff73ff64cff2

Other OpenFOAM® versions can be used for compilation, but aren’t officially supported.


Setup prerequisites for OpenFOAM®

Detailed description of prerequisites for OpenFOAM® can be found here . On an Ubuntu system (18.04+), you can use the following

sudo apt-get install build-essential flex bison cmake zlib1g-dev
libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin
gnuplot libreadline-dev libncurses-dev libxt-dev libscotch-dev
libptscotch-dev

Compile OpenFOAM®

You can follow the OpenFOAM® git compilation instructions , with a small number of exceptions: CFDEM®coupling requires the WM_LABEL_SIZE=32 , which is the standard setting.

On an Ubuntu system (18.04+), you can use the following steps to install OpenFOAM®. Open the .bashrc file:

gedit ~/.bashrc

add the following two lines in the end,

export WM_NCOMPPROCS=8
source $HOME/OpenFOAM/OpenFOAM-8/etc/bashrc

where 8 is the integer number of the processors you want to compile with (of course you can change this number). Save and exit gedit.

Then open a new terminal so that above changes to your .bashrc become active and compile OpenFOAM® by typing:

cd $WM_PROJECT_DIR
./Allwmake

OpenFOAM® and MPI

Often problems arise configuring OpenFOAM® to work with a specific MPI installation on a cluster. However it has built-in capability to work with nearly any MPI implementation. Set the following variable in the OpenFOAM® bashrc:

export WM_MPLIB=SYSTEMMPI

Defining the following variables in your ~/.bashrc before the sourcing of OpenFOAM® will take care of the rest. This is an example for older MVAPICH installations where there is no libmpi.so, only libmpich.so :

export MPI_ROOT=<path/to/mpi/installation>
export MPI_ARCH_PATH=$MPI_ROOT
export MPI_ARCH_FLAGS="-DMPICH_SKIP_MPICXX"
export MPI_ARCH_INC="-I$MPI_ARCH_PATH/include"
export MPI_ARCH_LIBS='-L$(MPI_ARCH_PATH)/lib -lmpich -lmpichcxx -lmpl -lopa -lrt'

Compiling OpenFOAM® and CFDEM®coupling in debug mode

Set the WM_COMPILE_OPTION parameter in the OF bashrc to Debug and compile OF with the Allwmake script. CFDEM®coupling detects the OpenFOAM® variable and compiles in debug mode.


Backward Compatibility

Basically, CFDEM®coupling supports one OpenFOAM® version. Therefore, all settings are prepared for that particular version. Nevertheless we try to maintain backwards compatibility as long as it works with reasonable effort.

The supported OpenFOAM® and Aspherix® versions are stated in:

src/lagrangian/cfdemParticle/cfdTools/versionInfo.H

For using other versions you can manipulate:

src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H

Install git

Git allows you to update the source code very easily with the git pull command. On debian based systems you can run

sudo apt-get install git-core

Similar packages are available on other systems too:

sudo zypper install git-core
sudo yum install git

Note

In this tutorial the git protocol is used to transfer files. If port 9418 is closed for internet connections, please switch to “https://” instead of “git://” for git clone commands.