You are on page 1of 154

SCHOOL OF MECHANICAL,

INDUSTRIAL & AERONAUTICAL


ENGINEERING

Computational Fluid Dynamics


Companion

MECN4031/A - Compressible Flows


MECN4024/A - Gas Dynamics & Propulsion

R.T. Paton

© R.T. Paton 2021


Contents

Contents i

List of Figures vi

List of Symbols xi

List of Acronyms xii

1 Introduction 1

2 Concepts & Terminology 2

2.1 General Flow Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1.1 Compressibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1.2 Viscosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Analytical Basis of Computational Fluid Dynamics . . . . . . . . . . . . . . . 5

2.3 Range of Applicability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.4 Discretisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.5 Solution Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.6 Solution Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.6.1 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.6.2 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Demonstration Problem 11

3.1 Problem description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2 Problem presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

i
4 Introduction to the ANSYS Workbench Environment 12

4.1 Logging into the application server . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2 General layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

4.3 Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 Geometry 18

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.2 Fluid Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.3 Domain Symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.4 Domain Dimensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

5.4.1 Three-dimensional models . . . . . . . . . . . . . . . . . . . . . . . . . 19

5.4.2 Two-dimensional models . . . . . . . . . . . . . . . . . . . . . . . . . . 19

5.4.2.1 Planar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.4.2.2 Axisymmetric . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.4.2.3 Axisymmetric Swirl . . . . . . . . . . . . . . . . . . . . . . . 20

5.5 Domain Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5.6 Domain layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.6.1 Continua and Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.6.2 Mesh motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

5.7 Creation in ANSYS DesignModeler . . . . . . . . . . . . . . . . . . . . . . . . 25

6 Meshing 39

6.1 Mesh Sizing and Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.1.1 Minimum mesh cell size . . . . . . . . . . . . . . . . . . . . . . . . . . 41

ii
6.1.1.1 Minimum feature length . . . . . . . . . . . . . . . . . . . . . 42

6.1.1.2 Geometric resolution of curvilinear features . . . . . . . . . . 42

6.1.1.3 Turbulence modelling . . . . . . . . . . . . . . . . . . . . . . 43

6.1.2 Maximum mesh cell size . . . . . . . . . . . . . . . . . . . . . . . . . . 44

6.2 Mesh motion vs fluid motion . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

6.3 Boundary Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

6.3.1 Physical boundary types . . . . . . . . . . . . . . . . . . . . . . . . . . 45

6.3.2 Inertial boundary types . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6.4 Creation in ANSYS Meshing . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

7 Solver 63

7.1 Solver Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.1.1 Pressure-based solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.1.2 Density-based solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.1.2.1 Explicit Linearisation . . . . . . . . . . . . . . . . . . . . . . 64

7.1.2.2 Implicit Linearisation . . . . . . . . . . . . . . . . . . . . . . 64

7.2 Viscosity in CFD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

7.2.1 Commonly used viscous models in CFD . . . . . . . . . . . . . . . . . 65

7.2.1.1 κ− . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

7.2.1.2 κ−ω . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

7.2.1.3 Spalart-Allmaras . . . . . . . . . . . . . . . . . . . . . . . . . 67

7.2.1.4 Large Eddy Simulation (LES) . . . . . . . . . . . . . . . . . 67

7.3 User-Defined Functions (UDFs) . . . . . . . . . . . . . . . . . . . . . . . . . . 67

iii
7.3.1 Fluid property functions . . . . . . . . . . . . . . . . . . . . . . . . . . 68

7.3.1.1 Fluid thermodynamic properties . . . . . . . . . . . . . . . . 68

7.3.1.2 Boundary value functions . . . . . . . . . . . . . . . . . . . . 68

7.3.2 Mesh motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

7.3.2.1 Forced motion functions . . . . . . . . . . . . . . . . . . . . . 69

7.3.2.2 Integrated motion functions . . . . . . . . . . . . . . . . . . . 69

7.4 Mesh Motion Meshing Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 70

7.4.1 Smoothing method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

7.4.2 Dynamic layering remeshing method . . . . . . . . . . . . . . . . . . . 70

7.4.3 In-cylinder remeshing method . . . . . . . . . . . . . . . . . . . . . . . 71

7.4.4 Remeshing method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

7.5 Mesh Motion Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

7.5.1 Stationary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

7.5.2 Rigid Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

7.5.3 Deforming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

7.5.4 Division of mesh blocks into zones . . . . . . . . . . . . . . . . . . . . 72

7.6 Adaptive Mesh Refinement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

7.7 Solution Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

7.7.1 Residuals monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

7.7.2 Flux or force monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

7.8 Transient Solutions and Time Step Size . . . . . . . . . . . . . . . . . . . . . 77

7.8.1 Temporal resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

iv
7.8.2 Rates of flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

7.8.3 Mesh Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

7.8.4 Number of time steps . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

7.9 Creation in ANSYS ANSYS© Fluent . . . . . . . . . . . . . . . . . . . . . . 79

8 Post-processing in ANSYS Fluent 118

8.1 Numerical post-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

8.2 Graphical post-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

8.3 Advanced graphical post-processing . . . . . . . . . . . . . . . . . . . . . . . . 120

8.4 Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

8.4.1 Setting up animations . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

8.4.2 Extracting animations . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

9 Iterative Model Development 126

9.1 Mesh Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

9.2 Solver Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

9.3 Temporal Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

9.4 Validation & Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

9.4.1 Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

9.4.2 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

10 High Performance Computing 128

Glossary 129

A Installation and Configuration of a C Compiler 131

v
List of Figures

1 Ranges of applicability in terms of Knudsen number of various fluid modelling


approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Citrix login page for application server . . . . . . . . . . . . . . . . . . . . . . 12

3 Application dashboard of Citrix application server . . . . . . . . . . . . . . . 13

4 ANSYS Workbench when you first open it . . . . . . . . . . . . . . . . . . . . 14

5 ANSYS Workbench component systems and information toggles . . . . . . . 14

6 Layout of geometry blocks for demonstration problem (Not to scale) . . . . . 24

7 ANSYS Workbench with a Geometry component system placed into the Pro-
ject Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

8 The most commonly used tools and areas of ANSYS DesignModeler . . . . . 26

9 Enabling Auto-constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

10 First rectangle used in the construction of the faster vehicle body . . . . . . . 28

11 A filleted corner of the first rectangle by the manual method . . . . . . . . . 29

12 Dimensions placed on faster vehicle boundary . . . . . . . . . . . . . . . . . . 29

13 Fully dimensioned first vehicle sketch . . . . . . . . . . . . . . . . . . . . . . . 30

14 Concept menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

15 Details for new surface from sketch . . . . . . . . . . . . . . . . . . . . . . . . 31

16 Completed surface item for the first vehicle . . . . . . . . . . . . . . . . . . . 32

17 Completed surface item for the faster vehicle block . . . . . . . . . . . . . . . 33

18 First point of new block constrained to existing sketch . . . . . . . . . . . . . 33

19 Second point of new block constrained to existing sketch . . . . . . . . . . . . 34

20 Final point of new block constrained to existing sketch . . . . . . . . . . . . . 34

vi
21 First three blocks of model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

22 All blocks of model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

23 Create menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

24 Details of a new boolean operation . . . . . . . . . . . . . . . . . . . . . . . . 36

25 Details of the subtract boolean operation . . . . . . . . . . . . . . . . . . . . 36

26 Final blocks for model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

27 Mesh block boundary interpolation . . . . . . . . . . . . . . . . . . . . . . . . 41

28 Geometry component system linked to the geometry item of the Mesh com-
ponent system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

29 Details of the mesh specification . . . . . . . . . . . . . . . . . . . . . . . . . 48

30 Details of the global mesh sizing specification . . . . . . . . . . . . . . . . . . 49

31 Details of the global mesh inflation sizing specification . . . . . . . . . . . . . 50

32 Some operations in the mesh context menu . . . . . . . . . . . . . . . . . . . 51

33 Initial mesh based on global mesh options . . . . . . . . . . . . . . . . . . . . 51

34 Details of the initial mesh based on global mesh options . . . . . . . . . . . . 52

35 Mesh control options that can be used to optimise the initial mesh . . . . . . 52

36 Detailed settings for the sizing mesh control method . . . . . . . . . . . . . . 53

37 Changing the mouse mode for geometry selection . . . . . . . . . . . . . . . . 54

38 Preview of edge sizing before mesh is updated . . . . . . . . . . . . . . . . . . 55

39 Meshing progress indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

40 Updated mesh including edge sizing mesh control . . . . . . . . . . . . . . . . 56

41 Detailed view of the faster vehicle mesh before the inflation method is applied 57

vii
42 The face of the faster vehicle mesh block selected for control by the Inflation
method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

43 The updated faster vehicle mesh with the inflation layer included . . . . . . . 58

44 Context menu options including Create Named Selection . . . . . . . . . . . . 59

45 Geometry selection with multiple coincident features . . . . . . . . . . . . . . 60

46 Context menu for geometry control in ANSYS Meshing including the Hide and
Suppress options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

47 All interfaces defined and indicated in the workspace . . . . . . . . . . . . . . 62

48 The ANSYS© Fluent Launcher configuration screen . . . . . . . . . . . . . . 80

49 Layout of the ANSYS© Fluent graphical interface . . . . . . . . . . . . . . . 83

50 Initial mesh interface list window . . . . . . . . . . . . . . . . . . . . . . . . . 84

51 The ANSYS© Fluent Text User Interface (TUI) main menu . . . . . . . . . . 85

52 The ANSYS© Fluent TUI Define menu . . . . . . . . . . . . . . . . . . . . . 85

53 Interface default setting changed using the TUI . . . . . . . . . . . . . . . . . 86

54 The ANSYS© Fluent TUI main menu after setting changes . . . . . . . . . . 86

55 Initial mesh interface list window with manual option . . . . . . . . . . . . . 87

56 Mesh interface specification window . . . . . . . . . . . . . . . . . . . . . . . 87

57 Mesh interfaces defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

58 Specification of the κ −  viscous model . . . . . . . . . . . . . . . . . . . . . 90

59 Specification of the fluids in the model . . . . . . . . . . . . . . . . . . . . . . 92

60 Specification of the ideal gas fluid . . . . . . . . . . . . . . . . . . . . . . . . . 92

61 Setting the operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . 92

62 Setting the pressure far field boundary condition . . . . . . . . . . . . . . . . 93

viii
63 Compiled user-defined function (UDF) menu . . . . . . . . . . . . . . . . . . 95

64 Text User Interface (TUI) output for a successful UDF build . . . . . . . . . 96

65 Global settings for the Dynamic Layering mesh motion method . . . . . . . . 97

66 Dynamic Mesh zone definition window . . . . . . . . . . . . . . . . . . . . . . 98

67 Rigid Body dynamic zone specification: motion attributes . . . . . . . . . . . 98

68 Rigid Body dynamic zone specification: meshing options for interior zones . . 99

69 Rigid Body dynamic zone specification: meshing options for edges . . . . . . 100

70 Rigid Body dynamic mesh zones defined . . . . . . . . . . . . . . . . . . . . . 101

71 Deforming dynamic zone specification: meshing options for mesh interiors . . 102

72 Cell Zone Info dialogue for dynamic meshing . . . . . . . . . . . . . . . . . . 103

73 Deforming dynamic mesh zones defined . . . . . . . . . . . . . . . . . . . . . 103

74 Residuals monitor screen including convergence limits . . . . . . . . . . . . . 104

75 Dialogue for the creation of a new report . . . . . . . . . . . . . . . . . . . . . 105

76 Dialogue for the creation of a new drag report . . . . . . . . . . . . . . . . . . 105

77 Settings for faster vehicle drag monitor . . . . . . . . . . . . . . . . . . . . . . 106

78 Settings for report plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

79 Details pane for the initialisation of the flow field . . . . . . . . . . . . . . . . 108

80 Details pane for the Calculation Activites Workflow item . . . . . . . . . . . . 109

81 Details pane for the Autosave item . . . . . . . . . . . . . . . . . . . . . . . . 109

82 Specification of commands to be executed during simulation . . . . . . . . . . 112

83 Commands for adaptive refinement of demonstration problem defined . . . . 113

84 Details for starting the execution of a simulation . . . . . . . . . . . . . . . . 114

ix
85 Residuals after initial steady-state run . . . . . . . . . . . . . . . . . . . . . . 115

86 Residuals after extended steady-state run . . . . . . . . . . . . . . . . . . . . 116

87 drag monitor on faster vehicle after initial steady-state run . . . . . . . . . . 116

88 First attempt at determining the minimum number of iterations per time step
for convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

89 Setup pane for a force report . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

90 Setup pane for a line graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

91 Setup pane for a contour plot . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

92 Setup pane for solution animations . . . . . . . . . . . . . . . . . . . . . . . . 122

93 Definition pane for velocity contour animation . . . . . . . . . . . . . . . . . . 123

94 Velocity contour at the start of the simulation . . . . . . . . . . . . . . . . . . 124

95 Setup pane for animation extraction . . . . . . . . . . . . . . . . . . . . . . . 124

x
List of Symbols

The units of quantities defined by a symbol are indicated in square brackets following the
description of the symbol. Quantities with no indicated units may be assumed to be dimen-
sionless.

a Sound speed [m.s-1 ].

C Courant number.

Kn Knudsen number.

