Child pages
  • OpenFoam on Odyssey and Linux Desktop
Skip to end of metadata
Go to start of metadata

Introduction

This page has information on running OpenFoam interactively as well as in batch mode on the FASRC Cluster (currently Odyssey). To learn basics of modeling with OpenFoam, please visit:

OpenFOAM - Modeling Basics

Openfoam via singularity container

We have built a singularity container with freecad, gmsh, openfoam and paraview. The container can be used on odyssey (in both the interactive and batch modes) or on a local linux machine with singularity installed.

On Odyssey

Running interactively

Connect to odyssey via OnDemand (https://www.rc.fas.harvard.edu/resources/documentation/virtual-desktop/). Open a terminal and create a directory for OpenFoam:

mkdir openfoam-test
cd openfoam-test

Run the openFoam container with shell option to obtain a command shell.

singularity shell /n/seas_computing/scientific_software/freecad-OpenFoam.simg

Once inside shell, you should be able to run a simple test job as follows:

source /opt/openfoam6/etc/bashrc

cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily
blockMesh
simpleFoam

Running in batch

To run openfoam in batch, you can create a bash script with openfoam setup, meshing and run commands in a script (say scr_pitzDaily) and invoke the script via singularity in a slurm submit script (say openfoam_pitzDaily.sh). The script "scr_pitzDaily" might look like:

#!/usr/bin/env bash
source /opt/openfoam6/etc/bashrc
rm -rf pitzDaily 
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily/ .
cd pitzDaily 
#Create mesh
blockMesh 
#Run openfoam via the solver simpleFoam
simpleFoam

The submit script "openfoam_pitzDaily.sh" might look like:

#!/bin/bash 
#SBATCH -n 1  #Number of cores 
#SBATCH -N 1  #Number of nodes 
#SBATCH -t 60  #Runtime in minutes 
#SBATCH -p general  #Partition to submit to 
#SBATCH --mem-per-cpu=500 #Memory per cpu in MB (see also --mem) 

module load intel/17.0.4-fasrc01 impi/2017.2.174-fasrc01

singularity exec /n/seas_computing/scientific_software/freecad-OpenFoam.simg ./scr_pitzDaily    

# Report some useful info

date

exit

 

Modeling on your own desktop/laptop

The singularity image on Odyssey (freecad-OpenFoam.simg) can be downloaded to your desktop/laptop and run in a flavor of Linux (eg: ubuntu) with singularity installed. For this you need:

  • Either a linux desktop/laptop or linux installed in a virtualized environment (such as virtualbox). For help with this, just use a modern search engine (google, bing, etc.) and look for "ubuntu installation in virtualbox" etc. There is plenty of documentation available on this.
  • Install singularity. Visit the following and look under documentation for users:
    https://www.sylabs.io/docs/
  • Once you have singularity installed, the commands are identical to those under "OpenFoam via singularity – running interactively"  described above.
  • No labels