Skip to content

ANSYS CFXΒΆ

ANSYS CFX is a high-performance, general purpose fluid dynamics program that has been applied to solve wide-ranging fluid flow problems for over 20 years. At the heart of ANSYS CFX is its advanced solver technology, the key to achieving reliable and accurate solutions quickly and robustly. The modern, highly parallelized solver is the foundation for an abundant choice of physical models to capture virtually any type of phenomena related to fluid flow. The solver and its many physical models are wrapped in a modern, intuitive, and flexible GUI and user environment, with extensive capabilities for customization and automation using session files, scripting and a powerful expression language.

To run ANSYS CFX in batch mode, you can utilize/modify the default cfx.slurm script and execute it via the sbatch command:

#!/bin/bash
#SBATCH --nodes=5             # Request 5 nodes
#SBATCH --ntasks-per-node=128 # Request 128 MPI processes per node
#SBATCH --job-name=ANSYS-test # Job name
#SBATCH --partition=qcpu      # Partition name
#SBATCH --account=ACCOUNT_ID  # Account/project ID
#SBATCH --output=%x-%j.out    # Output log file with job name and job ID
#SBATCH --time=04:00:00       # Walltime

#!change the working directory (default is home directory)
#cd <working directory> (working directory must exists)
DIR=/scratch/project/PROJECT_ID/$SLURM_JOB_ID
mkdir -p "$DIR"
cd "$DIR" || exit

echo Running on host `hostname`
echo Time is `date`
echo Directory is `pwd`
echo This jobs runs on the following processors:
echo `$SLURM_NODELIST`

ml ANSYS/2023R2-intel-2022.12

#### Set number of processors per host listing
procs_per_host=1
#### Create host list
hl=""
for host in $(scontrol show hostname $SLURM_NODELIST)
do
 if [ "$hl" = "" ]
 then hl="$host:$procs_per_host"
 else hl="${hl}:$host:$procs_per_host"
 fi
done

echo Machines: $hl

#-dev input.def includes the input of CFX analysis in DEF format
#-P the name of prefered license feature (aa_r=ANSYS Academic Research, ane3fl=Multiphysics(commercial))
cfx5solve -def input.def -size 4 -size-ni 4x -part-large -start-method "Platform MPI Distributed Parallel" -par-dist $hl -P aa_r

SVS FEM recommends utilizing sources by keywords: nodes, ppn. These keywords allow addressing directly the number of nodes (computers) and cores (ppn) utilized in the job. In addition, the rest of the code assumes such structure of allocated resources.

A working directory has to be created before sending the Slurm job into the queue. The input file should be in the working directory or a full path to the input file has to be specified. The input file has to be defined by a common CFX def file which is attached to the CFX solver via the -def parameter.

The license should be selected by the -P parameter. Licensed products are: aa_r (ANSYS Academic Research) and ane3fl (ANSYS Multiphysics-Commercial).