Skip to main content

Run OpenFOAM codes on Curnagl

Script to run OpenFOAM code

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 

# 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 ?

You can upload your OpenFOAM code thanks to FileZilla or copy and paste data to the cluster thanks to the scp command. 

Example: I want to copy to Curnagl. Run the following command:

scp <username>

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

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

This transfer can be done for any file type: .py, .csv, .h, images...

To copy a folder, use the command  scp -r.