Skip to main content

Run OpenFOAM codes on Curnagl

You are using OpenFOAM on your computer and you need more ressources. Let’s go on Curnagl! 

OpenFOAM is usually using MPI. Here is a bash script to run your parallelized OpenFOAM code. NTASKS should be replaced by the number of processors you want to use into your OpenFOAM code.  

#!/bin/bash -l 

#SBATCH --job-name openfoam  
#SBATCH --output openfoam.out 

#SBATCH --partition cpu 
#SBATCH --nodes 1  
#SBATCH --ntasks NTASKS 
#SBATCH --cpus-per-task 1 
#SBATCH --mem 8G  
#SBATCH --time 02:00:00  

module purge
module load gcc/10.4.0 mvapich2/2.3.7 openfoam/2206 

# RUN YOUR OpenFOAM CODE HERE
# For instance:
# decomposepar ...
# snappyHexMesh ...

Please note that running your parallelized OpenFOAM code should not be performed via  mpirun but  srun.  For a complete MPI overview on Curnagl, please refer to compiling and running MPI codes wiki.

How do I transfer my OpenFOAM code to Curnagl ?

 

Once you are connected on Curnagl, you can upload your OpenFOAM code thanks to FileZilla (see FileZilla wiki) or copy and paste data to the cluster thanks to the `scp` command. 

Example: I want to copy test.py to Curnagl 

`scp test.py username@curnagl.dcsr.unil.ch:/YOUR_PATH_ON_CURNAGL` 

Where YOUR_PATH_ON_CURNAGL is something like /users/username/work/....... 

In these commands, do not forget to change `username` with yours.