/
OpenFoam on Cannon and Desktop/Laptop

OpenFoam on Cannon and Desktop/Laptop

Introduction

This page has information on running OpenFoam interactively as well as in batch mode on the RC-Cluster (currently Cannon). 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 the RC-Cluster (in both the interactive and batch modes) or on a local linux machine with singularity installed.

On the RC-Cluster

Running interactively

Connect to the RC-Cluster (currently Cannon) 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/openfoam8/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/openfoam8/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

Installing OpenFOAM (with FreeCAD, GMSH, and ParaView) on Desktop/Laptop.

The singularity image on The RC-Cluster (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.

Related content

OpenFOAM - Modeling Basics
OpenFOAM - Modeling Basics
More like this
OpenFOAM (with FreeCAD, GMSH, and ParaView) on Desktop/Laptop
OpenFOAM (with FreeCAD, GMSH, and ParaView) on Desktop/Laptop
More like this
Open Source (OS) Engineering Software
Open Source (OS) Engineering Software
More like this
How to run Comsol on FAS Cannon (SEAS users only)
How to run Comsol on FAS Cannon (SEAS users only)
More like this
How to run ABAQUS on FAS Cannon cluster (SEAS users only)
How to run ABAQUS on FAS Cannon cluster (SEAS users only)
More like this
Tips for Cannon
More like this

Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use