Compiling OpenFOAM 4.1 on ARCHER
This page outlines the procedure we used for building OpenFOAM 4.1 on ARCHER. We downloaded the OpenFOAM-4.1 and ThirdParty-4.1 sources from the website and unpacked them on the /work filesystem on ARCHER.
Modifications
To build OpenFOAM we needed to make some small modifications to the configuration files. Firstly, we change the following lines in etc/bashrc:
Set this to the location of your OpenFOAM directory foamInstall= .... Set the WM_MPLIB to CRAY_MPICH export WM_MPLIB=CRAY_MPICH
Secondly, etc/config/settings.sh was updated as follows:
x86_64) case "$WM_ARCH_OPTION" in 32) export WM_COMPILER_ARCH=64 export WM_CC='cc' export WM_CXX='CC' export WM_CFLAGS='-m32 -fPIC' export WM_CXXFLAGS='-m32 -fPIC' export WM_LDFLAGS='-m32' ;; 64) WM_ARCH=linux64 export WM_COMPILER_LIB_ARCH=64 export WM_CC='cc' export WM_CXX='CC' export WM_CFLAGS='-m64 -fPIC' export WM_CXXFLAGS='-m64 -fPIC' export WM_LDFLAGS='-m64' ;;
We added the following in to etc/config.sh/mpi before the existing MPICH) entry:
CRAY_MPICH) export WM_MPLIB=CRAY_MPICH export FOAM_MPI=cray_mpich export MPI_ARCH_PATH=$MPICH_DIR export LD_LIBRARY_PATH=$MPI_ARCH_PATH/lib:$LD_LIBRARY_PATH export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION ;;
We ensured that the following was set in etc/config.sh/CGAL:
boost_version=boost-system cgal_version=cgal-system
We also needed to change this line in etc/config.sh/scotch:
export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION/$SCOTCH_VERSION
Next we changed the c and c++ files in wmake/rules/linuxGcc replacing gcc with cc and g++ with CC.
The same changes were made in the wmake/rules/linux64Gcc directory.
Some changes were also necessary in ThirdParty-4.1 directory. We updated ThirdParty-4.1/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-64Int32 replacing gcc with cc and g++ with CC.
Build OpenFOAM
We used the following modules and environment variables when building:
module load PrgEnv-gnu module load zlib module load boost/1.60 module load cmake export WM_64=ON export CRAYPE_LINK_TYPE=dynamic
To build OpenFOAM you then need to source to etc/bashrc in the OpenFOAM directory:
source etc/bashrc
And then run Allwmake from the OpenFOAM directory:
./Allwmake