Installing OpenFOAM 1.5 on a 64-bit AMD Opteron Cluster running CentOS 5 Linux

OpenFOAM (Open Field Operationa and Manipulation) is a computational fluid dynamics toolbox which simulates "anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics, electromagnetics and the pricing of financial options." All this and free and open source as well.

Download the source code and third-party essentials and put them somewhere sensible (e.g., /usr/local/src/OPENFOAM). Extract the tar files (tar xvf OpenFOAM-1.5.General.gtgz, ThirdParty.General.gtgz) and discover that the package doesn't have a standard configuration file, but rather a creature called Allwmake. This is a 'make all' for wmake, which varies slightly from a standard make file. To install in a prefered location set the environmental variable in a module file (yes we're creating the module file early and loading it). i.e., nano /usr/local/Modules/openfoam/.base, ln -s .base 1.5, module load openfoam).


#%Module1.0#####################################################################
##
## $name modulefile
##
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
proc ModulesHelp { } {
puts stderr "\tThis module sets the envinronment for $name v$ver"
}
if { ![ is-loaded gcc ] } {
module load gcc
}
module-whatis "Set environment variables to use $name version $ver"
#prepend-path --delim " " CPPFLAGS -I/usr/local/$name/$ver/include
set WM_PROJECT_VERSION 1.5
set WM_PROJECT OpenFOAM
#This is needed for installation purpose
#setenv foamInstall /usr/local/openfoam/1.5/OpenFOAM
set FOAM_INST_DIR /usr/local/openfoam/1.5
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib/linux64GccDPOpt/openmpi-1
.2.6
#prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib/linux64GccDPOpt/dummy
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib/linux64GccDPOpt
setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
setenv WM_PROJECT_DIR $FOAM_INST_DIR
setenv WM_PROJECT_USER_DIR ~
setenv WM_MPLIB OPENMPI
setenv MPI_BUFFER_SIZE 2000000000
prepend-path PATH /usr/local/$name/$ver/applications/bin/linux64GccDPOpt
module load openmpi-gcc/1.2.6

Now you'll need to modify the system compiler; edit etc/settings.sh and change the compiler from OpenFoam to System ie., nano etc/settings.sh;


# Select compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_COMPILER_INST = OpenFOAM | System
WM_COMPILER_INST=System

Load a gcc module, at least gcc/4.3.3 (module load gcc/4.3.3) and compile (./Allwmake), and if all goes well, complete the module file above, and run some tests from OpenFOAM/OpenFOAM-1.5/bin/foamInstallationTest.

There is a user tutorial at the VPAC website

Thanks to Laszlo Kun and Jin Zhang in developing this guide.