From Documentation
(Redirected from OpenFOAM)
Jump to: navigation, search
OPENFOAM
Description: open source CFD software package
SHARCNET Package information: see OPENFOAM software page in web portal
Full list of SHARCNET supported software


Introduction

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

OpenFOAM in SHARCNET

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 July 2014, version 2.3.0 is the latest version.

Installation

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:/work/isaac] mkdir OpenFOAM

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

[isaac@orc-login2:/work/isaac] cd OpenFOAM
[isaac@orc-login2:/work/isaac/OpenFOAM] wget http://downloads.sourceforge.net/foam/OpenFOAM-2.3.0.tgz?use_mirror=mesh
[isaac@orc-login2:/work/isaac/OpenFOAM] wget http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh
[isaac@orc-login2:/work/isaac/OpenFOAM] tar zxvf OpenFOAM-2.3.0.tgz
[isaac@orc-login2:/work/isaac/OpenFOAM] tar zxvf ThirdParty-2.3.0.tgz

2. Check the module environment and change into

[isaac@orc-login2:/work/isaac/OpenFOAM] cd OpenFOAM-2.3.0
[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] module list
Currently Loaded Modulefiles:
 1) torque/2.5.13            3) intel/12.1.3             5) mkl/10.3.9               7) ldwrapper/1.1
 2) moab/7.1.1               4) openmpi/intel/1.6.2      6) sq-tm/2.5                8) user-environment/2.0.1
[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] module switch intel/12.1.3 gcc/4.8.2
[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] module switch openmpi/intel/1.6.2 openmpi/gcc/1.8.1
[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] module list
Currently Loaded Modulefiles:
 1) torque/2.5.13            3) gcc/4.8.2                5) mkl/10.3.9               7) ldwrapper/1.1
 2) moab/7.1.1               4) openmpi/gcc/1.8.1        6) sq-tm/2.5                8) user-environment/2.0.1

3. Change basic environment script for OpenFOAM

[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] vi etc/bashrc
 ...
45 #foamInstall=$HOME/$WM_PROJECT
46 foamInstall=/work/$USER/$WM_PROJECT
...
85 #export WM_MPLIB=OPENMPI
86 export WM_MPLIB=SYSTEMOPENMPI
...
106 #foamOldDirs="$FOAM_INST_DIR $WM_PROJECT_SITE $HOME/$WM_PROJECT/$USER"
107 foamOldDirs="$FOAM_INST_DIR $WM_PROJECT_SITE /work/$USER/$WM_PROJECT/$USER"
...
135 #export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
136 export WM_PROJECT_USER_DIR=/work/$USER/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
[isaac@orc-login2:/work/isaac/OpenFOAM/OpenFOAM-2.3.0] source etc/bashrc

4. Submitting a job to compile

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

Submitting Parallel Jobs

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

[isaac@orc-login1:~] source /work/isaac/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc

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

[isaac@orc-login1:~] vi .bashrc

alias of23='source /work/isaac/OpenFOAM/OpenFOAM-2.3.0/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

BlockMesh

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:      www.OpenFOAM.org                      |
|    \\/     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
    "/gwork/isaac/OpenFOAM/isaac-2.3.0/run/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/blockMeshDict"
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
----------------
Patches
----------------
  patch 0 (start: 760 size: 20) name: movingWall
  patch 1 (start: 780 size: 60) name: fixedWalls
  patch 2 (start: 840 size: 800) name: frontAndBack

End

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 isaac@viz9-uwo.sharcnet.ca

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]].

References

o OpenFOAM Homepage
http://www.openfoam.org/