next up previous contents
Next: Changes to Source code Up: Porting OpenFOAM to HECToR Previous: Acknowledgements   Contents

Editing and compiling the OpenFOAM source code

To modify the source code you must copy the gzipped tarball from the OpenFOAM package account and install it in your local work directory. NB this gzipped tarball is an HECToR-specific version of OpenFOAM-1.6, in that the tarball contains additional HECToR-specific dynamic libraries and example batch scripts, and excludes html documentaion, and some unrequired third-party packages (malloc, OpenMPI, zlib and gcc).

In your designated work directory, copy and unpack the gzipped tarball into a new directory named OpenFOAM, i.e.

cd /work/z01/z01/gavin
mkdir OpenFOAM
cd OpenFOAM
cp /usr/local/packages/openfoam/OpenFOAM-1.6-HECToR.tar.gz .
gunzip OpenFOAM-1.6-HECToR.tar.gz
tar xvf OpenFOAM-1.6-HECToR.tar
This will create the `OpenFOAM-1.6' and `ThirdParty-1.6' directories in your workspace.

To compile, update the OpenFOAM-1.6/etc/bashrc file to point to your new local installation directory, i.e. for user gavin, change

 foamInstall=/work/y07/y07/openfoam/dual-core/OpenFOAM
to
 foamInstall=/work/z01/z01/gavin/OpenFOAM
and
export WM_PROJECT_USER_DIR=/work/y07/y07/openfoam/dual-core/$WM_PROJECT/
      $USER-$WM_PROJECT_VERSION
to
export WM_PROJECT_USER_DIR=/work/z01/z01/gavin/$WM_PROJECT/
      $USER-$WM_PROJECT_VERSION

Then, to compile, update and submit the batch script OpenFOAM-1.6/compile_OF, i.e.,

#!/bin/bash --login
#PBS -q serial
#PBS -N compile\_OF
#PBS -l walltime=05:00:00
#PBS -A y07            
. /opt/modules/3.1.6/init/bash
module swap PrgEnv-pgi PrgEnv-gnu
module swap gcc gcc/4.3.3
module swap xt-mpt xt-mpt/3.2.0
source /work/y07/y07/openfoam/dual-core/OpenFOAM/OpenFOAM-1.6/etc/bashrc 
export LD_LIBRARY_PATH=$WM_PROJECT_DIR/mylib:$LD_LIBRARY_PATH
cd $WM_PROJECT_DIR
cp wmake/rules/crayxt/general.orig wmake/rules/crayxt/general
./Allwmake >& make.out.1
cp wmake/rules/crayxt/general.temp wmake/rules/crayxt/general
./Allwmake >& make.out.2
cp wmake/rules/crayxt/general.orig wmake/rules/crayxt/general
./Allwmake >& make.out.3
NB The standard output will appear in three files, namely make.out.1, make.out.2 and make.out.3. This is because, under the current OS on HECToR, namely CSE 2.1, the default compilation will fail, however, this behaviour is expected. This is avoided by performing 3 different phases of compilation, where the standard output of each phase is written to make.out.1, make.out.2 and make.out.3. This complication will be resolved once HECToR starts running CSE 2.2.)


next up previous contents
Next: Changes to Source code Up: Porting OpenFOAM to HECToR Previous: Acknowledgements   Contents
Gavin J Pringle
2010-04-16