You are here: Home Resources Software Installed Software Applications OpenFOAM

OpenFOAM

OpenFOAM

Openfoam is a free, open source CFD software package.

To see which versions of openfoam are installed on any of the machines at PDC log into the machine and type

module avail openfoam

 

Compiling OpenFOAM on Lindgren

OpenFOAM is preferably compiled with gcc. To set this programming environment run the command

module switch PrgEnv-pgi PrgEnv-gnu
module load openfoam/2.0.1
. $FOAM_BASHRC

Note that version 4.3.x fails when compiling OpenFOAM.

You should consider questions before running openFOAM such as:

  1. How often do you save your solution?
  2. What trace/history of your iterations do you write to file(s)?

To control this behavior you need to modify the corresponding parameters in

controlDict

Moreover you can adapt your simulation to Lindgren by tweaking the following parameters:

writeCompression                    uncompressed;
runTimeModifiable                   no;

 

Running OpenFOAM on Lindgren

 

To submit a job

qsub submit.pbs

Example submit script

# The name of the script is myjob
#!/bin/bash

#PBS -N myjob

# Only 1 hour wall-clock time will be given to this job
#PBS -l walltime=1:00:00

# Number of cores to be allocated is 288.
# always request full nodes, i.e. mppwidth should normally be a multiple of 24
#PBS -l mppwidth=288

# Change to the work directory
cd $PBS_O_WORKDIR

# Enable modules in the queue system
. /opt/modules/default/etc/modules.sh

#swap to PrgEnv-gnu (required for openfoam to work)
module swap PrgEnv-pgi PrgEnv-gnu

# load the openfoam module
module load openfoam/2.0.1

#set the openfoam environment variables
. $FOAM_BASHRC

# Start the OpenFOAM job
aprun -n 288 icoFoam -parallel > my_output_file 2>&1

Running OpenFoam on Ferlin

OpenFOAM 1.6

NOTE : on Ferlin openfoam 1.6 will FAIL if you try to run on more than 1 node (8 cores)

To submit a job on Ferlin use

module add easy
esubmit -n 1 ./submit.sh

Example submit script for Ferlin and openfoam 1.6

#!/bin/bash
module add openfoam/1.6
processes_per_node=8
total_processes=`expr $processes_per_node \* $SP_PROCS`
mpiexec -np $total_processes -machinefile $SP_HOSTFILE pimpleFoam -parallel > log_file

OpenFOAM 1.7.1

The procedure for submitting jobs under newer versions of openfoam has changed slightly. Again to submit the job

module add easy
esubmit -n 2 ./submit.sh

The submit script for 1.7.1 should be

#!/bin/bash
module add gcc/4.5.0 openfoam/1.7.1
. $FOAM_BASHRC
processes_per_node=8
total_processes=`expr $processes_per_node \* $SP_PROCS`
mpiexec -np $total_processes -machinefile $SP_HOSTFILE pimpleFoam -parallel > log_file

OpenFOAM 2.1.0

To submit the job

module add easy
esubmit -n 2 ./submit.sh

The submit script for 2.1.0 should be

#!/bin/bash
module add gcc/4.6.3 openfoam/2.1.0
. $FOAM_BASHRC
processes_per_node=8
total_processes=`expr $processes_per_node \* $SP_PROCS`
mpiexec -np $total_processes -machinefile $SP_HOSTFILE pimpleFoam -parallel > log_file