` Characteristic length [m].

λ Mean free path length [Å].

M Mach number.

P Pressure [Pa, mmHg].

R Specific gas constant [J.kg-1 K-1 , kJ.kg-1 K-1 ].

ρ Density [kg.m-3 ].

Re Reynolds number.

t Time [s].

T Temperature [K, ℃, °F].

U∞ Far-field velocity magnitude [m.s-1 ; km.h-1 ].

∆x Minimum cell length [m].

xi
List of Acronyms

2D two-dimensional.

3D three-dimensional.

CFD Computational Fluid Dynamics.

CHPC Centre for High-Performance Computing.

CM Computational Mechanics.

CPU Central Processing Unit.

CSIR Council for Scientific and Industrial Research.

DNS Direct Navier-Stokes.

FEA Finite Element Analysis.

GPGPU General-Purpose Graphical Processing Unit.

GPU Graphical Processing Unit.

GUI Graphical User Interface.

HPC High-Performance Computing.

LES Large Eddy Simulation.

MPI Message Passing Interface.

NS Navier-Stokes.

PDE partial differential equations.

RANS Reynolds-Averaged Navier-Stokes.

RNG Renormalization Group.

SST Shear-Stress Transport.

TUI Text User Interface.

UDF user-defined function.

xii
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
1 Introduction

ENGINEERING
This companion is designed as a step-by-step guide to setting up a simple problem in
ANSYS© Fluent with relevant theory included at each step. While you may be expected
to use other Computational Fluid Dynamics (CFD) solver suites in the future, the process
presented here is meant to be a generic representation of the process of setting up a model
in a typical Reynolds-Averaged Navier-Stokes finite volume package. The focus of this guide
is on practical setup with supplemental information of the theory and other considerations
for that process. As such, you will be required as a practitioner in your working life to read
further on the theory behind various aspects of these models to understand limitations you
may encounter.

1
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2 Concepts & Terminology

ENGINEERING
Before getting into the details of the use of ANSYS© Fluent it is necessary to lay a foundation
of principles and terms to be used in the development of such models.

2.1 General Flow Concepts

In order to simplify the analysis of general flow conditions several broad conditions have
been specified for which analytical results hold with various degrees of accuracy. These
conditions are also used as indicators of the general behaviour of such flows and, typically,
non-dimensional parameters are used as indicators of these conditions. Several of the general
divisions of flow types are listed.

2.1.1 Compressibility

While dealt with elsewhere in this course, several points should be reiterated here concerning
compressibilty in fluid flows.

The term compressibility refers to the changes in density that occur in fluids under certain
pressure conditions. While most liquids are only marginally compressible, with small changes
in density with changes in pressure (having a high bulk modulus), gases are generally con-
sidered compressible (with a low bulk mod. This means that the density of the gas would, for
example, increase significantly with an increase in pressure (if all other conditions are held
constant). One of the most common working fluids for CFD analysis, air, is generally dealt
with as an ideal gas where the pressure, temperature and density are related by:

P = ρRT (1)

where: P is the pressure; ρ is the density; R is the specific gas constant; and T is the
temperature of the air.

The Mach number is used as an indicator of the degree of compressibility to which a particular
flow is prone. Generally it is considered that flow below Mach 0.3 is practically incompressible.
This means that the changes in density due to the deflection of the flow around the body
moving through it are negligible compared to the density at the far-field conditions. Above
Mach 0.7 the flow is considered fully compressible and is prone to large changes in density,
pressure, and temperature in response to the deflection around the body passing through
the flow. Between Mach 0.3 and Mach 0.7, the flow is considered somewhat compressible

2
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
flow in that there may be regions of high compressibility while others may be effectively
incompressible.

ENGINEERING
The entire regime of flow is broadly divided into 2 regimes, with the both subdivided into a
further 2 regimes. Below Mach 1, i.e. where the travelling speed of the body is less than the
speed of sound in the surrounding fluid, the flow is termed subsonic (or subcritical in liquid
flows). This regime is further divided into 2 further regimes though no fixed demarcation
Mach number exists. At low Mach numbers, the flow is always termed subsonic. However, at
Mach numbers approaching 1, the flow is often termed transonic. This is because the local
Mach number in these flows may be greater than 1 while the global Mach number is less than
one. Typically, once a Mach number of 0.8 has been reached the flow is termed transonic.
An example of this is flow over the wing of a commercial airliner. The Mach number of the
free-stream flow over the wing is less than 1 (typically 0.83 - 0.87) however, the flow over the
upper surface and, to a lesser extent and dependent on the wing geometry, the lower surface
is accelerated to a speed at the wing surface and in the near vicinity of M >1. Thus, while
the global flow is subsonic, the local flow at the wing surface is supersonic and experiences
significant compressibility effects. The precise Mach number at which this will happen is thus
clearly a function of the geometry of the body moving through the fluid.

Flows above Mach 1 are again divided into 2 regimes. Any flow with a Mach number above
1 is termed a supersonic flow. However, as the Mach number continues to increase other
thermodynamic effects in the flow become significant and such regimes are termed hypersonic
flows. No fixed Mach number is defined above which any flow would be hypersonic as the
Mach number for the onset of effects considered typical of hypersonic flow, e.g. chemical
degradation of the fluid, vary with geometry and working fluid. However, the minimum limit
for the onset of hypersonic flow is typically Mach 3 while the maximum limit above which
most flows are considered hypersonic is around Mach 7. An example of such a flow is the
re-entry of space craft into the Earth’s atmosphere at Mach 25. A detached shock wave
forms at the nose of the aircraft across which the air is suddenly heated and pressurised. The
heating of the air is typically severe enough that the constituent molecules of the air (ozone,
nitrogen and others) are split and ionise. This absorbs a significant amount of the energy
changes imparted to the fluid by the shock wave and reduces the temperature of the air as
compared to that which would be estimated by an ideal gas solution. These ionised particles
are then free to react with each other and the material of the shuttle itself adding another
degree of freedom to the energy considerations of the flow.

3
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2.1.2 Viscosity

ENGINEERING
Viscous effects are those effects in a fluid which originate at molecular level and are the result
of cohesive and adhesive attractive forces between particles. As such, viscous effects can
be thought of as the result of the particles of a fluid ’sticking’ to a heterogenous substance
(typically a solid surface) and then subsequent ’layers’ of fluid particles ’sticking’ to the ’layer’
adhering to that substance. A typical example of such viscous behaviour is the boundary
layer around a body moving through a fluid.

The degree to which viscous effects affect the flow around a body depends on the velocity of
the fluid passing the body and the size of the body relative to the molecules of the fluid. These
parameters are generally described using the Reynolds number. A low Reynolds number (Re)
would indicate that the viscous forces exerted on the body are comparable to the inertial forces
(momentum) of the fluid. At higher Reynolds numbers the inertial forces tend to dominate
the viscous ones and, in the limit, the flow can be considered inviscid. As an example, again
consider the boundary layer. At low Reynolds numbers (e.g. low fluid speed or highly viscous
fluid) the boundary layer is able to grow thick and the velocity difference across the thickness
of the layer is relatively small. Also, the viscous cohesive forces holding the ’layers’ of the
boundary layer together are comparable to the inertia forces ’washing’ the boundary layer
downstream. At high Reynolds numbers (e.g. high fluid speed or fluid of low viscosity) the
inertial forces exerted on the boundary layer are greater and the ’layers’ of the boundary
layer are forced to slip more relative to one another than in the low Reynolds number case.
Thus, as the Reynolds number increases the boundary layer gets ’thinner’ (for a given velocity
change) until a limit is reached where the thickness of the boundary layer, and thus its effect
on the surrounding flow, becomes negligible when compared to the effects of the body under
consideration, excluding the effects of turbulence and separation associated with these high
Reynolds numbers.

For a given fluid then, by transformation, the Mach number can also be used as an indicator
of the dominance of viscous effects in the flow under consideration. While no fixed rules of
thumb exist for the effects of viscosity as a function of subsonic Mach number, supersonic
flows may be considered inviscid provided that all points in the flow are supersonic. In the
presence of travelling shock waves, for example, where a boundary layer is known to develop
behind the shock wave, viscous effects would necessarily be a consideration in the numerical
solution. Furthermore, shock waves can cause disruption of boundary layers and so viscous
effects cannot be entirely ignored in models of supersonic flow.

4
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2.2 Analytical Basis of Computational Fluid Dynamics

ENGINEERING
Computational Fluid Dynamics is the general term for that group of mathematical methods
used to solve the analytical equations governing fluid flows derived from the physical laws of
conservation of Mass, Energy and Momentum for a continuum. This means that the fluid
is treated as a continuous field of properties and the effects of individual particles are not
directly resolved or modelled.

Various such methods exist for modelling fluid flows including; source, vortex panel / vortex
sheet, and potential flow methods. In most commercial packages, these equations have been
derived for flows of suitable density etc. such that the Navier-Stokes (NS) equations are
applicable. Through simplifications, these equations for general flow of compressible gases can
be adapted to model inviscid systems (Euler flow conditions). A further simplification, that
flow is fully developed (i.e. steady state) and isothermal (no thermal energy considerations),
produces the familiar Bernoulli condition. Most simulation work is done for an ideal gas i.e.
one where the pressure, density and temperature are related as given in 2.1. However, any
number of fluids, liquid or gaseous, can be modelled provided the behaviour of the fluid with
changes in temperature and pressure is well documented.

2.3 Range of Applicability

The formulation of commercial CFD packages to use the NS solver does limit the conditions
of flow that can be accurately modelled. In particular, extremely rarified gases cannot be
accurately modelled using the NS equations. These are conditions that would be experienced
by, for example, space craft when re-entering the Earth’s atmosphere. In such a fluid, the
mean free path length (or average distance) between particles in the fluid becomes comparable
to the dimensions of the body passing through the fluid. The Knudsen number, Kn = λ , is
`
used to represent this ratio where: λ is the Mean Free Path length, and ` is the characteristic
length of the flow field. For values of Kn lower than 0.3, i.e. when the mean free path is
less than 30% of the body length, the NS (or Euler) equations are applicable. Above this
limit the fluid can no longer be modelled accurately as a continuum and a discrete particle
model becomes applicable. While discrete particle models are generally applicable, these are
computationally expensive and hence the formulations of most CFD packages are in terms
of the continuum model. The general limits of this are shown in Figure 1.

Another flow regime in which the NS equations are not directly applicable are high-speed flows
in which chemical reactions occur i.e. hypersonic flow. In such flows, the thermodynamic
changes to the fluid as a result of chemical degradation mean that the ideal gas model (for

5
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
example) would over-estimate the temperatures and pressures occurring in a fluid. Many
solvers can be adapted to model these conditions by using pressure and density data as a

ENGINEERING
function of temperature, based on experimental data or chemical kinetics models, input by
the user.
Discrete particle model

Boltzmann Collisionless Boltzmann

Continuum model

Euler Navier-Stokes Conservation equations do not form a closed set

0 0.01 0.1 1 10 100 ∞


Knudsen number (Kn)
Inviscid limit Free molecule limit

Figure 1: Ranges of applicability in terms of Knudsen number of various fluid modelling


approaches

2.4 Discretisation

Some of the first methods of numerical solution of the fluid flow problems involved the use of
finite difference method. In such a method, the derivatives in the differential equations which
describe the fluid flow are replaced by finite differences, often of high order, that approximate
them. The domain being studied, however, remains a single entity. The obvious drawback of
such a method is that the accuracy of the estimated value at a point in the flow field depends
on the proximity of the points of known value which were used to estimate that value. The
farther a point is in the domain from the points of known value, the less accurate the estimate
of a particular flow variable would be at that point. Also, these methods effectively preclude
the presence of discontinuities in the flow field as the method presumes a continuous change
in any variable across the field.

The obvious conclusion of such error is that the estimation of values in a field in which
variables could be described by differential relationships is to limit the distance at which
these estimates are made from the points of known value. This logic led to the development
of the finite element method. In this method the domain being studied is divided into

6
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
smaller domains each with a simple variation of parameters across the extent of the sub-
domains. Specifically, the variations of the properties across the cells are modelled using

ENGINEERING
linear variations (i.e. variation of the first order). Finite element techniques have found
useful application in mechanical stress analysis where the variables being examined, e.g.
stress and strain, are simply related.

In fluid dynamics systems the range of flow properties being examined are generally related by
higher-order partial differential relationships and these prove difficult to formulate using the
finite element method. Thus the finite volume method, such as that used by ANSYS© Fluent,
was developed. It contains elements of both the finite element and finite difference schemes.
As in the finite element method, the domain being studied is sub-divided into smaller sub-
domains. This is done by creating a mesh of points, or nodes, at which flow values are
calculated and which represent the actual geometry of the system being studied by their
relative positions. The relationships defining the relative positions of these nodes, or edges,
define surfaces in the domain which, in a 3D environment, form closed volumes (also known
as cells), hence the name. In other words, the entire volume being studied is broken into little
blocks which fit together to approximate the shape of the domain and are forced to have the
same values of flow parameters as the adjacent block at the common boundaries.

The finite volume scheme also contains elements of the finite difference scheme as differentials
in the governing equations of the system for each cell are replaced by approximate differences.
Also, the values being calculated at points in the domain are calculated as a function of the
corresponding value at adjacent points in the domain. Thus, the finite volume method enables
complex flow fields to be examined by treating them as smaller, simpler flow fields. The cells
are assessed in such a way that the various fluxes calculated for each cell must match those
of the adjacent cell and hence these methods are conservative.

2.5 Solution Procedure

When using CFD to analyse a flow field there are 3 general steps to be followed: Pre-
processing, Solving and Post-Processing. In the first step, the mesh used to represent the
flow field in the solver is generated. The mesh is that system of nodes which describe the
geometry of the flow field and also serve as computation points for solution of the governing
equations. Thus, the finer the spacing of these nodes, the better the representation of the
geometry would be, especially in the case of curved surfaces. It is important to note that
in CFD the fluid being studied and NOT the bodies around which it is flowing
are modelled. Thus, when modelling the flow through a pipe, the volume inside of the pipe
and not the pipe walls are represented by a mesh.

7
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
The second step, solving, is where the geometry represented by the mesh is passed to the
solver, along with information on the flow conditions at certain points in the domain known

ENGINEERING
as boundary conditions. It is the solver which actually calculates the variation of the flow
variables throughout the domain based on these boundary conditions. It is thus vitally
important that the boundary conditions specified accurately represent the real conditions
being modelled otherwise the solution rendered is effectively meaningless.

The final step in a CFD analysis is post-processing. This is where the data produced by the
solver are formatted in such a way that useful information about the flow field being studied
can be easily represented. For example, one may wish to study the variation of pressure at
a point on the surface of a body with time. In such a case the value of the pressure at each
time step of the solution would be extracted from the solution files for use in a plot.

2.6 Solution Validity

When using CFD to analyse a flow field there are several concepts resulting from the meth-
odology used to analyse the field which must be considered when assessing the validity of the
solution produced.

2.6.1 Convergence

When a solver is calculating the flow variables for a flow field, it uses values initially supplied
for each node as an estimate of the final value. These values are set during a process known
as initialisation in which the flow variables are set at each node based on user input values
or boundary conditions. The solver then enforces the boundary conditions. This causes
a mismatch between the value defined at a particular node and the value driven by the
physics of the system. The solver then adapts the value at each node based on a weighted
average derived from the Courant-Friedrichs-Lewy condition for convergent partial differential
equations (PDE). This means that the values are adjusted to approach the value suggested
by the physics of the system but not be so vastly different from the current value that the
solution ’crashes’. A convergent solution is one which, over successive iterations of the solver,
approaches the analytical value (if such exists) of the differential equations being solved. In
the CFD context the values of the flow variables approach those of the real system being
modelled.

A model which is not convergent is referred to as divergent. This results in increasingly


large changes in field values away from the physical values expected for the given boundary
conditions until the model is forced to stop by internal limitations of the solver. These limits

8
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
are typically imposed to constrain values of flow parameters such as temperature and pressure
to values experienced in the flow fields for which the Navier-Stokes equations are applicable.

ENGINEERING
For example, temperature is typically limited to a maximum of around 5 000 K since fluids
above these temperatures are normally plasmas which do not follow the same behaviour as
liquids and gases because of the presence of ionisation and significant levels of thermodynamic
radiation.

The weighting of the value changes from one iteration to the next is set in the ANSYS© Flu-
ent system by means of the Courant number. The default value is 5 and is suitable for most
systems. However, systems with very strong shock waves may require a much lower Courant
number around 0.5. A lower Courant number will typically provide a solution that is more
stable but takes longer to solve. By corollary, a higher Courant number provides a solution
that is faster but more prone to divergence. This is because a solution with a higher Cour-
ant number, if convergent, will take a lower number of iterations to reach the same level of
convergence than a solution with a lower Courant number.

In unsteady solutions, i.e. where a changing system is modelled over a period of time, the
Courant number also affects the size of the time steps used between the start and end times.
While the user can specify a particular time step, if the solver is allowed to calculate its
own time stepping (implicit time stepping), the Courant number will be used to optimise the
calculated time step. Again, the lower the Courant number, the smaller the time step and
the longer the solution will take for a given time frame.

In ANSYS© Fluent, convergence is monitored by means of residuals and values of the various
flow parameters. Residuals are measures of the maximum relative change of a variable from
one iteration to the next. Typically, a residual much less than one will indicate a converged
solution while residuals greater than one will be indicative of solutions that are still unre-
solved. In the case of unsteady simulations the criteria for convergence may not be met at
each time step but rather it is typically considered acceptable if the residuals for each time
step reduce by 4 or more orders of magnitude.

Low values of residuals do not necessarily indicate convergence, however. Rather, it is typic-
ally necessary to monitor values of forces or fluxes of interest to assess convergence. When
these values become approximately constant as the solution progresses, this is another in-
dication of the convergence of the solution. In general, convergence should be measured as
comprehensively as possible to prevent premature termination of the simulation.

9
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2.6.2 Resolution

ENGINEERING
Resolution in CFD refers to the accurate description of flow phenomena based on the mesh
used to generate the solution i.e. if a feature is smaller in scale than the separation of nodes
in the mesh used in the solution, it may not be accurately resolved. For example, if the nodes
in a mesh are quite widely spaced, the representation of a shock wave in such a mesh would
be inaccurate as it would be averaged across the nodes on either side of it. Thus, the closer
those nodes are to each other, the better the shock wave would be represented.

A similar restriction is applicable to geometric resolution of the domain. The details of a


feature in a given domain are limited by the mesh size in that region. If the mesh is too coarse
the feature will not be adequately represented in the solver and the results obtained will not
be representative of the actual flow. A typical problem of this kind is curved surfaces. If the
cell size on the surface is too large it will be represented more as a multi-faceted polygon and
the flow over it will be disturbed accordingly. Typically, a circular arc is considered well-
represented if it ‘looks smooth’ when viewed as a feature in the entire flow field or relative to
the full body. Another rule of thumb, though it can be overly conservative, is that each cell
should cover between 2% and 20% of the curve for it to be adequately represented. Discretion
must be used to determine the overall relevance of a particular curve to the flow being studied
when specifying a curve representation.

When meshing rectilinear geometries it is necessary that the minimum average cell height
be less than or slightly larger than the length of the shortest feature. This, again, is open
to some adjustment. If the feature is insignificant in terms of the flow behaviour then the
minimum cell height can be such that it is ’smoothed’ out of the model passed to the solver,
though in such cases it should rather be properly eradicated by means of surface merging,
for example. If, however, the small region is of particular interest, then the mesh should
be sized such that a minimum of between 5 and 10 nodes lie across the feature. This will
ensure that it is adequately described geometrically and in terms of the flow in that region.
There are other considerations in sizing the minimum element in a given mesh, covered in
subsection 6.1.

10
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
3 Demonstration Problem

ENGINEERING
3.1 Problem description

The problem to be modelled will be that of one vehicle overtaking another along a straight
road. The leading vehicle will be travelling at 60 km.h-1 while the overtaking vehicle will
accelerate to a speed of 80 km.h-1 at a rate of 15 km.h-1 .s-1 . The model must describe the
flow from the point when the overtaking vehicle is 2 vehicle lengths behind the leading vehicle
until it is 2 vehicle lengths ahead. Each of the vehicles can be approximated for this two-
dimensional model as rectangles that are 3.6 x 1.8 m with rounded corners of radius 150 mm
and a separation when alongside each other of 900 mm.

3.2 Problem presentation

A short description of the considerations typically needed in defining a model will be given
before that rationale is applied to the given demonstration problem. The rationale particular
to the demonstration problem will be given in italics to make it easier to identify if necessary.
Since a given stage of the model may require understanding of procedures later in the process
it is advisable to follow this guide a second time after having created the model once.

11
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
4 Introduction to the ANSYS Workbench Environment

ENGINEERING
Before proceeding to the development of the model it is important to familiarise yourself with
the layout and symbols commonly used. Those particular to a particular part of the program
will be introduced in the relevant section.

4.1 Logging into the application server

The use of ANSYS within the School is through the application server.

• Within the Wits network (either directly or by VPN), navigate to


https://apps.mech.wits.ac.za/ in your browser. While this should work in any browser,
if there are problem it is suggested that you try using Windows Internet Explorer

• If you are using the application on your personal computer for the first time, you will
need to follow these steps:

1. When prompted to do so download the Citrix Receiver installer


2. Install the Citrix Receiver by following the installation prompts given (you will
need administrator rights to do so)
3. Refresh your browser page for the application server

• You should get to a landing page that looks as shown in Figure 2. Log in using your
Mech domain authentication data (i.e. what you use to log into the PC Pool in SWE)

Figure 2: Citrix login page for application server

• Once you have logged in, you will be presented with icons for applications available
on the server, as shown (for example) in Figure 3. If there is a suite of applications it

12
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
will appear as a folder icon and give all available applications within it. You will also
notice the log off button. It is important to understand at this stage that although

ENGINEERING
applications run on your terminal will appear as normal windows they are actually
being run on the application server and only the graphical interface as it would appear
on a local computer is being presented to you. Obviously this also means that without
a network connection to the application server you will not be able to work.

File manager Access to PC Pool computers

Complete list of apps available

App launch icon Home page with your favourite apps

Log out

Figure 3: Application dashboard of Citrix application server

For the purposes of this course we will be using ANSYS© Fluent version 2021 R1.

4.2 General layout

Once you have opened ANSYS Workbench you will be presented with a window which looks
like that shown in figure Figure 4. You can choose to have the tips shown at the start if
you wish (disabled in the current view). You can access the ‘Getting Started’ menu at any
time by going to the Help →Getting Started menu item The Analysis Systems block includes
systems that are packaged to represent the complete work flow of various sorts of model. You
can use these if you wish, but it has proved to be more useful for a new user to work with
component systems so that only part of their work is lost when some part of the model fails.

The component systems are shown in the next tab of the navigation tree on the left of the
ANSYS Workbench window, as shown in Figure 5. The systems available in each area will
depend on the licence available to you. If there are no systems / components shown, it
typically means that licences are unavailable for some reason, typically that the licence has
expired or that the licence server is offline. There are four toggles shown in the Workbench
environment as well:

13
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Toolbox - Analysis Systems

Figure 4: ANSYS Workbench when you first open it

Toolbox - Component Systems

Figure 5: ANSYS Workbench component systems and information toggles

• The Job Monitor toggle: this allows you to show or hide the messages sent through
to Workbench. These may be sent by the other programs being used or may be raised
by Workbench itself

14
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• The DPS toggle: this allows you to show or hide the Design Point data when you
are using the ANSYSDesign Point Service (DPS) for large parametric studies

ENGINEERING
• The Progress toggle: this allows you to show or hide the monitor of resource usage
and progress when you have multiple jobs queued

• The Messages toggle: this allows you to show or hide the messages sent through to
Workbench. These may be sent by the other programs being used or may be raised by
Workbench itself

The main open area is called the Project Schematic and is the area in which components will
be placed and linked allowing you an overview of the structure of the model created.

4.3 Data Structure

It is important to also have some understanding of the way in which ANSYS Workbench
arranges the data in a simulation. At this stage you have no simulation defined so you will
not be able to refer to your file system but this section should be revisited once your model
has been developed.

When you save a Workbench project, two items are created: a .wbpj file and a folder with
the name of the project followed by ” files”. It is important to realise at this point that
the .wbpj file is only the project header file which contains the information relating to the
relative layout and connections of the component and solution systems used. None of the
actual Computational Mechanics (CM) data are included in this file. Rather, all of the actual
CM data are included in various folders within the files folder. This means that if you want
to move your simulation data to another computer for assistance or to work there, you need to
take both items. It is possible to save the entire group to a repository but this is a compressed
file which will need to be uncompressed on the destination computer before the simulation
can be resumed.

If you open up the files folder you will typically see three or four items:

• dp0: The name of this folder stands for ”design point 0”. This refers to the fact that
you may create models with several design points and the data for each are separately
stored. Simple models normally have only one design point. The design point folders
are the ones which will contain the separated data for each stage of a simulation

15
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• user files: This is a folder in which some of your user files may be stored. However,
some files, such as UDFs (subsection 7.3), must be stored in the design point folders

ENGINEERING
for proper use

• .project cache: This is another configuration file. You will never need to edit this

• .lock: This is a file created when the workbench project is open to show that it is
locked by another user. If your simulation is unexpectedly shut down (through power
loss, for example) this file will remain and Workbench will prompt you to unlock the
project. At the same time that the .lock file is created, a hidden copy of the entire files
folder is created which is where changes are actually made. Only when finally saving
the project are the changes updated in the main folders

If you open the design point folder, you will see, at various stages of a model, one or more of
the following folders:

• SYS: This is the folder in which files created by the system for use in other component
or solution systems will be saved. There may be various folders within this folder but
you normally won’t need to use this. It is worth noting that part of the meshing data
(the .msh file which can be directly imported to Fluent) is typically stored here

• global: As the name suggests this is a folder the contents of which are accessible by
any component of the simulation. Although there are folders and files which will be
automatically created there by Workbench (such as the remainder of the meshing data
(subsection 6.4)), this location is important as it is where UDFs should be placed for
inclusion in Fluent

• Geom: This folder is created if you use the DesignModeler tool (subsection 5.7) to
create the geometry for your simulation. While it is one that you normally won’t need
to access, the geometry files are stored here and copies of external geometry files that
are imported are also placed here

• FLU or FFF: These folders are created if you use a Fluent (subsection 7.9) component
system or solution system, respectively. Within this folder is the folder, typically named
Fluent, where the case and data files saved by Fluent are automatically stored. This
location is particularly important to note as these are the actual CFD files that you
will need to analyse for your final results

Fluent data are stored in two associated files: the case (.cas.h5) and data (.dat.h5) files.
The case file contains the specification of the solver and the co-ordinates of the mesh nodes
amongst other settings. The data file contains only the associated flow field values at each of

16
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
the nodes. These files have been changed to the Common Fluids Format (CFF) and so are
compressed in the h5 format.

ENGINEERING

17
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5 Geometry

ENGINEERING
5.1 Introduction

When defining the geometry to be used in a model, there are several considerations to be
borne in mind: domain dimensionality, symmetry, size and layout. Although these decisions
are part of the initial setup of a model, very often one has to revise the geometry in the later
iterations thereof since limitations or improvements are often only identified at those stages.
Meshing and solver constraints inform the layout of the geometry and longer experience in
CFD will enable users to develop more refined models earlier in the process.

5.2 Fluid Domain

A fundamental consideration when creating a CFD model is that it is the fluid to be studied
and not any bodies with which it is interacting that must be modelled e.g. if you want to
model the flow around a car, the geometry of your model domain will be the block of air
around the car and the car will (typically) be a ‘hole’ in the domain.

5.3 Domain Symmetry

One of the simplest ways to reduce the computation time of a model is to reduce the domain
size as far as possible. Before limiting the domain extent for free-flow models, it is important
to consider if symmetry may allow domain reduction. If a flow field is inherently symmetrical
then the use of a symmetry boundary condition will typically halve the computation time
(because only half of the domain is actually computed). It is this reasoning that spurred the
development of the axisymmetric model type (subsection 5.4).

It is important when considering the use of a symmetry boundary condition to be aware of


the physical implications thereof. The symmetry boundary type, by definition, cannot allow
flow to cross it as that would define a spontaneous creation or destruction of matter, violating
the continuity of mass. As a result, any flow directed toward the symmetry plane will reflect
totally from that surface. This consideration is most important in three-dimensional (3D)
models. If, for example, a single plane of symmetry is used in the definition of the model it
will preclude the possibility of helical vortex shedding in the wake of a bluff body (such as
a bullet) because a helix has no planes of linear symmetry. While this type of wake is fairly
uncommmon, unless it is known that the wake does not exhibit this behaviour, it cannot be

18
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
assumed. If time or computing resource pressures force you to limit the model in such a way,
this must be borne in mind when analysing the results produced.

ENGINEERING
5.4 Domain Dimensionality

One of the first considerations for a CFD model is the dimensionality i.e. what order of
spatial dimension the model will have. There are two basic types of model and one of them
is sub-divided:

• 3D

• two-dimensional (2D):

– Planar
– Axisymmetric
– Axisymmetric Swirl

5.4.1 Three-dimensional models

While a 3D model is the most complete model that you can make in CFD, the higher di-
mensional order means that, for example, a cubic volume of the same edge length as a plane
square will take 4 - 8 times as long to solve. Thus, 3D models are normally only used if abso-
lutely necessary as dictated by flow behaviour. This is easier to understand when considering
the limitation imposed by a 2D model: when a model is specified as 2D it generally limits the
flow only to the plane of the model. In other words, the value of out-of-plane flow is forced
to be zero. In many cases, especially of models used for initial estimates, this limitation is
suitable but some flow fields inherently require a full 3D description of the flow field and
cannot be modelled two-dimensionally.

5.4.2 Two-dimensional models

As explained above, a two-dimensional model will typically limit the flow to the model plane
and set the out of plane flux to zero. It is worth noting that most solvers are written
exclusively to solve 3D models and that 2D models are solved as special cases where the
out-of-plane dimension is fixed to some unit value.

19
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5.4.2.1 Planar

ENGINEERING
This is the basic form of the 2D model. This is simply a representation of a field of infinite
depth in which the behaviour at any point through the depth of the field is the same for a
particular location within the plane. This is the method used for most fields described as
being two-dimensional. These models are based on effectively creating a computation block
of unit depth though the mesh itself is represented only as a plane.

5.4.2.2 Axisymmetric

A common type of flow within engineering is flow within or around bodies of revolution.
Examples of this include the flow within pipes or around a bullet. The axisymmetric (a
combination of the words ‘axis’ and ‘symmetric’) formulation is one which allows you to
model these 3D fields using a 2D formulation because the flow field is the same for a given
circle around the axis of revolution. An axisymmetric model is set up so that one of the
boundaries is the axis of the flow field (for example the centrelines of the pipe or bullet), which
is often required to coincide with one of the principal axes of the domain space. Normally
axisymmetric models must be defined in the XY Plane and the axis must lie along the X-
axis. Logically, an axisymmetric model can also have only one axis of symmetry so fields
with multiple bodies of revolution in them will have to be modelled as 3D.

Fluxes in an axisymmetric model are calculated incorporating the distance from the axis.
This means that a point twice as far from the axis with the same flow speed and density will
represent twice the mass flux because it represents the flow though a circular line with twice
the circumference. Flow in an axisymmetric model is constrained to the plane of the model
and this means that there can be no helical flow (i.e. sprial swirl) of the flow.

5.4.2.3 Axisymmetric Swirl

It is well known that many flows in engineering, such as pipe flows, involve swirl. This
means that the flow moves in the tangential, radial, and longitudinal directions. Since the
axisymmetric boundary condition prohibits out-of-plane flow, the axisymmetric swirl model
has been created to allow such helical flow. This is achieved by forcing the flow exiting one
edge of the computational domain (which can be considered as effectively a wedge) to match
that entering the other edge of the domain.

Since the case of overtaking vehicles has no axis of symmetry and has only been defined as a
2D model, the geometry to be created must be planar two-dimensional.

20
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5.5 Domain Size

ENGINEERING
In the case of a constrained flow, the domain size is limited directly by the system geometry
being modelled. However, for simulations of free-air (or other unconstrained fluid) flows,
some consideration must be given to the size of the domain being modelled. If the domain is
too small for the body and effects being modelled, the enforcement of some of the boundary
conditions by the solver may produce non-physical results or cause the solution to diverge.
Conversely, if the domain is too large the solution will take considerably longer to solve as
this procedure can be computationally very expensive.

The definition of what is too small for a flow is very strongly a feature of the speed. This
is because the size of the zone affected by the presence of a change is a function of the
distance from the change that the information pertaining to that change can propagate. The
speed of propagation of information in a quiescent fluid is the sound speed. In a moving
fluid, the orientation of the flow relative to a phenomenon (an immersed body, a change
in geometry, the introduction of another fluid flow...) will affect the zone affected by the
information emanating from it i.e. if the direction of the flow is toward the phenomenon
then the zone affected by the phenomenon will be smaller upstream of the body since the
information is being ‘washed’ downstream. If the flow is away from the body then the zone
affected downstream will be larger since the information is being ‘washed’ downstream.

Typically, the information most relevant in this is the pressure or velocity changes resulting
from these phenomena which affect other flow properties e.g. the higher pressure / stagnation
of flow at the nose of a car will cause the air upstream of the car to start to lift over the
body of the car some distance upstream of the car itself. The higher the velocity of the flow
/ body, the shorter the distance upstream and the longer the distance downstream that the
field could be affected by the body.

A typical rule of thumb for subsonic flows is that an absolute minimum of 5 characteristic
lengths, though 10 is generally considered more acceptable, must be modelled around a
body. This is to ensure that the effects of the body in the flow are suitably dissipated at
the domain boundary to approximate the far-field condition. Thus, for example, an airfoil
section with chord c should be modelled in a domain with a minimum radius of 5c. In the
case of the flow around a pipe joint (i.e. constrained flow), 5 diameters of the pipe upstream
would probably be sufficient to fully capture the effect of the joint, while as many as 20 pipe
diameters downstream of the joint might be needed to adequately capture the mixing of the
two streams, especially in the case of different temperatures, densities, or fluids themselves
at the joint. Another consideration in the upstream sizing of such a flow is how long it will
take for a developed velocity profile to form within the pipe before the region of interest.

21
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
In supersonic flow, the length of the domain upstream of the body can be significantly reduced,
if necessary, to as little as 2 characteristic lengths since little or no information can propagate

ENGINEERING
upstream of a body in such a flow. However, the downstream domain will need to be as large
as, if not larger than, the downstream domain for a subsonic model. The upstream domain
cannot be zero characteristic lengths as this would produce a singularity at the leading edge
of the body and the model would thus be inaccurate or, more likely, unstable. In hypersonic
cases, the downstream domain may need to be as large as 20 or 30 characteristic lengths to
adequately model the flow.

When defining the characteristic length for the sizing of a domain you need to consider the
dimension of the body relevant in that case. In the example of a car moving down the
road, the length of the car will be the most likely characteristic length in the streamwise
direction. In the directions transverse to the stream (i.e. typically vertically and laterally)
the characteristic length would more likely be height or the width of the car, respectively,
since these are the dimensions that will affect the displacement of the air around the vehicle.

A further consideration when sizing the domain for a model is the motion of any bodies within
the fluid and, related to this, the reference frame used for the simulation. The boundaries
need to be an appropriate distance from the bodies at all times in the simulation and so it
is typically useful to first determine the size of a box which would contain all of the motion
and then add the required distances around this. Although mesh motion is covered further
in subsubsection 5.6.2, it is important to consider here the necessity of mesh motion.

If a body is going to be modelled moving at constant speed, it is an intuitive transformation


to fix the reference frame of the model in the body and move the fluid past it. The benefit
of such a transformation is that rather than modelling a very large domain to capture the
effects of simple motion, a much smaller domain can be be created. Such a model is also
modelled as steady state.

If you want to model relative motion between multiple bodies, it is often worth transforming
the model into the reference frame of one of the bodies as long as its motion is inertial and
then describe the motion of the other bodies in that reference frame. By necessity, such a
model must also be transient. In CFD, transformation into a non-inertial reference frame
produces an inaccurate model because the total energy state of the moving fluid is incorrect
in that reference frame unless it is modified by external functions.

The smallest geometry that can be used in the demonstration problem will be one where the
reference frame is fixed in the slower vehicle. A simple kinematic calculation would show that
the distance required for the trailing vehicle to overtake the leading one is approximately 58
m. When one adds even only 10 vehicle lengths, as the characteristic length in that direction,

22
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
to the entire domain (5 upstream and downstream respectively), this suggests a minimum
domain length of 94 m.

ENGINEERING
By comparison, if the reference frame is fixed in the slower vehicle, the length of the box
in which the vehicles will move is 7 characteristic lengths (the length of the faster vehicle
in the initial position; the two vehicle lengths separating the vehicles initially; the length of
the slower vehicle; the two vehicle lengths separating the vehicles at the end of the modelled
motion; and the length of the faster vehicle in the final position) and hence a total domain
length of approximately 61 m, only 65% of the domain length without changing the reference
frame.

This approach is also preferable because it reduces the number of moving mesh boundaries
and the complexities that those entail.

The width of the movement box would require only 4.5 m (two vehicle widths and the 0.9
m separation of the vehicles) and then 5 - 10 characteristic lengths, which here would be the
width of the vehicles. A simple calculation suggests a domain width of approximately 23 m.

5.6 Domain layout

A consideration when creating the geometry for a model is the possible necessity of separated
continua. There are several reasons why this may be necessary including: different fluids in
the flow; fluids in different initial states; differences in local meshing behaviour needed; or
zones of mesh motion.

5.6.1 Continua and Blocks

In the first two cases the geometry is divided into the needed number of adjacent geometries
so that when specifying the model the different fluid states can be applied to each. An
example of this is in the modelling of a shock tube where there are two volumes of gas at
different pressures separated by a membrane. It is unnecessary to model the actual membrane
(diaphragm) so most such models will define one block for the high pressure gas and another
for the low pressure gas.

In the third case, as discussed in more detail in section 6, it is often useful to ‘pre-optimise’
the mesh for a model by creating regions of concentration of nodes. In order to do so most
systems require the creation of geometric boundaries to define the zones of refinement.

23
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5.6.2 Mesh motion

ENGINEERING
The final common cause for dividing a domain into mesh blocks is mesh motion. When
the boundaries of a mesh move, there is typically remeshing which happens adjacent to the
moving boundary. This process can lead to instability of the model if not properly defined and
generally it is preferred that the type of remeshing is kept as simple as possible. Changes in
cell size near bodies of interest would result in complicated remeshing and so these zones are
normally separated so that the entire complicated block can move with the mesh unchanged
while there is simple mesh deformation adjacent to that block. Remeshing processes also
take time and computational power of their own to complete. Thus, remeshing adds to the
total time that a model would take to run and so eliminating this is preferred if possible.

As an example of this, in the demonstration problem there will by necessity be a refined mesh
around each of the vehicles. Since the overtaking vehicle will have to move through the domain
it would be most expedient to create a block around it which will contain the refined mesh and
move in a linear fashion and then blocks to either side so that the extent of the remeshing
is limited and the layering remeshing type can be used (see subsubsection 7.4.2 for more detail)

Thus, the final layout of mesh blocks which should work quite well for this model is as shown
in Figure 6.

Slower vehicle block

Faster vehicle Slower vehicle

Shrinking mesh block

Growing mesh block Faster vehicle block

Stationary block

Figure 6: Layout of geometry blocks for demonstration problem (Not to scale)

24
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5.7 Creation in ANSYS DesignModeler

ENGINEERING
Please note that this guide will focus on the use of DesignModeler. The default geometry
generation tool in ANSYS Workbench is now SpaceClaim. You will need to refer to the
ANSYS Help Guides for more information on how to use SpaceClaim should you wish to do
so.

1. Open ANSYS Workbench

2. Drag a Geometry block from the Component Systems on the left into the workspace and
name it if you wish, as shown in Figure 7. Notice that when it is first placed that there
is a blue question mark icon . This indicates that the information included in the
block is insufficient for the simulation to proceed

Figure 7: ANSYS Workbench with a Geometry component system placed into the Project
Schematic

3. Right-click on the line with the blue question mark in it and Select the DesignModeler
option. This will open ANSYS DesignModeler, the universal geometry editor for AN-
SYS Workbench

4. Once ANSYS DesignModeler has loaded, familiarise yourself with the location of the
most important controls:

25
INDUSTRIAL & AERONAUTICAL
Mouse mode

SCHOOL OF MECHANICAL,
Selector dimensionality
View manipulation

ENGINEERING
Geometry operations

Generator
New sketch

Model tree

Display area

Co-ordinate system icon


Details pane

Figure 8: The most commonly used tools and areas of ANSYS DesignModeler

• Model tree: the block in most ANSYS applications where operations are displayed
and can be selected for: re-ordering; editing; or deletion
• Details pane: the block where the details of the item selected in the model tree
are displayed. Used to edit the parameters of any particular item
• Display area: shows the rendered form of the model described in the model tree.
Also used for the display of other items such as plots
• Mouse mode: allows you to change the mouse operation between single item
select and box select
• Generator: this executes changes made in the model tree. Some operations re-
quire generation before new operations can be added
• New sketch: creates a new sketching plane in the plane selected, which may be
within the base co-ordinate system or a plane within previously-generated geometry
• View manipulation: controls for zooming, rotating, and panning the view of the
model in the display area
• Geometry operations: the most common operations used to create any three-
dimensional geometry. Operations used for creating two-dimensional geometry are
found in the Concept menu
• Selector dimensionality: specifies the dimensionality of the items selected by
the mouse, in ascending order: point; line; surface; volume

5. Most geometric operations begin with creating sketches of the section to be extruded,
either linearly or rotationally. Since this model is to be two-dimensional, the geometry
must be constrained to the XY plane as this is required by Fluent. Select the XYPlane

26
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
item in the model tree and then press the New Sketch button . A new sketch
item will appear beneath the XYPLane item in the model tree

ENGINEERING
6. Select the sketch item in the model tree . Notice that a few items appear in the
Details pane which allow you to change the visibility and name of the sketch. Right-click
on the new sketch item and notice the options which appear:

• Always Show Sketch: making sketches invisible can be necessary to clarify


the view or to prevent creating unwanted dependencies when creating additional
sketches. Showing a sketch or fixing it as permanently visible allows you to check
the relationship between sketches. These options expand when multiple sketches
are present
• Hide Sketch: useful when needing to hide a sketch for clarity or creation of more
sketches
• Look at: this option changes the view to look orthogonally at the sketch plane,
which is useful when creating a sketch versus drawing in a three-dimensional space
• Show Dependencies: objects which depend upon a sketch, such as extrusions or
cut outs, will be undefined if the base object (the sketch) is deleted and so this is
locked by the existence of those objects. This item allows you to confirm that only
those objects which should depend on the sketch
• Delete: a normal part of developing a model but bear in mind that sketches with
dependent objects cannot be deleted
• Generate: an option which appears on almost all objects. Has almost no effect
on sketches
• Rename: allows you to interactively rename the object in the model tree rather
than in the details pane. Also updates the name shown in dependent objects for
the base object

Select Look At. Note that clicking on an axis in the co-ordinate system icon at the
bottom-right (as shown in Figure 8) will change the view to look down that axis while
clicking the blue ball in that icon will change to an isometric view

7. Notice that in the Model tree there is now a second tab labelled Sketching. Select this
tab

27
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
8. There are 5 toolboxes in the Sketching tab which are all various operations for sketching.
Before creating the first sketch, go to the Constraints toolbox

ENGINEERING
9. Using the black scroll arrow at the bottom right of the Sketching Toolboxes pane, scroll to
the bottom of the Constraints toolbox and enable the Auto-constraint options as shown
in Figure 9. While this option is not absolutely necessary, it does expedite the creation
of proper models

Constraints toolbox
Auto-constraints options
Toolbox scroll

Modeling tab
Sketching tab

Figure 9: Enabling Auto-constraints

10. Next open the Draw toolbox

11. Although there are various ways to draw a rectangle, it must be considered that it com-
putationally simpler to draw the base rectangle to represent the faster vehicle such that
the centre of volume (centre of gravity) is at the origin (i.e. (0,0)). Select the Rect-
angle tool and draw a rectangle of arbitrary size that includes the origin as shown in
Figure 10. Although the auto-fillet tool could be used here, leave it disabled for now

Draw toolbox

Rectangle tool (auto-fillet not selected)

Figure 10: First rectangle used in the construction of the faster vehicle body

28
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
12. Now go to the Modify toolbox and select the Fillet tool. Enter a value of 0.3 m and then
click the two lines at each of the corners as shown in Figure 11. You may need to zoom

ENGINEERING
in , pan , or fit the view to fillet all four corners this way

Modify toolbox
Fillet tool (radius defined)

Fillet placed

Figure 11: A filleted corner of the first rectangle by the manual method

13. Now open the Dimensions toolbox. Although there are options to manually define dimen-
sions such as: angles; horizontal and vertical distances; and radii, the semi-automatic
tool is typically sufficient. Select the semi-automatic tool and place the dimensions.
In this case there will need to be two horizontal distances (some combination to form
total length and distance of one edge from the origin), two vertical distances (as with
horizontal), and the radii of the fillets (one dimension may cover them all). Place the

Figure 12: Dimensions placed on faster vehicle boundary

dimensions as shown in Figure 12. Note that once suitably constrained, a line will
change to dark blue from turqoise and that dimensions which over-constrain the model

29
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
will be red. If the dimension suggested by the automatic tool is unsuitable, then make
use of the manual dimensioning tools instead

ENGINEERING
14. The names allocated to the dimensions may not be the most intuitive so, should you
wish to change them, select the dimension in the display area and then edit the name in
the details pane. Note that the dimension names can contain no spaces and any inserted
will be automatically removed. This can be helped for reading by using underscores( ).
You can only select the dimensions for editing in this manner by first changing back to
the Draw toolbox

15. All dimensions associated with the sketch will be shown in the details pane. You can
change the dimensions as needed there or by selecting each and changing the values
individually. To have the vehicle centred on the origin there must be 1.8 to each side
horizontally and 0.9 m vertically. Once dimension values are changed the model auto-
matically adjusts and so it may shrink out of view. In such a case use the fit function
to fit the view, remembering that the dimension lines may now be much larger than the
model itself. The final sketch should appear as shown in Figure 13. (Note that you
may need to enter these values using a comma (,) and not a point (.) as the decimal
separator, depending on the regional settings of your computer)

Figure 13: Fully dimensioned first vehicle sketch

16. Once the sketch is complete, click on the Modeling tab again. Note that if you select the
sketch in the Modeling tab you can also edit the dimensions there. Note also that there
is a checkbox to the left of each of the dimensions. Selecting this marks the dimensions
as a Model Parameter, meaning that it can be automatically varied once the model is
established. Such functionality will not be covered in this course

30
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
17. Since this is to be a two-dimensional model, the geometry must not be created using the
conventional extrusion tools but rather the conceptual tools. Hence, go to the Concept

ENGINEERING
→Surfaces From Sketches menu item, as shown in Figure 14

Figure 14: Concept menu items

18. If it wasn’t selected when you opened the tool, select the faster vehicle sketch either in
the display area or model tree under the Base Objects item of the details for the surface
item which has appeared in the model tree. Notice that the new surface item has a
lightning bolt icon next to it as it still has to be generated. Once you have selected
all of the sketches to be used, click Apply next to the Base Objects item

New surface object

Surface name
Base object(s)
Surface topology type
Surface orientation (normally not used)
Surface thickness

Figure 15: Details for new surface from sketch

19. Next specify the thickness of the surface. This number has no meaning in Fluent since
it recognises surface topologies as two-dimensional so it is recommended that you simply
enter 1. Do not simply leave this as 0 otherwise you will not be able to mesh
the model

20. The final item to specify is the topological type. There are two options for this:

• Add material: this option adds the topology as solid material. If the new volume
intersects any other material volumes their topologies are merged i.e. become one
volume of material. This is analogous to the merging of topologies used with inter-
secting geometries in CAD packages. Typically there is only one material feature
per model

31
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Add frozen: this option adds the topology as frozen material. If the new volume
intersects any other volumes, material or frozen, it remains independent of these.

ENGINEERING
This is useful when overlapping continua are needed as part of the development of
a model, either as intermediate geometries or as part of the final geometry

Since this geometry is going to be used to create the ’hole’ in the mesh for the faster
vehicle, add it as a frozen surface

21. Once all settings have been made, click the Generate button to create the surface.
Notice that once it has successfully generated, it will appear slightly transparent as in
Figure 16 because it is a frozen topology

Figure 16: Completed surface item for the first vehicle

22. Based on this, create a rectangle overlapping the initial one to become the faster vehicle
block. Since you don’t want to have the portion of the mesh adjacent to either of the
vehicles be too small, it is recommended that the width of the block on the side between
the two vehicles be half of the distance between them i.e. since the separation of the
vehicles is 0.9 m, the width of the block outside of the faster vehicle block should be
0.45 m. The length of the block is at your discretion, but obviously cannot exceed the
length of the domain downstream of the vehicle (5 characteristic lengths). An example
of the generated block is shown in Figure 17. Note that the two topologies have not been
merged and that both have been renamed to make working with them easier

23. The next sketch to be created will be the block downstream of the faster vehicle, the
growing mesh block. To do this, create another sketch in the XYPlane and then change
to the sketching environment

24. Use the Rectangle by 3 Points tool to create another rectangle. When doing so, start
the rectangle near the top-left corner of the existing surface for the faster vehicle block.

32
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 17: Completed surface item for the faster vehicle block

Notice, as shown in Figure 18 the P icon that appears next to the cursor. This is an
automatic constraint of that point to coincide with the corner vertex caused by enabling
auto-constraints. If the icon is C then it is some point on the line, which is not what is
required.
Thereafter, place the second point of the rectangle on the lower-left point of the faster

Figure 18: First point of new block constrained to existing sketch

vehicle block as shown in Figure 19


Finally, click somewhere to the left of the existing parts. Notice in Figure 20 that the
three right-most lines of the new sketch are dark blue (i.e. constrained) but that the left
line is turquoise (i.e. unconstrained). Add the relevant dimension

33
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 19: Second point of new block constrained to existing sketch

Figure 20: Final point of new block constrained to existing sketch

25. Since it will be adjacent to the faster vehicle block, ensure that the surface created is
of the frozen type, otherwise the topologies will merge. The generated block should look
something like that shown in Figure 21, where the distance downstream of the trailing
edge of the faster vehicle is 5 characteristic lengths

26. Now you can create the additional 4 blocks needed to complete the model (slower vehicle,
slower vehicle block, shrinking mesh block, and stationary block). Once complete, the
blocks should resemble the layout in Figure 22. Note that the sketches were hidden for
purposes of clarity and that there are 7 bodies and 7 parts

34
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Growing mesh block

Faster vehicle block


Faster vehicle

Figure 21: First three blocks of model

Slower vehicle block

Growing mesh block Slower vehicle


Faster vehicle block
Faster vehicle Shrinking mesh block

Stationary mesh block

Figure 22: All blocks of model

27. As previously discussed, the vehicles are modelled as ‘holes’ in the domain and so
an operation is required to accomplish this. Go to the Create →Boolean menu item
(Figure 23)

28. In the details pane you will find the options for the boolean, includeing the type selector:

• Unite: merges several topologies. Spatial equivalent of the AND logical operator
• Subtract: subtracts some topologies from others. Spatial equivalent of the NOT
logical operator
• Intersect: retains the portion where two topologies intersect. Spatial equivalent
of the OR logical operator
• Imprint faces: imprints the intersection of bodies on the boundary faces for
possible future operations

35
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 23: Create menu items

Boolean name
Boolean operation

Tool bodies

Figure 24: Details of a new boolean operation

Change the operation from the default of Unite to Subtract

29. Once you have selected the Subtract operation you will need to make several settings:

Target bodies

Target bodies

Target bodies

Figure 25: Details of the subtract boolean operation

• Target Bodies: these are the topologies from which the tool bodies will be sub-
tracted
• Tool Bodies: these are the topologies to be subtracted from the target bodies. By
default these will be deleted once the operation is complete

36
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Preserve Tool Bodies?: By default tool bodies in a subtraction operation are
deleted. Change this option to Yes if you wish to retain these

ENGINEERING
First select the Target Bodies. For the faster vehicle portion of the geometry that will be
the surface called Faster Vehicle Block. Click the surface dimensionality selector option
, select the Faster Vehicle Block, and then click Apply on the Tool Bodies option

30. Next you will need to select the appropriate tool bodies. In this case it would be the
surface called Faster Vehicle. Select this and click Apply next to the Tool Body item.
Note that when selecting items which overlap, an icon will appear at the bottom-left (for
example, for two overlapping topologies) of the display pane. Use this to select the
intended object. It may be necessary to hide overlapping objects in some cases to make
the required selections

31. Finally, since the tool body for the faster vehicle is not going to be needed elsewhere in
the model it can be deleted once done so leave the Preserve Tool Bodies option as No

32. Click Generate . Notice that there are now 6 bodies and 6 parts and that the
surface Faster Vehicle has disappeared

33. Repeat steps 27 to 32 for the slower vehicle after which the model should look as shown
in Figure 26

Figure 26: Final blocks for model

Alternative approaches such as a single large initial block divided by smaller blocks into
the final blocks by boolean operations would have worked equally as well and it is a
matter of preference and experience which approach one uses

34. Save the project on the application server. Files saved on the application server
should ONLY be saved in your S: drive, which is a temporary drive created for your

37
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
session. Once your model is complete, you must transfer your data to another location
otherwise they will be deleted when you log off. Do NOT save to your Z: drive (Wits

ENGINEERING
network storage drive) directly as it will slow down your model. You can transfer files
between your temporary drive and local computer using the UserData app in Citrix.
This tool works like your normal Windows Explorer but also allows you access to your
Z: drive and S: drive

35. Close ANSYS DesignModeler

This is the saved state of the model at the end of the geometry operations.

38
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
6 Meshing

ENGINEERING
6.1 Mesh Sizing and Structure

A common mistake by those new to CFD is the use of uniform meshes for all solutions.
While for small domains this method may not be computationally much more expensive,
for large domains or those with complicated flow or physical geometry this can result in
excessive computation time. The reason is that a certain minimum cell size may be required
to properly resolve the flow features of interest or the geometry of the bodies involved which
would result in a very large number of cells being used in the whole domain. One way of
optimizing a mesh is to use a sized mesh i.e. one where there are more cells where needed
and fewer in regions which are fairly uniform. Generally, this will mean a concentration of
cells at the solid surfaces and in the regions of shock waves and other discontinuities.

One concept to bear in mind in this regard is the use of structured and unstructured meshes.
A structured mesh is one which can be simply transformed mathematically into a simple
grid for computation. Thus, while adjacent rows of cells can be of differing height, the
rows are all generally bound by straight edges continuous from one row to the next. In an
unstructured mesh, the orientation of the cell boundaries relative to one another is arbitrary.
This means that unstructured meshes are generally computationally more expensive than
structured meshes. Also, structured meshes tend to produce solutions with higher orders
of accuracy i.e. the value of a variable based on the derivatives of variables calculated by
the solver for a structured mesh is generally more accurate than the same value for an
unstructured mesh. While structured meshes have been known to produce solutions of up
to 8th order accuracy, most unstructured solutions are 1st or 0th order accurate. Advances
in these methods in recent times, however, mean that this is changing and the insistence of
older CFD practitioners that only results from structured meshes are meaningful is becoming
less relevant.

Another consideration when structuring a mesh is that of mesh motion and deformation.
While re-meshing methods are becoming faster and simpler, the motion of meshes near
boundaries is a common cause of instability in such models. This is complicated by such
meshes being unstructured and often the initial refinement of the mesh around features of
interest is lost in such remeshing operations. It is therefore more common to create blocks
of mesh which are unstructured and move without deforming (i.e. rigid body motion of
the mesh) and then other, structured mesh blocks (which are more simply remeshed using
layering methods, for example) which do not move but do deform.

39
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
A final consideration in the sizing of meshes is the size difference and alignment of the meshes
between adjacent mesh blocks. When information is translated across a block boundary it is

ENGINEERING
directly transferred to the node in the adjacent mesh if it overlaps one in the first mesh i.e.
if two nodes lie in the same place then the values of the fluid properties must be the same.
Such an alignment of meshes is said to be conformal. However, more often the boundary
nodes of adjacent meshes do not overlap each other. In these cases, the value to be assigned
to the node in the destination mesh is estimated by weighted aggregate of the values at the
nodes nearest it in the source mesh.

The interpolation functions used to translate data between adjacent mesh blocks are normally
based on two or three nodes to either side of the destination node in the source mesh to make
the interpolated result as accurate as possible but there is a limit to the numerical precision
of the solver (increased by using a double-precision solver, for example) and the result is
truncated. Depending on the precision of the solver this can lead to a build-up of truncation
errors as the model progresses, which can even lead to instability. This is more common if the
separation between the nodes in the two meshes (i.e. the cell size) is significantly different
between the two meshes i.e. if the cells in one mesh are significantly larger than those in
the adjacent mesh, the interpolated result will be poor. Generally speaking, the cell sizes
between adjacent meshes should not differ by more than 300% i.e. the cells in the coarser
mesh should not be more than 4 times the size of the cells in the finer mesh at the interface.

An example of the reasons for block boundary errors is given in Figure 27. Assume that
there is an exponential gradient of a variable in a field such that the value at the equidistant
positions shown is 1, 2, 4, and 8. The true value at the node in the destination mesh is
approximately 2.83. When interpolating between two nodes, you are limited to a linear
interpolation. Hence, if the estimate was made using only the two outer nodes of the source
mesh (dark blue), the value estimated would be 4.5, an error of 59%. If the estimate was
made using the two nodes closer in (lighter blue) but still with a linear interpolation, the
estimated value would be 3, an error of only 6%. If the scheme being used could make a
higher-order polynomial estimate by using all four nodes (i.e. a third-order polynomial) the
estimated value would be 2.81, an error of 0.7%. While the final case would be preferable,
most schemes are limited to linear gradient estimates.

This example describes block boundary errors because high-order gradients in a fine mesh
would be lost in the translation to a coarse mesh while translation in the other direction could
lead to complete mis-representation of the data, even though the finer mesh has the resolution
to describe such gradients. It is for this reason that cell size changes at block boundaries
should be as low as possible. While this may seem like a justification for uniform fine mesh
scale throughout your domain, this is computationally inhibitively expensive and typically a
waste. A growing trend in modern CFD is the use of overset meshing techniques. These

40
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Cell boundary
Destination mesh node
Block boundary

ENGINEERING
1 2 4 8

Source mesh node

Figure 27: Mesh block boundary interpolation

are methods in which the mesh is not explicitly divided into separated blocks but rather there
are additional blocks of mesh associated with moving features. This separate mesh moves
‘over’ the background mesh as the feature moves (hence the term overset mesh). Where
the overset mesh is outside of the computational domain defined by the background mesh,
its nodes are ‘switched off’ i.e. no computation is done for them. Where the overset mesh
overlaps the background mesh, its nodes are ‘switched on’ and the nodes of the background
mesh are ‘switched off’.

In effect this means that a distinct block of mesh of arbitrary shape can move arbitrarily
over the background mesh allowing much more freedom to the range of motion that can be
considered. The overset mesh block can have a mesh that has been optimised for expected
physics (e.g. shock waves) and will retain this finer spatial resolution as it moves. The only
issue with such meshes is that there is an interface region at the edge of the overset mesh
through which information is translated between the overset and background mesh and so it
is important that the cells be similar in size and type here to minimise truncation errors, as
with classical block boundaries.

6.1.1 Minimum mesh cell size

The minimum cell size in a mesh is arguably one of the biggest considerations when sizing
the mesh. This is because small decreases in the minimum cell size can lead to very large
increases in the total number of nodes in the mesh. For this reason it is typically advisable to
determine the maximum possible minimum cell size that will meet your needs and use that
in the creation of the initial mesh. Smaller cells can then be included by adaptive refinements
methods (subsection 7.6) during the execution of the simulation.

41
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
There are three primary considerations when deciding on the minimum cell size for a mesh:
minimum feature length, geometric resolution of curvilinear features, and turbulence model-

ENGINEERING
ling.

6.1.1.1 Minimum feature length

The geometry of a flow field is carried through into the solver by the positions of the nodes
in the mesh. By definition, the edges / faces connecting the nodes of the mesh are straight
/ plane. Thus, if a feature is smaller than the separation of two nodes it will get ‘blurred
out’ by the geometric truncation of meshing. If the feature must be resolved because it is of
consideration in the model, it will define the minimum cell size in that region. This applies
equally to geometric and flow features.

For example, consider a micro-jet injected into a much larger tank. The diameter of the jet
will define the largest possible minimum cell size in that region. If the cells were larger than
the jet diameter, its geometry would not be accurately represented and a velocity flow rate
definition would result in an incorrect mass flow rate.

If the fluid dynamics around the jet were of interest in the model then you would also need
to consider the velocity profile of the jet. Assuming that it is a fully-developed, subcritical
flow, the velocity profile across the jet would be essentially parabolic. Thus, a minimum of
3 nodes across the jet would be needed, though typically you would need 10 or more nodes
across the jet diameter to make a reasonably accurate approximation. Thus the minimum
1 th of the jet diameter.
cell size in that region would need to be 10

In the case of a faster vehicle overtaking another, the accurate description of the flow in the
gap between the two vehicles is important to the determination of the transverse loads on each
vehicle during the manoeuvre. Assuming a velocity profile comparable to the developed flow in
a channel, you would need a minimum of 10 cells across the 0.9 m gap. Thus, the maximum
size for the minimum cell size in that gap would be 0.09 m (90 mm).

6.1.1.2 Geometric resolution of curvilinear features

Apart from the geometric resolution described above, there is the consideration of the accurate
representation of curvilinear geometry. Since the connectors of mesh nodes are straight, it is
clear that a significant number of nodes are required along any curvilinear feature to describe
the geometry with a reasonable level of accuracy. If you limit the change in arc to 5% of a
full turn, this is a maximum arc length of 18°. However, when representing curved surfaces
it often necessary to use a finer mesh than this as a 5% curve would mean only 6 nodes /

42
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
5 edges describing a 90° arc and, depending on the importance of that arc in the flow, the
modelled flow could vary significantly from the actual flow. Typically such surfaces would be

ENGINEERING
described by cells subtending around 5° of arc.

In the case of overtaking vehicles, there are 4 90°‘curves per vehicle that would need to be
described. The flow around these corners will strongly affect the separation around each
vehicle and the interaction of the separated flows between them. Thus, if you were to opt for
5° arc limit, this would require 18 cells around each arc. To determine the minimum cell size
suggested by geometric resolution, you would hence divide the 90° arc length (471 mm) by 18
for a suggested limit of 26.1 mm. For ease of specification this can be approximated as 25
mm.

6.1.1.3 Turbulence modelling

Viscous and turbulent effects in CFD are not directly represented since the mechanisms of
turbulence and viscosity are not completely understood, and such a model would also be com-
putationally expensive. Rather, these effects are modelled i.e. they are included in an overall
fashion by equations which calculate the average effect and impose this on affected regions
of the flow field. These equations are empirical and based on many different experimental
and theoretical results. As such, these models can be ‘tuned’ but the default values given in
packages like Fluent are adequate initial values for these models. It is, however, necessary for
any developed model that the values of the governing parameters for the turbulence models
be calculated for the given flow field and the model adjusted as necessary.

Due to this formulation of viscous modelling, the mesh in regions where these effects are most
pertinent (i.e. boundary layers) must be sized to produce the most accurate results. While
some models use so-called sub-grid modelling, the majority require that the basic mesh at the
boundaries conform to geometric limits. The most common of these rules of thumb is that the
first row of cells must be such that 5 ≤ y + ≥ 30. The reason for this is that a cell height less
than y + = 5 will allow for modelling of the laminar sub-boundary layer and direct calculation
of the other parts of the boundary layer. In contrast, cells larger than y + = 30 will model
the laminar and mixing zone sub-boundary layers while the remainder of the boundary layer
will be directly calculated. Please familiarise yourself with the structure of the boundary
layer if these terms are unclear to you to understand the physical implications of improperly
specifying these cell sizes.

A quick calculation would show that for typical flows in air a cell height for a value of y + = 5
would be of the order of 0.1 mm. Thus, for most air flows, the first layer of cells for a
boundary layer is typically sized for y + = 30, which is approximately 1 mm for most of these

43
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
flows. These low sizes also mean that boundary layer regions are handled in a special way
in CFD to prevent excessive cell counts in models. This is done by making use of inflation

ENGINEERING
layers when meshing. In these cases, the entire domain is meshed using the minimum cell size
dictated by other considerations and then cells are ‘pushed out’ from the solid boundaries
with the low y + height calculated. This results in cells with very high aspect ratio i.e. very
long versus the height. However, this is not a problem when modelling the boundary layer
as the property gradients through the boundary layer thickness are steep, requiring high
concentrations of cells to resolve, while the property gradients in the flow direction are low,
requiring low concentrations of cells to resolve.

6.1.2 Maximum mesh cell size

While not as critical as the minimum mesh cell size, the proper specification of the maximum
mesh cell size can be important for limiting the overall mesh size and ensuring good quality
of information reaching the refined areas of the model. If this size is too small then the mesh
may be too large for computation in a reasonable amount of time. In constrained flows the
maximum mesh cell size is often not that much larger than the minimum mesh cell size but
in far-field condition models, this size is often an order of magnitude (or even two) larger
than the minimum.

In selecting a maximum mesh cell size it is first necessary to consider where these cells are
most likely to occur. In far-field models, this will be at the far-field boundaries of the model.
Hence, the size of the cells there should be such that flow effects there are not blurred out by
being too large, though most features are expected to be dissipated at a far-field boundary if
it is suitably far from the object of interest. An upper limit for this size would typically be
one which places between 10 and 20 cells along one of these boundaries. Often this size will
need to be revised to be smaller to consider the possibility of flow features smaller than this
size. It should also be considered that using a maximum cell size at the upstream far-field
boundary can result in a loss of information for downstream calculations if the properties on
that boundary are not uniform. That said, most cases of a far-field boundary are defined by
uniform conditions along the far-field boundary.

In the case of the demonstration problem, the longest edge of any of the mesh blocks is
approximately 61 m. This would suggest a cell size of between 30 and 60 cm. It is important
to now consider how this would compare to the expected flow field. Although the effects of
the vehicles are expected to be felt upstream, at the boundary the effect is expected to be of
fairly small gradient. Hence if you were to imagine sampling the flow field 30 cm apart at
this distance it is feasible that there would be negligible difference. Thus a maximum mesh
cell size of 30 cm would seem reasonable.

44
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
6.2 Mesh motion vs fluid motion

ENGINEERING
It is important at this point to discuss the distinction between mesh motion and modelled
fluid motion. Many people new to CFD tend to think that the motion of the mesh implies
movement of the fluid being modelled, and that the fluid velocity equals that of the mesh.
The fact is that these two motions are entirely unrelated. Just as you can model a moving
fluid on a stationary mesh, you can model a stationary fluid on a moving mesh. The nodes of
the mesh are simply computational points for imposing the governing equations and boundary
conditions.

Typically there is no reason to move your mesh unless one of the boundaries is moving. This
means that the motion of that boundary will induce motion of the fluid but the movement
of the nodes of the mesh in the free fluid does not cause fluid motion. Rather, it is the
physical boundary conditions of no slip and continuity at a wall (the fluid must match the
velocity of the wall at the surface and cannot disappear into or emerge from the wall) that
induce the motion of the fluid, like stirring a spoon in a cup of coffee. If you were modelling
that scenario, the spoon would be a ‘hole’ in the mesh and would probably have a refined
mesh block associated with it which would move through the surrounding mesh but it would
be the solid walls of the spoon that would induce fluid motion.

6.3 Boundary Types

When defining the mesh the boundary types must also be specified as the node identifiers are
then saved into particular sets to be passed to the solver, Fluent. There are a few common
boundary types used in most solvers which can be broadly divided into physical and inertial
boundaries, where the former imposes physical conditions to be met while the latter defines
inertial properties of the fluid at that position:

6.3.1 Physical boundary types

• Wall: the most common boundary type and the default imposed by Fluent if no
specification is given. This boundary does not allow flow to cross it and will require
that the no-slip condition be met

• Symmetry: while similar to the wall boundary in that flow cannot cross it, there
are no viscous effects on a symmetry boundary. This can also sometimes be set as a
periodic boundary, meaning that the effects seen at the top may repeat at the bottom,
such as in modelling a gas turbine

45
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Axis: related to the symmetry boundary in that flow cannot cross it and there are no
viscous effects, this is required for an axisymmetric model to be run

ENGINEERING
• Interface: while not strictly a physical boundary, this type is needed to enable data
from one mesh block to be passed into another. Interfaces are defined in (at least) pairs
since each of the mesh blocks must have a boundary across which the information can
be passed

6.3.2 Inertial boundary types

Note that some of these conditions cannot be used in conjunction for reasons of compressib-
ility. These exceptions are identified by Fluent when setting up the simulation

• Pressure Far Field: the boundary type required for free-air models where one is
modelling effectively an infinite atmosphere. This is a non-reflecting boundary type
meaning that pressure variations reaching this boundary can pass out of the flow field.
Fluid properties can be set as quiescent (though a small, non-zero value must be set) or
a velocity imposed along the entire boundary. Serves as both inlet and outlet boundary
type

• Velocity Inlet: the simplest of the constrained inertial inlet boundary conditions,
this allows you to set the velocity of the flow passing through the boundary. Flow
is typically defined as normal to the boundary and the boundary surface is typically
constrained by wall boundary conditions. Specification of velocity by the Velocity Inlet
type can preclude the fully developed flow velocity distribution being modelled initially.
Typically used for subsonic flow. Inlet boundary for the Outflow boundary type

• Outflow: the simplest of the constrained inertial outlet conditions, it requires es-
sentially no specification. Typically used for subsonic flow. Outlet boundary for the
Velocity Inlet boundary type

• Pressure Inlet: a more comprehensive constrained inertial inlet boundary type which
requires the total fluid state (defined by temperature, total pressure, and static pressure)
to be specified. The local velocity is calculated from the continuity equations and
can hence be used to specify both subsonic and supersonic flows. Typically used for
supersonic flows. Inlet boundary for the Pressure Outlet boundary type

• Pressure Outlet: a more comprehensive constrained inertial outlet boundary type


which requires the fluid state (defined by temperature and static pressure) to be spe-
cified. The pressure is defined as a back pressure and hence there can be local reversed

46
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
flow if the back pressure exceeds the static pressure at the boundary. Typically used
for supersonic flows. Outlet boundary for the Pressure Inlet boundary type

ENGINEERING
6.4 Creation in ANSYS Meshing

1. In ANSYS Workbench, drag a Mesh component system into the workspace somewhere
near the Geometry block already there. Notice that there is now a check mark next
to the geometry item as it has been completed and is ready for use. As with when the
geometry component was first added, the geometry item in the Mesh component system
is marked with a blue question mark . In addition, you can see that the mesh item in
the Mesh component is marked with an open blue question mark . The reason for the
difference is that the mesh item is dependent on the geometry item and, since it hasn’t
been defined, nothing can be changed with the mesh item

2. Click and hold on the geometry item in the Geometry component system and drag across
to the geometry item of the Mesh component system, which will be highlighted in red
and give a share identifier, then release the mouse. You will see that there is now a link
between the two component systems and that the geometry item in the Mesh component
system has changed to a check mark while the open question mark for the mesh item
has changed to the refresh symbol .

Mesh component system


Component system link

Figure 28: Geometry component system linked to the geometry item of the Mesh component
system

47
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
3. Double-click on the mesh item in the Mesh component system to open the meshing
application, ANSYS Meshing. When ANSYS Meshing opens you will notice that the

ENGINEERING
layout is similar to that of Geometry. Notice that there is currently no mesh specified

4. Select the Mesh item in the Outline pane

5. The first specification to be made in the details pane (Figure 29) will be the type of
mesh:

Figure 29: Details of the mesh specification

• Physics Preference: is the specification of the type of solver that will be pro-
cessing this mesh. While Finite Element Analysis (FEA) solvers can work with
meshes with mid-side nodes, CFD solvers cannot and so it is important to select
the CFD option from the dropdown
• Solver Preference: can be left as Fluent as this example deals with the use of
Fluent
• Element Order and Element Size: can be left as they are, though the element
size should be set to the maximum (0.3 m) [Remember that if your changes do not
appear when you have finished them that you may need to use a comma instead of
a point to enter decimal fractions]

6. The next specification to be made is the global mesh sizing preferences (Figure 30),
which also limit the effect of subsequent local mesh sizing preferences. The first option
for this is to use the adaptive sizing function in Fluent. This will not be covered here
as it is effectively automatic

7. If you do not use the adaptive sizing function within Fluent, then several, more direct
controls become available for the global meshing controls:

• Growth Rate: This is the value which determines how much larger than the lower
cells the next row is. For example, if the growth rate is 1.20 and the first row of

48
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 30: Details of the global mesh sizing specification

cells has a height of 1, then the next row will have a height of 1.2. The default
value of 1.20 is suitable for most applications, and the value must be greater than
1
• Mesh Defeaturing: This is the setting which smooths unnecessary fine features
of the geometry when meshing. Rather than simply creating mesh truncation over
those region, the mesh defeaturing tool creates smooth meshing in the region by
extending the defeatured zone around a fine feature to prevent unexpected flow
features from too coarse a defeaturing. The value provided is the maximum length
of features which will be removed in meshing
• Capture Curvature: This is an automatic tool to resolve curved features of the
geometry. It requires 2 values: the minimum curvature size, and the curvature
normal angle
– Minimum curvature size is the smallest curved feature which will be resolved
in meshing i.e. curves with a smaller radius will be defeatured
– Curvature normal angle is the maximum angle span that would be represented
by a face when meshed
• Capture Proximity: This is an automatic tool to resolve flow between faces /
edges which are close together. It requires 3 values: the minimum proximity size,
the number of cells across the gap, and the proximity size function sources:
– Minimum proximity size is the smallest gap size that will be resolved i.e. gaps
which are narrower than this will be defeatured
– Number of cells across the gap is the minimum number of cells required across
gaps identified by the proximity meshing tool. The default value of 3 is gen-
erally insufficient for small gaps as it cannot resolve a fully-developed flow
profile well. It is typical to increase this to at least 10 if narrow-gap flows are
the focus of the model

49
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
– Proximity size function sources is a specification of the geometric features
between which the meshing tool will try to identify gaps. It has the options of

ENGINEERING
Faces, Edges, and Faces and Edges. The dimensionality of these sources will
depend on your model i.e. it is unnecessary to inspect for small gaps between
faces in a 2D model because the entire model exists in a face, while it may be
unnecessary to inspect for gaps between edges in a 3D model
Switch off mesh defeaturing and curvature capture. There are no very fine features
in the geometry to be removed (since it was not imported from CAD), and the
resolution of the curved edges will be specified by other means. Select the Capture
Proximity option as the flow between the vehicles will need resolution. Also, even
though the block boundary does not constrain the flow, proper meshing between the
vehicle edge and the block boundary must be considered. Change the value for the
number of cells across a gap to 10. Also, change the proximity size function source
to be only edges as this is a 2D model

8. The next option in the details pane is the Inflation section. This is used to create
an initial mesh and then to grow it out from solid surfaces so that the cells there are
optimised for boundary layer modelling. This method has proven to be somewhat fragile
for complex geometries but could be used here. Increase the number of layers to 10 and
leave the remainder of the settings at the default values. However, the inflation will be
specified manually later

Figure 31: Details of the global mesh inflation sizing specification

9. The final item of interest in the details pane is the Statistics item. Once you have
completed meshing this will report the size and other parameters of your mesh. Right-
click on the mesh item in the Outline pane and select the Generate option to create the
initial mesh based only on the global settings. If successful, the icon next to the mesh
item should change to a green check mark and the initial mesh should look something
like that shown in Figure 33, comprising fewer than 20 000 nodes

50
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 32: Some operations in the mesh context menu

Figure 33: Initial mesh based on global mesh options

10. Before proceeding it is worth inspecting the mesh in some detail to identify regions where
additional mesh controls may be needed. Using the zoom tool focus on the section
immediately around the two vehicles. There are several points to note in this initial
mesh:

• There is a high concentration of nodes in the small gaps between the vehicle bound-
aries and the block boundaries inserted by the Proximity advanced meshing function
• The outer corners of the slower vehicle are poorly resolved geometrically because
the curvature advanced meshing function was not applied
• Although not grouped into a single body in Geometry (the method used to enforce
conformal meshing) the meshes between the three blocks that will move or deform
are nearly conformal at their interfaces
• The meshes at the edges of the proximity-meshed regions are not conformal with
the adjacent mesh blocks (and cannot be)
• The mesh at the leading and trailing edges of the vehicles, and along the outer edge
of the slower vehicle, are quite coarse (estimated cell size of 40 cm along the outer
edge of the slower vehicle) and will likely need refinement
• There is currently no inflation mesh on the vehicles

51
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 34: Details of the initial mesh based on global mesh options

(Note than you can pan or rotate the view, and then return to the initial zoom
using the fit view tool )

11. Based on the inspection of the initial mesh, some refinement of the mesh immediately
surrounding the vehicles is needed. The most commonly used tools for this purpose are
inserted via the Mesh Control menu

Figure 35: Mesh control options that can be used to optimise the initial mesh

• Method: This item is used to specify the type of cells used in particular regions of
the mesh. This is used only when it is absolutely necessary to have particular cells
in a mesh block for computational reasons (e.g. types of motion or deformation of
the mesh) and the default meshing method has not inserted these cells
• Sizing: The most commonly used function, this allows you to explicitly specify
regions in which the mesh must be of a particular size

52
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Mapped and Face Meshing: These methods are used when you wish to force
a mesh to be structured i.e. it will resemble a tiled floor. Typically used when the

ENGINEERING
layering mesh motion method will be used. The Mapped Meshing function can only
be used in 3D models
• Inflation: This method defines features against which boundary layers are ex-
pected to form and defines inflation meshes to pre-optimise the mesh for solution
thereof

12. To begin, insert a Sizing item. Notice that a new sizing item appears in the outline
pane and that the mesh icon changes back to a question mark. The settings for a sizing
method are quite simple:

Figure 36: Detailed settings for the sizing mesh control method

• Scoping Method: This is the method that will be used to assign the control to
features of the geometry. Generally you will use the Geometry Selection option (as
in this case) where you directly select geometry elements but occasionally it may
be useful to use the Named Selection method, where you have previously made a
selection of several geometric features and assigned a name
• Geometry: This block will remain yellow until you have confirmed the geometry
to which mesh control will be applied. Choose the Edge dimensionality selector
and then change the mouse to the Box Selection mode (as shown in Figure 37).
Now draw a box around the edges that comprise the faster vehicle. Then, holding
down the Ctrl key, draw another box around only the edges comprising the slower
vehicle. Now click in the Geometry box and press the Apply button. If you have
done this correctly it should no longer be highlighted in yellow and should indicate
that 16 Edges have been selected (i.e. 8 per vehicle (4 straight edges and 4 corner
radii)). Notice as well that the Sizing element in the Outline pane has been renamed
as an Edge Sizing

53
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 37: Changing the mouse mode for geometry selection

• Suppressed: Leave this option set to No since you want this mesh control to be
applied. Later you may wish to suppress this in favour of other controls
• Type: There are four principal sizing types: Element Size, Number of Divisions,
Sphere of Influence, and Factor of Global Size
– Element Size: most of the time you will use this default option in which
you directly specify the size of the elements that must be placed on the selected
geometric features
– Number of Divisions: this method divides each of the edges into a fixed
number of lengths. A major drawback of this method is that it can lead to
large differences in cell size for edges connected to each other if they are of
different length
– Sphere of Influence: this method can be used to create spherical (or, in
2D models, circular) regions of a specified cell size. Typically you must first
create a new co-ordinate system at the centre of the required sphere and then
use this in the definition of the refinement region.
– Factor of Global Size: imposes a constant cell size which is the specified
fraction of the global cell size (defined in the global mesh controls). This is
useful to have cell sizing automatically change when the global size is increased
or decreased, but should be avoided if the cell size on the controlled elements
is specifically sized (rather than relatively)
For this problem, select the Element Size option
• Element Size: this is the size of the actual elements that you wish to enforce
on the selected geometry. Click where you see a size value specified next to the
Element Size control and enter the required size. In the case of the demonstration
problem, we want the cells to match the proximity method cell size which is most
likely the minimum global cell size so set this value to 15 mm (0.015 m)
• Behaviour: This method allows you to set a precedence of the mesh controls
inserted:

54
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
– Soft: the default option which allows the local mesh control to be overridden
by global or other harder local mesh controls

ENGINEERING
– Hard: the option which enforces that the specified control is imposed and
overrides other softer controls which may affect the same region of the mesh.
Generally a hard local mesh control will override a global control
Select the Hard option. Note that when you do so some of the control options
disappear
• Bias: this method allows you to specify the cells such that they change size over the
length of edges only. The default is to have no bias but biases such as larger cells
at one end of a line or even a refinement toward the centre and then coarsening
toward the other end of a line are possible. When specifying such a bias the bias
factor, which is the ratio of the largest cell edge to the smallest cell edge, must be
set. Leave this option at its default of No Bias

Notice that once you have specified the element size for this sizing that yellow rectangles
appear along the edges giving a visual representation of the new edge sizing. The icon for
the Edge Sizing item in the Outline pane will have changed to a check mark indicating
that the specification is complete. The icon for the Mesh item will have changed to a
lightning blot indicating that it must be updated

Figure 38: Preview of edge sizing before mesh is updated

13. Press the Update Button to update the mesh with the new controls. Bear in mind
that it may take a few seconds for this process to be completed, during which there will
be a progress bar displayed indicating the progress

14. Once complete the mesh detail should resemble that in Figure 40 and comprise around
26 000 nodes. As before it is worth inspecting the details of the mesh to be sure that
previous issues identified have been resolved:

55
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 39: Meshing progress indicator

Figure 40: Updated mesh including edge sizing mesh control

• The conformality between the moving and deforming blocks has not been affected
• The ratio of cell size at the edge of the proximity-refined region and the adjacent
mesh blocks seems to be around 6:1 so it may pose a bit of an issue to modelling
and translation of information across block boundaries. This can be revised in later
iterations of the model
• When the faster vehicle block is closer to the slower vehicle block the mesh sizes
either side of the block boundaries will be almost identical and so this should min-
imise interpolation errors during that critical stage of the simulation

15. The final mesh control to insert will be the inflation layers on each of the vehicles.
Before doing so it would be useful to inspect one of the vehicles so that the effect can be
observed. Use the zoom tool to view the entire faster vehicle in greater detail:
Notice that the cells on the vehicle boundary are clearly visible and fairly square in
appearance

16. Select the Inflation method from the Mesh Control menu

56
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 41: Detailed view of the faster vehicle mesh before the inflation method is applied

17. As with the Sizing method, the first item to be specified will be the geometry to which the
inflation must be applied. In this case, this will be the face on which the mesh must be
affected. Since the default dimensionality for inflation-affected geometries is Volumes
, change the dimensionality selector to Faces . Ensure that the mouse mode is set
to Single Select and then click on the mesh around the vehicle. The selected face will
go green as shown in Figure 42
Click Apply in the Geometry item of the details pane to confirm the selection

Figure 42: The face of the faster vehicle mesh block selected for control by the Inflation
method

18. The next item to specify is the Boundary Scoping Method and Boundary. As with the
Sizing method, the Geometry Selection option is most commonly used. Click in the
Boundary item and change the mouse mode to Box Select and the dimensionality is

57
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
for edges and then select the edges of the faster vehicle. Click Apply. There should
be 8 edges confirmed as selected

ENGINEERING
19. The final setting needed for the Inflation method is the maximum number of layers. As
before set this option to 10. Leave the other settings at their default values

20. Update the mesh . Once complete, the detailed mesh around the faster vehicle will now
include a very fine layer used for calculating the boundary layer flow and the number
of nodes will have climbed closer to 34 000. Note how the small apparent change in the
visible mesh has added a significant number of nodes because of the high cell density

Figure 43: The updated faster vehicle mesh with the inflation layer included

21. Apply a similar Inflation method to the slower vehicle. Upon completion the mesh
should be around 42 000 nodes

22. Before continuing, it worth checking the quality of the mesh, included as the Mesh
Metric item in the Quality item of the Mesh details. The most common option for this
is the Aspect Ratio of the cells. Once selected, the minimum, maximum, average, and
standard deviation of the aspect ratios of all the mesh cells will be displayed and a bar
graph of the distribution shown below the mesh. While the ideal is to have all cells as
close to an aspect ratio of 1 (i.e. a square cell) as possible, the use of an inflation layer
will add high aspect ratio cells. High aspect ratio cells are generally a problem if they
occur elsewhere in the mesh because it means that gradients in the longer direction of
the cell may be poorly represented. However, in a boundary layer mesh this is not as
much of a problem because the gradients along a boundary layer are generally weak, and
the use of inflation cells makes accurately modelling the shear exerted on the body much
easier

58
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
23. The final task before finishing is to specify the boundary types of the mesh. This is done
by naming the various geometric features of the mesh as Named Selections. It is not

ENGINEERING
essential that this be done at this stage but doing so allows for automatic boundary typing
in Fluent if the features are correctly named because Fluent will attempt to interpret the
boundary type from a name if present. Setting the boundary types in Fluent can be
done but is cumbersome because there is no graphical means to do so directly and the
automatically generated names for geometric features in Fluent are not immediately
intuitive. Start with the wall boundaries of the faster vehicle:

(a) Set the mouse mode to Box Select and the dimensionality for edges and select
the edges which comprise the faster vehicle
(b) Right-click and select Create Named Selection

Figure 44: Context menu options including Create Named Selection

(c) Specify the name of the named selection. For automatic boundary typing to work
in Fluent the name provided must include, and preferably begin, with the boundary
type required. You can also add extra information to make it clear which boundary
you are naming for ease of reference. If you do not include the boundary type
in the name, then Fluent automatically specify boundaries as walls. Since named
selections cannot include spaces, leave these out or replace them with underscores
( ) or hyphens (-). Enter Wall Faster Vehicle and then click OK
(d) Since this is the first named selection added the Named Selections item will now
appear in the Outline pane

24. Create a similar named selection for the slower vehicle

25. The next edges that can be named are the pressure far field boundary. Since the mesh
is divided into blocks, if you name all of the relevant edges as a named selection they
will get split in Fluent so it is advisable to name them per block:

59
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
(a) Set the mouse mode to Point Select and the dimensionality for edges and select
one the edges which comprise the outer boundaries (but not the block interface

ENGINEERING
boundaries) of the Slower Vehicle block
(b) Holding the Ctrl key, select the other two pressure far field boundaries of the block
(c) Right-click and select Create Named Selection. Specify the name of the named
selection. Enter Pressure Far Field Slower Vehicle and then click OK
(d) Repeat this process for the Growing Mesh, Shrinking Mesh, and Stationary blocks

26. The interfaces need to be properly defined now:

(a) Set the mouse mode to Point Select and the dimensionality for edges and
select one the edges which are mesh block interfaces in the Growing Block mesh.
You will notice that the Multiple Selection icon appears in the workspace. This
is because there are multiple edges that can be selected in the same location. You
can change between the options by clicking on of the planes of the icon, and select
multiple of the options by holding the Ctrl key while selecting planes in the icon.
However, this is not always as clear as in this case (because one edge is much
shorter than the other) and it is typically advised to hide blocks with which you
are not working while the named selections specific to that block are defined as
including the same edge in multiple named selections causes errors which prevent
the simulation from progressing

Figure 45: Geometry selection with multiple coincident features

(b) Expand the Geometry item in the Outline pane. As you select each of the parts
listed there it will be highlighted in the workspace. You may rename these from the
context menu if you wish to make selecting the correct one easier
(c) Right-click on the part for which you wish to define the interface named selection
and select the Hide All Other Bodies option. Note that there is also the option

60
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
to suppress this or other bodies. Suppression completely removes the geometry
definition from the model until unsuppressed while hiding only hides the body and

ENGINEERING
makes it unavailable for selection but retains its associations. Thus, if the parts
are suppressed the previously-defined named selections associated with them will
become suppressed as well (marked with a blue cross ) while if they are hidden
the associated features remain valid

Figure 46: Context menu for geometry control in ANSYS Meshing including the Hide and
Suppress options

(d) Right-click on the edge that you want to define as an interface and select Create
Named Selection. Note that when selecting the edge now that there is no Multiple
Selection icon. When naming interfaces it is useful to name them in such a way
that it is clear which ones must be paired in Fluent (since interface connection
is not automatic). One convention which has been found to be very useful is to
name the interface with the block to which it is attached and then the block/s to
which it must be paired. The two block names are separated by a hyphen rather
than an underscore to make it easier to parse the names into block identities.
This convention creates pairs of names that can be easily picked from a list when
associating interfaces in Fluent. Under this convention, you would enter Inter-
face Growing Mesh-Slower Vehicle and then click OK
(e) Once you have finished naming all of the interfaces for the current mesh block,
right-click on the block in the Geometry item of the Outline pane again an select
the Show All Bodies option
(f ) Repeat this process for all of the remaining mesh interfaces for a total of 12 inter-
face named selections as shown below

61
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 47: All interfaces defined and indicated in the workspace

27. The final named selections that must be made are the ones which define each of the
blocks. This serves two purposes: to ensure that the blocks are recognised as fluids
in Fluent, and also to make them easy to identify in Fluent for settings that will be
needed to define mesh motion. Change the mouse mode to Single Select and the
dimensionality for faces and select the Slower Vehicle face. As before, create a
named selection calling it Fluid Slower Vehicle

28. Repeat this process for the remaining 4 mesh blocks

29. Save the project

30. Close ANSYS Meshing

This is the saved state of the model at the end of the meshing operations.

62
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7 Solver

ENGINEERING
7.1 Solver Formulation

There are two predominant formulations for the CFD solver known as the Pressure-based
and Density-based solvers. These names refer to the way in which the NS equations are
linearised.

7.1.1 Pressure-based solver

This is a method that was originally developed for low-speed, incompressible flows although
it can now be used for other flows as well. The core of the pressure-based solver method
is that the governing equations are solved sequentially, which resulted in the old name for
such solvers, segregated, because of the segregation of the variables. Generally speaking the
momentum variables are each solved sequentially, and then a pressure correction based on
the continuity and mass equations is applied. Thereafter other field variables are calculated.

Due to the fact that field variables are only solved one at a time, the memory requirement of
pressure-based methods is lower and typically such models have faster solution times. The
drawback of this method is that the segregation of the field variables can result in high-
order dependencies being lost and this is why historically these methods are reserved for
incompressible flows.

7.1.2 Density-based solver

These are methods that were originally developed for high-speed, compressible flows though
they can be used for other flows too (since an incompressible flow is just a compressible
flow with negligible compressibility effects). The core of the density-based solver methods is
that the governing equations are solved simultaneously. Due to the inherently unsegregated
(coupled) approach, these methods are generally more memory intensive and thus typically
have longer computation times. These models often require several iterations of the solution
process to reach a converged solution. However, the additional accuracy that these models
can offer for high-order coupling means that they are typically required for high-flux flows
(either high flow speeds or high rates of change of internal energy).

Since the density-based methods are coupled and variables are solved simultaneously there
are two different methods of linearisation of the solver equations: Implicit and Explicit.

63
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.1.2.1 Explicit Linearisation

ENGINEERING
In the explicit linearisation method the equation for an unknown variable in any cell is
formulated in terms of known values of that variable only. This means that the variable in
question will appear in the equation of its cell only. A means of visualising this method is that
the values of flow variables will be solved from the points of known value, i.e. the boundary
conditions, toward regions of unknown value. It could thus be imagined that during solution
the values imposed at the boundaries of the model ‘move into’ the remainder of the mesh.
Another way of considering this is that all variables are solved one cell at a time.

7.1.2.2 Implicit Linearisation

In the implicit linearisation method the equations for an unknown variable in any cell are
formulated in terms of both known and unknown values of that variable. This means that
the variable will appear in the equations of multiple cells which must then be solved sim-
ultaneously. Thus, unlike the explicit linearisation, the values of all cell values are solved
simultaneously. This means that all variables are solved simultaneously (because the solver
is density-based) in all cells at once.

Understanding the difference in linearisation methods, it should be clear that the implicit
linearisation method requires significantly more computing power than the explicit linear-
isation method but that this can lead to overall shorter solution times. Also, since the
pressure-based method solves for each variable sequentially in the entire field it means that
the pressure-based solvers can only have an implicit linearisation.

In the demonstration problem the speeds of the vehicles and fluid flow are clearly in the
subsonic regime and hence a Pressure-based solver will be the most computationally efficient.

7.2 Viscosity in CFD

As alluded to in section 6.1.1.3, the typical Navier-Stokes formulation of CFD packages treats
the fluid as a continuous medium. Thus, viscous effects, which originate at molecular level,
are not directly modelled. To overcome this, most CFD packages use a method known as
viscous modelling. This entails the modelling of the effects on pressure etc. of the viscous
forces without directly resolving the viscous flow structures, or only to a limited degree. The
term ‘model’ means that the effects of viscosity are imposed without the underlying physical
origin being directly captured numerically.

64
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
An example of this is the viscous wake behind a flat plate normal to a steady, viscous flow.
Experience (e.g. dragging a teaspoon through a cup of tea) has shown that the wake behind

ENGINEERING
the plate is a complex system of vortices that grow and decay through mutual interaction
in time and space. However, in a CFD solution the wake behind a flat plate will show the
relevant decrease in pressure and other fluid property changes associated with such a wake
though none of the small, individual viscous vortices in the wake will be shown. This is
because the effects of these vortices are expressed in a time-averaged way in the flow field
by the viscosity model without actually resolving any of them. Large, inertia-driven vortices
may still be resolved though.

A drawback to such models is that these are sensitive to the scale of the mesh used to represent
the flow field and can over- or under-estimate the viscous forces exerted on a body. For
example, for the best results most viscosity models require that the cell height immediately
adjacent to a body be approximately equal to y+ = 5. In particular, this sensitivity to mesh
scale means that the drag exerted on a body in a given flow will typically be over-estimated
by between 5% and 8%, though various models produce differing degrees of accuracy. Since
drag is typically of fundamental importance in the design of aerodynamic (or hydrodynamic)
bodies such as aircraft, this is an important factor to bear in mind when validating the results
of a CFD simulation. It also means that a CFD model may require ‘tuning’ (i.e. adjustment of
the governing parameters of the viscous model) based on comparison with relevant validation
data before the results can be used further.

7.2.1 Commonly used viscous models in CFD

(The summaries given here are adapted from the ANSYS ANSYS© Fluent Theory Guide
available on any computer with the software installed. More details on the formulation of each
can be found in the same theory guide or other pertinent literature.) Almost all turbulence
models used in CFD are Reynolds-Averaged Navier-Stokes (RANS) models, meaning that
the effects are time-averaged to present an overall view of the behaviour without having to
attempt directly modelling the creation and dissipation of small vortices which is inherently
random. As a result of this, even in transient models, there is time-averaging over at least
the extent of a time step to make the model tractable computationally.

7.2.1.1 κ−

The κ −  (‘kappa-epsilon’ or ‘kay-epsilon’) model is considered the workhorse turbulence


model of modern CFD. It is part of a class of models which model the effects of turbulence
by calculating a turbulent length and turbulent time scale, though the manner in which

65
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
these are represented varies. In the κ −  model, the transport variables calculated are the
turbulence kinetic energy (κ) and the dissipation rate thereof (). The equations used to

ENGINEERING
calculate these are based on the assumptions that the flow is fully turbulent and that the
effects of molecular viscosity (such as laminar flow) are negligible meaning that these models
can only be used for fully turbulent flows.

Due to identified weaknesses in the standard κ −  model, two common variants have been
developed: the Renormalization Group (RNG) and Realizable κ −  models. The RNG
model essentially makes allowance for low Reynolds number effects in flows but this requires
appropriate treatment of the near-wall region. Effects covered by these include: effective
viscosity; turbulent Prandtl numbers calculated during simulation (rather than fixed values);
and accommodation of the effects of swirl and rapid fluid strain.

By comparison, the Realizable κ −  model is basically an alternative formulation of the


standard model which gives a better estimate of the turbulence dissipation rate for certain
flows not well-covered by the standard model. The term Realizable specifically refers to
limiting Reynolds stresses to levels consistent with real flows.

7.2.1.2 κ−ω

While similar to the κ −  model, the κ − ω (‘kappa-omega’ or ‘kay-omega’) model is an


empirical model (rather than a mathematical one like κ − ) meaning that it is based on
fitting equations to experimental data. The principal difference between these two models is
that the κ − ω model calculates the specific dissipation rate of turbulence (ω) rather than the
dissipation rate calculated in κ − .

The greater strength of the κ − ω model has been the handling of flows with separation,
typically not as well modelled by the κ −  model. For this reason, the κ − ω model is well-
suited to many industrial flows included pipe flows where the flow from pipes at a junction
may result in separated and recirculating regions. This is a model with significant continuous
development which has improved and continues to improve its accuracy for general flows.

As with the κ −  model, there has been the development of a major sub-model to improve
identified weaknesses in the Shear-Stress Transport (SST) formulation. This model is essen-
tially a combination of the κ −  and κ − ω models which takes advantage of the accurate
near-wall modelling of the κ−ω while adding the insensitivity to the values of k and ω outside
of the boundary layer inherent in the κ− model (and which is a problem of the κ−ω model).
Consequently, the SST κ − ω model has proven to be very popular and accurate for general
industrial flows.

66
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.2.1.3 Spalart-Allmaras

ENGINEERING
A one-equation model developed specifically for wall-bounded aerodynamic flows which has
been shown to give good results for boundary layers with adverse pressure gradients. Unlike
classical models which involve the calculation of a turbulence time term and an associated
length scale, the Spalart-Allmaras model only models the kinematic eddy viscosity. Although
it is finding some application in turbomachinery applications, it is not suitable for use model-
ling general wall-bounded flows (such as industrial models of duct flow) and produces errors
considered large for such cases.

7.2.1.4 LES

In a turbulent flow eddies (vortices) form on various scales with the largest eddies dependant
on geometry and boundary conditions (interia-driven vortices) while the smallest eddies are
quite independent of this. The large eddies are more involved in the transport of momentum,
mass, and energy while the smallest eddies are the mechanism of dissipation of turbulent
kinetic energy. While one could theoretically use Direct Navier-Stokes (DNS) to directly
resolve all of these features, the computational requirements of such a simulation for any
practical engineering flows are impossible to meet. Large Eddy Simulation (LES) is a method
which is part way between DNS and the RANS methods commonly used in that large eddies
are directly resolved in the simulation while smaller eddies are modelled as in other turbulence
schemes. As a result, LES requires much finer meshes than comparable RANS models and
much longer running times. It is also only applicable to 3D simulations. Despite these heavy
requirements, LES has proved to be useful for better resolving complex turbulent flows where
necessary without having to attempt DNS.

In the current model, the flow is external and of a generally low speed. As a result, it is likely
that the Realizable κ −  model will be sufficient. While the constants defined for the model
can be adjusted as per details given in the theory pertaining to it, the default values will be
used for this simulation.

7.3 User-Defined Functions (UDFs)

While the capabilities of most CFD solvers are quite extensive, many models in engineering
require such particular boundary conditions that it would be impossible to build in direct
capability for all of these. Rather, the approach is typically taken that the user can input
boundary conditions of various sorts via external programs, generally called User-Defined
Functions. Once prepared, these functions must be hooked to the model so that it is clearly

67
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
defined where each must be applied in the progress of the simulation. A wide variety of UDFs
are freely available on the Internet for various flow conditions.

ENGINEERING
While these may be used for steady state models of very particular scenarios, generally UDFs
are used for time-varying properties in a model. There are two broad categories of properties
which are handled in different ways: fluid property and body motion functions.

7.3.1 Fluid property functions

These functions are typically interpreted functions. This means that the function is parsed
at the start of the model because they are only needed in defining the fluid initially. Once
this behaviour has been defined it can be accessed by the solver at any point necessary. In
ANSYS© Fluent these are written as C++ (.cpp) files.

7.3.1.1 Fluid thermodynamic properties

Often models will entail fluids with experimentally-defined properties not accurately described
by built-in functions such as the ideal gas equation. A typical example of this would be
modelling hypersonic flows where the ionisation and chemical reactivity of the gas result
in lower fluid temperatures than predicted by the ideal gas equation. Normally there are
discrete temperatures at which different reactions begin and so properties such as the thermal
conductivity of the gas are defined as piecewise polynomials (i.e. several polynomials with
defined ranges of applicability) describing the thermal conductivity as a function of the gas
temperatures. Other properties which may be described by this sort of function are viscosity
as a function of velocity for non-Newtonian (shear-thickening or shear-thinning) fluids, or
density as a function of pressure for fluids including dissolved gases.

7.3.1.2 Boundary value functions

Many models will entail defining boundary conditions that have been defined by other rela-
tionships. For example, experimental measurements may have been used to develop a velocity
and temperature profile for the inlet flow for a model and these can be described mathem-
atically for inclusion. Another typical case of this is when transforming into the reference
frame of an accelerating body. While this cannot be achieved using the standard boundary
conditions, by defining the change of the Mach number, internal energy, and momentum as
functions of time the model can be made to accelerate the entire fluid without developing
non-physical property gradients which would not exist in the real fluid.

68
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.3.2 Mesh motion

ENGINEERING
These functions are typically compiled functions. This means that the function is compiled
into a method that will be used by the solver typically at every time step to update the
position of the body to which it has been hooked. One potential problem with mesh mo-
tion defined by UDFs is that it can result in edge boundaries of the model intersecting or
crossing which can cause non-positive cells volumes and result in failure of the model. In
ANSYS© Fluent these are written as C (.c) files. [Note that the term non-positive is used
rather than negative because a cell volume of 0 will also cause a simulation to fail]

There are two general types of body motion functions: forced and integrated.

7.3.2.1 Forced motion functions

Forced motion functions are, as the name clearly suggests, ones in which the motion of the
bodies involved is independent of the forces acting upon them. This is usually only the case
when the total forcing power of the system is much higher than the fluid dynamic power
applied. For example, although there is significant pressure developed in the cylinders of an
internal combustion engine, the motion of the pistons at steady state is almost completely
independent of that pressure because of the significant inertia of all of the parts of the drive
train sustaining the motion.

One result of forced motion in CFD is that very high or low pressures and temperatures
may be developed as a result of unrealistic descriptions of the motion. These can cause the
model to fail. In addition, these models are also very prone to boundary intersections or
mesh-boundary overruns which result in model failure due to non-positive cell volumes.

7.3.2.2 Integrated motion functions

Integrated motion functions are those which integrate the forces acting on a body to determine
the nett acceleration experienced and hence define the change in velocity at each time step.
A typical example of a model which would use such a function would the the store separation
from the wing of an aircraft since there is no explicit function which can define the loads
acting on it at all times.

While these models are obviously appealing for the physical completeness of the description
of body motion, they are computationally very expensive and should only be used when
absolutely necessary. As with the forced motion functions, these models can also be prone to
boundary-boundary and mesh-boundary overruns leading to model failure.

69
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
As the motion of the overtaking vehicle has been described as a constant acceleration to 80
km.h-1 it is expected that a user-defined function will be needed to describe the motion since

ENGINEERING
it is assumed that the values given include the air resistance. It must be remembered that
the model has been formulated in the frame of reference of the slower vehicle. Hence, the
acceleration of the overtaking vehicle in the simulation will be from relative rest to a speed of
20 km.h-1 at a rate of 15 km.h-1 .s-1 . The UDF used to do this is can be extracted from this
document here

7.4 Mesh Motion Meshing Methods

The range of motion that can be modelled in CFD is generally limited only by the ability
to describe the motion analytically. In addition, many methods exist to integrate the forces
acting on a body and hence calculate its motion. Thus the types of motion available in
CFD are almost limitless and so meshing methods have been developed to deal with various
general forms. Broadly speaking the methods for accommodating mesh deformation can be
divided into smoothing and remeshing methods. The smoothing method is the only method
of its form in ANSYS© Fluent while there are three remeshing methods (Dynamic Layering,
In-cylinder, and Remeshing) where the In-cylinder method is only a highly-specialised form
of the Layering method.

7.4.1 Smoothing method

This method effectively treats the links between nodes in a mesh as springs and determines
the resistance to movement of a node by a method similar to Hooke’s law. This means that it
will spread the local deformation of mesh over a larger area and absorb the movement. The
number of nodes in the mesh and the way that they are connected does not change. Due to
this, the Smoothing method is generally only applicable to small deformations of a mesh and
cannot be used for large, arbitrary motions of boundaries.

7.4.2 Dynamic layering remeshing method

This method is based on regular rows of cells adjacent to a moving boundary which are
split or merged based on the degree of deformation. In short, a cell can get squashed until
it reaches a specified percentage of its nominal size and will be merged with the adjacent,
undeformed cell. Conversely a cell can get stretched until it reaches a specified percentage
of its nominal size and will then be split into two. This method lends itself best to linear

70
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
motion orthogonal to the mesh rows and is not suitable to boundaries which move parallel
to a meshing direction.

ENGINEERING
Understanding the mechanism it is obviously important that the nominal mesh size be
correctly set adjacent to the moving mesh boundary otherwise the cells may not deform
timeously. When stretching a mesh this causes cells of very high aspect ratio which may
lead to inaccurate results but otherwise the model can continue to run. The biggest problem
with improperly defined nominal cell sizes is when squashing cells. If the nominal cell size
is not correctly set then the nodes on the moving boundary may overrun the next row of
nodes from one time step to the next resulting in non-positive / negative cell volume, where
a positive cell volume is as defined algebraically by the right-hand rule for plane cells, for
example. This condition immediately causes a simulation to terminate.

7.4.3 In-cylinder remeshing method

The In-cylinder method is related to the Dynamic Layering method but is designed to model
only the movement of pistons in the cylinders of internal combustion engines. Rather than
using an external UDF to define the movement of the piston mesh boundary, the user spe-
cifies terms such as the crank angle at the start of the simulation, displacement, and engine
frequency, and the displacement profile is automatically calculated

7.4.4 Remeshing method

The Remeshing method is the most general method used to update a mesh during a simula-
tion. While the Smoothing method can accommodate fairly large movements, if the boundary
movement is too large it can result in non-positive cell volumes which causes the model to
fail. The Remeshing method identifies cells that are becoming too skew and defines a region
incorporating all of these for local remeshing. Once the new mesh meets the global skewness
limits, the original cells are replaced with the new cells and the flow values updated through
interpolation. In models with very large displacements of complicated geometry this process
can require significant computational time and so this method should not be lightly used.

The mesh blocks for the demonstration problem were designed so that the mesh associated with
the faster vehicle will move rigidly while the two mesh blocks adjacent to it in the direction
of motion will employ the Dynamic Layering dynamic mesh method.

71
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.5 Mesh Motion Zones

ENGINEERING
When defining mesh motion, the motion and its effects are applied to different zones within
the mesh. There are three commonly-used mesh zone types: Stationary; Rigid Body; and
Deforming.

7.5.1 Stationary

This is the implicit mesh motion zone type. This means that if a zone type is not allocated,
most zones in the mesh are treated as stationary. However, this can be important when
defining mesh motion adjacent to a zone as it can affect the part of the mesh modified by the
mesh motion methods. For example, when using a Dynamic Layering method, if one of the
ends of the mesh is defined as Stationary then cells will be split or merged at the other end.

7.5.2 Rigid Body

This is the zone type used to specify the motion of mesh elements. Often the mesh motion
will involve not just the edges of the mesh block but also the mesh cells themselves and
so separate mesh motion zones using the same conditions must be created for each. Mesh
motion obviously requires at least one Rigid Body zone.

7.5.3 Deforming

This is the mesh motion zone type which allows for deformation of a mesh. This does not
only refer to changing size and shape of a mesh zone. If the cells of a mesh are supposed to
slide along an edge, that edge must be defined as a deforming zone. If this is not done then
the nodes on the edge will remain fixed and the cells connected to those nodes will deform
until the aspect ratio becomes too high at which point the model will generally fail.

7.5.4 Division of mesh blocks into zones

It is important to note at this point that, in general, mesh blocks are divided into the edges
and the interior mesh for dynamic mesh motion. Therefore, if you have defined a named
selection for a mesh block, for example Fluid Faster Vehicle, then the edges of that mesh (all
defined as interface or wall boundary types during meshing) will be separate zones to the
interior of that mesh, which will be automatically named interior fluid faster vehicle. This

72
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
also allows that the interior cells of a mesh can move while the bounding faces / edges do
not.

ENGINEERING
7.6 Adaptive Mesh Refinement

While efforts can be made in the meshing stage of a model to place refinement in regions of
expected high flow property gradients, in complex flows there will almost always be unex-
pected features that arise. Also, pre-optimisation of a mesh typically only works for steady
state simulations since the boundaries often move in a transient model and initial refinement
may be removed as a result. In these cases, adaptive mesh refinement is needed.

As the name suggests, adaptive mesh refinement changes the location in which refinement is
made based on the fluid properties at that time. What this means practically is that the solver
identifies regions with gradients of fluid properties (such as: density; velocity; temperature;
and pressure) greater than a user-defined limit and divides the cells in that region into smaller
ones to increase the local resolution. Conversely, the solver can also merge cells in regions
of low property gradients to reduce the total number of cells. Not all solvers are capable of
these adjustments and there are limits to the range of cases in which this can be done but it
is a powerful tool for improving the physical accuracy of a model.

As an example of where this method would be quite useful, consider modelling the flow in the
supersonic inlet of a jet engine. While for simple geometries (with right cones and such) you
could make some quick hand calculations to identify the region in which the oblique shock
wave is expected, this is almost impossible with the complex, curved geometries of modern
engines. In addition, it is a very time-consuming way of determining the flow behaviour
inside the engine, critical for optimising the performance of the compressor and hence the
engine overall. Adaptive mesh refinement based on gradients of flow properties that you
would expect to change rapidly over features of interest (shock waves) such as temperature,
velocity, density, and pressure can be used to put additional cells where needed.

It is important when considering the use of adaptive refinement methods that suitable flow
properties be considered for determining regions for refinement. For example, if you wish to
identify shock waves in a field you would use the Mach number, but this is actually a function
of the flow velocity and temperature and because of the change in both of these properties
across the shock wave, the change in Mach number is not as large as the changes in each of
these properties separately. Hence it is often more useful to specify velocity and temperature
separately as variable of interest for identifying refinement areas.

73
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Although there is some overlap between them, it is common to specify several variables for
adaption of the field to ensure that the desired features are captured. So, when adapting

ENGINEERING
your mesh to refine it in regions of shock waves, for example, it is typical to use velocity,
pressure, temperature, and density as variables for identifying shock waves in the flow field.
If, on the other hand, you were attempting to identify shear layers as well the use of pressure
would be of no use as shear layers are isobaric (same pressure on each side) while there is a
difference in velocity, temperature, and density.

There are actually several methods commonly used for adaptive refinement broadly divided
into the discriminating property and the threshold mechanism.

When defining the discriminating property for a model you can choose to identify regions
of interest by the value of a property, the gradient of the property, or the curvature of the
property. Essentially these three methods use different derivatives of flow properties (the
value itself, the first derivative, and the second derivative respectively).

By far the derivative methods are more commonly used in adaptively refining engineering
models because it is regions of change of property that are of most interest in such flows.
Put another way, it is unlikely that you could clearly know beforehand that you want to
refine a model when a fluid property like density reaches a particular value because you often
have only a limited idea of the numerical range of values that will occur throughout the
phenomenon being studied.

Correctly selecting the discriminating property is hence a function of the features you wish
to resolve. While both the gradient and curvature of properties like density are large across
a shock wave (because they are, in reality, almost step changes), the curvature of pressure in
the wake of a subsonic vehicle will be negligible compared to the gradient of pressure. You
must hence consider the expected flow physics carefully before selecting a property gradient
by which to adapt.

The second part of adaptive mesh refinement is the threshold mechanism. Once you have
selected a discriminating property you will need to set limits above or below which the mesh
will be refined or coarsened. Here again there are three typical possibilities: the direct value;
scaled property values; or normalised property values.

The first option would require you to set a numerical value for a physical property to be used
as the criterion for adaption. For example, if you were adapting by gradients of density you
would need to specify a value of (kg.m-3 ).m-1 above which the mesh would be adapted. Such
values are often difficult to know when setting up a model as mentioned before. Hence, this
method of threshold specification is not very commonly used.

74
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
By far, the scaled methods of threshold specification (scaled and normalised) are more com-
monly used. These methods refer to the discriminating property relative to the entire field.

ENGINEERING
Hence, in the scaled normalisation threshold specification all values are scaled by the aver-
age value in the domain. So, instead of specifying a density gradient directly by value, for
example, you would specify that all gradients higher than 120% of the mean gradient in the
field must be refined. This allows you to specify a model in which only the most extreme
gradients are considered for refinement. However, if the mean gradient in the field is close to
0 (which is often the case), this can lead to excessive levels of refinement.

By contrast, in the normalised threshold specification all values are scaled by the maximum
value in the domain. Hence, if adapting by density gradient you would specify that all
gradients greater than 70% of the maximum be considered for adaption. This is a method
typically simplest for most people to understand and is hence very popular.

Since the gradients in this flow field are not expected to be particularly high, adaptive refine-
ment can be left out of this model for now. Were you to implement it, it is recommended that
adaptive refinement be specified based on gradients of pressure and velocity changes (since
temperature and density changes are expected to be small). The use of adaptive refinement
will be demonstrated for instructive purposes.

7.7 Solution Monitoring

Once a model has been set up, you need to have methods of tracking the quality as it
progresses, and means of stopping the model once the desired quality has been achieved.
There are two methods commonly used for this: residuals monitoring, and flux or force
monitors.

7.7.1 Residuals monitoring

As discussed in 2.6.1, residuals are the scaled change in flow variables from one iteration to
the next. In ANSYS© Fluent these are used as the threshold mechanism for terminating
a solution i.e. you would request an initial number of iterations and if these conditions are
met before that number of iterations is executed the solver is stopped from executing. Since
residuals do not directly report values in the flow field, this does not necessarily
mean that the solution is correct but only that the change in values per iteration
is below the specified limit.

75
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
The mechanism of convergence limits for residuals means that you can indirectly limit the
number of iterations that the solution executes so that it does not simply continue refining

ENGINEERING
the solution beyond your requirements. These are referred to as convergence limits because
the solution is deemed to be converged when the residuals are at or below the specified levels.
There are cases, however, where a solution never reaches the convergence limits or is not
converged when it does so. The NS equations are PDE’s and hence can behave in under-
damped, critically damped, or over-damped fashion and can be prone to other harmonic
behaviour. When a solution is over-damped (e.g. when modelling an inflection point in
physical behaviour such as the sonic limit in a converging-diverging nozzle) the residuals will
become very small but the solution generally will not actually be converged. In such a case,
the residual limits often need to be made very small to force the solution to be converged.

In the case of under-damped solutions, the convergence may develop harmonic behaviour
in which the values in the flow field oscillate between two stable states but the difference
between them is too great to meet the convergence limits. There is nothing that can be done
to improve such a solution short of changing the boundary conditions.

It is also common for a solution not to reach the convergence limits in each time step of a
transient model. While it is preferred that this is the case, it is quite common for transient
models to develop harmonic behaviour.

In general the default values of convergence limits for most CFD solvers are insufficient for
gas dynamics models, with most convergence limits set at 0.1% (0.001). For gas dynamics
solutions convergence limits of 0.01% (0.0001) are generally recommended, though in the case
of the energy equation it is suggested that the convergence limit be set as 0.0001% (0.000001)
as this equation converges very rapidly.

7.7.2 Flux or force monitors

Since residual monitors do not report the actual values of variables in the flow field, it is
common to enable monitors of forces or fluxes in the model to check the convergence and
accuracy. In cases where the residuals are low and not changing it is informative to examine
the history of a relevant force or flux monitor for actual convergence. For example, in the case
of the overtaking vehicle, monitoring the wind speed would not provide additional information
about the convergence of the model but a monitor of the drag force acting on the overtaking
vehicle would give a sense of the behaviour of the model over the last few time steps and
iterations within each time step.

76
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.8 Transient Solutions and Time Step Size

ENGINEERING
One of the most fundamental specifications of a transient model is the size of the time step. If
you are using an implicit formulation this is determined directly by the value of the Reynolds
and Courant numbers. Specifically, the Courant number is defined as:
U∞ ∆t
C= (2)
∆x
Where C is the Courant number; U∞ is the free-stream velocity; ∆t is the time step size; and
∆x is the minimum cell length. Essentially, the Courant number specifies the rate at which
information diffuses in the mesh. However, in ANSYS© Fluent it is specified as a percentage
rather than the direct Courant number value. The time step size would thus be calculated
using this relationship if an implicit solver formulation is used.

However, in the majority of models it is necessary for you to specify the time step size yourself.
As with mesh sizing, it is recommended to make the time step size as large as possible because
excessive temporal resolution of a model leads to: long run times; large output data set size;
and possibly instability of the model. In a similar fashion to the determination of minimum
cell size, there are three principal considerations in determining the maximum time step
size for a model: required temporal resolution; rates of flux; and mesh motion. Once these
considerations have been used to calculate minimum time step length/s, it is common to
round these down to the nearest convenient temporal unit.

7.8.1 Temporal resolution

In any given transient model it may be that you are required to develop a temporal profile of
a phenomenon at a particular frequency. This is typically dictated by interaction with other
physics. Hence, if you have a flow field which is of a kilohertz (maximum time step 1 ms)
frequency behaviour but it is interacting with another feature, for example the temperature
of a heat source such as a laser operating at megahertz frequency (maximum time step size 1
µs), then it may be necessary for your model to have at least megahertz frequency temporal
resolution to accurately capture the excitation of the fluid by the laser. Should the time
profile of the laser excitation also need to be resolved (i.e. the rise and fall of the laser output
power) with a minimum of 10 time steps (for example), then the model would need to have
a 10-megahertz temporal resolution (i.e. maximum time step size of 100 ns).

77
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.8.2 Rates of flux

ENGINEERING
If the flow rates or other fluxes in your model are changing at a high rate it is necessary for
model stability and accuracy to specify a high model frequency to capture this behaviour.
For example, if a flow is accelerating on the order of tens of m.s-2 , the temporal resolution
will need to be of the order of kilohertz (maximum time step 1 ms) to ensure that modelled
temporal velocity profile is sufficiently smooth. If this is not done, it could cause apparently
sudden changes in speed that could lead to instability or flow features which do not exist in
the real flow, such as shock waves. This also applies to the oscillation of features such as
vortex shedding.

7.8.3 Mesh Motion

The specification of the time step size for a model in which there is mesh motion is possibly
the most critical since incorrect specification can most-easily lead to simulation failure. If
the time step size is too large the moving edges may overrun the adjacent mesh from one
time step to the next causing non-positive cell volumes and hence the model will crash. The
simplest way to estimate this is to consider the maximum speed and smallest cell size in
the direction of motion, in a similar fashion to the calculation of the Courant number. You
determine the time taken for the moving edge to cross the smallest cell at maximum speed,
which should be the minimum speed taken to cross any cell in the model. The maximum
time step size should then be about 40% of that speed as it means that the edge should take
2 - 3 time steps to cross the cell which, if the dynamic mesh methods have been properly
applied, will result in remeshing before non-positive cell volumes can occur. This fraction is
logically dependent on the specification of specification of the nominal cell size fraction below
which the cell must be collapsed with its neighbour.

In the current model, the fastest speed of any moving edge is 20 km.h-1 , corresponding to the
maximum speed of the overtaking vehicle in the absolute reference frame of 80 km.h-1 . Since
the mesh block surrounding the faster vehicle will be moving as a rigid body, the meshes for
which the minimum cell travel time must be computed (i.e. the meshes through which edges
are moving) are the growing and shrinking mesh blocks. In both mesh blocks the cell height
adjacent to the moving edges is 0.3 m. Thus, the minimum time taken for moving edges to
cross these cells is 0.054 s. Calculating a value that 40% of this value and rounding this down
to the nearest convenient temporal unit would suggest a time step size for the model of 20 ms
(0.02 s).

78
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7.8.4 Number of time steps

ENGINEERING
Once the maximum time step size for the model has been determined it is a trivial matter to
calculate the number of time steps required. Simply, you divide the total time to be simulated
by the time step size. Often you will not specify this entire number initially as you would
want to check the stability of your model first and adjust the number of iterations per time
step for the best results.

In the case of the overtaking vehicle, it is required to model the flow from when the faster
vehicle is two vehicle lengths behind the slower vehicle until it is two vehicle lengths ahead, a
total distance of 21.6 m. Using basic kinematics for accelerating bodies, and noting that the
acceleration stops when the faster vehicles reaches a speed of 20 km.h-1 relative to the slower
vehicle, it can be calculated that the time this will take is 4.55 s. Hence the minimum number
of time steps required is 228, which could be rounded to 230 time steps.

7.9 Creation in ANSYS ANSYS© Fluent

1. In ANSYS Workbench, drag a ANSYS© Fluent component system into the workspace
somewhere near the Mesh block already there. Notice that there is now a check mark
next to the mesh item as it has been completed and is ready for use. As with when
the mesh component was first added, the setup item in the ANSYS© Fluent component
system is marked with a blue question mark . In addition, you can see that the
solution item in the ANSYS© Fluent component is marked with an open blue question
mark . The reason for the difference is that the solution item is dependent on the
setup item and, since it hasn’t been defined, nothing can be changed with the solution
item

2. Click and hold on the mesh item in the Mesh component system and drag across to the
setup item of the ANSYS© Fluent component system, which will be highlighted in red
and give a share identifier, then release the mouse to link the two systems

3. You will see that the mesh item in the Mesh component system has changed to a light-
ning bolt while the question mark for the setup item has changed to the refresh
symbol . This is because while linking the systems has shared the mesh with the
ANSYS© Fluent component system, some of the information must be checked for com-
patibility with the existing setup of the model (which is empty) and some of the options
for ANSYS© Fluent must be set based on the dimensionality of the mesh, for example.
Click the Update Project button to update this information. Once
complete a message will pop up telling you that ANSYS© Fluent requires more setup

79
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
information before the model can be executed. The meshing item will have changed back
to a check mark and the setup item of the ANSYS© Fluent component system will

ENGINEERING
now be a question mark. Note that if the setup had already been completed that this
would cause the model to begin executing without the necessity of opening ANSYS© Flu-
ent first.

4. Double-click the setup item in the ANSYS© Fluent component system. This will open
the ANSYS© Fluent launch screen where several options must be set:

Figure 48: The ANSYS© Fluent Launcher configuration screen

• Dimension: Since the project was updated, this option has been locked to 2D
because that was the information passed from the Mesh component system. When
launching ANSYS© Fluent independently you would be required to manually select
the relevant option for the model you wish to run
• Options: There are 4 options available for 2D models:
– Double Precision: This refers to the size of the variables used to store the
model valuables. Selecting the Double Precision solver will use double type
variables instead of the standard float type to store the flow values. This is
only needed for models where very high numerical accuracy is required, typic-
ally where the physics being modelled has regions near unstable solution points.
These models are normally solved asymptotically and hence require the accur-
acy. Most models do not and so the default is not to use this
– Display Mesh After Reading: This option simply means that the mesh will
be displayed immediately after opening, or after reading i a new file in within

80
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
ANSYS© Fluent. This is a useful option to check that the mesh appears to
have been correctly imported before starting with solver settings

ENGINEERING
– Do not show this panel again: This will prevent this configuration panel
from showing in future on that particular computer. Given that some of the
options shown here may be useful in other models, it is advisable to leave this
option unchecked
– Load ACT: This option loads the ANSYS© Fluent environment which allows
the execution of interface macros that have previously been defined. Given that
this is an advanced user capability, no more will be covered on it here
Leave only the default option of displaying the mesh checked
• Parallel (Local Machine): The options given here refer to whether the model
will be running on a single compute node or parallelised over several on the local
computer. The title of this section will change if the local computer is networked
into a cluster of ANSYS© Fluent compute nodes.

These options are presented because distributed processing has allowed for signific-
ant increases in the size of models which can be processed in a reasonable amount
of time and / or reduced the time required for simple models.

You are required to specify two values here: the number of Solver Processes, and
the number of Solver GPGPUs per Machine:
– Solver Processes: This is the number of solver processes which will be run
simultaneously to solve the model. The model is broken into blocks which are
each processed by a solver and the information is passed between them by an
Message Passing Interface (MPI). It is worth noting that the parallelisation
blocks do not necessarily correspond to any mesh blocks which may exist, but
rather that the mesh is divided to balance the number of nodes being handled by
each compute process. There are two rules of thumb for parallelisation. The
first is that you should have a minimum of 100 000 nodes per compute node
i.e. do not parallelise a model with fewer nodes because it will actually slow the
calculation down because of information transfer between the compute blocks.
The second is that the maximum number of processes that can be specified on
a single computer is:

Pmax = nCP U × (ncores − 1) (3)

Where: nCP U is the number of Central Processing Unit (CPU) chips in the
computer to be used and ncores is the number of processing cores per chip. The
reason that the total is calculated with one less core per chip is that one core

81
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
must be kept separated on which to run the MPI.

ENGINEERING
The typical ANSYS© Fluent licence at present allows for a maximum of 4
compute nodes per licence seat. If you wish to use more compute nodes you
will need an additional High-Performance Computing (HPC) licence. More
information on parallelisation of models is covered in section 10.

Since this model is small, you will only use the Serial option
– Solver GPGPUs per Machine: This option allows you to indicate if there
is a General-Purpose Graphical Processing Unit (GPGPU) (or more) available
for use on the computers to be used. A Graphical Processing Unit (GPU) is
a processing chip, which differs from a CPU, which has historically been used
to process the graphics of a computer. While a CPU is designed to handle
a wide range of tasks quickly, but not concurrently, a GPU is designed to
handle a high number of parallel operations (though the types of these opera-
tions are generally more limited). GPUs were developed for graphics because
rendering images requires higher bit rates (for example). In recent years, how-
ever, GPUs have been evolved into the category of GPGPU since the higher
processing power of GPUs for limited tasks has meant that using these can sig-
nificantly accelerate computation. This has also led to supply constraints for
GPGPUs as they are also in demand for machine learning and cryptocurrency
mining operations.

Since most computers do not include GPGPUs, and your instance of ANSYS© Flu-
ent run through the Citrix environment will not, leave this option as 0 for this
model.
• Show More Options: The majority of the options in this part of the launcher
are only for configuration by advanced users, however, there is one option here that
should be noted. On the first pane of the advanced option (called General Options)
is a selector for the Pre/Post Only mode. This is the mode of ANSYS© Fluent that
should be used if you are only going to be post-process results generated previously
as it only caches those tools and not the majority of the solver freeing memory
space for the typically memory-intensive post-processing activities

Once you have made the appropriate setting click OK to launch ANSYS© Fluent

5. As before, when ANSYS© Fluent first launches it is worth familiarising yourself with
the layout of the most important tools:

82
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Menu
Menu bar

Workflow detail pane Display window


Workflow Text User Interface window

Figure 49: Layout of the ANSYS© Fluent graphical interface

• Menu Bar: Although obviously expected, it is mentioned specifically here because


there are some settings only available through the classical menu
• Workflow: This list follows the order typically required to set up a model i.e. you
must make sure that you have made or confirmed the correct settings in at least
these items in order to run a general model
• Workflow Detail Pane: As you select each item in the Workflow, this pane will
show the particular items required for that item. Often you will open additional
dialogues from this pane to make the detailed settings
• Display Window: Each item that you select to display will be shown in this com-
mon display area (unless you previously de-selected the option to embed graphics
windows). When multiple items have been displayed, tabs will appear at the top of
the display window allowing you to change between them
• Text Interface Window: This is the pane where the ANSYS© Fluent solver
reports output and which can also be used to make settings via the TUI system. Al-
though not explicitly covered in this guide, familiarity with the TUI system is needed
for deploying models on systems like the Centre for High-Performance Computing
(CHPC) since most HPC systems do not allow the use of advanced Graphical User
Interface (GUI)s. More detail on this can be found in section 10

6. The first action that you should take in general is to check that the mesh that has been
imported is correctly sized and connected. To do so, press the Check button in the Mesh
item in the Workflow Detail Pane for the General item in the Workflow

83
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
7. With the mesh as directly imported from Meshing, the mesh check will fail and if you
inspect the output in the TUI window you will note that warnings given are for unas-

ENGINEERING
signed mesh interfaces. This is because the interfaces have not been coupled and so it
is unclear how the solver should treat them. Before the model setup can continue it is
therefore necessary to define these and then check the mesh again

8. Double-click the Mesh Interfaces item in the Workflow: The default setting in ANSYS© Flu-

Figure 50: Initial mesh interface list window

ent is that interfaces are paired in a one-to-one fashion. However, this model makes use
of interfaces where more than one interface connects to another. For example, the in-
terface Interface Slower Vehicle-Growing Mesh-Faster Vehicle-Shrinking Mesh must be
connected to the interfaces for three other blocks ( Interface Growing Mesh-Slower Vehicle,
Interface Faster Vehicle-Slower Vehicle, and Interface Shrinking Mesh-Slower Vehicle).
It is therefore necessary to disable this default setting, which can only be done through
the TUI:

• Close the mesh interfaces window and then click in the Console window and press
Enter. Notice that a menu of options appears. The menu for any given section of
the TUI is accessed by pressing Enter, while you can return to the higher level by
entering ‘q’. Menu levels are accessed by entering the full (or partial but unique)
name of the level. Commands can also be entered by separating all entries by
spaces in a single row
• Enter ‘def ’ at the prompt. Notice that the correct menu item has been selected
because the incomplete name entered was a unique truncation of the full name
• Press Enter again to see the menu options. While only one is being edited now,
notice that there are many more settings accessible via the TUI that through the
GUI. Enter ‘mesh-interfaces’ (or any unique truncation) at the prompt:

84
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 51: The ANSYS© Fluent TUI main menu

Figure 52: The ANSYS© Fluent TUI Define menu

• Enter ‘one’ at the prompt. Notice that a new prompt will appear asking whether
to use the default interface creation method. The current value (yes) is indicated
in square brackets at the end of the prompt. Enter ‘no’ at the prompt to disable
the default creation method as needed
• Enter ‘q’ at the prompt to return to the Define menu section. Enter ‘q’ again to
return to the TUI root. You may also leave the TUI in the last-used location if
you wish

9. Double-click the Mesh Interfaces item again in the Workflow: Notice that there is now
a button for manual creation of interfaces

10. Click the Manual Create... button in the opened dialogue:

85
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 53: Interface default setting changed using the TUI

Figure 54: The ANSYS© Fluent TUI main menu after setting changes

• Mesh Interface: This is the field where you will enter the name of the mesh
interface that you want to create. You can also select interfaces that have already
been defined from the list below to edit or confirm the definition or delete the
interface
• Interface Zone 1 and Interface Zone 2: These are the windows where you
will select the interface zones to be associated with one another. While not strictly
necessary it is advised that, if the interface zones are of different size, the smaller
zone(s) be selected under Interface Zone 2. An interface zone cannot be used in
multiple interface definitions so it is important that you keep track of this

86
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 55: Initial mesh interface list window with manual option

Figure 56: Mesh interface specification window

• Interface Options: There are 6 additional settings that can be made when de-
fining an interface:
– Periodic Boundary Condition: This allows you to define a non-conformal
periodic boundary condition. These can be translationally or rotationally peri-
odic. For example, a 2D model of compressor flows would be considered trans-
lationally periodic (since it is two meshes sliding past each other) while a 3D
model would be considered rotationally periodic

87
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
– Periodic Repeat: This is the periodic boundary type applicable to periodic
systems such as the rotors and stators in a compressor. Rather than modelling

ENGINEERING
all rotors and stators, you define meshes for one of each and then define the
interface so that it effectively repeats the properties from each to simulate
a complete set. The repeat option means that the full model can be simply
displayed through proper definition of the repetition frequency
– Coupled Wall: This is required most commonly when you are modelling
fluid-solid interactions involving heat transfer. If an interface is not defined
as coupled, the interface surfaces are treated as adiabatic and heat transfer
between the fluid and the solid will not be correctly modelled
– Matching: This is a special condition which is used when interfaces may not
align properly because they are different in size. By default, ANSYS© Flu-
ent creates walls on the non-overlapping portion. This condition should there-
fore be used to improve data transmission across interfaces of different size
– Mapped: This is a special condition, typically used with the Matching tech-
nique, when modelling conjugate heat transfer
– Static: This option prevents the automatic creation of zones if the interface
changes due to mesh motion. This should only be selected if it is known that
that the interface zones will not be moving or deforming relative to each other
• Period Boundary Condition settings: This is where additional settings de-
fining the periodic behaviour of periodic interfaces would be defined as needed
• Interface management tools: Beside the Create option, you can also delete
incorrectly defined or unnecessary interfaces as needed

Generally interfaces are used for sliding meshes such as in the current model. Since
these are not periodic or thermal conductivity interfaces, none of the options are neces-
sary

11. To define the first interface, select the interface zone Interface Slower Vehicle-Growing Mesh-
Faster Vehicle-Shrinking Mesh under Interface Zone 1

12. Next select Interface Growing Mesh-Slower Vehicle, Interface Faster Vehicle-Slower Vehicle,
and Interface Shrinking Mesh-Slower Vehicle under Interface Zone 2 since these are all
smaller than Interface Slower Vehicle-Growing Mesh-Faster Vehicle-Shrinking Mesh. Note
that you do not need to hold Ctrl or Select to select multiple zones. Rather, any zone
you click will be highlighted and you can de-select it by clicking it again

13. Next enter the name interface top for the interface in the Mesh Interface box (while you
could enter a more comprehensive name, in this case it is simpler to use a shorthand)

88
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
14. Click Create. You notice that, if properly defined, the interface will appear in the list of
interfaces listed

ENGINEERING
15. Repeat steps 11 to 14 For the remaining 3 interfaces. Once complete, the list of inter-
faces should look like that in Figure 57 and you can close the mesh definition windows.

Figure 57: Mesh interfaces defined

16. Repeat the mesh check. It should now pass. Notice that in the mesh check some statistics
of the mesh are given such as the domain extents and the minimum and maximum cell
sizes. Ensure that these are as expected. If the domain size is incorrect you will need
to use the Scale tool under the Mesh items of the details pane. There will also be a
warning issued regarding the use of the pressure far-field boundary type. Ignore this for
now. It will be addressed later

17. The next settings to make are the solver selection. As discussed in subsection 7.1, the
solver to use for this model would be a Pressure-based planar 2D solver. Since this is
a model in which the boundary conditions (including the position of wall boundaries)
change with time, the Transient option must be selected. The Velocity Formulation can
be left at the default of the Absolute formulation. Also, since the model is a 2D top-view
model of the vehicle interaction, it would be incorrect to enable the Gravity option. This
should only be used in fields in which gravity is expected to have a significant effect, such
as in liquid flows.

18. Now double-click the Models item in the Workflow to change the details pane to those
options. Most of these options are not used in typical undergraduate level models and
you are recommended to study up on each as necessary. Two are commonly used:
Energy and Viscous. The Energy model is simply a condition that checks the continuity
of the energy equation during simulations. This is particularly important in compressible

89
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
flows and so it is automatically enabled when specifying a compressible gas. Select the
Viscous model (currently on the default value of SST k-omega) and click Edit

ENGINEERING
19. In the menu which opens up you will see several options. The first is the Inviscid model
(otherwise known as an Euler solver). This option should be used when it is considered
that viscous effects are negligible in the model at hand. As discussed in subsection 7.2,
the appropriate model for this simulation would be the Realizable κ − . Select κ − 
from the presented list

20. Once you have selected the κ −  option you will notice that the options available all
change:

Figure 58: Specification of the κ −  viscous model

• Model Constants: These are the values used to control the values produced by
the model during the simulation. Generally speaking these should be adjusted as
per the definitions given in the theory guide for the model but the default values
are fairly accurate for most flows and so these values can be retained as given
• k-epsilon Model: This allows you to select the formulation of the κ −  model
that you wish to use. Change this option to Realizable and notice that some of the
options and constants given change

90
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Near-Wall Treatment: In some simulations it is necessary to change the near-
wall treatment used by the model to better reflect the particular fashion in which the

ENGINEERING
fluid interacts with the solid. For most simulations the Standard Wall Functions
are sufficient
• Options: These are advanced options used for particular flow conditions. None
of these will be needed in the current model and the details are available in the
relevant theory
• User-Defined Functions: As described in subsection 7.3, many properties of a
model can be described if necessary by external functions. This dialogue would allow
for selection of the correct models that have been added. The current simulation
will not be using UDFs for fluid properties

Once all options have been set, click OK to close the dialogue box

21. Double-click the Materials item in the Workflow. There is a default list of fluid and solid
materials listed (air and aluminium respectively). ANSYS© Fluent has an extensive
database of materials which can be imported and modified as necessary. Models can
contain many different materials but in this case the only one is air. Select air under
the list of fluids and click Create/Edit...

22. In the presented dialogue, you will notice that you can customise the name of the fluid
that you want to use. You can copy a new fluid into this pane from the ANSYS© Flu-
ent Database... button but that will not be necessary in this model because the only
fluid is air. You also have access to the GRANTA database, as well as a database
of user-defined materials (which you would need to have defined previously). Each of
the relevant fluid properties are adjustable via a text box for fixed values and a drop-
down that allows you to select from among formulation options. Although there are no
compressible effects expected in this model, the use of the pressure far-field boundary
type requires the use of an ideal gas formulation for the air (as per the earlier warn-
ings). select the ideal-gas option from the density specification Once you have changed
the density definition you will notice that the text box for density becomes unavailable
and that additional fluid properties are now listed. These default values can be used
but notice that any of these properties could also be defined by various built-in meth-
ods as well as by UDFs Once you have checked that all of the values are correct, click
Change/Create and close the Materials dialogue. Notice as well that there is a message
in the TUI window indicating that the energy equation has been automatically enabled
since you are using an ideal gas model

23. Check in the Cell Zone Conditions item that each mesh body is recognised as a fluid and
not a solid. This can be prevented (if it has happened) by creating a named selection
for each region in the Meshing operation

91
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 59: Specification of the fluids in the model

Figure 60: Specification of the ideal gas fluid

24. Now select the Boundary Conditions item in the Workflow. This is arguably the most
important part of establishing the model. First the Operating Conditions must be set.
Click on the Operating Conditions button (Note that this is also accessible through the
Cell Zone Conditions item):

Figure 61: Setting the operating conditions

92
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Operating Pressure (pascal): This is the option in which the reference pres-
sure is set. All pressures entered in the model are in a gauge pressure reference

ENGINEERING
frame i.e. the difference between the absolute pressure and the specified operating
pressure. In gas dynamics it is conventional to work in absolute pressures and so
this value should be set to zero (since all pressures relative to zero are, by defini-
tion, absolute). If this value is not changed and absolute pressures are entered in
other specifications, the calculated flow speeds, loads, and other properties will be
incorrect
• Reference Pressure Location: If you are running a model with no pressure
boundary conditions, this is the cell used to adjust the gauge pressure field for
incompressible fluid models. In a model such as this there will be no effect on its
setting and it can generally be left at (0,0,0)
• Gravity: This is another location in which gravity can be enabled in the model.
If you do so it also opens a dialogue box so that the components of gravitational
acceleration can be specified

25. Now the actual boundary conditions can be set. In this particular example, there is
only one setting to be made: the pressure far-field boundary condition. Select the pres-
sure far field slower vehicle boundary from the list and click Edit...:

Figure 62: Setting the pressure far field boundary condition

• Gauge Pressure (pascal): This is the static pressure that exists along the entire
pressure far field boundary. Since the operating condition was set to 0 Pa, this
value should be set to 101 325 Pa (1 standard atmosphere) so that the absolute
static pressure on the boundary is 101 325 Pa
• Mach Number: For the pressure far-field boundary condition, the inertia is spe-
cified by the Mach number directly. Since we only know the speed of the vehicles,
this will need to be calculated. Assuming that the air temperature is 300 K (stand-
ard atmosphere), the sound speed, a, for the domain can be calculated by:
p
a = γRT (4)

93
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Which evaluates as 346.76 m.s-1 . Hence the Mach number of the ‘wind’ resulting
from the transformation into the reference frame fixed in the slower vehicle travel-

ENGINEERING
ling at 60 km.h-1 (16.67 m.s-1 ) is 0.048064. While it may seem unusual to use so
many decimal places, it is especially necessary at low speeds to use 5 or 6 decimal
places to ensure that the value of the actual speed calculated by ANSYS© Fluent is
as close to the desired value as possible
• X-Component of Flow Direction and Y-Component of Flow Direction:
Rather than requiring a full remeshing every time you want to test a different wind
angle, by changing the components of the wind direction you can use a single mesh
to accomplish the same effect (provided that the geometry of the system allows
this to be physically meaningful). These values are most simply calculated as the
cosine and sine of the wind angle needed but it does not matter how large or small
the values are as long as they are in the correct proportion. That being said, it is
considered safe practice if the values given are between 0 and 1 since values outside
of this range may be truncated. In this case, the wind will be ‘blowing’ from right to
left to simulate the motion of the vehicles from left to right. Hence the components
of the wind will be -1 and 0 respectively
• Turbulence: You can change details of the turbulence properties of the boundary
via this menu but the default values will be sufficient for this model

Note that any of these properties can also be defined by expressions based on model
parameters but this topic will not be covered here.

26. Set the value of the temperature in the Thermal tab to 300 K (the default). Once the
boundary values for Pressure Far Field Slower Vehicle have been set, click Apply and
then Close

27. Set the same values for the remaining 3 pressure far-field boundaries

28. The next item in the Workflow, Mesh Interfaces, has already been handled previously

29. The next item in the Workflow, Dynamic Mesh, is where the actual mesh motion will
be defined. Before this can be done, the UDF that will be used must be compiled. Open
the User-Defined →Functions →Compiled... menu item

30. The Compiled UDFs menu requires you to include all of the files that must compiled. In
most models this will only be the UDF file itself since the header files used are included
in the ANSYS© Fluent search path:

• Source Files: These are the files which contain the functions that you want to
hook to you model. As discussed in subsection 4.3, the source files can be placed
in the global folder of the model to be visible to ANSYS© Fluent even though

94
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 63: Compiled UDF menu

ANSYS© Fluent will tell you to put it in the same folder as the ANSYS© Flu-
ent files (this is a vestige from when ANSYS© Fluent was a separate company)
• Header Files: As you should have learned in programming, some languages re-
quire additional methods to be imported in header files in order for the programmes
to work. When defining ANSYS© Fluent UDFs, the only header file typically used
is ‘udf.h’ which is built into ANSYS© Fluent and so you generally will not need
to import any header files (.h) here
• Build: This is the item which actually builds the UDF so that it can be used
during the execution of the model. The compiled UDF will be placed in a folder
called libudf by default in the ANSYS© Fluent subfolder. In order for this to work,
a suitable C compiler must be installed on the computer used for the simulation.
If this has not been done, the build will fail and you will not be able to include the
UDF in your model. It is especially important if you are using a 64-bit operating
system (recommended for CM computers) that you have a compiler with full 64-bit
compilation capability. Finally, if the model is being run in parallel, the compiled
UDF is different to the compiled form for serial since there are separate functions
for the head and parallel nodes. This generally means that if you change a model
from serial to parallel execution that you will need to re-compile and possibly re-
hook the UDF
• Library Name: This is the folder that will be created with the files ANSYS© Flu-
ent needs to execute the UDF during the simulation. If you place this in the global
folder of the model, you will have to define the explicit location rather than leaving
just the default of ‘libudf ’ (for library - UDF)
• Load: Once the UDF library has been successfully built, you will need to load it so
that the functions you have defined are available for hooking. If you use the default
name of only libudf then the UDF will be built in ANSYS© Fluent subfolder

Under the Source Files item, click the Add button and select the UDF file, Vehicle.c,
that you extracted from the document earlier and moved to the ANSYS© Fluent folder
of the model. Should you need a C compiler, follow the instructions in Appendix A

95
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
31. Click Build. If the build is successful then the output in the TUI window should look
like that in Figure 64. If you receive any messages about nmake being an unknown

ENGINEERING
executable then there is a problem with the C compiler that you are using and you will
need to correct this before you can proceed. If you receive other error messages then
there may be a problem with your UDF source file

Figure 64: Text User Interface (TUI) output for a successful UDF build

32. Click Load to load the functions in the UDF into ANSYS© Fluent. If it has been
successfully loaded then this will be indicated in TUI window

33. Now that the UDF has been successfully built and loaded into ANSYS© Fluent, you can
proceed with specifying the dynamic mesh zones. Double-click the Dynamic Mesh item
in the Workflow

34. The first thing required for Dynamic Meshing is that it be enabled in the Details pane
by checking that box

35. As discussed in subsection 7.4, this model will employ the Dynamic Layer method. Un-
check the Smoothing method and check the Layering method

36. Click the Settings button for the Layering method:

• Options: There are two methods that can be used for the Dynamic Layer mesh
motion method: Height Based or Ratio Based. The Ratio Based option allows you
to create cells that may become finer or coarser as the relevant boundary moves but
this is normally only used for motion in one direction only and can cause problems
if the direction of motion is reversed. The most common (and hence default)
setting for this is the Height Based option where the cells are split or merged based

96
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 65: Global settings for the Dynamic Layering mesh motion method

on the relationship between their size and the ideal specified when defining the mesh
motion. Keep the default setting
• Split Factor: This is the minimum fraction of the ideal size by which a stretched
cell must exceed the ideal cell height before it will be split i.e. a cell will be split
when the height is h >= (1 + fsplit )hideal . If this value is too small then the
resulting split cell may be very small while if this value is too large then the cells
may stretch to a very high aspect ratio before being split. Keep the default value of
40% (0.4)
• Collapse Factor: As with the Split Factor, the Collapse Factor is the maximum
fraction of the ideal cell size to which a cell can be compressed before it is merged
with the adjacent row of cells i.e. a cell will be collapsed when the height is h <=
fcollapse hideal . If this value is too small then there is the risk that the moving
boundary will overrun the cell in the next time step before collapsing the cell and
cause non-positive cell volumes (and hence cause the simulation to fail). If the
value is too large then the merged cell may be of a very high aspect ratio. Keep the
default value of 20%

Click OK to close the Dynamic Layer settings window

37. To define the Dynamic Mesh zones, click on the Create/Edit... button:

• Zone Names: This is a drop-down which allows you top select the mesh zones
to define as dynamic zones
• Type: This is the menu allowing you to select the dynamic mesh zone type you
wish to create. As discussed in subsection 7.5 mesh motion typically requires at
least one Rigid Body zone and typically several Deforming zones. The options
available in each of the configuration panes will change depending on the dynamic
mesh zone type selected

97
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 66: Dynamic Mesh zone definition window

• Motion Attributes: This is the pane in which the UDF to be applied will be
selected and the details of features such as the centre of gravity of the body being
moved are specified
• Geometry Definition: There are only options given here for Deforming dynamic
zone types and the default values are typically suitable for most models
• Meshing Options: This is a critically important tab for each of the three com-
monly used Deforming Mesh zone types since it is here that the mesh properties,
specifically the ideal cell height, are defined for the dynamic zone
• Solver Options: There are only options here for the System Coupling dynamic
zone type which is not covered in this guide

To begin, select the interior fluid faster vehicle zone from the drop-down list to define
this as a rigid body zone

38. In the zone type select Rigid Body as the type to use and then define the options in the
Meshing Attributes pane:

Figure 67: Rigid Body dynamic zone specification: motion attributes

98
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Motion UDF/Profile: Ensure that the UDF that was built and loaded previously
is selected here. The name given will be the name of the function followed by the

ENGINEERING
library in which it has been built. Hence, in this case, it would be ‘Vehicle :: libudf ’
• Center of Gravity Location: Generally speaking, this attribute is not really
important if the motion is purely translational (rectilinear) as the motion of the
entire body is the same regardless of its position. However, for rotational motion
this definition is critical as rotation of the model is always defined as about the
centre of gravity. For example, if you were using a UDF to rotate a circular mesh
about its centre at (0,1) but kept the default value of (0,0) for the centre of gravity
then the mesh would be swung about its edge and overrun the adjacent boundaries
leading to model failure. For this particular model the default value of (0,0) can
be kept
• Motion Options: This allows the specification of UDF motion relative to another
body. This option will not be covered in this guide
• Center of Gravity Orientation: As with the centre of gravity location, this
attribute only has importance with models where the mesh may be rotating since
the orientation of the moment of inertia of the body in question is likely to affect
the rate of rotation. Since this is a model with only translation you can keep the
default values of 0

39. Skip the Geometry Definition tab (since there are no options here for the Rigid Body
zone type) and select the Meshing Options tab:

Figure 68: Rigid Body dynamic zone specification: meshing options for interior zones

• Adjacent Zones: Here there are two adjacent zones identified. Since this mesh
is moving as a rigid body there should be no need for these values to be set at
something other than 0 but it is advised that these be set as the minimum and
maximum cell size values within this region. The use of the inflation layer means

99
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
that the cell sizes are very small here but the original minimum and maximum cell
sizes used for this zone can be used here i.e. 0.015 m and 0.3 m

ENGINEERING
• Deform Adjacent Boundary Layer with Zone: This option ensures that the
inflation layers move rigidly with the wall boundary to which they are attached.
If it is not selected the mesh outside of the inflation layer will move and this will
eventually result in non-positive cell volumes. This option cannot be selected for
the interior cells but should be selected when moving the wall boundary of the faster
vehicle

Once all of the required options have been defined, click Create to define the dynamic
mesh zone

40. Since this is the only Rigid Body dynamic mesh interior the next step will be defining
the Rigid Body dynamic mesh edges. Select the interface growing mesh-faster vehicle
zone. The Motion Attribute settings for this zone will be the same as for the in-
terior fluid faster vehicle zone so proceed directly to the Meshing Options pane: You will

Figure 69: Rigid Body dynamic zone specification: meshing options for edges

notice that the options entered for the previous zone have been retained but that there is
only one Adjacent Zone here. The Cell Height adjacent to the interface growing mesh-
faster vehicle zone is about 30 cm, therefore change this value to 0.3. If this value was
left at the previous default it would be too small for the adjacent cell zone when cells are
being assessed during Dynamic Layer and so the cells would split very rapidly. Once
these values have been changed, click Create

41. Repeat steps 38 to 40 to define the following zones as Rigid Body dynamic mesh zones
(with the adjacent cell size and boundary layer deformation option as shown. It often
helps to have a sketch of all of the dynamic mesh zones on which you can mark the
zones already created and their type for easy visual reference:

100
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Zone Cell Height
interface faster vehicle-growing mesh 0.3

ENGINEERING
interface faster vehicle-shrinking mesh 0.3
interface shrinking mesh-faster vehicle 0.3
wall faster vehicle 0.001
Once complete the list of defined Rigid Body zones should be as shown in Figure 70

Figure 70: Rigid Body dynamic mesh zones defined

42. Next select interior fluid growing mesh. Change the zone type to Deforming and note
that since there are no values necessary for the Motion Attributes tab that the interface
automatically changes to the Meshing Options tab

43. Change to the Geometry Definition tab. Although the ANSYS© Fluent theory guide
suggests various settings that can be made here, these are none pertinent to a 2D model
since all motion is confined to a single plane. Therefore you can leave this option at
the default value of Faceted. If you are building a 3D model, you will need to explore
the different values that can be used here

44. Change back to the Meshing Options tab. Notice that the options given are quite different
to those for a Rigid Body zone type:

• Smoothing and Remeshing: You can specify that the Smoothing and Remesh-
ing dynamic mesh methods be applied in the vicinity of this particular dynamic
zone. Since this model will be using the Dynamic Layering method, these are not
necessary, though the Remeshing option should be retained to make the Layering
settings
• Parameters and Methods: These are the settings which will ensure proper
splitting or merging of the cells during mesh motion using the Dynamic Layering
method (along with the definition on the adjacent rigid body). If you leave these at
the default values of 0 m and 1 000 m then cells will not be correctly split because

101
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 71: Deforming dynamic zone specification: meshing options for mesh interiors

it is unlikley that most cell sizes would exceed 140% of 1 000 m and so the mesh
may appear to ‘unzip’. These settings are substantially more important for zones
like interior fluid shrinking mesh where the cells would never be collapsed because
no cell would be smaller than 20% of 0 and this will always result in non-positive
cell volumes. There are three values that are required: Minimum Length Scale;
Maximum Length Scale; and Maximum Skewness:
– Minimum Length Scale: This is used to define the absolute minimum
cell height that any cell (except inflation layers) in the domain can have
(fcollapse `min ) so that any cell smaller than this is immediately merged. This
is especially important for meshes being affected by the Remeshing dynamic
mesh method
– Maximum Length Scale: This is used to define the absolute maximum cell
height that any cell in the domain can have (fsplit `max ) so that any cell larger
than this is immediately split. This is especially important for meshes being
affected by the Remeshing dynamic mesh method
– Maximum Skewness: This is used in the Remeshing dynamic mesh method
to identify cells which may fall within the acceptable size limits but be of de-
graded quality and hence require remeshing. A typical value for this is 0.7
(where a cell that is unskewed has a skewness of 0 and an infinitely-skewed
cell has a skewness of 1)

You will need to decide appropriate values for each of these

45. To determine the values of the current mesh zone as a guide for the Zone Parameter
values, click the Cell Zone Info... button. Based on the values shown here it seems that
the minimum and maximum length scales for the mesh can be identically set as 0.3 m
while the limit for the skewness can be set as 0.7, since this would allow for subsequent

102
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
deformation of cells during the actual run. These values can only be set if the Global
Settings option has been unchecked Close the Cell Zone Info dialogue box

ENGINEERING
Figure 72: Cell Zone Info dialogue for dynamic meshing

46. Set the values for the Zone Parameters and then click Create to confirm the creation of
the interior fluid growing mesh Deforming mesh zone

47. Repeat steps 42 to 46 to define the following zones as Deforming dynamic mesh zones
(with the adjacent cell sizes and skewness as shown:
Zone Cell Min Cell Max Max Skewness
interface growing mesh-slower vehicle 0.3 0.3 0.7
interface growing mesh-stationary 0.3 0.3 0.7
interface faster vehicle-slower vehicle 0.3 0.3 0.7
interface faster vehicle-stationary 0.3 0.3 0.7
interior shrinking mesh 0.3 0.3 0.7
interface shrinking mesh-slower vehicle 0.3 0.3 0.7
interface shrinking mesh-stationary 0.3 0.3 0.7
Once complete the list of defined Deforming zones should be as shown in Figure 73

Figure 73: Deforming dynamic mesh zones defined

48. The final Dynamic Mesh zones to define are the Stationary ones. Select pressure far field growing mesh
and change the dynamic zone type to Stationary. The only setting that needs to be made
here is the adjacent cell size in the Mesh Options tab. Change this to 0.3 m and click
Create to finish the zone definition. Repeat this process for pressure far field shrinking mesh

103
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
49. Once all of the dynamic zones have been created, close the dynamic zone dialogue box
and save the project via File →Save Project

ENGINEERING
50. In order to check the mesh motion settings you will need to complete quite a bit more
of the setup of the model. The next item in the Workflow is Solution Methods. This
item allows you to select specific details of solver settings such as the pressure-velocity
coupling and discretisation schemes. These are changes which only more advanced CFD
users can make so these will not be covered here

51. Select the Solution Controls item in the Workflow. If you are using a Density-based
solver this is where you will set the Courant number discussed in 2.6.1. Since this is a
Pressure-based solution, the values presented here are, instead, under-relaxation factors
for various parameters. Simply put, the higher an under-relaxation factor is, the more
that the relevant variable may change from one iteration to the next. If a solution seems
to be divergent, you would lower the under-relaxation factor for the relevant variable(s)
to try to bring it back under control. The values given as default have proved to be
optimal for the highest number of test cases and you can leave these as they are for now

52. As discussed in subsection 7.7, you should set up monitors and reports of the quality
of your model to check the performance as it progresses. These are set in the Monitors
item in the Workflow. To set the convergence limits, double-click the Residuals item:

Figure 74: Residuals monitor screen including convergence limits

• Options: You can choose to display the residuals in the TUI window (print) and
/ or plot them to the display window. In general, both are done. You can choose
the number of iterations to display in the plot but typically the default value of 1
000 is sufficient for interpreting the history of a simulation
• Iterations to Store: This is the number of iterations for which the residual data
are saved when saving the state of the simulation. As with the plot, 1 000 iterations
is generally sufficient though you can save more if you wish
• Convergence Conditions: Here you can make advanced settings of how conver-
gence based on residuals monitoring is applied

104
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Equations: Here you can select the properties of the flow field that will be mon-
itored during the simulation and set the convergence limits for each.As discussed

ENGINEERING
in subsection 7.7 change most of these values to 0.0001 except energy which can
be left at 0.000001 (the default)

Once you have set all of the residuals, click OK

53. As discussed in subsection 7.7 it is advisable to also set up a force monitor on the
overtaking vehicle. The drag on the vehicle is a reasonable force to monitor as it would
directly indicate convergence of the aerodynamics around the vehicle. Definining the
force monitor will require that you set up a report, and then use it in a monitor. Double-
click Report Definitions:

Figure 75: Dialogue for the creation of a new report

(a) Click on the New drop-down, select Force Report, and select the Drag option:

Figure 76: Dialogue for the creation of a new drag report

• Name: The name used to identify the report. Specify this as faster vehicle drag

105
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Force Vector: Used to define the direction of the force to be calculated. Enter
simple components (here (-1, 0, 0))

ENGINEERING
• Create: Options that allow you to specify how the results of the monitor are
stored / presented:
– Report File: Saves the report output into an automatically-generated file
with the report name in the Fluent folder. Leave this option unchecked
here
– Report Plot: Creates a plot in the display window of the report output.
Check this option for this model and leave the output frequency as 1 (this
will plot the drag after each iteration or time step as defined later)
– Print to Console: Displays the report output in the Console as the model
is running. Leave this option unchecked for this model
• Report Output Type: Specifies whether the force is report as a value or a
co-efficient. Reporting as a co-efficient requires that the reference values used
in calculating the dynamic pressure and the reference area be set up in the
Reference Values Workflow item. Select the Drag Force option for this model
• Zones: Selects the zones of the domain on which the force will be calculated.
Select the wall faster vehicle wall as it is the drag on the faster vehicle that is
of interest here

Figure 77: Settings for faster vehicle drag monitor

Once the settings have all been made as shown in Figure 77, click OK and close
the Report Definitions window

54. Notice that a plot called faster vehicle drag has been created under the Report Plots
Workflow item. Double-click this to edit it:

106
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 78: Settings for report plot

• Name: The name of the plot item. Leave this as the default
• Available Report Definitions: A list of all reports that have been defined and
could thus be plotted. Select the faster vehicle drag report and click the Add>>
button
• Selected Report Definitions: A list of the reports that will be presented in the
plot. The faster vehicle drag report should now appear in this list
• Options: This allows you to configure the appearance of the plot, as well as the
frequency with which it is updated. Change the data frequency to every iteration
(instead of the default of time step, or the flow time) as this plot is going to be
used to monitor the progress of the simulation. You can change the plot title and
axis labels if you wish

Click OK to finalise the definition of the force monitor plot. The plot will not open yet
as there are no data available to plot (as can be seen by the message in the Console)

55. The next item in the Workflow is Initialization. This is the part of a simulation where
define the initial values of the flow field variables from which the enforcement of the
Navier-Stokes (NS) equations and boundary conditions will be used to calculate the
actual flow values. Essentially this is a guess of the true conditions. As with any dif-
ferential system, if the initial estimate is poor, the numerical solution may take longer
to solve or even diverge. In a flow field such as this it is normally best to assume that
the initial flow field is a uniform flow as defined by the far-field boundary condition.

Double-click the Initialization item to open it:

• Compute From: This option allows you to calculate the values for initialisation
from the values set for one of the boundary conditions. This is a very common
choice as it allows you to check your boundary values and minimise the risk of
mis-match between the boundary conditions and the values entered. Since we are

107
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 79: Details pane for the initialisation of the flow field

assuming that the initial flow field is a uniform flow as described by the pressure
far-field boundary conditions select pressure far field slower vehicle from the drop-
down list. Notice that when you do that the values in the Initial Values section
automatically change
• Reference Frame: This option allows you to specify if the values given are relat-
ive to the reference frame of moving mesh elements or the absolute reference frame.
If there is no mesh motion then these options are identical but if the values sup-
plied are for the absolute reference frame and there are moving mesh regions, the
absolute values used will be incorrect and the results therefore invalid. Therefore,
select the Absolute option
• Initial Values: These are the values that will be set throughout the flow field
when initialised. If these are calculated from a boundary (as here) then you can
use the values printed there to confirm that your boundary conditions were correctly
set, noting that the values presented may have truncation errors versus the nominal
values specified in the boundary conditions e.g. a temperature of 299.9995 K versus
the nominal value of 300 K
• Patch: This button is not available yet because the field has not been initialised
but allows you to change some of the values in different blocks of the mesh after
initialisation if needed. A common example where this is needed is when modelling
a shock tube where the entire flow field is initialised at the expansion chamber pres-
sure and temperature, and then the mesh block representing the driver is patched
to have the higher value of pressure and possibly temperature

Once all the settings have been made, click Initialize to set the initial values throughout
the flow field. Note that this process may take some time, especially for large meshes

108
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
56. The next item to set in the Workflow is the Calculation Activities: While there are

ENGINEERING
Figure 80: Details pane for the Calculation Activites Workflow item

other activities that may be defined here (such as adaptive mesh refinement and solution
animations), this item always requires attention because it is where automatic saving
(autosave) of the model is implemented. Besides problems of power supply, the autosave
function is important because it allows you to save your model at various stages through
the execution which also allows you to resume from a stable point with new settings if
the model diverges or to interrogate a particular point in much detail

57. Click Edit.. in the Autosave item of the Details pane:

Figure 81: Details pane for the Autosave item

• Save Data File Every: This sets the frequency of the data save operation.
Depending on the time step size and the level of temporal resolution you want in
your output files, you can set this value as high or as low as needed. It is typical
in transient models to save every 10 time steps since this is a large enough window
in which the model may diverge and the preceding saved state be suitable for re-
starting the model from that point without saving an unnecessarily large number
of files. If this value is left as 0 then the autosave function is disabled. You are

109
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
also able to specify that the model be saved with a direct temporal frequency (i.e.
every specified number of second) if you change the export frequency type to Flow

ENGINEERING
Time. The output frequency will be a multiple of iterations if you are running a
steady-state model
• Save Associated Case Files: Since it is possible, and typically probable, that
several hundred or thousand points in a solution history will be saved, it is possible
to save a significant amount of hard drive space by limiting the number of files
saved. In models where the mesh does not change, either through mesh motion or
adaptive refinement, you can elect to save the data file only when such changes
occur. However, if these changes occur it is necessary to save the case file as well
as the data file because the mesh will have changed and, if you did not, the data
saved would not match the mesh used for processing. Although it is redundant here
because the mesh will have changed each time the solution is saved, change this
option from Only If Modified to Each Time
• File Storage Options: This is an additional control that allows you to retain
only a limited number of the most recently-generated files. This is especially useful
in steady-state simulations where it is only the final, converged result that is of
interest. Alternatively, this may be useful in transient simulations where an initial
modelling period is required to set up the initial flow field but where only the later
data are required. Either way, this option will not be used in this model
• Append File Name with: This option allows you to define the identifier used at
the end of the automatic file names. While some users prefer to use the flow time,
using the time step number is advisable because it makes automation of external
post-processing via scripted operations simpler since the time step count advances
predictably

Since the autosave operation can create a very large amount of data there are additional
tools provided to limit the output in the Data File Quantities... dialogue, but these will
not be covered here. Once all settings have been made, click OK to confirm the autosave

58. The next item in the Calculation Activities window is called Execute Commands. This
is the item where you can define any commands that should be executed throughout
the solution using TUI commands. While there is a menu item (Adapt →Gradient...)
that would allow you to specify dynamic mesh adaption (i.e. mesh adaption that occurs
every few time steps or iterations), you can only define this to be done for one flow
variable. Since most models would require adaption by several variables, it is better
to define the adaption using the commands execution item. Extract this text file of
adaption commands and open it so that you can paste the values into ANSYS© Fluent.
All of the commands are executed within the mesh →adapt →cell-registers menu item:

110
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• add: This function defines a new register of cells which will be marked according
to the specifications following:

ENGINEERING
– Name: Specifies the name of the register that is to be defined immediately
after the command ‘add’
– type: Defines the type of register to be defined. In the case of adaptive refine-
ment, the registers are based on field values (denoted by the term ‘field-value’)
i.e. the value of variables within the flow field
– field: Specifies the field variable to be used to define the register. Four registers
are defined in the provided file (for density, pressure, temperature, and velocity
magnitude)
– derivative: Specifies the type of field derivative to be used in defining the
register. The options are: none, gradient, and curvature (where gradient is
used here). None will adapt by the actual value of the property; gradients will
adapt by the linear gradient of the property; and curvature will adapt by the
second-order gradient (curvature) of the property
– scaling: Specifies the manner in which the field value is scaled when identi-
fying cells. The options are: none; scale-by-global-average; scale-by-zone-
average; scale-by-global-maximum; and scale-by-zone-maximum (scale-by-global-
maximum is used here). The use of no scaling means that the cell register will
be defined directly based on the field value. Scaling by the average corresponds
to the scaled type and means that some values of the scaled field value will be
greater than 1. Scaling by the field maximum normalises the field values so
that the maximum possible value is 1. This last is often the most intuitive
scaling to understand, and simplest to implement as prior knowledge of the
field values is not required to specify it. The distinction between zone and
global scaling pertains particularly to models with multiple blocks, such as this
one. However, the use of per-zone scaling is an advanced topic and will not
be covered here
– option: Specifies the range of the field value that will be used to define the cell
register. The options here are: min-max; in-range; except-in-range; top-value-
cells; low-value-cells; less-than; and more-than. The last two options are the
most commonly-used for defining cell registers for coarsening or refinement
since they define threshold values below which cells may be coarsened, or above
which cells should be refined, respectively (for example). The value following
the specification of the option is the threshold value to be used in defining the
register. Care should be taken when defining other register definition option
that the threshold value/s are defined in correct order

111
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• refine: Command to adapt the mesh based on the cell register. Adaption can
only happen based on one register at a time and so registers must be defined after

ENGINEERING
each refinement action. If all registers are defined initially and then adaptions run
afterwards , cells that had been marked in a register may no longer exist after one
or more previous adaptions have been executed. It is therefore necessary to run
each set of register creation and adaption sequentially
• delete: Deletes the register that has been used for the refinement action. This is
necessary to allow a register with the same name to be defined later without causing
an error

The current file specifies the gradient method ( space-gradient). The normalised 0.7
for refinement (i.e. cells with gradients above 70% of the maximum are considered for
refinement). Details of the other settings can be found in the theory guide. Note that
only cells added by adaptive refinement can be removed by adaptive coarsening i.e. the
original cells in the mesh will not be coarsened further

59. To define the executable commands click on the Create/Edit... button under the Ex-
ecutable Commands item in the details pane:

Figure 82: Specification of commands to be executed during simulation

• Defined Commands: This specifies the number of commands to be executed. If


you do not change this number you will not be able to define executable commands.
Since we will be marking cells for adaption by two variables (subsection 7.6), comb-
ing those registers and then adapting we will need 6 commands
• Active: You are required to check commands that must be executed as the default
is that these commands are not automatically included on definition. This also
allows you to de-activate commands which do not behave as expected or are no
longer necessary
• Name: While not essential for the execution of the commands, this makes it easier
to find problematic commands by description of the action especially if many are
named. It is recommended that the 6 commands here be named pressureregister,
pressurerefine, pressuredelete, velocityregister, velocityrefine, and velocitydelete
respectively

112
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Every: This defines the frequency of the command execution, whether specified by
time steps or iterations. It is generally advised that you save your model before

ENGINEERING
adapting the mesh since the changed mesh may make the model unstable. Hence
the frequency of adaption is typically at least the same as the autosave frequency.
Set this value to 10
• When: This allows you to specify whether the command is executed based on
the number of elapsed iterations (default) or time steps. Since we want these
commands to be synchronised with the autosave operations, set this value to time
step
• Command: These are the actual commands that will be executed in the order
listed. Copy the relevant lines, with the described changes, from the provided file.
Once done the dialogue should resemble Figure 83

Figure 83: Commands for adaptive refinement of demonstration problem defined

Once you have checked all of the definitions, close the Execute Commands dialogue box
by clicking OK

60. The final settings which may need to be defined are for the export of an animation. This
is necessary at the setup of the model if ANSYS© Fluent is to produce the animation
as the individual frames must be exported at each time step of the model. Alternatively,
the frames can be extracted from autosaved files afterwards if necessary, however, this
can result in a loss of temporal resolution of the animation if the autosave frequency is
lower than that needed for the animation. The definition of the animation is covered
under post-processing (subsubsection 8.4.1)

61. The final step in setting up the simulation is initialising the run. Select the Run Cal-
culation item from the Workflow:

• Time Advancement: You can choose to use the Adaptive time stepping method
here. This changes the size of the time step depending on the stability of the model,
decreasing it as the model becomes less stable. The problem with such a method
is that results for particular times need to be interpolated. In general it is simpler
to use the Fixed time stepping method, where you specify the value of the time

113
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 84: Details for starting the execution of a simulation

step. You can also choose to specify the time advancement method here to specify
the size of the time step (User-Specified, default), or based on either a particular
period or frequency (Period-Based or Frequency-Based, respectively). Leave the
default settings as given
• Time Step Size: As discussed in subsection 7.8, a suitable time step size for this
model would be 20 ms (0.02 s)
• Number of Time Steps: As discussed in subsection 7.8, the total number of
time steps required for this model is 230. However, to establish the initial flow
field properly leave this value as 0 initially. This means that the model will not
step forward in time while the initial calculation is made. In this way the values
used for calculating the first time step will be more accurate. This is effectively a
steady-state initial solution before the faster vehicle starts accelerating
• Max Iterations/Time Step: This is a value that you can only determine
through observation of the model. You can specify a very large number, since
the default value of 20 is generally too low for most models to sufficiently converge
per time step before advancing to the next. Specifically, 20 iterations per time step
is based on a philosophy that dictates very small time steps.

When you take the first time step it is advised that you set a large number of
iterations, say 200, and assess the convergence from the various monitors set up.
You can then adjust the maximum number of time steps per model to the minimum
value for acceptable convergence per time step. Note that the residuals generally
spike when changing from one time step to the next due to interpolation errors.
This jump is larger when mesh adaption has taken place and so it is generally

114
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
advised that the model be observed until at least 1 time step after the first mesh
adaption operation to be sure that a suitable value has been specified

ENGINEERING
• Reporting and Profile Update Intervals: These intervals can be left at the
default of 1 (i.e. every time step)
• Options and Solution Processing: There are some options here for advanced
functions but these will not be covered in this guide

Once you have completed these steps, save the project

62. When you are ready to run the model click Calculate with the time step set to 0. This
will run the model without advancing the time to better resolve the flow field. Notice
that once the initial 200 iterations have completed that the residuals for both x- and
y-velocity still show a downward trend. Notice also that the residual values are printed
in the TUI window. Double-click on the faster vehicle plot plot monitor item and Click
Plot in the window that opens. Although there will be a message that there are no data
to plot yet, this plot should now start updating. Click Calculate again and continue to
do so until the residuals have settled at a suitably low value or settle at a constant value.

Figure 85: Residuals after initial steady-state run

63. Once this has completed, notice that the residuals have levelled off (Figure 86) and
that the drag on the faster vehicle is approximately constant (Figure 87). Although the
latter may appear to fluctuate greatly, it is worth examining the value on the ordinate
of the drag plot to note that the actual fluctuation in value is very small (< 10-5 ). This
provides an initial estimate of the number of iterations needed per time step of 400

64. Change the number of time steps to 1 and click Calculate again. In this step you will
now determine a reasonable number of iterations per time step for convergence. Notice

115
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 86: Residuals after extended steady-state run

Figure 87: drag monitor on faster vehicle after initial steady-state run

the small jump in the residuals at the start of the new time step. Although the residuals
fluctuate somewhat, notice that there is a generally decreasing trend If the residuals
have not yet levelled off at the end of the specified number of iterations, change the
time step number back to zero to allow the calculation to continue for that time step,
and make note of the approximate number of iterations in this time step for that to
happen. From the residuals plotted it would seem that time step convergence occurs
after approximately 400 iterations

65. Set the maximum number of iterations per time step to 400 and the time step counter
to 10 so that you can observe the convergence of the model after the first mesh adaption
operation. Note that subsequent time steps may exhibit faster convergence than the first

116
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 88: First attempt at determining the minimum number of iterations per time step for
convergence

and that you can possibly reduce the maximum number of iterations per time step after
you have confirmed the suitability following mesh adaption

66. Once you are satisfied that the settings are suitable for the continued run of the model,
change the time step counter to 209 (the remaining time steps of the 230 calculated
earlier) and click Calculate...

This is the saved state of the model just before the start of execution, and with the animation
set up.

117
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
8 Post-processing in ANSYS Fluent

ENGINEERING
8.1 Numerical post-processing

One of the primary reasons for running a CFD simulation is that measures of the force acting
on a body are needed. As such, the majority of CFD results reported are either force values
or co-efficients thereof.

Under the Reports item in the Workflow select Forces from the Details pane and click Set
Up...

Figure 89: Setup pane for a force report

• Options: This allows you to determine the type of force report required. Typically you
will need to report forces so keep the default selection of Forces

• Direction Vector: This area changes depending on the type of report required. For a
force report you are required to enter the direction in which the force must be calculated,
effectively the unit vector of the force

• Wall Zones: These are the surfaces on which you wish to calculate the force that is
acting. There will typically be a series of wall items listed here as well as mesh interfaces
due to the mechanism by which these are implemented. Click the deselect all button
and then select only those bodies you require

• Print: Displays the force report in the TUI window

• Write...: Allows you to save the force report to a text file

Note that if you print the force report to the TUI window that it will display the force value as
well as the co-efficient of the force. If these co-efficients are incorrect but the forces are not
then you need to change the values of the Reference Values used to calculate the co-efficient
in the Reference Values Workflow item

118
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
8.2 Graphical post-processing

ENGINEERING
Another common requirement of CFD models is the distributions of values around a body
or other feature. This is achieved in post-processing by the creation of line graphs of these
values. Double-click the XY Plot item under the Plots item in the Workflow:

Figure 90: Setup pane for a line graph

• Options: Here you can choose to also write the graph data to a text file, useful for
plotting in another program such as Microsoft Excel

• Plot Direction: This allows you to specify the orientation of the independent (X Axis)
and dependent (Y Axis) as possibly necessary for easier interpretation

• Y Axis Function: This allows you to select the property you wish to plot by first
selecting the general category of the property (e.g. Pressure...) and then selecting the
particular form of the property (e.g. Static Pressure) that you wish to plot

• X Axis Function: This lets you choose whether the plot produced will be defined
by the distance along the direction vector or by the distance along the curve of the
surface in question. Making use of the latter option can make interpretation of the
curve difficult as it can be unclear where the start of the curve is. It is also worth
noting that plots on closed lines, such as one of the vehicles, would have at least two
apparent lines of data (one for each side of the vehicle), and so further interpretation
outside of ANSYS© Fluent is often required to clarify this. Splitting such closed surfaces
into multiple named selections at the geometry and meshing stages can help to improve
this

• Surfaces: This lets you select the surfaces at which the values will be plotted. In
general these should be line surfaces as the graphs produced are typically 2D

119
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
8.3 Advanced graphical post-processing

ENGINEERING
While force co-efficients and line diagrams are often the principal sort of information preferred
in reports, visualisations of flow fields are more useful for interpreting the physics resulting
in the values presented in those results. The most common sort of plot for this is the contour
plot, in which the flow field (or a section thereof) is coloured by the values of a variable.

Double-click the Contours item under the Graphics Workflow item:

Figure 91: Setup pane for a contour plot

• Contour Name: The name used to refer to the contour, which is also the name of
the contour plot window that will be created in the Display area

• Options This sections allows you to control a number of the aspects of the contour plot
produced:

– Filled: This option allows you to created flooded contour plots where all regions
are filled by colour. If this option is not selected then only lines of constant value
of each of the levels of the property being plotted will be drawn e.g. if you are
plotting pressure these will be isobars
– Contour Lines: While this option is automatically selected if the Filled option
is deselected, it can also be selected in addition to the Filled option to overlay the
contour lines on the flooded contour plot
– Global Range: This option specifies that the range calculated for the plot be based
on the entire domain and not only those surfaces that have been selected
– Auto Range: This will determine the range for the model by the maximum and
minimum value of the property being plotted, either on the selected surfaces or
across the entire domain as appropriate. Often you will need to limit this to a

120
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
particular range, either to increase the effective resolution of the plot or to ensure
a consistent range for a series of values. Generally you should uncheck this option,

ENGINEERING
which will allow you to alter the values given under Min and Max
– Clip to Range: This option will leave as transparent those regions of the domain
where the values fall outside of the range defined by Min and Max. If this option
is unchecked then values below Min will all be filled with the colour for Min while
values above Max will be filled with that colour
– Draw Mesh: This option allows you to include representations of the edges or
faces of the geometry of the model. Normally it is unnecessary to enable this
option but it is especially of use when plotting contours on planes taken as sections
through 3D flow fields. It is also useful when identifying regions of the mesh where
unexpected value occur

• Coloring: This allows you to choose between a banded or smooth plot. While a smooth
plot is often a better representation of the real variation of a property, the banded plot
can be useful to identify regions that broadly have the same values

• Contours of: This allows you to select the property you wish to plot by first selecting
the general category of the property (e.g. Pressure...) and then selecting the particular
form of the property (e.g. Static Pressure) that you wish to plot

• Surfaces: This allows you to specify the surfaces upon which you wish to plot the
contours. The default list is the zones defined in the Meshing operation but you can
create additional surfaces, either by geometric definition or by interpretation of other
fluid properties, via the New Surface menu. Note that with 2D plots that if you want
to display on all surfaces that you may need to deselect all surfaces to get filled plots.
Note that the surfaces in this list are grouped by type, which makes selecting all surfaces
of a particular type as simple as clicking on the type at the head of the list

Once you have completely specified you contour plot, click Display to show it in the Display
Window. Note that this may take some time with very large meshes.

8.4 Animations

8.4.1 Setting up animations

While this needs to be done before executing the model, it cannot be accomplished with
understanding of the graphical post-processing methods covered here. Also, you need to
have some sense of the range of the variables you wish to plot in order to set this up as it
cannot be done after the simulation has run.

121
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
1. Before executing the simulation but after model initialisation double-click the Solu-
tion Animation item under the Calculation Activities Workflow item:

ENGINEERING
Figure 92: Setup pane for solution animations

• Name: You can name the animation as you wish. Since this will be an animation
of the velocity field around the vehicles, call this velocity-animation (note that
names can only consist of lowercase letters)
• Record after every: This defines the frequency of the output of animation
frames, whether in time steps or iterations. Since you would want to create a de-
tailed video of the solution, set this value to 1. Keep the default value of time-step
for the frequency unit, but note that you can also record in multiples of iterations
or flow time
• Storage Type: Here you can specify how the frames for animation are stored.
While they can all be stored In Memory for small models and numbers of frames,
this option is typically not suitable for most simulations. It is more common
for users to choose either to export to one of the common image formats (.TIFF,
.PNG, or .JPEG) but the default .HSF format can also be edited outside of ANSYS© Flu-
ent if necessary so leave this default value
• Animation Object: This is a list of defined plots (XY, histogram, contour, vector
etc.) that can be animated and have already been defined. If the item that you want
to animate has not been defined, it will need to be defined first to be animated

2. Click the New Object button and select the Contours... option to specify the velocity
contour object that will be animated:

122
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 93: Definition pane for velocity contour animation

• Name: You can specify the name of the animation object. Enter velocity (note
that the contour cannot have the same name as the animation object)
• Contours of: Select the Velocity Magnitude item under the Velocity... contour
type
• Options: Specify a Filled contour plot using the Global Range. However, disable
the Auto Range option as otherwise it becomes meaningless to compare the contour
levels (colours) through the duration of the simulated time since the range of values
is always changing. Instead, define a range of 0 - 100 km.h-1 (0 - 27.7 m.s-1 ). Also
uncheck the Clip to Range option
• Surfaces: Do not select any surfaces. This should create a plot on all surfaces
(which differs from one on all surfaces in appearance)

Once complete Save/Display to show the contour plot at that time. Close the Contours
window if the plot appears as required

3. Select the velocity animation object from the list and click OK to close the animation
definition window. Note that the new animation object appears in the Workflow if
successfully defined

8.4.2 Extracting animations

You can save the animation into various formats, including video, once the simulation has
completed. As mentioned previously, animations can also be constructed from frames saved
from auto-saved files, but may have lower temporal resolution.

123
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
Figure 94: Velocity contour at the start of the simulation

1. Expand the Results Workflow item and double-click on the Playback sub-item of the
Animations item:

Figure 95: Setup pane for animation extraction

• Playback Mode: This allows you to control how the exported animation will
playback. The default mode, Play Once, is suitable for all export types. The other
two modes, Auto Repeat and Auto Reverse, are more suited to video exports
• Start Frame, Increment, and End Frame: The controls allow you to select
particular limits for the animation (for example if the model required an initial
setup period which is not of interest in the final video), as well as increment between
frames. The latter control has a default of 1 (i.e. every frame is exported) but
higher values can be used to skip frames if preferred

124
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
• Frame and Playback Controls: These controls allow you to skip through the
animation a single frame at a time, or to play it back (either forward or in reverse)

ENGINEERING
to review the animation before exporting it
• Write/Record Format: The default option here (Animation Frames) will export
the Fluent .CXA animation header file as well as .PPM files. The other options
allow you to either export image files for later processing (Picture Files), or to
export a video (Video File). Note that the Picture Options menu will become
available if the option to Export Pictures is selected. Select the Video File option
• Animation Sequences: This allows you to select the animation sequence that
you wish to export
• Delete and Delete All: These options will allow you to delete the files created
during the simulation for any defined animations
• Write: This option will export the specified animation
• Read...: This option will read in a previously-defined animation sequence file
(.CXA) to allow the export of the animation

2. Click the Write button to export the animation video. This process may take some time
as ANSYS© Fluent will create animation frame files and then compile these into a
.MPEG file. The exported animation will be saved in the FLUENT directory of the
folder structure

This is the exported animation of the velocity contours for the completed model.

125
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
9 Iterative Model Development

ENGINEERING
Once you have run a model for the first time there are several checks that you need to do of
its quality aside from the physical results presented. Any of these may suggest changes to
the geometry, mesh, or solver settings used to improve the model. Thus, a model typically
requires several iterations to produce results of the desired quality.

9.1 Mesh Independence

Once a model is completed it is important to test the validity by checking the mesh inde-
pendence. This means that the results obtained do not depend on the type or resolution of
the mesh used. The simplest way to do this is to run successive model with half and one
quarter the cell size of the initial model. When the results of interest do not change within
an acceptable tolerance (typically 1%) the model can be said to be mesh independent. The
results used to assess this independence should be of relevance to the physics of interest and
logically selected. For example, assessing the velocity on the upstream far-field boundary of
the demonstration problem would not be a meaningful measure of the independence since
the value is directly specified as a boundary condition, and it occurs far from the parts of the
domain where the highest gradients occur. In contrast, the drag on the overtaking vehicle is
not directly specified and is a reflection of the loads of interest.

You can then use the coarsest mesh, or the general meshing process thereof for other related
geometries, that produced the mesh-independent result for subsequent models. Similarly you
should also check the dependence of the model on the type of cells used (triangular versus
square, for example) to confirm that the results are independent.

9.2 Solver Independence

In the same way that the result produced should be independent of the mesh, the result
should be independent of the solver used within the limits of the solver. Thus, you cannot
use an inappropriate solver or turbulence model and expect to get similar results to a properly-
formulated model. However, if these different settings are similarly suitable then the variation
between them should be explored. This is especially true of the specification of the turbulence
models used, where you should test several formulations out for the best result.

126
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
9.3 Temporal Independence

ENGINEERING
Another measure that should be considered particularly with transient solutions is independ-
ence of the results with respect to the time step size. This is directly comparable to assessing
the independence of the results from the geometric cell size. It is important to appreciate
that this is a refinement of the simulation that may be time-consuming but which is essential
to proving the validity of the results.

9.4 Validation & Verification

Validation and verification are the processes whereby the quality of a CFD result are assessed
and confirmed. While the one process, verification, can be considered a cross-check, the other,
validation, is an external confirmation of result quality. Before this it is always important
that you critically assess the quality of your own results in terms of physical feasibility and
reasonable values given the provided boundary conditions. For example, if you are modelling
a body travelling at Mach 1.5 and develop a region of Mach 25, there is likely a flaw in your
model.

9.4.1 Verification

This is the process of comparing the results of your model to results produced by another
model, either of your own or as published results. When comparing your results to another
model of your own you would typically need to compare the results produced by two com-
pletely independent solvers (e.g. Fluent and Star-CCM+) and find that the results are similar
within acceptable tolerance (somewhere between 1 and 5 %). Comparison to published res-
ults is typically with published numerical data produced by a third party i.e. simulation data
in the same or another solver to the one you used published for the same scenario.

9.4.2 Validation

This is the process of comparing your results with existing theory or experimental data.
Since these data are not numerical models they are considered to be a better standard for
actual behaviour. There is the caveat that theories may be incomplete and not fully capture
physical behaviour, while experimental results may be from poorly-designed experiments (or
have other errors not immediately apparent). As always, balanced critical assessment of your
results in comparison to these data is essential.

127
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
10 High Performance Computing

ENGINEERING
A growing trend in Computational Fluid Dynamics (CFD) is the use of High-Performance
Computing (HPC) to allow the modelling of systems intractable on desktop computers. A
typical example of this is the computation of the aerodynamics of passenger aircraft or details
of passenger car aerodynamics. If the model is expected to capture additional phenomena,
such as acoustics, the mesh size and hence memory requirement become too large for even
the most powerful desktop servers.

HPC is the ability of a solver to be deployed on a large server where the model may be
processed by tens, hundreds, or even thousands of parallelised processes. This is not implicit
in the formulation of most solvers and requires special functions such as the division of the
mesh into solution blocks (not necessarily the same as mesh blocks) and the communication of
information between these blocks. It should be apparent that dividing a model into too many
blocks could lead to it actually running slower and possibly having greater errors because
of the time taken to transfer information between blocks. Consequently users should spend
some time developing understanding of appropriate limits for model size and parallelisability.

The final concept of importance when considering the deployment of a model in an HPC
environment is that of scaleability. The developers of parallelised solvers typically undertake
a test in which they compare the time taken for a standard model to solve versus the number of
processes used. Most solvers have a limit at which the improvement in solution time with the
increase of solver processes decreases until there is no tangible benefit to further increasing the
number of solution processes. The linearity of this relationship and the maximum number of
solution processes are both metrics of the scaleability of a solver i.e. how well the performance
improvement scales with the number of solver processes. Most commercial solvers, such as
ANSYS Fluent, have scaleability giving linear improvement in solution time up into the
hundreds of solver processes but it should be borne in mind that this is not universally true.

In South Africa there is a national HPC cluster that has been developed by the Department
of Science and Technology and administered by the Council for Scientific and Industrial
Research (CSIR) called the CHPC. While most of the solvers running on the Centre for
High-Performance Computing (CHPC) are non-commercial (because of the cost of licencing),
ANSYS has developed a system in South Africa where holders of HPC licences (such as
Universities) can use Fluent on the CHPC. This use does not cost anything in addition to
the existing licence costs and is not limited to the number of licences used by the University.
Some of the Masters and PhD, and even fourth year, projects in the School of Mechanical,
Industrial, and Aeronautical Engineering make use of the CHPC due to the much faster
model run times.

128
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Glossary

ENGINEERING
application server Typically a high volume computing server on which applications are
hosted for use by many users. Normally accessed via a browser portal or by remote
access application.

base object In a hierarchical model construction, an object which is required for the gen-
eration of another object, typically referred to as the dependent object, or child object.
Also known as a parent object.

characteristic length The dimension of an object within a flow field which is most pertinent
to generically characterising the behaviour e.g. the chord is used to define the Reynolds
number of flow passing over a wing as this is the dimension aligned with the flow.
Generally the dimension of an object aligned with a flow. The properties of flow fields
without implicit characteristic length are normally expressed per metre.

conformal In multi-block meshing, a mesh such that the nodes in adjacent mesh blocks are
coincident at the block boundary. Favoured for the minimisation of block boundary
interpolation truncation errors.

continuum A field in which properties vary continuously i.e. without discrete local proper-
ties.

convergent In CFD, a convergent solution is one which approaches an analytical or physical


solution with a steady decrease of error.

density Scalar measure of the mass of a substance for a particular volume thereof; inverse
of the specific mass.

dependent object In a hierarchical model construction, an object which is dependent upon


another object for its generation, typically referred to as the base object, or parent
object. Also known as a child object.

finite difference method A mathematical approach to the solution of derivative problems


by approximation of the derivatives by series of finite difference equations such as Taylor
series.

finite element method A mathematical approach to the solution of boundary value prob-
lems for partial differential equations by division of the computational domain into
smaller domains over which variational methods are applied to simplified (typically
lower-order) differential equations.

129
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
finite volume method A mathematical approach similar to the finite difference and finite
volume methods in which the computational domain is divided into sub-domains (known

ENGINEERING
as volumes or cells) in which volume integrals are calculated with divergence terms
matched to adjacent cells.

hypersonic Characterising a speed greater than the local speed of sound in which increased
thermodynamic effects (such as ionisation or chemical reactivity) may occur.

inertial Loosely speaking a reference frame that is not accelerating since the expression of
physical laws will depend on the nature of the acceleration.

Knudsen number Ratio of the Mean Free Path length to the characteristic length of a flow
field expressing the degree of continuity of the flow i.e. how closely it approximates a
continuum.

Mach number Ratio of the local transport speed (body or flow) to the local sound speed.

Mean Free Path length The average distance separating atoms / molecules of a sub-
stance.

mesh System of nodes and linkages thereof used in CFD to define the geometry of the system
being studied and as calculation points for the physical behaviour.

pressure Scalar quantity measuring the effect of interaction of objects with the random
motion of the particles with a fluid.

quiescent In fluid mechanics a flow field that is completely at rest.

resolution In CFD, resolution refers to the scale of the mesh versus the scale of the features
it depicts. Generally speaking, features (geometric or physical) smaller than the mesh
resolution at a particular point will not be resolved.

Reynolds number Ratio of the inertial and viscous forces within a fluid in motion (or
through which an object is passing).

Reynolds stress A term used to describe the fluctuating portion of the total stress tensor
in a fluid separated by the averaging process normally used in RANS methods.

specific gas constant Gas constant for a particular gas related to the universal gas constant
by division by the molar mass of the gas.

steady state In reference to the temporal specification of a CFD model, a model in which
time-dependent effects are not directly resolved but rather averaged.

130
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
subsonic Characterising a speed less than the local speed of sound.

ENGINEERING
supersonic Characterising a speed greater than the local speed of sound.

temperature Scalar quantity measuring of the total atomic / molecular energy state of a
substance.

time step The length of time by which a transient solution is incrementally advanced from
initial time until completion of the required simulation period.

transient In reference to the temporal specification of a CFD model, a model in which time-
dependent effects are directly resolved by quasi-steady approximation in which the flow
field for each time step is resolved dependent on previous time steps and changes in
boundary conditions.

transonic Characterising a speed less than the local speed of sound but in which local
phenomenon speeds may be greater than sound speed.

viscosity The property of a fluid describing the shear force that would be required to induce
a particular flow.

A Installation and Configuration of a C Compiler

The use of rigid-body motion UDFs requires the use of a C compiler. You can try using the
built-in compiler in Fluent. However, if this does not work, then it is recommended that
you install the free Visual Studio Community by Microsoft as per the following instructions.
This is the batch file needed to finalise the configuration.

131
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Compiling and Loading User Defined Functions using

ENGINEERING
Fluent and Microsoft Visual Studio 2019 Community
Edition running ANSYS Fluent in Serial and Parallel
This document assumes that you have Administrator rights and know how to Share folders and Map
drives. If you do not please consult with your local IT personnel. Microsoft Visual Studio 2019 is not
officially supported for any current ANSYS Fluent release. It will be officially supported with ANSYS
Fluent 2020 but can be used by following the instructions below. Alternatively, Microsoft Visual Studio
2019 will work if you launch Fluent from the Command Line using the Visual Studio 2019 x64 Native
Tools Command Prompt. The Microsoft Visual Studio 2019 compiler will work natively with Windows 10
but if you are running Windows 7 or Windows server please see Microsoft’s installation requirements.

NOTE: The Microsoft Visual Studio compilers are generally NOT free of charge. Please read the Microsoft
agreements for restrictions or licenses needed or contact your IT Department

Table of Contents

Windows 7 note using the 2019 compiler ..................................................................................................... 1


Downloading and Installing Microsoft Visual Studio 2019 Community ........................................................ 2
Download a UDF Batch File Fix for running Fluent without using the SDK Window ..................................... 2
Compiling Fluent UDFs in serial or SMP (Shared Memory) ........................................................................... 3
Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple Computers ........................................... 3
Launching and Configuring ANSYS Fluent to run across Multiple Computers and Compile UDFs ................ 4
Compiling ANSYS Fluent UDFs from the Command Line using the Visual Studio 2019 x64 Native Tools
Command Prompt window ........................................................................................................................... 6
Compiling Fluent UDFs in serial or SMP (Shared Memory) ........................................................................... 7
Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple Computers ........................................... 8
Launching and Configuring ANSYS Fluent to run across Multiple Computers and Compile UDFs ................ 9

Windows 7 note using the 2019 compiler


If your Operating System is Windows 7 you will need the following Microsoft Patch in order to use this
version (2017) of the compiler to compile Fluent UDF's.

Update for Windows 7 (KB2999226)

1
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
https://www.microsoft.com/en-us/download/details.aspx?id=49077

ENGINEERING
If you do not have this patch you will get this error when trying to compile Fluent UDFs

fatal error: Cannot open include file 'stdio.h': No such file or directory

Downloading and Installing Microsoft Visual Studio 2019 Community

ANSYS is not responsible for the correct installation of Microsoft Visual Studio. If you have issues
installing the compiler, please contact Microsoft or your IT staff.

NOTE: You will need to choose the selection in RED as well as the optional components on the
right hand side of the screenshot for the SDK, etc.

Download a UDF Batch File Fix for running Fluent without using the SDK
Window

1. In order to use the 2019 compiler with Fluent (until the release of 2020) you will need to
download the attached file, udf-batch-file-2019.
2. Browse to C:\Program Files\ANSYS Inc\v19.x\fluent\ntbin\win64 and rename the existing
udf.bat.

2
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
3. Rename udf-batch-file-2019 to udf.bat and place it in the C:\Program Files\ANSYS 4.

ENGINEERING
Inc\v19.x\fluent\ntbin\win64 directory
Note: The v19.x is an example. If you are running any other version of Fluent browse to the
appropriate v##.# directory.

Compiling Fluent UDFs in serial or SMP (Shared Memory)


1. Launch Fluent ensuring that your “Working Directory” is set to the location where your
case, data and UDF is located in.
2. Read in your model
3. Select the Console tab (at the bottom of the Fluent window)
4. Select the User Defined tab
5. Choose Functions > Compiled
6. Select the Add button to add your source file (.c)
7. Select Build
8. Select Load

Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple


Computers
NOTE: If you running the ANSYS Fluent solver on multiple computers and will be compiling and loading
UDFs you need to follow the steps below. If you are running in local parallel you do not need to share
and map drives. Follow the steps above except choose Parallel and the number of cores (processes) you
wish to run on.

1. Share the “ANSYS Inc” folder located at C:\Program Files\ANSYS Inc\v19.x with Full Control

3
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2. Create a working directory that contains the ANSYS Fluent case, data files and UDF source

ENGINEERING
code files. DO NOT COMPILE OR LOAD UDFS FROM FOLDERS WITH SPACES IN THE NAME
AND DO NOT INCLUDE SPACES IN THE NAME OF YOUR CASE AND DATA FILES.
3. Share the Working directory folder with Full Control
4. Map a drive letter to the shared folder, for example, U:\ (When compiling UDFs and
running in parallel (across machines) you must use a mapped drive letter to the shared
folder. Fluent will use this shared folder as its Working Directory in the Fluent Launcher.)

Launching and Configuring ANSYS Fluent to run across Multiple


Computers and Compile UDFs
1. Launch ANSYS Fluent
2. Select Show More Options from the ANSYS Fluent Launcher.
3. Set your Working Directory to the shared, mapped drive letter that you created earlier
4. Change the Fluent Root Path to in UNC format with the Computer_name\and the Shared
ANSYS Inc directory, for example, \\Computer_name\ANSYS Inc\v19.x\fluent
5. Select Parallel under Processing Options and then enter the Number of Processes you will
be using.

6. Select the Parallel Settings tab


7. Choose File Containing Machine Names
8. Choose the Text icon and enter the machine names once.
9. Click OK once you have entered and saved the machines.txt file.

4
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
10. Click OK to launch ANSYS Fluent

ENGINEERING
11. Read in your model
12. Select the Console tab (at the bottom of the Fluent window)
13. Select the User Defined tab
14. Choose Functions > Compiled
15. Select the Add button to add your source file (.c)

16. In the Library Name text box type in the \\Computer_name\share_name\libudf. It is


necessary to type in the network path to the compiled UDF in this text box if running across
multiple computers.

5
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
17. Select Build

ENGINEERING
18. Select Load
19. After you have compiled the UDF the working folder will include a new subfolder called
libudf.

Compiling ANSYS Fluent UDFs from the Command Line using the Visual
Studio 2019 x64 Native Tools Command Prompt window
1. Open up the Visual Studio 2019 x64 Native Tools Command Prompt window and change to your
working directory where your case and data reside.

2. Create an ANSYS Fluent v1xx.x shortcut on the desktop

3. Drag the ANSYS Fluent shortcut into the x64 Native tools Command Prompt window.

6
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
4. Press Enter
5. ANSYS Fluent launches.
6. Follow the procedures below for compiling UDFs

NOTE: If you are compiling from the x64 Native Tools Command Prompt then you must uncheck
this box when Fluent launches. Choose the Environment Tab, uncheck “Set up Compilation
Environment for UDF”. If you have replaced the udf.bat file as noted above, do not uncheck
this box.

Compiling Fluent UDFs in serial or SMP


(Shared Memory)
1. Launch Fluent ensuring that your “Working
Directory” is set to the location where your case, data and UDF is located in.

7
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
2. Read in your model

ENGINEERING
3. Select the Console tab (at the bottom of the Fluent window)
4. Select the User Defined tab
5. Choose Functions > Compiled
6. Select the Add button to add your source file (.c)
7. Select Build
8. Select Load

Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple


Computers
NOTE: If you running the ANSYS Fluent solver on multiple computers and will be compiling and loading
UDFs you need to follow the steps below. If you are running in local parallel you do not need to
share and map drives. Follow the steps above except choose Parallel and the number of cores
(processes) you wish to run on.

1. Share the “ANSYS Inc” folder located at C:\Program Files\ANSYS Inc\v19.x with Full Control
2. Create a working directory that contains the ANSYS Fluent case, data files and UDF source
code files. DO NOT COMPILE OR LOAD UDFS FROM FOLDERS WITH SPACES IN THE NAME
AND DO NOT INCLUDE SPACES IN THE NAME OF YOUR CASE AND DATA FILES.
3. Share the Working directory folder with Full Control
4. Map a drive letter to the shared folder, for example, U:\ (When compiling UDFs and
running in parallel (across machines) you must use a mapped drive letter to the shared
folder. Fluent will use this shared folder as its Working Directory in the Fluent Launcher.)

8
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,
Launching and Configuring ANSYS Fluent to run across Multiple

ENGINEERING
Computers and Compile UDFs
1. Launch ANSYS Fluent
2. Select Show More Options from the ANSYS Fluent Launcher.
3. Set your Working Directory to the shared, mapped drive letter that you created earlier
4. Change the Fluent Root Path to in UNC format with the Computer_name\and the Shared
ANSYS Inc directory, for example, \\Computer_name\ANSYS Inc\v19.x\fluent
5. Select Parallel under Processing Options and then enter the Number of Processes you will
be using.

6. Select the Parallel Settings tab


7. Choose File Containing Machine Names
8. Choose the Text icon and enter the machine names once.
9. Click OK once you have entered and saved the machines.txt file.
10. Click OK to launch ANSYS Fluent

9
INDUSTRIAL & AERONAUTICAL
SCHOOL OF MECHANICAL,

ENGINEERING
11. Read in your model
12. Select the Console tab (at the bottom of the Fluent window)
13. Select the User Defined tab
14. Choose Functions > Compiled
15. Select the Add button to add your source file (.c)

16. In the Library Name text box type in the \\Computer_name\share_name\libudf. It is


necessary to type in the network path to the compiled UDF in this text box if running across
multiple computers.
17. Select Build
18. Select Load
19. After you have compiled the UDF the working folder will include a new subfolder called libudf.

10

You might also like