18.
0 Release
Workshop 08: Transonic Flow Over a NACA 0012 Airfoil
Introduction to ANSYS Fluent
1 © 2017 ANSYS, Inc. April 5, 2019
Introduction
Workshop Description:
The purpose of this workshop is to simulate transonic flow over a two-dimensional NACA 0012 airfoil and
assess to what extent the solution is affected by different types of numerical errors.
Learning Aims:
This workshop
‒ Checking for round off error - Solving a compressible flow
‒ Checking for iteration error - Comparison with experimental data
‒ Checking for mesh independence on a hierarchy of meshes
Learning Objectives:
• To understand how to assess solver accuracy (applicable to any CFD simulation), how to solve
compressible flow and how to compute lift and drag in external aerodynamics applications
2 © 2017 ANSYS, Inc. April 5, 2019
Problem Description
• The case considered here is flow around over a NACA 0012 airfoil at a 1.55° angle
of attach and free stream Mach number of 0.7
• The airfoil drag and lift coefficients are the primary quantities of interest
3 © 2017 ANSYS, Inc. April 5, 2019
Computational Domain
Airfoil geometry NACA 0012
Computational
Domain
y
α
x
Angle of attack, a = 1.55° (not to scale)
4 © 2017 ANSYS, Inc. April 5, 2019
Flow Conditions
We will apply far field boundary conditions at the
T0 −1 2
po − 1 2 −1 = 1+ M
= 1+ M 2
p 2
outer boundary of the domain shown on the T
previous slide. where
T0 = total temperature = 311 K
where
The simulation results will be compared with test T = static temperature
po = total pressure = 101325 Pa
data from a wind tunnel. In the test, the total = 1.4 for air
pressure was reported as 101,325 Pa, the total p = static pressure
M = Mach number = 0.7
temperature as 311 K and the Mach number was = 1.4 for air
T
0.7. M = Mach No. = 0.7 0 = 1.098 and so T = 283.24 K
T
p
o = 1.3871
Based on these values, the static temperature and p
static pressure can be computed using the p = 73048 Pa
relations on the right.
The speed of sound in air at 283 K is ≈ 338 m/s.
For an airfoil chord length of 1 m and Ma = 0.7, the
Reynolds number is around 12x106, so the flow is
turbulent.
5 © 2017 ANSYS, Inc. April 5, 2019
Start Workbench
• Start Workbench, go to File >
Save As… and save the project
as WS08-Airfoil
• Create a Fluent analysis system
6 © 2017 ANSYS, Inc. April 5, 2019
Import Mesh
• Copy the file naca0012-
coarse.msh.gz to the folder
where the Workbench project
was saved on the previous slide 1.
• Right click on the Mesh Cell
(A3), choose Import Mesh File
and Browse
Select naca0012-
2. coarse.msh.gz and click Open.
Geometry and mesh cells
change to reflect imported
mesh
7 © 2017 ANSYS, Inc. April 5, 2019
Launch Fluent
• Double click Setup and launch
Fluent
– Use Serial
8 © 2017 ANSYS, Inc. April 5, 2019
Fluent Workflow: Ribbon
• The Ribbon is used to guide the basic Fluent workflow
• The four primary tabs used in every simulation are
– Setting Up Domain
– Setting Up Physics
– Solving
– Postprocessing
9 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Domain: Mesh Display
• The mesh is already displayed if the
Display Mesh After Reading check
box was ticked
• If not, open the mesh display panel
The mesh consists of 5,043
cells. Later in this workshop
you will use two additional
meshes with increasing cell
counts and therefore increasing
spatial resolution.
It is desired to achieve a mesh resolution of y+ ≈ 1 at
the airfoil surface (important for drag prediction) so
the mesh is very fine in the wall normal direction. This
will be checked after the solution is calculated
10 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Domain: Mesh Check and Mesh Quality
• In the Setting Up Domain tab, in the
Mesh group, click Check and
examine the output in the Console
– No errors are reported
• Click Quality and examine the
output in the console
The mesh check returns no error messages.
The minimum orthogonal quality is not good. If it
is hard to converge the solution or any
unreasonable features in the solution a new mesh
might be needed. The maximum aspect ratio is
very high due to the stretched cells close to the
airfoil surface, but well within the range of
acceptability for boundary layer mesh.
11 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Physics: Operating Conditions
• In the Setting Up Physics tab,
activate Energy
• Set the operating pressure to 0 Pa
In Fluent, the absolute pressure = (operating pressure + gauge pressure).
Operating pressure is set here and gauge pressure is what the solver calculates.
For incompressible flows, the operating pressure is typically set to atmospheric
pressure. This allows the solver to compute only the smaller gauge pressures,
which helps to prevent round off errors.
For compressible flows, the solver needs to use the absolute values in the
calculation. Therefore it is sometimes convenient to set the operating
pressure equal to zero so that the absolute pressures can be used as boundary
conditions.
12 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Physics: Solver and Models
• In the Setting Up Physics tab, click
Operating Conditions
• The Reynolds number is 12x106, so
a turbulence model is required
• Click Viscous and enable the SST k-
omega model
13 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Physics: Materials
• Click Materials and select ideal-gas
for Density
• Select sutherland for viscosity and
keep the default Three Coefficient
Method
The Sutherland model for viscosity is well-
suited for high speed compressible flow.
For simplicity, Cp and thermal conductivity
will use constant values, but ideally in high
speed compressible flow modeling these
should also be defined as temperature
dependent.
14 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Physics: Cell Zones and Boundary Conditions
• Materials definitions are
complete so proceed to Zones
• The default material of air will be
used so no need to set any cell
zone conditions
• Click Boundaries and open the
boundary conditions panel for
the farfield boundary
• At pressure far field boundaries,
required inputs are the Mach Because the angle of attack is 1.55°, the flow
number, static pressure, flow direction should be (.99878, .02079). It is
direction, turbulence bc’s and possible to enter this directly in the panel, but for
this workshop, parameters will be used to control
static temperature (in the
these values.
Thermal tab)
15 © 2017 ANSYS, Inc. April 5, 2019
Setting Up Physics: Boundary Conditions
• Return to the Project Schematic and double click
Setup to start Fluent again
• Choose Yes when prompted to load the new
parameter values
• Open the panel for the farfield boundary and
note the updated values appear for the flow
direction
• The airfoil walls will use default settings so no
inputs are required
16 © 2017 ANSYS, Inc. April 5, 2019
Solving: Methods
• Click Methods in the Ribbon to open the Solution
Methods Panel
• Change the Pressure-Velocity Coupling scheme to
Coupled
– Activate Pseudo Transient and High Order Term
Relaxation
Use of Coupled for the Pressure-Velocity Coupling is
recommended for compressible flows.
The Pseudo Transient and High Order Term Relaxation
options often help to stablilize the convergence behavior
17 © 2017 ANSYS, Inc. April 5, 2019
Solving: Report Definition for Drag Coefficient
• In the Solving tab, click on Definitions in the
Reports section and choose New > Force
Report > Drag
Enter the following in the
definition panel, then click OK:
Name = cd-report
The drag coefficient is the normalized Report Type = Drag Coefficient
force on the selected surfaces in the Surfaces = both airfoils
direction of the flow: Force Vector (0.99978,0.020795)
Report Plot = check
Fdrag Create Output Parameter =
Cd =
1 check
V 2 A
2
18 © 2017 ANSYS, Inc. April 5, 2019
Solving: Report Definition for Lift Coefficient
• In the Solving tab, click on Definitions in the
Reports section and choose New > Force
Report > Lift
Enter the following in the
definition panel, then click OK:
Name = cd-report
The drag coefficient is the normalized Report Type = Drag Coefficient
force on the selected surfaces in the Surfaces = both airfoils
direction perpendicular to the flow: Force Vector (0.99978,0.020795)
Report Plot = check
Flift Create Output Parameter =
Cl =
1 check
V 2 A
2
19 © 2017 ANSYS, Inc. April 5, 2019
Reference Values for Drag and Lift Coefficients
• Double click Reference Values in
the Tree to open the Reference
Values Task Page
• Select farfield under Compute from
The density, velocity and area values used by Fluent to compute drag
and lift coefficients are based on the entries in Reference Values.
We want to use free stream values of density and velocity, so it is
convenient to automatically fill the panel based on the farfield
boundary. In other cases, one or more values can be manually
edited at any time should boundary values be unsuitable.
The area for a 2D problem is based on 1m depth in the z-direction
and the chord length, which here is also 1m. Therefore just leave the
value of 1 m2 for the area.
20 © 2017 ANSYS, Inc. April 5, 2019
Solving: Initialize and Calculate
1. Click Initialize
‒ Remember the message about the
hybrid initialization is just a
warning, not an error, and it is ok to
proceed
2. Enter 100 iterations and
click Calculate
3. When iterations complete,
File > Save Project
The lift coefficient in the lower right
plot is still changing, so more
iterations will be required even
though the residuals have reached
the convergence criteria.
21 © 2017 ANSYS, Inc. April 5, 2019
Solving: Residuals
• To perform more iterations, open the
residuals panel and reduce the criterion
for the equation with the highest value,
here continuity, by one order of
magnitude
• Click Calculate
• Use changes for current and future
calculations
Report plots have leveled off by the time
residuals reach the new criterion
22 © 2017 ANSYS, Inc. April 5, 2019
Postprocessing: Mass Balance
• The solution is converged so
move from the Solving tab to the
Postprocessing tab and Click
Fluxes to compute the mass flow
rate
There are not distinct inlets and outlets in this problem, just the far field boundary. It
would be negligent to simply decide that .0005 kg/s must be ok because it looks like a
small number. The extent of the computational domain in the y-direction is 60 m, as seen
to the left. A better way to evaluate the imbalance is to use the boundary values for
density (≈.90 kg/m³) and velocity (≈240 m/s) (the origin of these values is shown in slide
23, or it would also be possible to compute average values in surface integrals) such that
the mass flow through a 60 m cross section is 60 m x 1 m (z-direction) x 240 m/s x .90
kg/m³ ≈ 13,000 kg/s. Here, the imbalance is several orders of magnitude lower, so the
solution has achieved a good mass balance.
23 © 2017 ANSYS, Inc. April 5, 2019
Postprocessing: Contours
• Display contours of pressure
– Note the high static pressure at the nose and low
pressure on the upper (suction) surface, which is
expected, as the airfoil is generating lift
– Note that in 2D cases you should not select any
surfaces in the Contours panel, otherwise it will
display the mesh lines colored like contours
Deselect all surfaces and redisplay
if contours look like this
This surface should not be selected
• Display contours of Mach number
– Note that the flow is locally supersonic (Ma > 1.0)
as the flow accelerates over the upper surface of
the airfoil
24 © 2017 ANSYS, Inc. April 5, 2019
Postprocessing: XY Plots
• Make an XY plot of Wall Yplus on
the surfaces of the airfoil
It is important to resolve the viscous sublayer for this application, so y+
≈ 1 is desired. Values seen here in the range of 2 to 3 are probably ok.
A grid study will be performed later, so it will be possible to check
whether that is the case.
25 © 2017 ANSYS, Inc. April 5, 2019
Postprocessing: Plot Pressure Coefficient Data
• Make an XY plot of Pressure
Coefficient
• Click Curves and change the plots to
solid line
– You have to click Apply for each curve
number and then click Plot again
• Copy the files test-data-top.xy and
test-data-bottom.xy from the
workshop input files to the directory
where your Workbench project is
saved
• Click Load File, navigate to the xy file
location and add them to the plot
– Following, it will be evaluated whether the
differences are the result of numerical errors
The .xy plot file format is described in the User’s Guide but standard practice is to write a .xy plot file using the Write to
File option on this panel and using a text editor to paste the experimental data over the original contents.
26 © 2017 ANSYS, Inc. April 5, 2019
Check for Round Off Errors
• After viewing the plot on the previous
slide, save the project and close Fluent
• Remember that round off errors can be
detected by comparing results from
single precision with results from
double precision
• In the Project Schematic, make a
duplicate of the Fluent system and
rename the systems as shown to the
right
• Double click the Setup cell (B3) in the
new system, select Double Precision in
the Fluent Launcher and start Fluent
• Click OK when prompted
27 © 2017 ANSYS, Inc. April 5, 2019
Solving: Initialize and Calculate the Solution
1. Click Initialize, then Calculate
2. Residuals do not converge
(continuity has to reach 1e-4) so
click Calculate once again
3. Report plots are level, residuals
are converged, so save the
project and close Fluent
28 © 2017 ANSYS, Inc. April 5, 2019
Compare Output Parameters in Workbench
• Output parameters for each
case can be viewed in
Workbench
• Output parameters were
defined for the drag and lift
coefficients because they
are quantities of interest for
this study
• Values for either case agree
to three significant digits, so
it can be concluded round
off errors are negligible
29 © 2017 ANSYS, Inc. April 5, 2019
Check for Iteration Errors
• Remember that iteration errors
represent the difference between a
converged solution and the solution at
a given iteration ‘n’
• We need to set the residual
convergence criteria low enough that
quantities in the report plots have
stopped changing by the time the
residual criteria are satisfied
• Make a duplicate of system A, name it
Iteration Error Test and double click
Setup to launch Fluent
30 © 2017 ANSYS, Inc. April 5, 2019
Solving: Initialize and Calculate the Solution
1. Reduce Continuity Residual criterion to 1e-5
2. Initialize, set number of iterations to 500 (expect to need
longer to reach lower residuals) and calculate
3. The continuity residual stalls at around 3.5e-5 (can see
numerical values in console window), but since the report
plots are practically unchanged since iteration 100, accept
the solution for now, save the project and close Fluent
31 © 2017 ANSYS, Inc. April 5, 2019
Compare Output Parameters in Workbench
• Differences between the
three cases are less than
0.1%
• Results so far are not
affected by round off or
iteration errors
• Discretization errors will be
assessed next
32 © 2017 ANSYS, Inc. April 5, 2019
Check for Discretization Errors and Mesh Independence
• Remember that discretization errors represent the difference between the solution of the discretized CFD
equations on the current mesh and what the solution of the discretized equations would be on an
infinitely fine mesh
• It is normally not possible to quantify the level of discretization error in a given problem
• Instead, discretization error is considered to be negligible when the mesh is fine enough that the solution
does not change under further mesh refinement, which is known as mesh independence
• In order to study mesh independence, three meshes have been created for this problem:
5,043 cells 18,720 cells 76,314 cells
33 © 2017 ANSYS, Inc. April 5, 2019
Solve on Medium Mesh
• Copy the files naca0012-med.msh.gz
and naca0012-fine.msh.gz to the
folder where your Workbench project
is located
• Make a duplicate of system A, name
the new system “Medium Grid”, right
click on the Imported Mesh cell (D2)
and choose Import Mesh File
– Remember to change the file type in
the lower right of the panel if the
meshes do not appear in the panel
• Select naca0012-med.msh.gz and Importing the new mesh upstream of
double click Setup (D3) to start Fluent the setup cell means that the
previous problem definition is
• Select Yes when prompted completely preserved and all you
have to do is calculate the solution
Note that the arrangement of the cells in your project schematic
might be arranged differently depending on how various
operations were performed. This is nothing to worry about.
34 © 2017 ANSYS, Inc. April 5, 2019
Solving: Initialize and Calculate
1. Click Initialize
‒ Unlike the other messages, this is an
error and it is not
2. Numerous error messages
are reported in the console
In any case, such as this one, with very high aspect ratio cells,
and the panel there is a possibility the solution might diverge with single
‒ Unlike the other messages, this is an precision. Here it did not even make it to solution – even the
error and something must be done initialization diverged. The problem definition is identical to all
in order to proceed the other cases – all that has changed is the grid and the
precision. Even though single precision was fine on the coarse
3. Close Fluent and return to grid, that does not guarantee it is ok for all grids. So it is logical to
switch to double precision and see what happens.
the Project Schematic in
Workbench
35 © 2017 ANSYS, Inc. April 5, 2019
Relaunch Fluent with Double Precision
• Right click Setup (D3) and
choose Edit
• Activate Double Precision
and launch Fluent
36 © 2017 ANSYS, Inc. April 5, 2019
Solution on Medium Mesh
• Initialize the solution and click
Calculate
• No problem with initialization or
calculation
• In the Tree, expand the Parameters &
Customization and Output
Parameters branches such that the
output parameters appear
• Right click on cd-report-op and
choose Print to Console
• Repeat for cl-report-op
• Values on the coarse grid were Cl =
0.188 (1.1% higher than medium
mesh) and Cd = .00912 (10.7% higher
than medium mesh)
37 © 2017 ANSYS, Inc. April 5, 2019
Plot Y+ on the Medium Mesh
• Using the steps from Slide 28, make
an XY plot of y+ on the airfoil surfaces
• There are similar levels and
distribution of y+, indicating no
significant refinement of the wall
normal grid spacing
Medium Mesh Original Mesh
38 © 2017 ANSYS, Inc. April 5, 2019
Plot Pressure Coefficient on the Medium Mesh
Medium Mesh
• Using the steps from Slide 29,
compare the experimental data for
the pressure coefficient with the CFD
results
• There might be marginally better
agreement on the upper surface near
the nose of the airfoil (x-axis below
0.2)
Original Mesh
39 © 2017 ANSYS, Inc. April 5, 2019
Solve on Fine Mesh
• Make a duplicate of system D, name
the new system “Fine Grid”, right
click on the Imported Mesh cell (E2)
and choose Import Mesh File
– Make the duplicate from system D so that
double precision will be retained
• Select naca0012-fine.msh.gz and
double click Setup (E3) to start Fluent
• Initialize and calculate the solution
(not shown)
40 © 2017 ANSYS, Inc. April 5, 2019
Plot Y+ on the Fine Mesh
• Using the steps from Slide 28, make an XY plot of y+ on the airfoil surfaces
• There are similar levels and distribution of y+, indicating no significant
refinement of the wall normal grid spacing
Fine Mesh Medium Mesh Original Mesh
41 © 2017 ANSYS, Inc. April 5, 2019
Plot Pressure Coefficient on the Fine Mesh
Fine Mesh
• Using the steps from Slide 29,
compare the experimental data for
the pressure coefficient with the CFD
results
• Some differences can be seen
between the two cases but the level
of agreement with the data is similar
Medium Mesh
42 © 2017 ANSYS, Inc. April 5, 2019
Table of Output Parameters
• Differences between the medium and
fine grids are less than 1% while
differences between the coarse and
medium grids are substantially larger
– This would typically suggest that further studies can
be performed using the medium grid
– However, the question of near-wall grid refinement
remains open since y+ is similar for all cases
43 © 2017 ANSYS, Inc. April 5, 2019
Wrap-up
• This workshop has shown the basic steps for checking for numerical errors:
– Compare single and double precision results to check for effect of round off error (or lack thereof)
– Using report plots to identify the level of residuals where there is no iteration error
– Using a hierarchy of meshes to prevent discretization errors from using too coarse of a mesh
– Comparison with experimental data to check for possible existence of systematic error (errors remaining
after other types of error have been minimized)
• One of the most important things to remember in your own work, before even starting the
ANSYS software, is to think WHY you are performing the simulation
– What information are you looking for?
– What do you know about the boundary conditions?
In this case the goal was to calculate flow around an airfoil and determine the lift and drag coefficients
under specified free stream conditions and angle of attack. Since these coefficients were identified as
key output before doing any CFD, they could be used to make assessments of possible numerical
errors.
44 © 2017 ANSYS, Inc. April 5, 2019