You are on page 1of 18

9.

Pre- and Post-Processing

 Pre-processing:
– creating geometry
– grid-generation
– governing equations
– boundary conditions

 Solving

 Post-processing

 Pre-processing

 Solving:
– discretisation
– solution of equations

 Post-processing

1
 Pre-processing

 Solving

 Post-processing:
– analysis
– visualisation

CFD Codes

 Commercial Codes:
– STAR-CCM+
– Fluent
– FLOW3D
– PowerFLOW
– COMSOL

 Open source:
– OpenFOAM
– CodeSaturne

 General portals:
– www.cfd-online.com

The Computational Mesh

2
Mesh Generation

 Function:
– to decompose the domain into control volumes

 Constraints:
– flow geometry
– capabilities of the solver

 Output:
– cell vertices (x, y, z)
– connectivity data

Mesh Arrangements

 Node locations (cell centres / vertices)

 Staggered / co-located

 Cell shapes (tetrahedra / hexahedra / arbitrary polyhedra)

 Structured (single- or multi-block) / unstructured

 Cartesian / curvilinear (orthogonal / non-orthogonal)

 …

Storage Locations

cell-centred cell-vertex

u p

staggered

3
Cell Shapes

 2-d: triangles, quadrilaterals, …


 3-d: tetrahedra, hexahedra, …

hexahedron tetrahedron

Areas and Volumes

 Vector areas are needed to compute fluxes:


mass flux: ρu A

diffusive flux:  Γ  A

 Volumes are needed to compute amounts and averages:


amount in cell: ρV

Face Areas

Triangles s2
A
A  12 s1  s 2
s1
A

r4
Quadrilaterals r3
 4 points are not necessarily coplanar
 Vector area is independent of spanning surface
A
A  12 d13  d24  12 (r3  r1 )  (r4  r2 )
r2
r1

4
Some Vector Calculus (Not Examinable)
  
( , , ) is both a vector and a differential operator
x y z

  
Gradient: grad ()    ( , , )
x y z

f x f y f z
Divergence: div f    f   
x y z
i j k
  
Curl: curl f    f 
x y z
fx fy fz

Integral Theorems
  f  dA
Gauss’ Divergence Theorem:    f dV  
V
V

   f  dA   f  ds
Stokes’ Theorem:  
A A

Volumes

Position vector: r  ( x, y, z )

x y z
Divergence:  r    3
x y z

Integrate over an arbitrary closed volume V:


 
   r dV   3 dV
V V

Use the divergence theorem:


 r  dA  3V

V

V 
1
 r  dA
3 V

Volumes
V 
1
Arbitrary volume:  r  dA
3 V

1
General polyhedron: V r f  A f
3 faces

Tetrahedron Hexahedron

s3
s1

s2

V  s1  s 2  s 3
1
6
V  13 r
faces
f Af

r f  14 (r1  r2  r3  r4 )

5
2-D Case

 Treat as cells of unit depth


 The “volume” of the cell is then the planar area V

 Outward “face area” vectors derived from Cartesian projections:


x
0  Δy 
-x ΔA   
s   Δx 
y y
0 (cell boundary traversed anticlockwise)
A

Cell-Averaged Derivatives
   1   1 1

1
    dV    (e x ) dV    e x  dA   dAx
 x  av V V x V V V
V
V
V

    1
x
   (,0,0)   
 x  av V

faces
f A fx

1
( av 
1
  dA
() av 
V
 f Af
V faces
V

An
Hexahedra:
1 Aw n
() av  w A w  e A e  s A s  n A n  b Ab  t At ) w e
V
s Ae

As
Cartesian cell:
 e  w e Α   w Α 1
area A

x

Δx

AΔx
 (e Αex  w Αwx )
V
V
x

Example

A tetrahedral cell has vertices at A(2, –1, 0), B(0, 1, 0), C(2, 1, 1) and D(0, –1, 1).

(a) Find the outward vector areas of all faces. Check that they sum to zero.
(b) Find the volume of the cell.
(c) If the values of  at the centroids of the faces (indicated by their vertices) are
BCD = 5, ACD = 3, ABD = 4, ABC = 2,
find the volume-averaged derivatives    ,    ,   
 
 x  av  y  av  z  av

6
Example

In a 2-dimensional unstructured mesh, one cell has the


form of a pentagon. The coordinates of the vertices are
as shown in the figure, whilst the average values of a (1,3)
scalar  on edges a – e are: c
b

a = –7, b = 8, c = –2, d = 5, e = 0 (5,1)


(-3,0)

d a
Find:
(-2,-3)
(a) the area of the pentagon; e
      (2,-4)
(b) the cell-averaged derivatives   ,  
 x  av  y  av

Example
The figure shows the vertices of a single triangular cell in a 2-d unstructured finite-
volume mesh. The accompanying table shows the pressure p and velocity (u,v) on
the faces marked a,b,c at the end of a steady, incompressible flow simulation.
(3,5)

edge p u v
a 3 5 –1 c
b 5 7 –5 b
c 2 uc –6 y, v
Find: (1,1)
a
(a) the area of the triangle; x, u (4,0)

(b) the net pressure force (per unit depth) on the cell;
(c) the outward volume flow rate (per unit depth) for all faces;
(d) the missing velocity component uc;
(e) the cell-averaged velocity gradients u/x, u/y, v/x, v/y.
(f) Define, mathematically, the acceleration (material derivative) Du/Dt. If the
velocity at the centre of the cell is u = (16/3,–4), use this and the gradients from
part (e) to calculate the acceleration.

Structured Grids
Control volumes indexed by (i, j, k)

