You are on page 1of 97

Good Practice in CFD.

A rough guide.

Prof. Neil W. Bressloff


March 2015
Material covered

Introduction External and internal flow

The CFD process Geometry, meshing, simulation, post-processing

The issues For each of the steps in the CFD process


• The Reynold’s number
• Verification and validation
Test case 1 Simulation of flow over a 2D backstep
• Model selection
• Order of accuracy
• Mesh verification
Test case 2 Simulation of flow over an airplane
• y+: the non-dimensional distance from the wall
• Turbulence model selection
• The drag prediction workshops (variation in CFD results)
Test case 3 Pulsatile (unsteady) blood flow
• Verification of number of pulses, spatial and temporal spacing
Test cases 4 & 5 Verification in CFX (tank sloshing) and in OpenFOAM (rim-driven thruster)
Checklist The things to consider for setting-up, running and post-processing a CFD
simulation
Other resources http://www.soton.ac.uk/~nwb/lectures/GoodPracticeCFD/Articles

2
Introduction – external flow

Good practice in CFD (Bressloff) 3


Introduction – external flow 2015
Introduction – internal flow

Good practice in CFD (Bressloff) 5


Introduction – internal flow 2015
Introduction – the process

• Geometry > mesh > simulation > post-process


Geometry
Mesh

Simulation

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-dpw/

fifth drag prediction workshop


The fourth

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-
dpw/Workshop4/presentations/DPW4_Presentations_files/
D1-9_DPW4-ANSYS-Marco-Oswald-new.pdf

Good practice in CFD (Bressloff) 7


Introduction
• Geometry > mesh > simulation

25
20

flow rate m3/s


15
10
5
0
0 0.2 0.4 0.6 0.8 1
non-dimensional time

Bressloff, N. W., 2007, Parametric geometry exploration in the carotid artery bifurcation, J. Biomech. , 40, 2483-2491.

Good practice in CFD (Bressloff) 8


The issues - geometry

• Construct from scratch?

OR

• Supplied geometry?

• Feature definition – wrapping

• Outer domain (for external flow)

• Parameterisation

Good practice in CFD (Bressloff) 9


The issues – geometry software

Rhino

CATIA
DesignModeler

NX4
Solidworks

Good practice in CFD (Bressloff) 10


The issues - mesh

• Mesh tool?

AND

• Mesh strategy?

• Boundary layer mesh?

• Mesh dependence?

• Computational cost?

Good practice in CFD (Bressloff) 11


The issues – mesh software

Harpoon
Starccm+

ANSYS mesher

ICEM CFD Solidworks

Good practice in CFD (Bressloff) 12


The issues - simulation

• Model definition?

AND

• Solution strategy?

• Boundary conditions?

• Initial conditions?

• Monitoring?

• Convergence?

Good practice in CFD (Bressloff) 13


The issues – simulation software

Fluent

Starccm+

CFX

OpenFOAM

Good practice in CFD (Bressloff) 14


Reynold’s number

• Why is Re important?

Laminar > Transition > Turbulent

Increasing Re

http://www.petrodanesh.com/Virtual%20Education/Mechanics/ANSYS-
FLUENT/ANSYS%20CO/fluent12-lecture06-turbulence.ppsx

Boundary layer behaviour/representation

http://www.princeton.edu/~gasdyn/
Good practice in CFD (Bressloff) 15
Simulation – accuracy?

• Which of the above Cp variations is correct ?


• Is either of them correct ?
• If so, how accurate are they ?
• Do the associated solutions yield physically meaningful results ?

Good practice in CFD (Bressloff) 16


The issues – post-process

• Need to show quantitative results

• Explain the results

 Verification

 Validation Has this flow separated?


 Errors

 Significance

Good practice in CFD (Bressloff) 17


Verification & Validation

• Verification

 Check for correct setup

• Validation

 Check accuracy of results (preferably against experimental data)

Good practice in CFD (Bressloff) 18


Test case 1.

2D flow over a backward facing step


2D flow over a backward facing step – validation

Good practice in CFD (Bressloff) 20


2D flow over a backward facing step – the experiment

Good practice in CFD (Bressloff) 21


2D flow over a backward facing step – flow settings

Good practice in CFD (Bressloff) 22


2D flow over a backward facing step - results

Good practice in CFD (Bressloff) 23


