OpenFOAM Tutorial

The OpenFOAM (Open Field Operation and Manipulation) CFD Toolbox can simulate anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics, electromagnetics and the pricing of financial options. OpenFOAM is produced by OpenCFD Ltd and is freely available and open source, licensed under the GNU General Public Licence.

Please read Logging in and transferring files tutorial before continuing here.

Job Submission

Serious compute loads must be launched via PBS on Tango. You will need X-forwarding turned on for when you use Paraview to visualise the files.

Copy the job files to your working directory using the following commands:


ssh -X tango.vpac.org
mkdir openfoam_examples
cd openfoam_examples
cp -r /common/examples/openfoam/parallel_openfoam .
cd parallel_openfoam/
ls

The files copied to your working directory are shown below:

0 constant openfoam_par system

openfoam_par is the pbs script; please modify to use your username. You can optionally reconstruct the parallel jobs with the final line of the PBS script, which is commented out by default.


#!/bin/bash
#PBS -N parallel_openfoam
#PBS -l nodes=4
#PBS -M username@vpac.org
#PBS -m ae
#PBS -l walltime=1:00:0
#Initialize OpenFOAM
module load openfoam/1.5
export OpenFOAM_case=parallel_openfoam
CURDIR=$HOME/openfoam_examples
cd $CURDIR
#Mesh the geometry
blockMesh -case $OpenFOAM_case
#Decompose the mesh for parallel run
decomposePar -case $OpenFOAM_case
#Run the solver
#simpleFoam $TMPDIR $OpenFOAM_case
mpirun -np 4 simpleFoam -case $OpenFOAM_case -parallel
#Reconstruct the parallel results
#reconstructPar -case $OpenFOAM_case

To launch the script use qsub openfoam_par

cd openfoam_examples/parallel_openfoam

Check with module list command if openfoam appear in the list if not load with;


module load openfoam/1.5
module load paraview

OpenFOAM files need to be converted to VTK to be viewed with paraviw. Simply enter foamToVTK in the directory with your openFOAM files. This will create a separate directory VTK; change to this directory and enter paraview. A graphic window for paraview will appear on the desktop. Go to File->Open and select the parallel_openfoam.vtk file and select 'apply'.