# CFX software package ::::::{tab-set} :sync-group: lang :class: lang-tabs :::::{tab-item} En :sync: en ANSYS CFX is a high-performance software tool for fluid flow simulation. It is distinguished by its generality, robustness and ease of use through a modern and customisable user interface. It offers a range of physical models with which almost all hydrodynamic problems can be simulated: - turbulent flows - flows in turbomachinery - multiphase flows - heat transfer and radiation - combustion processes - fluid–structure interaction (FSI) - on-the-fly adaptation of the computational mesh (remeshing, immersed solids) The main components of the package are the preprocessor (cfx5pre), the solver (cfx5solve) and the postprocessor (cfx5post). All components can be run via scripts, i.e. from the command line, or interactively through the graphical interface. All operations can be recorded and automated. The flow geometry and computational mesh must be created in other programs, for example in ANSYS DesignModeler and the Meshing application, ICEM CFD, TGrid, etc. Users get access to the CFX programs in graphical mode with the ansys module and the command ``` text cfx5 ``` Detailed CFX documentation with tutorial examples is available in the help (Help menu) or in the CFX section of ANSYS Help ``` text anshelp140 ``` **CFX-Pre** ![ANSYS CFX preprocessor](../../files/figs/cfx-pre.png) The simulation definition together with the computational mesh is saved to a .def file, e.g. AxialIni.def. **CFX-Solver** In general, the CFX solver is run in batch mode from the command line: ``` text cfx5solver -def AxialIni.def ``` If we want to solve the problem in parallel on multi-core systems (one process on computer hostA, three processes on hostB), we must specify the host names and the MPI library the processes use to communicate with each other: ``` text cfx5solver -def AxialIni.def -par-dist hostA,hostB*3 -start-method "Platform MPI Distributed Parallel" ``` On the HPCFS supercomputer, the job must be submitted to SLURM with a job script `cfx.sh` ``` bash #!/bin/bash #SBATCH --job-name=AxialIni #SBATCH --partition=rome #SBATCH --ntasks=8 #SBATCH --ntasks-per-core=1 #SBATCH --time=24:00:00 #SBATCH --mail-type=END module load ansys HOSTS=$(srun hostname | sort | uniq -c | awk '{print $2"*"$1}' | paste -sd,) cfx5solve -def AxialIni.def -par-dist "$HOSTS" -start-method "Platform MPI Distributed Parallel" ``` and the *sbatch* command: ``` text sbatch cfx.sh ``` SLURM on Prelog will reserve 8 cores in the cluster (--ntasks=8) for the AxialIni job and run the solver on them. When the solution is finished, it will notify us by e-mail. ``` text $HOSTS ``` is a variable built inside the SLURM job from the reserved nodes (`srun hostname`). It contains a comma-separated list of reserved nodes and the number of processors. E.g. "cn01*2,cn07*2" means two reserved processor cores on each of the nodes cn01 and cn07. This list must be passed to the solver at startup. The progress of the solution can be monitored, and to some extent modified, in the **CFX Solver Manager** by pointing it to the job's working directory, e.g. AxialIni\_001.dir: ![ANSYS CFX solver manager](../../files/figs/cfx-solve-mgr.png) **CFX-Post** On successful completion, the solver generates a .res file with the simulation results. We open it in cfx5post: ![ANSYS CFX postprocessor](../../files/figs/cfx-post.png) ::::: :::::{tab-item} Slo :sync: sl **Programski paket CFX** ANSYS CFX je visoko zmogljivo programsko orodje za simulacijo toka fluidov. Odlikujejo ga splošnost, robustnost in enostavna uporaba preko modernega in prilagodljivega uporabniškega vmesnika. Na voljo ima vrsto fizikalnih modelov s katerimi lahko simuliramo skoraj vse hidrodinamske probleme: - turbulentne tokove - tokove v turbinskih strojih - večfazne tokove - prenos toplote in radiacijo - procese zgorevanja - interakcijo fluida in trdne snovi (FSI) - sprotno prilagajanje računske mreže (remeshing, immersed solids) Glavne komponente programskega paketa so predprocesor (cfx5pre), solver (cfx5solve) in postprocesor (cfx5post). Vse komponente lahko izvajamo skriptno oz. iz ukazne vrstice ali pa interaktivno z grafičnim vmesnikom. Vse operacije je možno posneti in avtomatizirati. Geometrijo toka in računsko mrežo je potrebno izdelati v drugih programih, na primer v ANSYS DesignModeler in Meshing aplikaciji, ICEM CFD, TGrid ipd. Dostop do CFX programov v grafičnem načinu dobijo uporabniki z modulom ansys in ukazom ``` text cfx5 ``` Podrobna dokumentacija o CFX s primeri za vajo so na voljo v pomoči (meni Help) oziroma v ANSYS Help CFX razdelku ``` text anshelp140 ```   **CFX-Pre** ![ANSYS CFX predprocesor](../../files/figs/cfx-pre.png) Definicijo simulacije skupaj z računsko mrežo shranimo v .def datoteko, npr. AxialIni.def.   **CFX-Solver** V splošnem CFX solver poženemo v batch načinu iz ukazne vrstice: ``` text cfx5solver -def AxialIni.def ``` Če želimo vzporedno reševanje problema na večjedrnih sistemih (en proces na računalniku hostA, trije procesi na hostB) moramo navesti imena računalnikov in MPI knjižnico s katero procesi komunicirajo med seboj: ``` text cfx5solver -def AxialIni.def -par-dist hostA,hostB*3 -start-method "Platform MPI Distributed Parallel" ``` Na superračunalniku HPCFS moramo reševanje poslati v čakalno vrsto SLURM s skripto `cfx.sh` ``` bash #!/bin/bash #SBATCH --job-name=AxialIni #SBATCH --partition=rome #SBATCH --ntasks=8 #SBATCH --ntasks-per-core=1 #SBATCH --time=24:00:00 #SBATCH --mail-type=END module load ansys HOSTS=$(srun hostname | sort | uniq -c | awk '{print $2"*"$1}' | paste -sd,) cfx5solve -def AxialIni.def -par-dist "$HOSTS" -start-method "Platform MPI Distributed Parallel" ``` in ukazom *sbatch*: ``` text sbatch cfx.sh ``` SLURM na Prelogu bo rezerviral 8 jeder v sestavu   (--ntasks=8) za posel AxialIni in na njih pognal solver. Po končanem reševanju nas bo obvestil po pošti. ``` text $HOSTS ``` je spremenljivka, ki jo znotraj SLURM posla sestavimo iz rezerviranih vozlišč (`srun hostname`). Vsebuje z vejico ločen seznam rezerviranih vozlišč in število procesorjev. Npr. "cn01*2,cn07*2" pomeni dva rezervirana procesorska jedra na vsakem od vozlišč cn01 in cn07. Seznam moramo posredovati solverju ob zagonu. Potek reševanja lahko spremljamo in v določeni meri spreminjamo v **CFX Solver Manager**-ju tako, da ga usmerimo v delovni direktorij posla npr. AxialIni\_001.dir: ![ANSYS CFX solver manager](../../files/figs/cfx-solve-mgr.png)   **CFX-Post** Solver ob uspešnem zaključku generira .res datoteko z rezultati simulacije. Odpremo jo v cfx5post: ![ANSYS CFX postprocesor](../../files/figs/cfx-post.png) ::::: ::::::