2D flow over a backward facing step – 2D versus 3D

Good practice in CFD (Bressloff) 24


2D flow over a backward facing step – simulation

Good practice in CFD (Bressloff) 25


2D flow over a backward facing step – simulation

• Solver settings
• Model definition?
• Mesh dependence
AND
 Resolution
• Solution strategy?
 Type
• Boundary conditions?
 Boundary layer mesh
• Initial conditions?
 Memory
• Monitoring?
• Convergence
• Convergence?
• Simulation time

 Hardware

 Parallel simulation

Good practice in CFD (Bressloff) 26


Solver setup: default settings

Mesh spacing = 1mm

Good practice in CFD (Bressloff) 27


Solver setup: change to 1st order

Mesh spacing = 1mm

Good practice in CFD (Bressloff) 28


Solver setup: pressure algorithm set to 2nd order

Mesh spacing = 1mm

Good practice in CFD (Bressloff) 29


Solver setup: pressure based; SIMPLE; 2nd order
(finer mesh)

Mesh spacing = 0.5mm

Good practice in CFD (Bressloff) 30


Solver setup: switch to SIMPLEC and use higher
under-relaxation factors

Mesh spacing = 0.5mm


Higher under-relaxation factors

Default values

Note: 0.8 for momentum didn’t converge 31


So SIMPLEC converges well with high under-relaxation factors.
BUT….do we trust the solution?

Mesh spacing = 0.5mm

Good practice in CFD (Bressloff) 32


Solver setup: pressure based; Coupled; 2nd order
(switch from SIMPLEC for finer mesh)

Test under-relaxation
Mesh spacing = 0.25mm

Switch to 1st order

Switch to 2nd order

Switch to coupled solver

SIMPLEC Coupled

Coupled
Selecting Coupled from the Pressure-Velocity Coupling drop-down list indicates that you are using the
pressure-based coupled algorithm, described in this section in the separate Theory Guide. This solver
offers some advantages over the pressure-based segregated algorithm. The pressure-based coupled
algorithm obtains a more robust and efficient single phase implementation for steady-state flows. It
is not available for cases using the Eulerian multiphase, NITA, and periodic mass-flow boundary conditions.

Good practice in CFD (Bressloff) 2010 33


Solver setup: The coupled solver

Good practice in CFD (Bressloff) 34


Solver setup: The coupled solver

Mesh spacing = 0.5mm

Good practice in CFD (Bressloff) 35


Solver setup for mesh dependence

• Coupled solver is more robust and is recommended


for steady-state solutions

 N.B. only incompressible flow considered here

• Use at least 2nd order discretisation schemes

• Check convergence

 N.B. aim for at least three orders of magnitude

• Mesh dependence

 Consider at least four mesh resolutions

 Halve the mesh spacing each time

36
Good practice in CFD (Bressloff)
Mesh dependence: spacing of 1mm to 0.125mm

Good practice in CFD (Bressloff) 37


Mesh dependence – x-component of shear stress on
bottom wall.

Good practice in CFD (Bressloff) 38


2D flow over a backward facing step - results

Good practice in CFD (Bressloff) 39


Boundary (layer) mesh or inflation layer
1mm spacing

1mm spacing

5 layers

0.1mm first layer

Growth rate = 2.0

Cell count increased from 6,000 to 10,069

Good practice in CFD (Bressloff) 40


Boundary (layer) mesh or inflation layer
0.5mm spacing

0.5mm spacing

5 layers

0.1mm first layer

Growth rate = 1.5

Cell count increased from 24,353 to 31,366

Good practice in CFD (Bressloff) 41


Boundary (layer) mesh or inflation layer
0.25mm spacing

0.25mm spacing

5 layers

0.1mm first layer

Growth rate = 1.2

Cell count increased from 99,844 to 105,407

Good practice in CFD (Bressloff) 42


Triangular cells – spacing = 0.25mm

Cell count increased from 99,844 to 211,589

Good practice in CFD (Bressloff) 43


The Lyceum cluster

http://www.soton.ac.uk/isolutions/computing/hpc/compute/index.html

Good practice in CFD (Bressloff) 44


Logging into the Lyceum cluster

• You’ll need to request access to the Lyceum


cluster from serviceline

• Read the web-pages (including the wiki pages)

• Use secure shell to remotely login

Good practice in CFD (Bressloff) 45


