From Documentation
Jump to: navigation, search
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Line 115: Line 117:
  [isaac@orc-login2] cd /work/isaac/OpenFOAM/ThirdParty-5.0/boost_1_65_1
  [isaac@orc-login2] cd /work/isaac/OpenFOAM/ThirdParty-5.0/boost_1_65_1
  [isaac@orc-login2] ./
[isaac@orc-login2] ./b2
4. Submitting a job to compile
4. Submitting a job to compile

Latest revision as of 10:34, 6 June 2019

This page is scheduled for deletion because it is either redundant with information available on the CC wiki, or the software is no longer supported.
Note: Some of the information on this page is for our legacy systems only. The page is scheduled for an update to make it applicable to Graham.

Description: open source CFD software package
SHARCNET Package information: see OPENFOAM software page in web portal
Full list of SHARCNET supported software


OpenFOAM is a free, open source CFD software package produced by a commercial company, OpenCFD Ltd ( It has a large user base across most areas of engineering and science, from both commercial and academic organisations.


Due to a variety of versions with third party installation for each group/user, SHARCNET does not provide the module for this software and instead we support the users to install his or her own version in the user's working directory. If you need a support for installation, please see below for instance or open a ticket for the help.

Version Selection

As of Feb 2017, version 4.1 is the latest version.


Here is a short instruction about how to install the package. Here the package is installed in /work/$USER.

0. Make directory

[isaac@orc-login2] cd /work/$USER 
[isaac@orc-login2] mkdir OpenFOAM

1. Download the package (source + third party) and unzip the package

[isaac@orc-login2] cd OpenFOAM
[isaac@orc-login2] wget
[isaac@orc-login2] tar zxvf 5-0
[isaac@orc-login2] mv OpenFOAM-5.x-version-5.0 OpenFOAM-5.0
[isaac@orc-login2] wget
[isaac@orc-login2] tar zxvf 5-0.1
[isaac@orc-login2] mv ThirdParty-5.x-version-5.0 ThirdParty-5.0

2. Download 'boost' and 'CGAL'

[isaac@orc-login2] wget
[isaac@orc-login2] wget
[isaac@orc-login2] cd ThirdParty-5.0
[isaac@orc-login2] tar zxvf ../boost_1_65_1.tar.gz
[isaac@orc-login2] tar xf ../CGAL-4.10.1.tar.xz

3. Setting up the compilation configuration

[isaac@orc-login2] cd /work/$USER/OpenFOAM/OpenFOAM-5.0/etc
[isaac@orc-login2] vi bashrc

This file is the core file to setup all relevant working/compilation variables in OpenFOAM. It has been known that OpenFOAM is working well with Gcc compiler + OpenMPI. Here is an example to change modules and change 'HOME' directory to install by setting the new location as 'NEWHOME'. Don't forget to change all 'HOME' variable in the file have to be changed into 'NEWHOME' in the following setup.

module unload intel
module unload openmpi
module unload python

module load gcc/6.3.0
module load openmpi/gcc630-std/2.1.1
export NEWHOME=/work/$USER

Furthermore, you also need to comment out the following two lines

# USER EDITABLE PART: Changes made here may be lost with the next upgrade
# FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to
# the directory containing this file if sourced by a bash shell.
# Please set to the appropriate path if the default is not correct.
#[ $BASH_SOURCE ] && \
#export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \

Since we use different version of CGAL and boost from what is installed in system. Two files need to be modified as followed.

[isaac@orc-login2] cd ThirdParty-5.0 
[isaac@orc-login2] sed -i -e 's=boost-system=boost-1_65_1=' makeCGAL
[isaac@orc-login2] sed -i -e 's=cgal-system=CGAL-4.10.1=' makeCGAL
[isaac@orc-login2] cd ../OpenFOAM-5.0/etc/
[isaac@orc-login2] sed -i -e 's=boost-system=boost-1_65_1=' CGAL
[isaac@orc-login2] sed -i -e 's=cgal-system=CGAL-4.10.1=' CGAL

Finally, we need to source the bashrc file

[isaac@orc-login2] source /work/$USER/OpenFOAM/OpenFOAM-5.0/etc/bashrc

We can make sure the setup by checking environment variables as shown

[isaac@orc-login2] env |grep WM
WM_CXXFLAGS=-m64 -fPIC -std=c++0x

4. Build boost

[isaac@orc-login2] cd /work/isaac/OpenFOAM/ThirdParty-5.0/boost_1_65_1
[isaac@orc-login2] ./
[isaac@orc-login2] ./b2

4. Submitting a job to compile

[isaac@orc-login2] sqsub -r 1d -o log -e err --mpp=4G /work/isaac/OpenFOAM/OpenFOAM-5.0/Allwmake

Submitting Parallel Jobs

Before submitting a job, you should load the appropriate working environment by

[isaac@orc-login2] source /work/isaac/OpenFOAM/OpenFOAM-4.1/etc/bashrc

You may setup an alias to load the working environment by inserting the following into '~/.bashrc'

[isaac@orc-login2] vi .bashrc

alias of41='source /work/isaac/OpenFOAM/OpenFOAM-4.1/etc/bashrc'

To submit a job,

sqsub -q mpi -n {No of Subdomains} -r {Run Time Required} -o {Log File} -e {error reporting file} --mpp {mem required per processor} 
{OpenFOAM Solver} -parallel

Pre/Post Processing


To generate the grid, you may want to run the 'blockMesh'. Here is the example for cavity case in incompressible solver,

[isaac@orc-login2:/work/isaac/OpenFOAM/isaac-2.3.0/run/tutorials/incompressible/icoFoam/cavity] blockMesh 
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:                      |
|    \\/     M anipulation  |                                                 |
Build  : 2.3.0-6b88e07ba67e
Exec   : blockMesh
Date   : Aug 12 2014
Time   : 00:47:49
Host   : "orc-login2"
PID    : 23077
Case   : /gwork/isaac/OpenFOAM/isaac-2.3.0/run/tutorials/incompressible/icoFoam/cavity
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Creating block mesh from
Creating curved edges
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

	Basic statistics
		Number of internal faces : 0
		Number of boundary faces : 6
		Number of defined boundary faces : 6
		Number of undefined boundary faces : 0
	Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 0.1
    Block 0 cell size :
        i : 0.005 .. 0.005
        j : 0.005 .. 0.005
        k : 0.01 .. 0.01

Writing polyMesh
Mesh Information
  boundingBox: (0 0 0) (0.1 0.1 0.01)
  nPoints: 882
  nCells: 400
  nFaces: 1640
  nInternalFaces: 760
  patch 0 (start: 760 size: 20) name: movingWall
  patch 1 (start: 780 size: 60) name: fixedWalls
  patch 2 (start: 840 size: 800) name: frontAndBack


Since all SHARCNET machines are targeted to run the CPU-intensive jobs, all Pre- and Post-processing has to be done via our Visualization machines.

Isaacs-MacBook-iPro:~ isaac$ ssh -Y

Instead of paraFoam, there is the 'PARAVIEW' installed in our visualization machines. To run it, simply type

[isaac@localhost:/work/isaac/OpenFOAM/isaac-2.3.0/run/tutorials/incompressible/icoFoam/cavity] paraview

Note that the grid generation 'blockMesh' must be done in the main cluster and paraview is only used to check the grid and results. The details for paraview can be found in our wiki page[[1]].


o OpenFOAM Homepage