You are on page 1of 55

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


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
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.
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,
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,
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,
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,
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.
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,


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
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,


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,
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.
subsection 7.6),
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
subsubsection 8.4.1)
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,
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,
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
Figure 86)
86 and
that the drag on the faster vehicle is approximately constant (Figure
Figure 87).
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

You might also like