Fluent on the Lyceum cluster

• Type module load fluent/14.5.7

• Type fluent 2d –t4 &


– to run a 2d session of Fluent using 4 processes
– Note: only use this on the head node to perform quick tests

• A special script is needed to submit jobs to the scheduler in order to run


on the slave nodes

Good practice in CFD (Bressloff) 46


Connecting to the Lyceum cluster and launching Fluent

Good practice in CFD (Bressloff) 47


200 iterations of the 1mm mesh on the Lyceum cluster

Good practice in CFD (Bressloff) 48


Help with connection to the Lyceum cluster

Good practice in CFD (Bressloff) 49


Test case 2.

3D flow around a transonic aeroplane

Fluent
Drag prediction workshop

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-dpw/

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-
dpw/Workshop4/presentations/DPW4_Presentations_files/
D1-9_DPW4-ANSYS-Marco-Oswald-new.pdf

Good practice in CFD (Bressloff) 51


DPW-4 - grid guidelines
• Grid Convergence Case – NASA Common Research Model:
– Coarse (3.5M), Medium (10M), and Fine (35M) grids are required;
The Extra-fine (100M) grid is optional
– Total grid size to grow ~3X between each grid level for grid convergence cases
– Initial spacing normal to all viscous walls (RE=5e+6 Based on CREF=275.80):
• coarse: y+ ~ 1.0 dy = 0.001478
• medium: y+ ~ 2/3 dy = 0.000985
~ 0.04mm
• fine: y+ ~ 4/9 dy = 0.000657
• extra-fine: y+ ~ 8/27 dy = 0.000438

– Recommended: generate grids with 2 cell layers of constant spacing normal to


viscous walls
– Grid convergence cases must maintain the same grid family between grid levels, i.e.
maintain the same stretching factors, same topology, etc.
– Growth rate of cell sizes in the viscous layer should be < 1.25.
– Farfield located at ~100 CREF’s for all grid levels.

Good practice in CFD (Bressloff) 52


DPW-5 - overview

Good practice in CFD (Bressloff) 53


Grid guidelines – coarse grid

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-
dpw/Workshop4/presentations/DPW4_Presentations_files/
D1-9_DPW4-ANSYS-Marco-Oswald-new.pdf

Good practice in CFD (Bressloff) 54


Solver setup

http://aaac.larc.nasa.gov/tsab/cfdlarc/aiaa-dpw/Workshop4/presentations/DPW4_Presentations_files/D1-
9_DPW4-ANSYS-Marco-Oswald-new.pdf

Good practice in CFD (Bressloff) 55


Turbulence model selection

ALSO consider how


to model
the near wall
behaviour

 Is y+ in the
correct range?

Good practice in CFD (Bressloff) 56


RANS models descriptions

Good practice in CFD (Bressloff) 57


RANS models behaviour and usage

Good practice in CFD (Bressloff) 58


Near-wall treatment (y+)

y  y p
Good practice in CFD (Bressloff) 59
Harpoon – first mesh
• Mesh settings

 Surface cell size = 138mm

• BL settings

 Initial cell height = 20mm

 No. of layers = 3

 Expansion rate = 1.3

• Volume mesh: 389,585 cells

• Including BL mesh: 553,566 cells

• 39 seconds to create mesh

Good practice in CFD (Bressloff) 60


Harpoon-Fluent - first mesh y+

Good practice in CFD (Bressloff) 61


Harpoon – second mesh
• Mesh settings

 Surface cell size = 69mm

• BL settings

 Initial cell height = 2mm

 No. of layers = 4

 Expansion rate = 1.5

• Volume mesh: 1,363,903 cells

• Including BL mesh: 2,238,970 cells

• 112 seconds to create mesh

Good practice in CFD (Bressloff) 62


Harpoon-Fluent – second mesh y+

Good practice in CFD (Bressloff) 63


Harpoon – third mesh
• Mesh settings

 Surface cell size = 69mm

• BL settings

 Initial cell height = 0.5mm

 No. of layers = 10

 Expansion rate = 2.0

• Volume mesh: 1,363,903 cells

• Including BL mesh: 3,521,225 cells

• 148 seconds to create mesh

Good practice in CFD (Bressloff) 64


Harpoon-Fluent – third mesh y+

Good practice in CFD (Bressloff) 65


