OpenFOAM
Jump to navigation
Jump to search
First step in using the program is to load module file which will set up the environment. To do so please run the command
module load openfoam/2.3.0
The script will ask you to load the bashrc file. Run the command:
source /share/apps/openfoam/2.3.0/OpenFOAM-2.3.0/etc/bashrc
Make directory for the project and put all your project files there. Change to this directory.
Create a SLURM script for the type of job you want to use:
For sequential job
#!/bin/bash #SBATCH --partition production #SBATCH --job-name <name of your run> #SBATCH --nodes=1 #SBATCH --ntasks=1 # Find out name of master execution host (compute node) echo "" echo -n ">>>> SLURM Master compute node is: " hostname # Change to working directory cd $SLURM_SUBMIT_DIR echo ">>>> Begin serial run ..." echo "" <name of open foam program> log.<open_foam_program> 2>&1 echo "" echo ">>>> End serial Run ..."
For MPI run on 4 cores:
#!/bin/bash #SBATCH --partition production #SBATCH --job-name <name of your run> #SBATCH --nodes=1 #SBATCH --ntasks=1 # Find out name of master execution host (compute node) echo "" echo -n ">>>> SLURM Master compute node is: " hostname # Change to working directory cd $SLURM_SUBMIT_DIR echo ">>>> Begin parallel run ..." echo "" mpirun -np 4 <name of open foam program> -parallel log.<open_foam_program> 2>&1 echo "" echo ">>>> End parallel run ..."
More information about openFOAM plus some examples can me found on OpenFoam documentation web page: