Using OpenFOAM on the Blade Center
- About OpenFOAM
- Serial Usage
- Serious Serial Usage
- Parallel Runs
- About OpenFOAM
Software licenses for commercial finite element codes are
more expensive than the hardware. Use of commercial codes
can be subject to license restrictions.
OpenFOAM is "open source" and versatile, so
if someone learns to use it, they can use it anywhere. It is used for
example by Boeing engineers who suggested to us.
OpenFOAM is developed by the OpenCFD corporation, founded in
2004. Standard solvers include 'basic' CFD, incompressible flows,
compressible flows, combustion, electromagnetics, and solid dynamics.
Partitioning routines and choices of linear algebra solvers are
provided.
One use is for liquid solid interactions.
A program called paraview provides visualization.
For more about
OpenFOAM capabilities, see About OpenFOAM
- Serial Usage
Follow these steps to set environmental variables for running FOAM and run
some serial (single processor) examples.
From one of the login nodes on the blade center
source /home/gwhowell/scripts/foam15.csh
will allow usage of version 1.5.
source /home/gwhowell/scripts/foam171.csh
will add the needed paths for version 1.7.1. Example codes are available in
/home/gwhowell/apps/samples/foarmtutorials.tar
To try the examples, you can copy them to your /share directory.
(If you don't already have a directory in /share, you can make one by
mkdir /share/myunityID ).
cd /share/myunityID
cp /home/gwhowell/apps/samples/foamtutorials.tar .
tar xvf foamtutorials.tar
To run foam, use
source /home/gwhowell/scripts/foam171.csh
to set environmental variables. The subdirectories give simple
examples for a variety of problems. A web page describing usage is
OpenFOAM
tutorial. The following details how to run a first example.
cd /share/gwhowell/tutorials/icoFoam/cavity
blockMesh
icoFoam
foamToVTK
paraview
"foamToVTK" converts to VTK
form, usable by the paraview GUI, which presumably pops with the
paraview command. In the paraview GUI click on File and VTK, then
on cavity_1.vtk and then Display under the Object Inspector.
Then click Set Color and pick some color. Scrolling down to
Style, scroll through the Representation and try Wireframe.
Many other examples and detailed explanation as to input
files and file formats are found in the online tutorial.
- Serious Serial Usage
Only short jobs should be run from the login nodes.
Longer jobs should be submitted to the LSF scheduler so that
they can run on any of the thousand or so computational cores.
Postprocessing with the GUI interface can be run on the VCL using
a 64 bit HPC Linux image (http://vcl.ncsu.edu).
As a first try, it's convenient to run the same simple job
to make sure it goes without a hitch.
Assume that in tutorials/icoFoam/cavity directory, you have
the following file
#! /bin/csh
#BSUB -q debug
source /home/gwhowell/scripts/foam.csh
#BSUB -W 5
#BSUB -n 1
#BSUB -R em64t
blockMesh
icoFoam
foamToVTK
#BSUB -o /share/myname/out.%J
#BUSB -e /share/myname/err.%J
If the above file is bfoam, then the job can be submitted by
bsub < bfoam
The #BSUB -W 5 line asks for 5 minutes.
Once you know the job runs, edit the file to ask for more time. Also,
make sure the -o and -e output and error files are writing to a directory
for which you have write privileges.
- Parallel Runs
An example of a parallel run is found at
CSC Foam tutorial (disclaimer -- this is a site from the CSC corporation,
not from NC State).
Some Notes on the CSC Parallel Example
Some directory paths were not quite the same as in the subdirectories of foamtutorials.
I found blockMeshDict in foamtutorials/icoFoam/cavity/constant/polyMesh and edited
it as specified in the example.
I found the file decomposePardict in foamtutorials/multiphaseInterFoam/damBreak4phase/system and copied it to foamtutorials/icoFoam/cavity by
cd foamtutorials/icoFoam/cavity
cp foamtutorials/multiphaseInterFoam/damBreak4phase/system/decomposePardict .
In foamtutorials/icoFoam/cavity, I put the file bfoam (used instead of
the parjob script quoted in the online example).
#! /bin/csh
#BSUB -W 10
#BSUB -n 4
#BSUB -R "em64t span[ptile=2]"
source /home/gwhowell/scripts/foam171.csh
source /home/gwhowellscripts/gary13a2-gnu412.csh
blockMesh
mpiexec_hydra icoFoam
reconstructPar
#BSUB -o /share/gwhowell/chap03/foamo.%J
#BSUB -e /share/gwhowell/chap03/foame.%J
and ran the job by
bsub < bfoam
Of course you'll need to specify a directory for the foamo.%J and foame.%J
(standard output and error files)
where you have write privileges.