DPW- 5 summary - drag

W/T @ 0.0245

Good practice in CFD (Bressloff) 66


DPW- 4 summary - drag

Good practice in CFD (Bressloff) 67


DPW- 5 – drag (turbulence models)

• Scatter is still large for coarser grids

• Best results for hex-based grids (even if unstructured)

• Discretisation and turbulence modelling major contributors to scatter


Good practice in CFD (Bressloff) 68
DPW-1V summary - separation

Good practice in CFD (Bressloff) 69


DPW-1V summary – no separation

Good practice in CFD (Bressloff) 70


Test case 3.

Coronary artery stent design

(pulsatile flow)
Starccm+
Coronary artery disease

• Coronary Artery Disease (CAD) is a condition caused by the accumulation of


plaque (usually atheromatous or fibrous plaque) on the inner walls of the
artery.

(1) GNU Free Documentation License - http://commons.wikimedia.org/wiki/Commons:GNU_Free_Documentation_License


(2) Creative Commons License - http://creativecommons.org/licenses/by-sa/2.5/
(3) Antonio Colombo and Goran Stankovic. Colombo’s Tips & Tricks with Drug-Eluting Stents. Taylor and Francis Group, 2005.

Good practice in CFD (Bressloff) 72


Stents

(1) National heart lung and blood institute (nlhbi).


http://www.nhlbi.nih.gov/health/dci/Diseases/Angioplasty/Angioplasty All.html.

Good practice in CFD (Bressloff) 73


Geometry construction
• Representative models of the ART stent and Bx VELOCITY are constructed
using Rhinoceros 4.0

ART stent – Flat model Bx VELOCITY – Flat model

Good practice in CFD (Bressloff) 74


Problem formulation
• Blood flow in coronary arteries
Flow type Unsteady, Newtonian, Incompressible and - Unsteady due to the pulsatile nature of
laminar blood flow
Dynamic Viscosity(μ) 3.7x10-3 Pa-s
-Blood behaves as a Newtonian fluid for
Density (ρ) 1.06 x 103 kg/m3 shear rates higher than 100 s-1 (1)
Peak and mean blood velocities 8.99 cm/s & 5.04 cm/s - Incompressible laminar flow for Reynolds
Peak and mean Reynolds number 77 & 44 numbers lower than 200

• Inlet velocity profile

Inlet velocity profile(2)


1. Fung Y C 1993 Biomechanics: Mechanical Properties of Living Tissues vol 18 2nd edn (New York: Springer) 75
2. K. Perktold,M. Hofer, G. Rappitsch,M. Loew, B.D. Kuban, and M.H. Friedman. Validated computation of physiologic flow in a realistic coronary artery artery branch.
”Journal of Biomechanics”, 31:217–28, 1998.

Good practice in CFD (Bressloff) 75


Simulation setup
• Governing Equations

∇.(v) = 0 (1)
ρ(∂v/∂t) + ρ(v.∇v ) = -∇P + μ∇2v (2)

• Boundary conditions
– Numerical simulations are performed over a quarter stent to exploit symmetry
Outlet: zero pressure

Plane2: Periodic/cyclic
boundary condition

Stent & artery wall: No slip wall


Berry et al : change in dia less than 2% on average

Inlet: velocity specified as a


fourier series representing
pulsatile blood flow
Plane1: Periodic/cyclic 76
boundary condition

Good practice in CFD (Bressloff) 76


Mesh, time-step and pulse
• Various time-step, mesh, and blood-pulse dependence tests help to
determine the final parameters for CFD simulations.

Mesh dependence test Time step independence

Time step 10-3 s


Mesh size ~ 1 million cells
Blood pulses 2

Final parameters

Pulse dependence test

Good practice in CFD (Bressloff) 77


Meshing

• Tool used for meshing and CFD runs: Star CCM+ 3.06.006

Cells 1,097,951 Cells 1,076,793


Interior faces 6,023,874 Interior faces 6,177,303
Vertices 4,850,151 Vertices 5,010,556

Good practice in CFD (Bressloff) 78


Results – wall shear stress
• Axial WSS patterns at point 3 of the cardiac pulse – areas of low WSS are
localised around the struts and the connectors.

• In earlier studies low WSS areas are reported to correlate with sites of more
intimal thickening

Good practice in CFD (Bressloff) 79


