#!/bin/bash -l
#SBATCH --job-name="fluent-cylinder"                  # name of the job (can be changed to whichever name you like)
#SBATCH --output="cylinder.out"              # output file
#SBATCH --ntasks=4         # number of MPI processes
#SBATCH --mem-per-cpu=1GB  # memory per node in megabytes
#SBATCH --time=00:10:00    # maximum run time in hh:mm:ss
#SBATCH --partition="compute"
#SBATCH --account=innovation # replace with your education/research/project account if applicable

# load modules

# Note that older versions of Fluent do not work correctly across multiple nodes on DelftBlue.
module load ansys/2024R2
# Fluent comes with it's own MPI, but we can tweak it to use ours (otherwise inter-node communication may not work or be slow)
module load 2026 cpu openmpi

# set up  hostfile containing the list of nodes as <hostname>:<cores>
srun hostname | sort | uniq -c | awk '{print $2 ":" $1}' | paste -s -d "\n" - > hostfile.txt
#if [ "$SLURM_PROCID" == "0" ]; then
fluent   2ddp -t$SLURM_NTASKS   -g  -i cylinder.script -cnf=hostfile.txt -mpi=openmpi -pinfiniband -cflush
#fi