Cartesian Curvilinear

7
Unstructured Grids

Fitting Complex Boundaries


− Blocking Out Cells

 Implemented by a source-term modification:


aP  P   aF  F  bP  sP  P bP  0, sP  (large number )
F

P 
a F F
0
aP  large number

 A lot of redundant matrix operations for cells inside block

Fitting Complex Boundaries


− Volume-of-Fluid (VOF) Approach

f=0

f=1 0<f<1

f=0

 One way of handling free-surface calculations.


 For moving surfaces, solve a transport equation for fluid fraction f.
 Related technique: level-set method.

8
Fitting Complex Boundaries
− Curvilinear (Body-Fitted) Grids

Curvilinear Grids
d
(amount)   (advection  diffusion )  source
dt faces

=
const.

Diffusion: con
st.
E =
– also requires derivatives parallel to cell faces
P
    P 
Γ A  Γ E  A
n  Δ PE 

v
Advection: u
– all velocity components contribute to mass flux

Fitting Complex Boundaries


− Multi-Block Grids

2 3 4 2 3 4
1 5 1 6 7 8 5

6 7 8
4 5
1 2 3
 Multiple structured blocks
 Grid lines may or may not match at block boundaries
 Arbitrary interfaces allow non-coincident grid vertices
 Sliding grids used for rotating machinery (pumps; turbines)

9
Fitting Complex Boundaries
− Overset (Chimera) Grids

Disposition of Grid Cells

 Local refinement needed where gradients are large:


– solid boundaries
– shear layers
– separation, reattachment and impingement points
– discontinuities (shocks, hydraulic jumps)

 Grid-dependence tests necessary

 Turbulent calculations impose constraints:


– low-Re calculations: y+ < 1 (ideally)
– wall-function calculations: 30 < y + < 150 (ideally)

Multiple Levels of Grid

 Used to confirm grid independence

 Exploited by multi-grid methods

 Permit estimation of error (and solution improvement)


by Richardson extrapolation

10
Richardson Extrapolation

Order n  error  Δn

Δ   *  CΔn
2Δ   *  C (2Δ) n

2 n Δ   2 Δ Improved solution by weighted


* 
2n  1 average from two meshes

 2 Δ  Δ Estimate of error from difference


CΔn 
2n  1 between solutions on two meshes

Example

A numerical scheme known to be second-order accurate is used to


calculate a steady-state solution on two regular Cartesian meshes A
and B, where the finer mesh A has half the grid spacing of mesh B. The
values of the solution  at a particular point are found to be 0.74 using
mesh A and 0.78 using mesh B. Use Richardson extrapolation to:

(a) estimate an improved value of the solution at this point;

(b) estimate the error at this point using the mesh-A solution.

Lewis Fry Richardson


Father of modern weather forecasting

11
Summary of Grids
 Dictated by:
– flow geometry
– solver capabilities

 Grid generator provides vertex and connectivity data


 Vector geometry to find areas, volumes and cell-averages
 Structured/unstructured meshes
 Complex geometries via:
– blocked-out cells
– volume-of-fluid methods
– curvilinear (body-fitted) meshes
– multiblock grids
– overset meshes

 Cell density higher in rapidly-varying regions

Boundary Conditions

Boundary Conditions
 Inlet:
– velocity inlet
– stagnation / reservoir inlet

 Outlet:
– standard outlet
– pressure boundary
– radiation boundary

 Wall:
– non-slip (rough/smooth; moving/stationary; adiabatic/heat-transfer)
– slip (inviscid case)

 Symmetry plane
 Periodic boundary
 Free surface

12
Flow Visualisation

Uses of Flow Visualisation

 Understanding flow behaviour


 Locating important regions
 Summarising data
 Optimising design
 Finding reasons for non-convergence
 Publicity

Types of Plot

 x-y line graphs


 Contour plots
 Vector plots
 Streamline plots
 Mesh plots
 Composite plots

13
x-y Graphs

x-y Graphs
− Assessment

• Simple

• Widely-available software

• Precise and quantitative

• Direct comparison with experimental data

• Linear or logarithmic scales

• Limited view of flow field

Contour Plots

14
Contour Plots
− Assessment

 Isoline (2D) or isosurface (3D)

 Optional smooth or discrete colour shading

 Global view of the flow

 Geometric spacing of lines indicates gradient

 Not as quantitative as line graphs

 Miss detail in small, but important, flow regions

Vector Plots

Vector Plots
− Assessment

 Direction and magnitude


 Used to plot vector quantities (velocity and stress)
 May be coloured to indicate magnitude
 Excellent first indication of flow behaviour
 Interpolation often necessary for non-uniform grids
 Not good in flows with wide range of magnitudes
 Miss important detail in small regions
 Orientation effects deceptive in 3d

15
Streamline Plots

Calculating Streamlines

dx
3D: integrate a particle path u
dt

2D: contour the stream function

2 2 dψ  u dy  v dx  volume flux
volume flux
dy u
ψ ψ
dx u , v
1
1 y x
-v

Example

(a) Two adjacent cells in a 2-dimensional Cartesian mesh are shown below, along
with the cell dimensions and some of the velocity components (in m s–1) normal
to cell faces. The value of the stream function  at the bottom left corner is
 A = 0. Find the value of the stream function at the other vertices B to F. (You
may use either sign convention for the stream function.)

D E 2 F
2 3 1 0.1 m
5
A B C
0.3 m 0.2 m

(b) Sketch the pattern of streamlines across the two cells in part (a).

16
Mesh Plots

Composite Plots

Composite Plots

17
Composite Plots

18

You might also like