Velocity profiles- the ART stent

Good practice in CFD (Bressloff) 80


Velocity profiles- Bx-VELOCITY stent

Good practice in CFD (Bressloff) 81


Test case 4.

Sloshing in a LNG tank

(oscillatory free surface flow)


CFX
Sloshing of LNG

Good practice in CFD (Bressloff) 83


Sloshing verification & validation

Good practice in CFD (Bressloff) 84


Test case 5.

Rim driven thruster

OpenFOAM
Mesh verification of open propeller flow

Good practice in CFD (Bressloff) 86


Validation of open propeller flow

Validation Against Experimental Data for the Wageningen B4-70 Pro-


peller Using k-omega SST Turbulence Model

Good practice in CFD (Bressloff) 87


Validation of rim driven thruster

Validation Against Experimental Data for the 70mm Rim Driven Thruster

Good practice in CFD (Bressloff) 88


Checklist (1)

• Grid design

 Geometry (check/fix CAD model)


 Boundary conditions
 Boundary layer (Turbulence model)
 y+ of first layer of grid points
 how many points in the boundary layer?
 structured BL or size functions or refinement?
 Avoid skew cells
 Local resolution (adaption)
 Check/improve the grid
 Check units, scaling, reference values

Good practice in CFD (Bressloff) 89


Checklist (2)

• Validation

 Compare to experimental data


 Compare with other simulations
• Grid dependence
 At least 3 (preferably 4) different grid resolutions
 Select a sensible range of grids
 8 times 8?
• Time dependence
 At least 3 significantly different time step sizes
 Use engineering judgement and a sensible
Courant number.

Good practice in CFD (Bressloff) 90


Checklist (3)
• Solution scheme
 Pressure based (segregated) or density based
(coupled) solver ?
 Implicit or explicit ?
 At least 2nd order accuracy (in space and time)
 Set high under-relaxation parameters
 Monitor residuals, derived variables, point data
• Flow physics
 Post-process (Fluent, Fieldview, TecPlot,
Ensight)
 How meaningful ?
 Discuss results using graphical evidence
 Label all axes and figures

Good practice in CFD (Bressloff) 91


Checklist (4)

• Convergence problems

 Mesh quality (errors)


 Boundary conditions
 Under-relaxation
 First order and then switch to second order
• Slowness due to problem size
 Check memory and CPU power
 Consider running in parallel
o speed-up from multiple processors
o avoid paging through distributed memory

Good practice in CFD (Bressloff) 92


Checklist (5)

• Research the literature

• Journal and conference papers, reports etc


• Read the software manuals

Casey, M. & Wintergerste, T., 2000,


Special Interest Group on “Quality and
Trust in Industrial CFD”,
Best Practice Guidelines,
Version 1, ERCOFTAC.

Good practice in CFD (Bressloff) 93


http://www.ercoftac.org/ercoftac_news/wiki1/

Good practice in CFD (Bressloff) 94


Other resources: see articles and
papers in the Articles folder

• Software manuals

 Check recommended settings


• External aerodynamics best practice
• Marine CFD best practice guidelines
• Simulation versus reality
• Verification & validation

Good practice in CFD (Bressloff) 95


Summary – learning outcomes
Good Practice in CFD

Understand the key steps in setting-up, running and post-processing a CFD simulation.

Knowledge about the issues relating to each of these steps.

Appreciate the importance of verification (particularly with respect to mesh resolution and
the effect this has on results).

Understand the significance of the Reynold’s number.

Knowledge about turbulence model selection and the impact of mesh resolution close to
solid boundaries.

Appreciation of the critical need to read the CFD manuals (theory and user guides) and
other supporting literature.

96
And finally!
 http://www.soton.ac.uk/~nwb/lectures/GoodPracticeCFD

GoodPracticeCFD_2015.pdf

 CFD surgeries (Dr Zheng-Tong Xie) during semesters 1 & 2

 Blackboard (http://blackboard.soton.ac.uk/) CFD-SURG: enrolling code is


fluent

 ANSYS portal (use customer number 237419)

 Short video describing a new Part 4 module, Biomedical Implants and Devices:

https://coursecast.soton.ac.uk/Panopto/Pages/Viewer.aspx?id=4d40a575-1596-
433f-9941-a27b25154bad

Good practice in CFD (Bressloff) 97

You might also like