Fluent


ANSYS Fluent is a Computational Fluid Dynamics (CFD) code for modelling fluid flow, heat transfer, mass transfer and chemical reactions. Fluent has interfaces to other pre and post processing packages supplied by ANSYS such as ICEMCFD or Ensight and can incorporate user developed models via user defined functions. Fluent can make use of built in MPI to utilize multiple cross node CPU and can scale to hundreds of cores.


Module loading

After connecting to Bessemer (see Establishing a SSH connection), you can start an interactive graphical session or submit a batch job using ANSYS programs activating them and making them available with one of the module load commands below:

module load ANSYS/19.4
module load ANSYS/20.1/binary
module load ANSYS/20.2/binary
module load ANSYS/21.1/binary
module load ANSYS/21.2/binary

Interactive jobs

While using a X11 GUI forwarding supported SSH client, an interactive session can be started on Bessemer with the srun --pty bash -i command which supports graphical applications. You can load an ANSYS module above and then start the fluent program by running the fluent command.

If desired, the ANSYS Workbench GUI executable can be launched with the ansyswb command. To use more than a single core, you should write a batch job script and fluent journal file for submission to the batch queues.


Batch jobs

To submit Fluent jobs with larger resources a batch job must be submitted to the scheduler. A Fluent batch job is composed of a Fluent journal file which tells Fluent what to do and submission script which tells the scheduler how much resource to request and how to start Fluent.

Fluent Journal files

A Fluent journal file is effectively a sequence of TUI and/or Scheme commands that you’ll supply to Fluent instead of using the GUI / TUI. A more thorough explanation and tutorial on how to make a Fluent journal file can be found on the following page: Writing Fluent journal files.

Important

It is critical that you consult with the Fluent journal syntax documentation linked above in order to ensure features such as autosaving and intermediate save states are turned on and functioning correctly!

Batch Submission Script

Fluent is capable of running in both MPI and SMP parallel environments but will use its in-build MPI communications for both. On Bessemer, cross node jobs are not permitted and there is no mpi-rsh parallel environment. This necessitates the use of the default SMP OpenMP parallel environment (up to 40 cores on a single node only). The lack of other options compared to Fluent on ShARC is as a result of execution on a single node not requiring these options.

The following is an example batch submission script, cfd_job.sh, to run the executable fluent with input journal file subjou.jou, and carry out a 2D double precision CFD simulation. The script requests 4 cores using the OpenMP parallel environment with a runtime of 60 mins and 2 GB of real memory per core.

Sample SMP Fluent Scheduler Job Script

Hint

  • The 2ddp argument is used to specify a 2D double precision simulation. Valid values include: 2d, 2ddp, 3d and 3ddp

  • The argument $SLURM_NTASKS is a SLURM scheduler variable which will return the requested number of tasks.

  • The arguments -gu and -driver null instruct Fluent that it will be running with no GUI to avoid errors caused by plot / figure export.

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --mem=8000
#SBATCH --job-name=name_fluent_smp_4
#SBATCH --output=output_fluent_smp_4
#SBATCH --time=01:00:00
#SBATCH --mail-user=joe.bloggs@sheffield.ac.uk
#SBATCH --mail-type=ALL
module load ANSYS/20.2
fluent 2ddp -i test.jou -gu -t$SLURM_NTASKS -driver null

The job is submitted to the queue by typing:

sbatch cfd_job.sh

Exporting GUI Fluent plots in batch submission jobs

While in a batch job you cannot call a display of a window / figure / animation as Fluent has nowhere to direct this output (there is no available display.)

To avoid this issue while attempting to export images from a batch job you should ensure the fluent command in your submission script has the -gu and -driver null arguments.

i.e. for a ShARC batch job:

fluent 2ddp -i test.jou -gu -t$NSLOTS -rsh -mpi=intel -pib.infinipath -driver null

for a Bessemer batch job:

fluent 2ddp -i test.jou -gu -t$SLURM_NTASKS -driver null

You can setup your plots / graphs either in your journal file or interactively via the GUI and saving the case file.

You can then instruct Fluent to make a hard copy after each figure/animation in the you journal file with:

/display/hard-copy "myfile.tif"

Ensure that you select the correct file format as some file types will not support animations.


For an example of the journal file commands see below:

/display set-window xx ;(xx -> window number)
/display set contours surface yy ;(surface id = yy)
/display set contours filled-contours yes
/display contour zz vof 0 1 ;(contour of volume fraction field (vof) of zz phase, min = 0, max = 1)
/display hard-copy "vof-%t.jpg" ;(save the image file in .jpg format)

Sources