117
Fluid Dynamics CYCLONE Dolfyn Developers Guide DRAFT CFD-08xxxx 1st December 2008 Cyclone Fluid Dynamics B.V. Sweelincklaan 4 Tel.: +31-40-22 30 491 Web: www.cyclone.nl NL–5583 XM Waalre Fax.: +31-40-22 30 490 email: [email protected]

dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Dolfyn Developers Guide

DRAFT

CFD-08xxxx1st December 2008

Cyclone Fluid Dynamics B.V.Sweelincklaan 4 Tel.: +31-40-22 30 491 Web: www.cyclone.nlNL–5583 XM Waalre Fax.: +31-40-22 30 490 email: [email protected]

Page 2: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent
Page 3: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Dolfyn Developers Guide

DRAFT

Cyclone Fluid Dynamics BV

Author:H.W. Krüs

CFD-08xxxxCyclone Fluid Dynamics B.V.

1st December 2008

Copyright c© Cyclone Fluid Dynamics B.V., 2008. All rights reserved.

Cyclone Fluid Dynamics B.V.Sweelincklaan 4 Tel.: +31-40-22 30 491 Web: www.cyclone.nlNL–5583 XM Waalre Fax.: +31-40-22 30 490 email: [email protected]

Page 4: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

ii

Page 5: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Preface

This is just a collection of notes, thoughts and ideas about the dolfyn code. Donot expect a decent structure nor an in depth methodology manual. Consult forthe latter the various appropriate text books.

Thanks to Yousef Saad of University of Minnesota, Department of ComputerScience and Engineering for Sparsekit2 (www-users.cs.umn.edu/∼saad/) andthe people behind Lapack (www.netlib.org/lapack/) and countless others likethose involved in the Hypre and VisIt packages at Lawrence Livermore(www.llnl.gov/CASC/linear_solvers/ respectively www.llnl.gov/visit/)

A special thanks goes to Franco Magagnato of the Department of Fluid Ma-chinery, University of Karlsruhe, for sharing his Sparc code years ago (Struc-tured PArallel Research Code). Sparc showed and proved the concept of f95and MPICH on a heterogeneous network consisting of different machines andoperating systems. Within a day the code was up and running over a networkwith Alpha/Unix and PC/Linux workstations. A quality statement for the threepieces of software involved (Sparc, f95 and MPICH).

Thanks also to those involved in for example TEX, LATEX and pdfTEX, xfig,NEdit, the Gimp, Perl, Gnu and Linux. Intel made it’s contribution by releasingtheir Intel Fortran95 compiler (ifc/ifort) for free to the Linux community. Andof course, Andy Vaught for his amazing work on g95 (www.g95.org). Thanksto IBM for Data Explorer or OpenDX as it is now called (www.opendx.org). Animpressive tool. Also CiteSeer at Penn State was, and is, very useful.

Simplicity and accuracy are the keywords. This means for example that there areno 2D and axisymmetric modes of the code. Also readability is more importantthan speed (rely instead on the quality of today’s compilers and on the arraysyntax of f95).

Dolfyn is based on the ideas, algorithms, and procedures presented in the bookby Joel Ferziger & Milovan Períc ‘Computational Methods for Fluid Dynamics’[13]. This book is also acts as Theoretical Manual.

Dolfyn contains contributions by Thomas Geenen, Johan Jacobs, Shibo Kuang,Max Staufer, Bouke Tuinstra.

Enjoy!

CFD-08xxxx iii

Page 6: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

iv

Page 7: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Contents

Preface iii

Contents v

List of Figures vii

1 Introduction 11.1 Fortran 9x 31.2 Further reading 4

2 A transported scalar 92.1 Conservation of momentum 122.2 Diffusion term and non-orthogonal meshes 142.3 Calculation of wall shear stresses 14

2.3.1 Calculation of turbulent wall shear stresses 152.3.2 Rough walls 16

2.4 Residuals 16

3 Convective term and differencing schemes 213.1 Standard upwind differencing, UD 253.2 Second order central differencing, CD 25

3.2.1 Linear interpolation, CD1 253.2.2 Gradient based averaging, CD2 253.2.3 Simple averaging, CD3 26

3.3 Blended differencing 263.3.1 Constant blending 263.3.2 Variable blending, hybrid scheme 263.3.3 Variable blending, power law scheme 26

3.4 Second order linear upwind differencing, LUD 273.5 Third order linear upwind differencing, QUICK 273.6 Second order switching schemes 28

3.6.1 MinMod differencing, MinMod 283.6.2 Gamma differencing, GAM 283.6.3 Third order monotone upstream, MUSCL 28

3.7 Discusion 29

4 Calculation of gradients 334.1 Gauss 334.2 Least squares 334.3 Gradient limiters 35

4.3.1 Barth and Jespersen 354.3.2 Van Albada 36

CFD-08xxxx v

Page 8: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

4.3.3 Venkatakrishnan 394.3.4 Polynomial function 404.3.5 Uniform regions 41

4.4 Discussion 42

5 Heat transfer 435.1 Laminar heat transfer 455.2 Turbulent heat transfer 45

6 Lagrangian particles 476.1 Basic equations 47

6.1.1 Drag force 476.1.2 Virtual mass force 486.1.3 Body forces 486.1.4 Adding all forces 48

6.2 Integrating particles in time 516.3 Particle within a cell 526.4 Intersecting a cell face 536.5 Interpolating velocities 546.6 Examples 56

Appendices 63

A Geometry input files 65

B Verification with equidistant Lid Driven Cavity tests 67

C Various tests 83C.1 C1 Unstructured 83C.2 C3 Leonard tests 84C.3 C6 Wedges 87C.4 C7 Mesh jump 88C.5 45 degrees lid driven cavity 89C.6 Lid driven cavity with tetrahedral cells only I 90C.7 Lid driven cavity with tetrahedral cells only II 91C.8 Walls with tetrahedral cells only 92C.9 Stagnation flow with tetrahedral cells only 93C.10 Stagnation flow with polyhedral cells 94

D Mathematical toolbox 95D.1 Gauss’ theorem 95D.2 Sum of two vectors 95D.3 Multiplying a vector 96D.4 Length of a vector and vector products 96

Bibliography 101

Index 105

vi

Page 9: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

List of Figures

1.1 Dolfyn data and result files 21.2 Example Fortran95 code 3

2.1 An arbitrary control volume 102.2 Correction 112.3 Over relaxed non-orthogonal treatment 15

3.1 Definition of upwind, central and downwind nodes 223.2 Convection Boundness Criterion with UDS, CDS and LUDS 233.3 283.4 Smart, MinMod and Gamma-schemes 29

4.1 Average as a result of fraction x 374.2 Influence of the bias ε2 on the van Albada function 384.3 Venkatarishnan limiter vs Barth Jespersen and van Albada. 404.4 Transition function s(x) 42

5.1 Heat transfer near a wall 44

6.1 Characteristic response of a particle to forces 496.2 Example of particles passing through cells 526.3 Example of particle inside and outside of a cell (red) 536.4 Particle intersects face 536.5 Free falling particles, influence of particle Courant number 566.6 Free falling particles, details showing steps within cells 576.7 Particles in a stagnation flow 586.8 Particles in a stagnation flow, influence of particle Courant num-

ber 596.9 Small particles/streamlines in a stagnation flow 606.10 Small particles/streamlines in an 45 angle test 61

A.1 Cell definitions 65

B.1 Streamlines at Reynolds 25, 100, 400, 1,000, 3,200, 5,000, 7,500and 10,000 with 128x128 and LUX 70

B.2 Velocity magnitude at Reynolds 25, 100, 400, 1,000, 3,200,5,000, 7,500 and 10,000 with 128x128 and LUX 71

B.3 Results from Ghia et.al 72B.4 Reynolds 25 73B.5 Reynolds 100 74B.6 Reynolds 400 75B.7 Reynolds 1,000 76B.8 Reynolds 3,200 77

CFD-08xxxx vii

Page 10: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

B.9 Reynolds 5,000 78B.10 Reynolds 7,500 79B.11 Reynolds 10,000 80B.12 Reynolds 10,000 at 256x256 and influence of differencing scheme

(UD, CD, CD1, LUD, Gamma, MinMod, LUX) 81

C.1 C1 UD, CD(0.8), CD1, CD2, LUD, Gamma 83C.2 Leonard step UD, CD(0.8), CD1, CD2, LUD, Gamma, Min-

Mod, LUX 84C.3 Leonard semi UD, CD(0.8), CD1, CD2, LUD, Gamma, Min-

Mod, LUX 85C.4 Leonard sin2 UD, CD(0.8), CD1, CD2, LUD, Gamma, Min-

Mod, LUX 86C.5 C6 Wedges UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod,

LUX 87C.6 C7 Jump UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod, LUX 88C.7 45 degrees UD, CD(0.8), LUD, Gamma 89C.8 m3a lid driven cavity, UD, CD(0.8), LUD, Gamma 90C.9 m5a lid driven cavity, UD, CD(0.8), LUD, Gamma 91C.10 m5b left to right with UD, CD(0.8), LUD, Gamma 92C.11 m5c stagnation flow with UD, CD(0.8), LUD, Gamma 93C.12 m6 stagnation flow with UD, CD(0.8), LUD, Gamma 94

D.1 Sum of two vectors 96D.2 Inner product of two vectors (hashed area of outer product) 97D.3 Vector components near a wall 99

viii

Page 11: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

The purpose of computing is insight, not numbers.

R. Hamming, 1962

CFD-08xxxx ix

Page 12: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

x

Page 13: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

1 Introduction

Heat and mass transfer, transport phenomena, and fluid dynamics play an im-portant role in various products, machines and in our daily life.

Examples are:

• Automotive industry

– External flow around vehicles

– Fouling

– Thermal passenger comfort

• Heating and cooling

– Heat exchangers

– Cooling of electronics

• Flows in pipes and tubes

– Industrial installations

– Air conditioning

• Wind in the built environment

– Wind forces

– Wind nuisance for pedestrians and cyclists

• Process technology

dolfyn is a face based implicit Finite Volume Method code, employing primitivevariables on 3D unstructured polyhedral meshes targeted towards these indus-trial type of problems.

dolfyn is accompanied by a preprocessor. The preprocessor writes a geometryfile in a format suitable for dolfyn. The input is a set of three files which describethe cells, vertices en the boundaries (see Appendix A). Dolfyn reads the geo-metry file and a separate input file (format is described in a separate document).In this input file the user sets numerical and model data, boundary conditionsetc. The input file can be edited with any simple editor. The file structure isshown in Figure 1.1.

The code uses a ‘segregated solver’ which means that the transport equationsare solved sequentially. Because the coupled non-linear equations have been

CFD-08xxxx 1

Page 14: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 1 Introduction

standard editor

Hypermeshothers ...ICEM/CFD

result translator

OpenDX GMV others ...

opendx data file (*.odx)

restart file

restart data file (*.rst)

control data deck (*.din)

DOLFYN

grid preprocessor

grid data (*.geo)

geometry data (*.cel *.vrt *.bnd)

output files (*.txt)

output

Figure 1.1: Dolfyn data and result files

linearised implicitly, several iterations are needed in order to get a convergedsolution. Using the currently known fluid properties and mass fluxes the threemomentum transport equations are solved. At this stage the continuity equationmay not be satisfied and a pressure correction is set up. This correction is solvedto obtain the correct pressure and velocity fields and the mass fluxes at the facessatisfy the continuity equation. After this stage the transport equations for theturbulence models, energy or species is solved. Finally the fluid properties areadjusted and the process is repeated until convergence.

The grid or mesh used by dolfyn is based on ‘face based unstructured polyhedralcells’. Unstructured does not mean tetrahedral cells only (in 3D, or triangles in2D), but refers to the way the topology is implemented. In using polyhedra anytype of mesh can be used, even ‘structured hexahedra’s’. It only depends on thekind of preprocessor, or ‘mesher’, or ‘grid generator’ one is using. The sameapplies to the postprocessor to visualise the final results; a postprocessor whichonly can handle hexahedral cells is of no use when one employs tetrahedral cells.On the other hand results of hexahedral cells can be converted to a tetrahedralstructure and displayed (this technique is partly used for OpenDX for example).However, ‘real polyhedra’ still pose a problem (except, maybe, for GMV, butGMV is not Open Source). Thus dolfyn is never the limiting code in the processand it all depends on the kind of, favourite, pre- and postprocessors at hand.

2

Page 15: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

1.1 Fortran 9x Fluid DynamicsCYCLONE

1.1 Fortran 9x

Dolfyn uses Fortran? But isn’t that hopelessly old fashioned?

Lots of people who have not encountered the latest Fortran compilers react inthis way. Fortran 77 is indeed a bit ‘old fashioned’ and had some serious limita-tions (however not it’s speed).

The language was developed way back in 1954 at IBM and has been updatedsince. Well known versions are Fortran IV (or Fortran 66), Fortran 77 (the wellknown old standard), Fortran 90 and soon followed by Fortran 95. In 2003further enhancements were made, notably enhancements of derived types, asyn-chronous transfer, stream access and procedure pointers and, very important,much improved interoperability with the C programming language. If numbercrunching is what you are up to then Fortran (95+) still is the best horse for yourcourse. With g95 and f03gl you can even do OpenGL!

Modern Fortran is also highly portable. It is relatively easy to write an entirelyportable program in Fortran, even without recourse to a preprocessor. Nor doesone needs tools like the configure and build system (‘automake’, ‘autoconf’,and ‘configure’ etcetera). Hunting down ‘include files’ all over the place andfile name case sensivity are absent (something one has to take care of whendeveloping a multiplatform solution). And finally, not to mention Fortran’s vec-torisation and parallelisation capalilities are excellent.

If the before mentioned arguments are not enough. Well, the most importantargument for Fortran is it’s readability. Even people who hardly know the lan-guage can read and understand the code (see the example in Figure 1.2). “An-other important point is that the time required to learn Fortran 90 is much lessthan the time to learn either C or C++. ... But the issue is what freshmen shouldlearn as their first language and for that I would recommend Fortran 90 handsdown.”1 Readability should not be underestimated since it is the core of thepeer-reviewed human eye parallel debugging device.

.

.Xn = Face ( i )%n ! sur face vec to rc a l l normal ise (Xn) ! normal vec to r w i th leng th 1

Up = Up − Uw ! v e l o c i t y d i f f e r e n c e vec to r

dp = dot_product ( Up , Xn ) ! dot product o f the two vec to rsUn = dp ∗ Xn ! normal v e l o c i t y componentUt = Up − Un ! t a n g e n t i a l v e l o c i t y component..

Figure 1.2: Example Fortran95 code

1"Fortran 90 vs C++ - An educational perspective", by Dr. John K Prentice, Quetzal Com-putational Associates, 1996. Note that Fortran 90 is addressed and advocated, imagine Dr.Prentice’s enthusiasm about Fortran 95 or even Fortran 2003.

CFD-08xxxx 3

Page 16: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 1 Introduction

The current July 2008 version of dolfyn only consists of about 25,000 lines ofFortran code. About 60% of it, in the order of 15,000 lines of code, is actuallyrelated to dolfyn itself. 16% of the lines only deal with reading the din controlfile and setting the control parameters (easy of use always tends to increase the‘interactive part’ of a code). Another 10% are subroutines for the various out-put interfaces. Finally 18% accounts for the Fortran77 SparseKit2 and Lapacksubroutines.

1.2 Further reading

Of course the basics of dolfyn can be found in Ferziger and Períc’ ‘Compu-tational Methods for Fluid Dynamics‘ [12][13]. Older classic textbooks are byRoache [36] and Patankar [31], the influence of the latter is not to be underestim-ated. Today ‘Patankar’ is useful as an introduction but ‘proves’ that a co-locatedcode, like dolfyn, is not feasible. The breakthrough came with the Rhie andChow paper [34] in 1983. But ‘staggered grids’ today still have their supporterslike Wesseling [51][49].

Dolfyn relies heavily on the work and theses by people like Spalding, Gosman,Issa, Jasak, Weller and many others at Imperial College and in Britain (examplesare [17][32][25]). Imperial College is at the roots of various leading commer-cial CFD codes (from the seventies, early eighties onwards). Spalding startedin mid 70’s with Concentration Heat and Momentum Ltd (CHAM) in Wimble-don and in 1981 (single block hexahedral structured) Parabolic Hyperbolic OrElliptic Numerical Integration Code Series, or PHOENICS, appeared. Fluent hasit’s (ancient) roots at Sheffield and saw it’s first launch in 1983 by Creare Inc2.Computational Dynamics was founded in 1987 in London by Gosman and Issaand they launched Star-CD, from version two onwards hexahedral unstructured.Down the road in Harwell/Oxford the UK Atomic Energy Authority (AEA) re-leased the multi-block structured Flow3D, later known as CFX3.

Another stronghold is the T-3 group at Los Alamos [27] were k-ε was born in1967 [19][20][18] and the Volume-Of-Fluid, VOF, method in the eighties. LosAlamos has a long tradition in open source codes (the Marker-and-Cell, MAC,method by Harlow and Welch, the first successful code with primitive variablesthanks to a novel staggered scheme [14][21][48][5]. Followed by ‘SOLA’ [24],‘SOLA-VOF’ by Hirt and Nichols [30], Arbitrary Lagrangian-Eulerian or ALE[23] and other codes, and the impressive ‘Kiva’ series of combustion codes byHirt, Amsden and others [35][8][7][15][6][3][4].

Yet another world of CFD applications originates naturally from the aerospaceworld. Here too the vast majority of the codes were multi-block structuredcodes see for example the interesting introductions as Anderson’s ‘Computa-

2Fluent acquired Fluid Dynamics International (FDI) and it’s Finite Element Method basedpackage Fidap. Fluent was bought by Ansys in 2006.

3Later the privatised part of AEA, called AEA Technology, aquired Canadian Advanced Sci-entific Computing (ASC) and it’s coupled solver TASCflow in 1997. CFX was bought byAnsys in 2003.

4

Page 17: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

1.2 Further reading Fluid DynamicsCYCLONE

tional Fluid Dynamics: The Basics with Applications’ [9] or ‘ComputationalFluid Mechanics and Heat Transfer’ by Tannehill, Anderson and Pletcher [41].Tetrahedral unstructured codes were rare and some of the techniques used forthese kind of codes now start to appear in the general purpose codes.

More on boundary layers can be found in Schlichting [38], and on turbulencestart with Tennekes and Lumley [42] and then Hinze [22]. Turbulence modellingfor CFD is dealt with by Wilcox [50]. Another book with much attention tomodelling is Pope’s ‘Turbulent flows’ [33].

On general working with CFD one can use Versteeg and Malalasekera’s ‘An In-troduction to Computational Fluid Dynamics’ (use the latest 2007 edition [47]instead of the 1995 edition [46]). Shaw’s ‘Using Computational Fluid Dynam-ics’ [39] is even older (1992) and is today not so useful anymore.

Do not start with the numerics without proper background in fluid dynamics.Consult your local popular textbooks. And keep Van Dyke’s ‘Album of fluidmotion’ [44] and other books like ‘Visualized Flow’ by Nakayama [29] at hand.

CFD-08xxxx 5

Page 18: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 1 Introduction

6

Page 19: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

1.2 Further reading Fluid DynamicsCYCLONE

Just as with buses, so with Open Source compilersfor Fortran95: you wait ages for one, then two arrive at once.

Clive Page

CFD-08xxxx 7

Page 20: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 1 Introduction

8

Page 21: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

2 A transported scalar

The basic ideas of how a transport equation can be solved will be illustrated inthis chapter.

The basis is formed by the assumption that a variable varies within a controlvolume according to

φ(~x) = φP + (~x− ~xP ) · (∇φ)P . (2.1)

With the centroid ~xP defined as:∫VP

(~x− ~xP ) dV = 0. (2.2)

Now when equation (2.1) is integrated over volume V results in∫VP

φ(~x) dV =∫VP

φP + (~x− ~xP ) · (∇φ)P dV

= φP

∫VP

dV + [∫VP

(~x− ~xP ) dV︸ ︷︷ ︸=0

] · (∇φ)P

= φPVP (2.3)

This means that equation (2.2) is an essential geometrical proposition. Because~xP is in the centre and the variable varies linearly; the value of φ at P is equalto the mean value, and therefore

∫V φ(~x)dV is equal to φPVP with second order

accuracy.

Imagine a known flow field (which might be at rest as well) in which the scalarquantity φ like a temperature or a concentration is transported. For some controlvolume one can write down the following conservation equation:

∂t(ρ φ)︸ ︷︷ ︸

unsteady term

+ div( ρ ~vr φ )︸ ︷︷ ︸convective term

= div( Γφ grad φ )︸ ︷︷ ︸diffusive term

+ qφ︸︷︷︸source term

. (2.4)

Where ~vr is the relative velocity (~v − ~vc) between the fluid moving with ~v andthe sweeping coordinate velocity ~vc.

It simply states that the change in time of φ is the result of the balance betweenthe transport (convection) and diffusion in and out of the the control volume,and, when present, the result of a source (or sink).

Equation (2.4) for an arbitrary moving volume V with surface S transforms into

d

dt

∫Vρ φ dV +

∫S

(ρ ~vr φ) · d~S =∫S

( Γφ grad φ) · d~S +∫Vqφ dV (2.5)

CFD-08xxxx 9

Page 22: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

N faces = 7

y

f = 6

x

f = 7

f = 1

f = 2

f = 3

f = 4

f = 5

P

Figure 2.1: An arbitrary control volume

where ~S is the surface vector and the relative velocity is now related to themoving surface.

For steady state cases without sources (or sinks) this equation reduces to a simpleconvection/diffusion equation:

div( ρ ~v φ )− div( Γφ grad φ ) = 0 (2.6)

or using Gauss’ theorem∫Sρφ~v · ~n dS −

∫S

Γ grad φ · ~n dS = 0 (2.7)

and can be casted into:

Nfaces∑f=1

F cf −Nfaces∑f=1

F df = 0

orNfaces∑i=f

(F cf − F df ) = 0

withF cf =

∫Sρφ~v · ~n dS ≈ mfφf (2.8)

and mf as the mass flux through face ‘f’:

mf =∫Sf

ρ~v · ~n dS ≈ (ρ~v · ~n)f Sf (2.9)

As the face can be arbitrarily oriented all the velocity components can contributeto the mass flux. Thus each velocity component is multiplied by the correspond-ing surface vector component (see 8.6.1).

mf = ρf (Sxux + Syuy + Szuz)f (2.10)

Now assume that the fluid properties ρ and Γ are known (eg. from a previousiteration). Then the value of φ and its gradient normal to the cell face is needed.

10

Page 23: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

npx

∆1∆2∆1

∆2∆1 xf

xf’x

+

λ =

x

y

P

N

Figure 2.2: Correction

Recall that the normal of a cell face is positive directed outwards (in Dolfyndefined by the Face(i)%cell1 and Face(i)%cell2, the first one is by definitionnode ‘p’ and the second, if present, the ‘next’ node ‘n’).

The values at the faces are needed at the face centre. The second order linearinterpolation of two φ’s is on a equidistant grid:

φf =φP + φN

2

and for non-equidistant grids:

φf = λfφN + (1− λf )φP (2.11)

with λ defined as:λf =

xf − xPxN − xP

(2.12)

The factor λ can be calculated and stored in advance. This is the ‘central differ-encing scheme’ (CDS).

For non-smooth grids however the before mentioned accuracy will probably belost. The value is not evaluated at ~xf but at ~xf ′ which is defined by the ratio ofthe original lengths (λ) and lies on the straight line connecting the two centres.Part of the accuracy can be restored if one evaluates the gradient of φ at ~xf ′(= (∇φ)f ′ ) and travels from ~xf ′ to ~xf . This is shown in Figure 2.2.

For equidistant grids, and some smooth expanding grids, the correction is notnecessary (~xf ′ − ~xf = 0). For highly distorted grids the procedure might be re-peated several times (hence the variable Ngrad in subroutine GradientPhiGauss).

There is also a simpler first order method called ‘upwind differencing scheme’(UDS), in which the upstream nodal value is used:

mf =φP if (~v · ~n)f > 0φN if (~v · ~n)f < 0

(2.13)

The upwind differencing scheme is robust and never results in under- or over-shoots, nor is it oscillatory. However, it is inaccurate especially when the flow is

CFD-08xxxx 11

Page 24: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

oblique trough the cell face. Thus it is possible to combine both scheme’s into ablended or hybrid scheme:

Ff = (1− β) F udsf + β F cds

f (2.14)

or the using a deffered correction approach

Ff = F udsf︸︷︷︸

implicit

+ γ(F cdsf + F uds

f

)old

︸ ︷︷ ︸explicit

(2.15)

a hybrid scheme in which the higher order scheme is evaluated explicitely as acorrector step to the stable lower order implicit scheme.

Thus the flux can be approximated by:

F cf =

max(mf , 0) φP + min(mf , 0) φN for UDSmf (1− λf ) φP + mfλf φN for CDS

(2.16)

For the diffusive fluxes one needs the gradient vector at the cell face centre. TheCDS scheme is normally used:

F df =∫Sf

Γ grad φ · ~n dS ≈ (Γgrad φ · ~n)f Sf (2.17)

For simple grids one can simply use:(∂φ

∂n

)face

= (∇φ)face · ~xface ≈φN − φP|~xN − ~xP |

As both values at P and N show up; this relationship can be used simply in animplicit form:

However this form is too simple for complex meshes. A correction term isdiscussed in paragraph XXX.

So for one control volume there are a number of fluxes, each of them relatedbetween the central node ‘P’ and the neighbour defined by the face.

surface area components sx, sy and sz ==> normal

2.1 Conservation of momentum

Consider the conservation equations for mass and momentum in the form ofequation (2.4) for an arbitrary moving volume V with surface S:

d

dt

∫Vρ dV +

∫S

(ρ ~vr) · d~S = 0

andd

dt

∫Vρui dV +

∫S

(ρui~vr) · d~S =∫S

~T · d~S +∫Vρbi dV

12

Page 25: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

2.1 Conservation of momentum Fluid DynamicsCYCLONE

With bi the ‘body force’ in the direction of the Cartesian coordinate xi (forexample gravity, centrifugal and Coriolis forces, electromagnetic forces etc.).

The stress tensor ~T is the molecular rate of transport of momentum and incor-porates the surface forces (pressure, normal and shear stresses, surface tensionetc.).

Introducing the outwards pointing unit normal ~n to surface d~S = ~ndS resultsin:

d

dt

∫Vρ dV +

∫S

(ρ ~vr) · ~n dS = 0 (2.18)

and

d

dt

∫Vρui dV +

∫S

(ρui~vr) · ~n dS =∫S

~ti · ~n dS +∫Vρbi dV (2.19)

For isotropic Newtonian fluids the components τij , of the viscous stress tensorare:

τij = −p δij + µ

(∂ui∂xj

+∂uj∂xi

)− 2

3δij µ div~v (2.20)

with the dynamic fluid viscosity µ and the Kronecker delta δij .

The stress tensor

Π =

τxx τxy τxzτyx τyy τyzτzx τzy τzz

with τxx = σx etc, and τxy = τyx, τxz = τzx and τyz = τzy only contains sixelements and is symmetric

Π =

σx τxy τxzτxy σy τyzτxz τyz σz

(2.21)

and the elements are

σx = −p− 23µ div ~v + µ( ∂u∂x+ ∂u

∂x )σy = −p− 2

3µ div ~v + µ( ∂v∂y + ∂v∂y )

σz = −p− 23µ div ~v + µ(∂w∂z +∂w

∂z )(2.22)

τxy = τyx = µ( ∂v∂x+ ∂u∂y )

τyz = τzy = µ(∂w∂y + ∂v∂z )

τzx = τxz = µ( ∂u∂z +∂w∂x )

(2.23)

With p as the local thermodynamic pressure. Pleas note that for incompressibleflows div ~v = 0.

Because the momentum equation (2.19) is a vector equation, the correspondingdiffusive term is ∂

∂xj(µ ∂ui

∂xj) or

∫S µ gradui · ~n dS (see FP 7.1.1).

One can extract the pressure p from equation (2.22)

CFD-08xxxx 13

Page 26: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

2.2 Diffusion term and non-orthogonal meshes

The discretisation of the diffusion term is:∫VP

∇ · (ρΓφ∇φ) dV =Nfaces∑f=1

~S · (ρΓφ∇φ)f

=Nfaces∑f=1

(ρΓφ)f ~S · (∇φ)f . (2.24)

If the mesh is orthogonal then the diffusion term is simply

~S · (∇φ)f = |~S|φN − φP|~d|

. (2.25)

Another method would be calculating the cell centered gradients

(∇φ)P =1VP

Nfaces∑f=1

~Sφf (2.26)

and interpolating to the cell face using (2.11) again:

(∇φ)f = λf (∇φ)N + (1− λf )(∇φ)P. (2.27)

However this approach cannot be used for non-orthogonal meshes [25].

The product ~S · (∇φ)f is split into two parts

~S · (∇φ)f = ~s · (∇φ)f )︸ ︷︷ ︸orthogonalpart

+ ~t · (∇φ)f )︸ ︷︷ ︸non−orthogonal corr.

. (2.28)

The two vectors ~s and ~k should give the surface again

~S = ~s+ ~t. (2.29)

Where ~s simply is parallel to ~d (= ~xP − ~xN ) and equation (2.25) can still beused.

In [25] the over-relaxed approach is chosen. The contribution of φP and φN isincreased when the non-orthogonality is increased.

2.3 Calculation of wall shear stresses

The viscous stresses near a wall are ([13] eq. (8.75)):

τnn = 2µ(∂vn∂n

)wall

= 0 , (2.30)

14

Page 27: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

2.3 Calculation of wall shear stresses Fluid DynamicsCYCLONE

S

s

k

d

y

x

N

P

Figure 2.3: Over relaxed non-orthogonal treatment

and

τnt = µ

(∂vt∂n

)wall

. (2.31)

In which the coordinate t is in the direction of the velocity vector near the wall.The third coordinate s is orthogonal to t and the normal n.

The surface integral of τnt results in a force:

~fwall =∫S

~t τnt dS ≈ (~t τnt S)S (2.32)

in which ~fwall points in the direction of ~t (with unit length) and magnitude τntmultiplied by the surface area S.

2.3.1 Calculation of turbulent wall shear stresses

In subroutine FluxUVW the effective wall shear stress is used. Yet in the lawof the wall the shear stress is calculated differently. Start with the laminarformulation:

τw = µeff

(∂U

∂n

)wall

(2.33)

or

τw = µeffUt∆n

(2.34)

CFD-08xxxx 15

Page 28: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

Rewriting

µeff =τw

Ut/∆n

=ρ u2

τ

Ut/∆n

=ρ u2

τ ∆nUt

=ρ uτ ∆n

µ

µ uτUt

=ρ uτ ∆n

µ

µ

Ut/uτ

=y+ µ

u+(2.35)

Finally the minimum viscosity possible is the laminar viscosity. Thus a simpletest on y+/u+ ≥ 1 is needed.

2.3.2 Rough walls

The law of the wall for a rough wall reads:

u+(z) =1κ

ln(z

ks

)+Brough , (2.36)

with ks as the sand roughness height, and Brough an empirical constant equal to8.5 (Schlichting).

Another description (used for atmospheric boundary layers) is:

u+(z) =1κ

ln(z − zdz0

), (2.37)

with zd as the displacement thickness and z0 an aerodynamic roughness para-meter.

In case zd = 0 the relationship between z0 and ks is:

z0 = ks/eκBrough . (2.38)

With Brough = 8.5 and κ = 0.4 follows z0 = 1/30 ks, and thus 20 z0 equals to2/3 ks.

2.4 Residuals

Consider the equation:A ~x = B .

16

Page 29: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

2.4 Residuals Fluid DynamicsCYCLONE

After some iterations the approximate solution is ~xn which is inexact and leavesa non-zero residual:

A ~xn = B − ~ρn .

or~ρn = B −A ~xn . (2.39)

This is an absolute residue and doe not give a clue of the degree of convergence.

In the subroutine ’Set_Normalisation_Factors’ the residuals are normalised us-ing the mass flux entering the domain:

Σmin =∑inlets

ρi (~ui ·Ai) (≡MP ) (2.40)

For the momentum equations the residual is normalised with the total momentumm~v entering the domain:

Mv =∑inlets

mi

√~ui · ~ui (2.41)

The turbulence energy:

Mk =∑inlets

mi (~ui · ~ui) (2.42)

The turbulent dissipation:

Mε =Mk

L/Vinlet(2.43)

Note that the latter contains an arbitrary length scale L (and is thus not a veryreliable measure).

All the above mentioned normalisation factors depend on the mass flux flowinginto the domain. In case there is no inflow then ....

CFD-08xxxx 17

Page 30: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

18

Page 31: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

2.4 Residuals Fluid DynamicsCYCLONE

Big whirls have little whirlsThat feed on their velocity;

And little whirls havesmaller whirls

And so on to viscosity.

L.F. Richardson, 1926

CFD-08xxxx 19

Page 32: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 2 A transported scalar

20

Page 33: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

3 Convective term and differencingschemes

The discretisation of the convection term is:∫VP

∇ · (ρ~vrφ) dV =Nfaces∑f=1

~S · (ρ~vrφ)f

=Nfaces∑f=1

~S · (ρ~vr)fφf

=Nfaces∑f=1

F φf (3.1)

were one recognises F as the mass flux through the face. Assume that the massflux is known and the process reduces to interpolating φ on the face.

One possibility was already introduced as equation (2.11) and it is called the‘Central Differencing Scheme’:

φf = λfφN + (1− λf )φP (3.2)

with λ defined as:λf =

xf − xPxN − xP

. (3.3)

For non-smooth grids a correction can be applied. This scheme is called ‘CD’in dolfyn.

Another central differencing scheme can be defined using the central nodes, thegradients and the distances towards the face center. The last step is averagingthe two found values:

φf =12

(φP +∇φP (~xf − ~xP ) + φN +∇φN (~xf − ~xN )). (3.4)

This scheme is available as ‘CD2’.

Finally a very crude, but simple, method is avaible (just for testing purposes)and that is simply averaging the values of φP and φN :

φf =12

(φP + φN ). (3.5)

Of course this scheme is second order for equidistant grids. This scheme isnamed ‘CD3’. This scheme is also used in [?, mathur]nd is the basis of thegradients a major CFD code.

CFD-08xxxx 21

Page 34: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

φ

φ

U

C

D

φ

U DC

flow direction

φf

face f

Figure 3.1: Definition of upwind, central and downwind nodes

All the central differencing schemes can cause unphysical, i.e. unbounded, res-ults.

The classic scheme which is guaranteed to be bounded is the ‘Standard FirstOrder Upwind Differencing Scheme’:

φf =φP if (~v · ~n)f > 0φN if (~v · ~n)f < 0

. (3.6)

See the classic texts and critics on the Upwind Scheme, Upstream Scheme,Donor Cell method, or ‘Pigpen method’1 of Roache in 1972 [36], or Patankar in1980 [31].

Next a combination of UDS and CDS is possible by blending the two schemes,or blending any second order scheme with UDS:

φf = (1− γ)φlow orderf + γφhigh order

f . (3.7)

were γ is a fixed constant for the domain.

Although in [13] it is claimed that a blend between UDS and CDS should besuffient, sometimes other bounded high resolution schemes are desired. Fol-lowing [25][26] and [11] the Normalised Variable Approach (NVA) is intro-duced. Under certain circumstances boundness can be achieved by introducinga small amount of first order numerical ‘diffusion’. First start with the Convec-tion Boundness Criterion for unstructured meshes.

1“D.B. Spalding is purported to have referred to upwind differencing as the “pigpen method,”the idea being that if ζ is taken as a concentration fraction, then we should smell the pigpenwhen we’re on the downwind side, and not on the upwind side (except for diffusion effects).”[36]

22

Page 35: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Cφ~

φf

~

1/2

1/2

1

3/4

1

UDSLUDS

CDS

3/8

Quick

Figure 3.2: Convection Boundness Criterion with UDS, CDS and LUDS

The nomalised variable is defined as (see Figure 3.1):

φ =φ− φUφD − φU

. (3.8)

The value at face f is then a function of φ at U (upwind node), C (the centralnode), and D (the downwind node): φf = f(φC) with

φC =φC − φUφD − φU

(3.9)

and

φf =φf − φUφD − φU

. (3.10)

Now it is required that φC and φf are locally bounded between φU and φD, or

φU ≤ φC ≤ φD (3.11)

orφU ≥ φC ≥ φD. (3.12)

The Convection Boundness Criterion is then simply:

0 ≤ φC ≤ 1. (3.13)

In the Normalised Variable Diagram (NVD) the boundness criteria can be presen-ted, see Figure 3.2, with φf as a function of φC . Within the grey region and onthe line φf = φC the scheme is bounded.

In the CBC the upwind value of φC is needed for the definition of φC . Following[25] again one can argue that φC is bounded by φU and φD and therefore also

CFD-08xxxx 23

Page 36: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

by the interpolated values at φ−f and φ+f (see Figure 3.3). The new definition of

φC is

φC =φC − φ−fφ+f − φ

−f

= 1−φ+f − φCφ+f − φ

−f

. (3.14)

Recall Equation (2.11):

φf = λfφN + (1− λf )φP (3.15)

with λ defined as:λf =

xf − xPxN − xP

. (3.16)

Thus φ+f − φC is (with φN = φD and φP = φC)

φ+f − φC = λfφD + (1− λf )φC − φC

= λfφD − λfφC= λf (φD − φC)

= λfφD − φCxN − xC

(xN − xC)

= λf (∇φ)f · d (xN − xC). (3.17)

With the unit vector d parallel with CD

d =~d|d|

. (3.18)

For the two faces φ+f and the virtual upstream face φ−f the process is analogous:

φ+f − φ

−f =

φ+f − φ

−f

x+f − x

−f

(x+f − x

−f )

= (∇φ)C · d (x+f − x

−f ). (3.19)

Now Equation 3.14 turns into

φC = 1−φ+f − φCφ+f − φ

−f

= 1−λf (∇φ)f · d (xD − xC)

(∇φ)C · d (x+f − x

−f )

(3.20)

Using the definition of λ which is defined as the distance from point C to φ+f

divided by CD) and the fact that C is located in the middle of the cell gives

x+f − x

−f

xD − xC= 2

x+f − xCxD − xC

= 2λf (3.21)

and Eqn. (3.20) transforms into

φC = 1−(∇φ)f · d

2 (∇φ)C · d

= 1−(∇φ)f · d

2 (∇φ)C · d

= 1− φD − φC2 (∇φ)C · d

(3.22)

24

Page 37: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

3.1 Standard upwind differencing, UD Fluid DynamicsCYCLONE

because the product (∇φ)f · d is equal to φD − φC .

Using this framework all kinds of differencing schemes can be defined based onthe value of φC .

3.1 Standard upwind differencing, UD

In this case simply use the upwind value.

φf = φC . (3.23)

It is called ‘standard (first order) upwind differencing’ as it is the oldest upwindscheme and (still) often used as the default differencing scheme. It is very dissip-ative, especially when the (hexahedral) grids do not follow, or are aligned with,the main flow direction. However it is very robust which makes it an attractivescheme for the startup phase of a simulation.

3.2 Second order central differencing, CD

As has been noted before the central differencing scheme can cause unphysicaloscillations (which can have desastrous effects for example when the turbulentkinetic energy becomes negative). However, central differencing is important toLES simulations as it preserves the turbulent kinetic energy better where upwindschemes tend to decay the energy faster.

All three methods presented below more or less act in the same way (for examplewith respect to oscillating results).

3.2.1 Linear interpolation, CD1

The standard method proposed by [13] is the linearly weighted central differen-cing scheme. Including the non-orthogonal correction it reads

φf = λfφD + (1− λf )φC + (∇φ)f (~xf ′ − ~xf ). (3.24)

3.2.2 Gradient based averaging, CD2

Another CDS method is based on averaging the results including both the up-and downstream gradients as in

φf =12

(φC +∇φC(~xf − ~xC) + φD +∇φD(~xf − ~xD)) . (3.25)

The attractivness of this formulation is that it automatically deals with non-orthogonal, or skewed, cells.

CFD-08xxxx 25

Page 38: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

3.2.3 Simple averaging, CD3

The most simple method, discarding all the geometrical information.

φf =12

(φC + φD). (3.26)

3.3 Blended differencing

3.3.1 Constant blending

Using a fixed blending, by an amount of γ, between UD and CDS is the proposedmethod in [13]:

φf = γφCD + (1− γ)φUD. (3.27)

3.3.2 Variable blending, hybrid scheme

Instead of using a fixed blending factor in the domain one could differentiate onthe basis of the local Peclet number Pe. The Peclet number is defined as

Pe =(ρ u)f ∆xf

Γf. (3.28)

If the viscosity is used for the diffusion coefficient Γ it is immedeately obviousthat the Peclet number remsembles the Reynolds number Re. Hence the term‘cell Reynolds number’ is often used as well.

In [13] and [31] it is shown that the oscillations depend on the value of Pe.When Pe ≤ 2 at every grid node, no oscillations occur. ‘This is a suffient, butnot necessary condition for boundness of CDS solution’ [13]. Spaldings hybridscheme [40] was designed to switch from CDS to UD at any node at whichPe ≥ 2. ‘This is too restrictive and reduces the accuracy’ [13] as it is onlyneeded in regions where the gradient is high. Another way of looking at it is touse the viscosity and regard it as the cell Reynolds number; even for very mildair flow the Peclet number would jump up and UD would be used everywhere.For a further discusion see [13].

The hybrid scheme is therefore not implemented.

3.3.3 Variable blending, power law scheme

Patankar introduced a scheme based on the exact one-dimensional solution whichshould provide better results than the hybrid scheme [31]. It switches to UDwhen Pe ≥ 10.

26

Page 39: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

3.4 Second order linear upwind differencing, LUD Fluid DynamicsCYCLONE

The original formulation is of the form [31]

φ(x)− φ0

φL − φ0=

exp(Pe xL)− 1exp(Pe)− 1

(3.29)

hence the name ‘power law’.

In [47] an equivalent expression is given:

φf = φC − βf (φD − φC) (3.30)

for 0 < Pe < 10 with

βf =(1− 0.1Pef )5

Pef. (3.31)

Especially the original formulation should not be used as the numerous callsto the exponentional function would be too costly. The power law scheme, al-though it performs better than the hybrid scheme, inherits the same defficiencies.The power law scheme is not implemented.

3.4 Second order linear upwind differencing, LUD

The original formulation includes a second upwind node in order to find a gradi-ent and extrapolate to the face. As gradients are available the same idea can beaccomplished using:

φf = φC +∇φC (~xf − ~xC). (3.32)

Two forms are implemented: LUD using the CBC framework (and reverting toUD outside the range) and the unbounded version LUX.

When the gradient∇φC is limited –using a separate slope limiter– then the CBCframework is superflous. In such (limited) cases the second order linear upwinddifferencing scheme combines relative simplicity, robustness and second orderaccuracy. Albeit that slope limiting might deteriorate convergence behavior; theonly downside of slope limited LUD.

3.5 Third order linear upwind differencing, QUICK

Historically the third order linear upwind differencing ‘Quadratic Upwind Inter-polation for Convective Kinematics’, or QUICK is important. In principle thisscheme involves an additional upstream node (or φUU ). The search for such a‘virtual’ node is not useful. Moreover the results in the past of QUICK wererarely superior.

CFD-08xxxx 27

Page 40: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

φ

φ

U

C

D

φ

U DC

φf

face f

flow direction

φf

+

face f− +

Figure 3.3:

In the NVD diagram, see Figure 3.2, the QUICK scheme is found to be equal to[2]

φf =38

+34φC . (3.33)

The QUICK scheme is not implemented.

3.6 Second order switching schemes

3.6.1 MinMod differencing, MinMod

Following Alves et.al. [1]

3.6.2 Gamma differencing, GAM

3.6.3 Third order monotone upstream, MUSCL

The third order ‘Monotone Upstream-centered Scheme for Conservation Laws‘,or MUSCL, is a blending of a CDS scheme and the LUD scheme. In short

φf = γφCDS + (1− γ)φLUD. (3.34)

It has not (yet) been implemented. It can be easily done, either with or withoutthe CBC framework.

28

Page 41: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

3.7 Discusion Fluid DynamicsCYCLONE

φf

~

βm

Cφ~

1/2 1

CDS

LUDS

Quick

1/3

1

minmod

gamma

smart

Figure 3.4: Smart, MinMod and Gamma-schemes

3.7 Discusion

The schemes are not complete yet. On very skewed, really bad or dirty, meshesinstabilities still occur. This point needs further attention as a remedy has notbeen found yet.

CFD-08xxxx 29

Page 42: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

30

Page 43: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

3.7 Discusion Fluid DynamicsCYCLONE

The last decent thing written in Cwas Schuberts 5th Sympony.

Ron Bell

CFD-08xxxx 31

Page 44: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 3 Convective term and differencing schemes

32

Page 45: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

4 Calculation of gradients

Currently only two methods have been used: Gauss and Least Squares. Both arecalled from subroutine GradientPhi.

Both depend on the number of neighbours; the more the merrier (and the accur-acy improves). And here tetrahedra, especially near boundaries, are sufferingfrom the reduced number of neighbours.

4.1 Gauss

Consider Gauss’ divergence theorem applied to a gradient:∫V

grad φ dV =∫Sφ d~s

(grad φ)P0 ≈ 1VP0

nf∑j=1

φj~sj (4.1)

with φj the value at the centre of face j.

When the mesh is orthogonal only one pass is needed as the data is available tocalculate (reconstruct) the gradient. In case of non-orthogonal meshes at leastone extra pass is necessary for the correction.

This is done in subroutine GradientPhiGauss.

4.2 Least squares

Another possibility is based on the following thought: one knows the values atthe cell centre surrounding point P0. Thus for one pair

~dj · (grad φ)P0 = φPj − φP0

or the set~dj · (grad φ)P0 = φPj − φP0 (j = 1, . . . , n) (4.2)

CFD-08xxxx 33

Page 46: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 4 Calculation of gradients

with ~dj = ~xPj − ~xP0 the vector from P0 to Pj . This results in general to moresets or pairs than there are unknowns. For example

dj+11

δφ

δx1+ dj+12

δφ

δx2+ dj+13

δφ

δx3= φPj+1 − φP0

dj+21

δφ

δx1+ dj+22

δφ

δx2+ dj+23

δφ

δx3= φPj+2 − φP0

dj+31

δφ

δx1+ dj+32

δφ

δx2+ dj+33

δφ

δx3= φPj+3 − φP0

dj+41

δφ

δx1+ dj+42

δφ

δx2+ dj+43

δφ

δx3= φPj+4 − φP0

...

dj+n1

δφ

δx1+ dj+n2

δφ

δx2+ dj+n3

δφ

δx3= φPj+n − φP0

With the unknowns δφδx1, δφδx2

, and δφδx3

. Now multiply equation (4.2) with the

transpose of ~dj :

~d Tj~dj ·

δφδx1δφδx2δφδx3

P0

= ~d Tj ∆φPj,0 (j = 1, . . . , n) (4.3)

And the sum of (4.3) is:

nf∑j=1

~d Tj~dj ·

δφδx1δφδx2δφδx3

P0

=nf∑j=1

~d Tj ∆φPj,0 (j = 1, . . . , n) (4.4)

or

nf∑j=1

δx12 δx2δx1 δx3δx1

δx1δx2 δx22 δx3δx2

δx1δx3 δx2δx3 δx32

j

·

δφδx1δφδx2δφδx3

P0

=nf∑j=1

δx1∆φPj,0

δx2∆φPj,0

δx3∆φPj,0

j

This looks like the classic:A ~x = B

With

A =nf∑j=1

~d Tj~dj (4.5)

and

B =nf∑j=1

~d Tj (φPj − φP0) (4.6)

and the solution is ~x = (grad φ)P0 .

This is done in subroutine GradientPhiLeastSquares.

34

Page 47: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

4.3 Gradient limiters Fluid DynamicsCYCLONE

Note that A is a symmetric 3 x 3 matrix with only geometrical coefficients (thedistances from P0 to Pj). So inverting A gives:

(grad φ)P0 = A−1

nf∑j=1

~d Tj (φPj − φP0) (4.7)

A−1 can be stored once and the gradient is simply calculated every time fromequation (4.7). Of course storing will need some extra memory (6 elements percell).

4.3 Gradient limiters

4.3.1 Barth and Jespersen

The definition of the cell centroid in eq. (2.2) is also crucial to the multi-dimensional limiter of Barth and Jespersen (see [10]). In a cell the variationof a variable can be described according to:

φ(~x) = φcentroid + grad φ ·∆~r (4.8)

where grad φ represents an estimate of the solution gradient in the cell fromsurrounding centroid data (using Gauss or least squares) and ~r the position insidethe cell (~r = ~x− ~xcentroid). Consider a ‘limited’ form of the reconstructed fieldof φ in cell i:

φi(~x) = φi + Φ grad φi · (~x− ~xi) (4.9)

with 0 ≤ Φ ≤ 1. Then find the largest admissible Φ not exceeding the maximumand minimum of the neighbouring centroid values. The procedure is as follows.First compute

φmin = min(φi, φneighbors) (4.10)

andφmax = max(φi, φneighbors) (4.11)

then requireφmin ≤ φi(~x) ≤ φmax. (4.12)

For linear reconstructions, extrema in φi(~x) occur at the nodes, or vertices, of thefaces. The original procedure then visits each node k to determine the limitedvalue Φ which satisfies (4.12):

Φk =

min(1, φ

max−φkφk−φi

) if φk − φi > 0

min(1, φmin−φkφk−φi

) if φk − φi < 01 if φk − φi = 0

(4.13)

with Φ = min(Φ1,Φ2, . . . ,Φk).

This procedure guarantees that the variables satisfy the monotonicity principlewhen evaluated anywhere within a face (when using the nodes for the test). A

CFD-08xxxx 35

Page 48: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 4 Calculation of gradients

less restrictive procedure would be satisfying at the face centres. In [10] it is saidthat “numerical evidence shows that both methods work well”, however this isnot true for 2D models consisting of one layer of cells in the third dimension.

Finally using a different notation which follows the implementation. First findthe neighboring maximum and minimum values, then define the maximum changeof a neighbor of cell i as

∆max = φmax − φi∆min = φmin − φi (4.14)

and the change at each node, centroid or face, k as

∆k = φk − φi. (4.15)

next define the ratio:

rk =

∆max

∆kif ∆k > 0

∆min

∆kif ∆k < 0

1 if ∆k = 0(4.16)

and the final limiter is Φ = min(r1, r2, . . . , rk).

The Barth and Jespersen limiters come in three flavours: centroid, face, andnode based, with the face based version as the default. See subroutine Gradient-PhiLimiterBarthJespersen.

4.3.2 Van Albada

The Barth and Jespersen method relies on the non-differentiable min-function.Such functions can kick in or not, also called ’switching behaviour’, and as aresult of this non-smooth behaviour convergence (to steady state) is severelyhampered.

Using the (simple) arithmetic average which is defined as

x =1n

(x1 + x2 + . . .+ xn) =1n

n∑1

xi. (4.17)

Thus the average of two values a and b is

ave arithmetic(a, b) =12

(a+ b). (4.18)

Which is equivalent to the central difference of a value at a face centre (using anequidistant mesh).

Now suppose that b is related to a according to

b = xa, (4.19)

36

Page 49: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

4.3 Gradient limiters Fluid DynamicsCYCLONE

0

0.2

0.4

0.6

0.8

1

1.2

1.4

0 0.5 1 1.5 2 2.5 3 3.5 4

y

x

arithmetic(x)harmonic(x)van Albada

Barth Jespersen

Figure 4.1: Average as a result of fraction x

with x as the fraction of a, and thus eq. (4.18) becomes

ave arithmetic(a, xa) =12

(a+ xa) =12

(1 + x) a. (4.20)

Another average is the harmonic average, typically appropriate for situationswhen the average of rates is desired. Defined as

H =n

1x1

+ 1x2

+ 1x3. . .+ 1

xn

=n∑n1

1xi

, xi > 0 for all i. (4.21)

The harmonic average of two values a and b is thus

ave harmonic(a, b) =2

1a + 1

b

(4.22)

which can be recasted into

ave harmonic(a, b) =|b|a+ |a|b|a|+ |b|

(4.23)

a form of an earlier version of the formula used by van Leer [43]. Note that thisform has a risk when a and b approach zero.

Assume (4.19) again and insert it in equation (4.22) and the result is:

ave harmonic(a, xa) =2xx+ 1

a, (4.24)

with limx→∞ = 2a.

CFD-08xxxx 37

Page 50: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 4 Calculation of gradients

0

0.2

0.4

0.6

0.8

1

1.2

1.4

0 0.5 1 1.5 2 2.5 3 3.5 4

y

x

van Albada50%25%10%

Figure 4.2: Influence of the bias ε2 on the van Albada function

Van Albada et al. [43] choose the following averaging variant:

ave van Albada(a, b) =(b2 + ε2)a+ (a2 + ε2)b

a2 + b2 + 2ε2, (4.25)

with ε2 as a very small non-vanishing bias.

Setting ε2 to zero yields

ave van Albada(a, b) =b2a+ a2b

a2 + b2, (4.26)

and using b = xa gives

ave van Albada(a, xa) =(xa)2a+ a2(xa)a2 + (xa)2

=x2a3 + xa3

a2 + x2a2

=x2 + x

1 + x2a. (4.27)

In a similar way one can study the influence of ε. Assume ε = εa, or the bias asa fixed fraction of a:

ave van Albada(a, xa) =((xa)2 + (εa)2)a+ (a2 + (εa)2)(xa)

a2 + (xa)2 + 2(εa)2

=x2 + x + ε2 + ε2x

1 + x2 + 2ε2a. (4.28)

The result is shown in Figure 4.2. As long as ε is small, say less than 1% of a,its influence is minimal.

38

Page 51: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

4.3 Gradient limiters Fluid DynamicsCYCLONE

The result of (4.25) tends to 12(a+ b) if a and b are finite differences of a smooth

solution, but tend to the smallest value where the solution is not smooth (ifb = xa then limx→∞ = a). Overall the form resembles the harmonic variant.See also Figure 4.1.

Because the shape, or behavior, of (4.25), resembles the characteristics of theBarth and Jespersen function (min(1, x)) one can use it as a limiter. Start withfinding the neighboring maximum and minimum changes ∆max and ∆min ofcell i as in (4.14), and the change ∆k at each node, centroid or face, k as in(4.15), with the ratios rk of (4.16) and the function

φk =r2k + rk1 + r2

k

. (4.29)

The final limiter is Φ = min(φ1, φ2, . . . , φk). See also subroutine Gradient-PhiLimiterAlbada.

Note that in this form of the limiter, i.e. (4.29), there is no need for a small biasε as a division by zero is not possible unlike the original form as in eq. (4.26).

4.3.3 Venkatakrishnan

Venkatakrishnan took van Albadas concept further with a function of the ratioof two second degree polynomials (with boundary conditions as φ(∞) = 1 andφ(0) = 0):

φ(x) =x2 + 2xx2 + x+ 2

. (4.30)

Originally his final form looks like [45]:

Φ =1

∆−

[(∆2

+ + ε2)∆− + 2∆2−∆+

∆2+ + 2∆2

− + ∆−∆+ + ε2

](4.31)

with ∆+ = ∆max and ∆− = ∆k with ε2 again as a bias.

Setting ε2 = 0 and recasting (4.31) into

Φ =∆2

+ + 2∆−∆+

∆2+ + 2∆2

− + ∆−∆+

=∆2

+ (1 + 2∆−∆+

)

∆2+ (1 + 2(∆−

∆+)2 + ∆−

∆+)

and with r′ = ∆−∆+

Φ =2r′ + 1

2(r′)2 + r′ + 1. (4.32)

Using the previous definitions r = 1/r′ = ∆+

∆−= ∆max

∆k

φk =2( 1rk

) + 1

2( 1rk

)2 + ( 1rk

) + 1=

r2k + 2rk

r2k + rk + 2

(4.33)

CFD-08xxxx 39

Page 52: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 4 Calculation of gradients

0

0.2

0.4

0.6

0.8

1

1.2

1.4

0 0.5 1 1.5 2 2.5 3 3.5 4

y

x

van AlbadaVenkatarishnan

polynomial (x<1.5)Barth Jespersen

Figure 4.3: Venkatarishnan limiter vs Barth Jespersen and van Albada.

and the limiter is again Φ = min(φ1, φ2, . . . , φk). The result compared to BarthJespersen and van Albada is shown in Figure 4.3. The code can be found inGradientPhiLimiterVenkatarishnan.

4.3.4 Polynomial function

Clearly Figure 4.3 suggests that a polynomial function of the form

φ(x) = a3x3 + a2x

2 + a1x+ a0 (4.34)

can be considered with either two or three sections.

For the case with two sections the boundary conditions are:

φ(0) = 0 withdφ(0)dx

= 1

and at x = xc

φ(xc) = 1 withdφ(xc)dx

= 0.

For φ(0) = 0 it simply follows that a0 = 0. Differentiating (4.34) results in

dφ(x) = ( 3a3x2 + 2a2x+ a1 ) dx, (4.35)

thus dφ(0)dx = 1 simply means that a1 = 1.

At xc is by definition φ(xc) = 1 and dφ(xc)dx = 0. With

dφ(xc)dx

= 3a3x2c + 2a2xc + 1 = 0

40

Page 53: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

4.3 Gradient limiters Fluid DynamicsCYCLONE

follows

a2 = −1 + 3a3x2c

2xc. (4.36)

Finally

a3x3c −

1 + 3a3x2c

2xcx2c + xc = 1

or

a3x3c −

12xc −

32a3x

3c + xc = 1

−12a3x

3c +

12xc = 1

so

a3 =x− 2x3c

. (4.37)

The case of xc = 1.5 is plotted in Figure 4.3.

4.3.5 Uniform regions

Assume a uniform flow, field distribution, where ∆min ≈ ∆max, then it is de-sirable to circumvent the limiter. Note that in such cases the ratio’s rk are ap-proximately unity and in case the Venkatarishnan limiter is used the gradientis reduced by 25% (in equation (4.33) is φ(1) = 3/4); by contrast the BarthJespersen and van Albada limiters do not alter the gradient in that point.

Michalak and Ollivier-Gooch suggest to ‘switch the limiter off’ when [28]

δφ ≡ (∆max −∆min) < (k∆x)32 . (4.38)

Switching the limiter off should not introduce new switching behavior. This canbe accomplished by:

Φ = σ + (1− σ)Φ (4.39)

where Φ is the active limiter and σ is

σ =

1 δφ2 ≤ (k∆x)3

s(δφ2−(k∆x)3

(k∆x)3

)(k∆x)3 < δφ2 < 2(k∆x)3

0 δφ2 ≥ 2(k∆x)3

(4.40)

with the transition function s(x) is defined by, see Figure 4.4

s(x) = 2x3 − 3x2 + 1. (4.41)

CFD-08xxxx 41

Page 54: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 4 Calculation of gradients

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

y

x

transition function s(x)

Figure 4.4: Transition function s(x)

4.4 Discussion

Gradient limiters can be used for any CBC scheme and even for the definitionof φC . However some care is needed as the risk of extra dispersion is there.

The gradient limiters seem useful for the gradient based second order centraldifferencing scheme (CD2) and the unbounded form of the second order linearupwind differencing scheme (the unbounded form as the gradient limiter alreadyensures boundness).

42

Page 55: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

5 Heat transfer

For non-isothermal flows the energy equation reads:

∂t(ρ cpT )︸ ︷︷ ︸

unsteady term

+ div( ρ ~vr cpT )︸ ︷︷ ︸convective term

= div( λ grad T )︸ ︷︷ ︸diffusive term

+ qT︸︷︷︸source terms

(5.1)

The primitive variable is the temperature T thus in order to adhere to the standardscalar transport equation the heat capacity is rearranged to:

∂t(ρ T ) + div( ρ ~vr T ) = div(

λ

cpgrad T ) +

qTcp

(5.2)

Where λ/cp appears as the thermal diffusivity ΓT .

Near solid walls either the wall temperature Tw or the heat flux qw through thewall can be specified. In both cases the heat transfer coefficient is needed.

The heat transfer coefficient h is a simple way to lump the heat transfer in oneempirical formula. Starting from

Q = h A (Tw − T )

and rearranging

h =Q/A

Tw − T=

qwTw − T

(5.3)

Thus once the heat flux qw and the temperatures Tw and T are known the heattransfer coefficient is defined by equation (5.3). Likewise if instead of the tem-perature in the cell adjacent to the wall T some other reference or bulk tem-perature Tbulk is used, another value of h is found. This latter value shouldcorrespond to the values found in empirical handbooks of heat transfer.

Recall that λ/cp is used as the thermal diffusivity in the fluid domain. Introdu-cing the (laminar) Prandtl number:

Pr =cp µ

λ(5.4)

henceλ

cp=

µ

Pr(5.5)

which links and scales the laminar viscosity directly to the thermal diffusivity.

For an given wall temperature Tw and heat transfer coefficient h the heat sourceQ = qw A = h A (Tw − T ) near the boundary cell is known and splits in two

CFD-08xxxx 43

Page 56: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 5 Heat transfer

δ

TwTbTs

αλ

T

h

qn

y

x

Figure 5.1: Heat transfer near a wall

parts: h A Tw and h A T , the former enters the source term ST for the boundarycell and the latter enters the diagonal term Ap as h A.

When the heat flux qw is used as a boundary condition then the wall temperatureis first calculated. This value is then used in the source term.

The temperature boundary condition Tw does not need to be specified at thesolid fluid interface. Assuming one dimensional heat conduction through a wallof s thick and a heat conduction of λs gives (see Figure 5.1):

q =λss

(Tb − Tw) (5.6)

In the surroundings with Ts and an assumed heat transfer coefficient of αs resultsin:

q = αs (Ts − Tb) (5.7)

The heat flux through all three components must be equal thus

q = αs (Ts − Tb) =λss

(Tb − Tw) = h (Tw − T ). (5.8)

The overall temperature difference is then:

Ts − T = (Ts − Tb) + (Tb − Tw) + (Tw − T )

=q

αs+

q

λ/s+q

h

= q (1αs

+1λ/s

+1h

) (5.9)

and can be regarded as a chain of resistances as in q = ∆T/∑Ri or

q =∆T

1h +

∑Ri. (5.10)

R =s

λ

44

Page 57: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

5.1 Laminar heat transfer Fluid DynamicsCYCLONE

5.1 Laminar heat transfer

In the case of laminar flow the heat transfer is dictated by heat conduction fromthe centre of the wall cell to the wall over a distance of δn. The heat flux simplyreads:

q = λ(Tw − T )

δn

=µ cpPr

(Tw − T )δn

=1

Pr δnµ cp

(Tw − T )

=1

1h +

∑Ri

(Tw − T ). (5.11)

With the local heat transfer coefficient h

h =µ cpPr δn

. (5.12)

Note that λ/cp is the thermal diffusivity ΓT in the transport equation. Also theheat source (or sink) for the boundary cell is needed. In the code itself

Q = H (Tw − T ) (5.13)

is used, with

H =1

1µ/(Prδn) + cp

∑Ri

A. (5.14)

However for output purposes H has to be transferred into h again

h = HcpA

(5.15)

with a heat flux in W/m2

qw = h (Tw − T ) (5.16)

and a total heat balance of

Q =∑

qwi Ai. (5.17)

5.2 Turbulent heat transfer

The turbulent heat transfer is basically modelled analog to the viscous boundarylayer. Where the law of the wall profile u+ = f(y+) is scaled by the turbulentPrandtl number Prt (or σT ). In short dimensionless form:

T+ = Prt u+ (5.18)

However, in general a sublayer resistance factor (commonly denoted by P ) byC. Jayatilleke is accounted for as well:

P = 9.24[( Pr

Prt

)3/4

− 1][

1 + 0.28 exp(−0.007 Pr

Prt

)](5.19)

CFD-08xxxx 45

Page 58: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 5 Heat transfer

which brings eqn. (5.18) to

T+ = Prt (u+ + P ) (5.20)

The dimensionless temperature T+ is defined by:

T+ =ρ µt (Tw − T )

qw(5.21)

Using the definition of the heat transfer coefficient (5.3), and eqns. (5.20) and(5.21) gives

h =qw

Tw − T=

ρ Cp µtPrt(u+ + P )

(5.22)

One of the great consequences of eqn. (5.22) is that one does not need to performa thermal simulation in order to find the local heat transfer coefficients. On theother hand, a local heat transfer might become high, but when the temperaturedifference Tw − T is negligible, there will hardly be any heat flux and thus nocooling (or warming up).

46

Page 59: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

6 Lagrangian particles

6.1 Basic equations

Multi-phase flows often contain particles or droplets. Let ~u be the velocity ofthe continuous phase, ~vp the current droplet velocity and ~xp the droplet position.

Then the Newtonian equation of the motion of a droplet with mass mp is

mpd~vpdt

=∑i

~Fi . (6.1)

After summing all the forces the equation of motion (6.1) can be solved using

d~xpdt

= ~vp . (6.2)

6.1.1 Drag force

The most important force is the drag force

~Fd = Cd(Re)12ρf |~u− ~vp|(~u− ~vp) Sp (6.3)

with the drag coefficient Cd as a function of the droplet Reynolds number Re.Sp is the frontal area of the particle.

The droplet Reynolds number is defined by

Rep =ρf |~u− ~vp| Dp

µ. (6.4)

The drag coefficient is

Rep

24, 000. , Re ≤ 0.00124/Re , 0.001 ≤ Re ≤ 0.2

24 (1 + 0.15 Re0.687p )/Rep , 0.2 < Re ≤ 1000

0.44 , 1000 < Re ≤ 200 000.0.10 , Re > 200 000.

(6.5)

CFD-08xxxx 47

Page 60: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

6.1.2 Virtual mass force

For accelerating or decelerating particles the surrounding carrier fluid needs tobe accelerated or decelerated too. Potential flow theory, also know as irrotationalflow (without viscosity), shows that an accelerating particle give rise to a forceof:

~Fv = −Cv ρfΩpd(~vp − ~u)

dt. (6.6)

Using potential flow theory the ‘virtual mass coefficient’ Cv is found to be equalto 0.5.

For a steady state flow equation (6.6) reduces to

~Fv = −Cv ρfΩpd~vpdt

. (6.7)

The mass of a particlemp then simply increases by Cv ρfΩp to (ρp+Cv ρf )Ωp.Thus for a particle with density ρp of 1000. kg/m3 in air (ρf ≈ 1.2 kg/m3) theincrease is neglible (just 0.06%).

6.1.3 Body forces

Gravity, or any other external force, can also act on a particle. It is incorpor-ated into the ‘body force’. When gravity acts on a particle it will also let aparticle float or the buoyant force is equal to the weight of the displaced fluid(Archimedes’s principle). The net result is

~Fb = mp ~g = (ρp − ρf )Ωp ~g . (6.8)

6.1.4 Adding all forces

Starting with equation (6.1) and using Sp = 32Ωp/Dp, ρ′p = ρp + Cvρf and

~vs = ~u− ~vp:

mpd~vpdt

=∑i

~Fi

ρpΩpd~vpdt

= ~Fd + ~Fv + ~Fb

(ρp + Cvρf )Ωpd~vpdt

= Cd12ρf ‖~vs‖ (~u− ~vp)

32

Ωp

Dp+ (ρp − ρf ) Ωp ~g

ρ′pd~vpdt

= Cd12ρf ‖~vs‖ (~u− ~vp)

32

1Dp

+ (ρp − ρf ) ~g

d~vpdt

= Cd34

ρfρ′p Dp

‖~vs‖ (~u− ~vp) +ρp − ρfρ′p

~g (6.9)

Equation (6.9) can be solved analytically provided some terms are assumed tobe constant:

d~vpdt

= C1 (~u− ~vp) + C2 ~g (6.10)

48

Page 61: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.1 Basic equations Fluid DynamicsCYCLONE

V1

v/V1

1

0/0 1 2 3 4 5 6τ

τ

t /

Figure 6.1: Characteristic response of a particle to forces

withC1 = Cd

34

ρfρ′p Dp

‖~vs‖ (6.11)

andC2 =

ρp − ρfρ′p

. (6.12)

Rearanging 6.10 tod~vp

C1 (~u− ~vp) + C2 ~g= dt

and integrating

−1C1

ln( C1 (~u− ~vp) + C2 ~g ) = t+ c

C1 (~u− ~vp) + C2 ~g = e−C1t+c

C1 (~u− ~vp) + C2 ~g = C e−C1t

or~vp = (~u+

C2

C1~g)− C

C1e−C1t (6.13)

At t = 0 the particle has an initial velocity of ~vp0 thus C is:

~vp0 = C1 (~u− ~vp) + C2 ~g −C

C1

orC = ( C1~u+ C2~g )− C1~vp0 .

The particle velocity is then

~vp = ( ~u+C2

C1~g )︸ ︷︷ ︸

~v1

− ( ~u+C2

C1~g − ~vp0 )︸ ︷︷ ︸

~v2

e−C1t (6.14)

and is illustrated in Figure 6.1. In a quiescent fluid (~u = 0) and after some timea particle will drop subjected to the action of gravitational force ~g

~vp∞ =C2

C1~g

CFD-08xxxx 49

Page 62: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

or

~vp∞ =(ρp − ρf ) Dp ~g

34Cd ρf ‖~vs‖

.

For small particles the drag coefficient equals to 24/Re. Thus with ‖~vs‖ =‖~u− ~vp‖ = ‖~vp‖

~vp∞ =(ρp − ρf )

24Re

34ρf

Dp‖~vp‖

~g

=(ρp − ρf )

24µρf‖~vp‖Dp

34ρf

Dp‖~vp‖

~g

=(ρp − ρf )

18µDp

1Dp

~g

=(ρp − ρf )

18µD2p ~g . (6.15)

Which is the well known particle settling or sedimentation velocity for smallparticles or ‘Stokes’ law’.

The characteristic time in the response of equation (6.14) can be found using

~vp∞ = ~vpo +d~vpdt

∣∣∣∣t=0

∆t

or~vp∞ = ~vpo + (C1 (~u− ~vp ) + C2 ~g ) ∆t

and consider again a quiescent fluid (~u = 0) and a starting velocity ~vp0 = 0.

The characteristic time τmomentum or τM is thenC2

C1~g = ~vpo + (C1 (~u− ~vp ) + C2 ~g ) ∆t

C2

C1~g = C2 ~g ∆t

∆t =1C1

τM =4 ρ′p Dp

3 Cd ρf ‖~vs‖(6.16)

which meaning becomes clear in Figure 6.1. Note that the gravitational effectsare cancelled out and the characteristic time is only based on the drag force.

For light or small particles in the Stokes’ range equation (6.16) reduces to

τM =4 ρ′p Dp

3 24Re ρf ‖~vs‖

=4 ρ′p Dp

3 24µρf ‖~vs‖ Dp

ρf ‖~vs‖

=ρ′p D

2p

18 µ(6.17)

note that the division of |~u − ~vp|/|~u − ~vp| which goes to 0/0 when the slipvelocity drops to zero has been eliminated.

50

Page 63: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.2 Integrating particles in time Fluid DynamicsCYCLONE

6.2 Integrating particles in time

The most common method to integrate equation (6.2) is to use a simple explicitmethod known as ‘explicit Euler’ or ‘forward Euler’. It is so popular because itrelies only on the currently known values at time level tn:

φn+1 = φn + f(φn, tn) ∆t (6.18)

It is only first order accurate but more important it has restrictions in the size of∆t for stability (set by τM ).

Equation (6.17) also shows what happens when very light and small particles aregoing to be used. Consider a tiny (Dp = 1 10−6 m) droplet of water (ρp = 1000.kg/m3) in air (µ = 18 10−6 Pa s) when τM will drop to ≈ 3 10−6 s. Thereforeexplicit Euler has it’s limitations when any kind of droplet has to be catered for.

An alternative is to use ‘implicit Euler’ or ‘backward Euler’ method

φn+1 = φn + f(φn+1, tn+1) ∆t (6.19)

in which there is, in principle, no restriction to the time step size ∆t. The dis-advantage is that the values of f(φn+1, tn+1) at the new time tn+1 are unknownand extra work is necessary.

When equation (6.9) is casted in the form of (6.10)

d~vpdt

= C1 (~u− ~vp) + C2 ~g

with only ~vp and t as variables then it can be solved analytically. The solutionis:

~vp = ~v1 + ~v2 e−C1t (6.20)

with~v1 = ~u+

C2

C1~g

and~v2 = ~u+

C2

C1~g − ~vp0 = ~v1− ~vp0

and the constants C1 and C2 defined in 6.11 and 6.12 and the characteristic timeτM = 1/C1.

The solution of ~vp in equation (6.20) approaches ~v1 rapidly (see Figure 6.1).How close ~vp is to the final solution ~v1 depends on it’s initial velocity ~vp0 , orthe ratio of ~vp0/~v1. The closer the ratio is to 1 the larger the time step can beallowed to be.

The velocity 6.20 can be integrated once again to obtain the new position:

~xp = ~v1 t+~v2

C1(1− e−C1t) (6.21)

xxxxx

The basic scheme is:

CFD-08xxxx 51

Page 64: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

Figure 6.2: Example of particles passing through cells

1. choose a suitable time step ∆t

2. use the current particle velocity Vp, or fluid velocity U (whichever ishigher), to get an estimate of the time needed to pass through a cell

3. calculate the new particle velocity ~vp

4. use equation (6.21) to find the new particle position using the new particlevelocity ~vp

5. check if the particle has left the cell

The starting time step ∆t is estimated using the Courant number defined by

Co =Uδt

δx. (6.22)

As there are three dimensions the choose the lowest of

∆tc = min(Co ∆xux

,Co ∆yuy

,Co ∆zuz

) . (6.23)

And a value of Co ≈ 0.34 in order to step in two or three steps through a typicalcell (see an example in Figure 6.2).

6.3 Particle within a cell

One of the major tasks is to find out whether a particle or droplet is within oroutside of a cell. The easiest way to find out for an arbitrary cell is to use thecell face normals (positive pointing outwards, see Figure 6.3) and a normalisedposition vector from the particle to the cell face centre

xpf = ~xcell face − ~xp . (6.24)

Next simply calculate the dot product using the cell face normal ~xn

xpf · ~xn

52

Page 65: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.4 Intersecting a cell face Fluid DynamicsCYCLONE

y

x

particle

particle outside cell

Figure 6.3: Example of particle inside and outside of a cell (red)

y

x

particle

particle velocity

λ > 0λ > 0

λ < 0λ < 0

λ < 0

Figure 6.4: Particle intersects face

The result is xpf · ~xn > 0 particle insidexpf · ~xn = 0 particle on the facexpf · ~xn < 0 particle outside

Simply loop over all faces and check if the dot product does not become negat-ive.

6.4 Intersecting a cell face

Once a particle is within a cell it will travel in some direction. It is then neces-sary to find out on which cell face the particle will leave the cell. When thiscell face is known then the neighbouring cell is by virtue of dolfyns unstruc-tured addressing method also known. Hence there is no need for special particlesearching algorithms. Consider a particle in a cell at point ~xp with a velocity ~vp.Any point on the line, including an intersection point ~xi made with this velocityis defined as

~xi = ~xp + λ ~vp . (6.25)

CFD-08xxxx 53

Page 66: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

A cell face is defined by its cell face centre and normal. For any point on thecell face, including an intersection point ~xi, the normal is perpendicular to thevector from the cell face centre to the intersection point. In such a case the dotproduct is equal to zero. Hence

(~xi − ~xcell face) · ~xn = 0 . (6.26)

Insert 6.25 into 6.26 and solve for λ

(~xp + λ ~vp − ~xcell face) · ~xn = 0

(~xp − ~xcell face) · ~xn + λ ~vp · ~xn = 0

or

λ = −(~xp − ~xcell face) · ~xn~vp · ~xn

(6.27)

The lowest positive λ found is the intersection point. The point itself is thenfound using equation (6.25).

When the dot product ~vp · ~xn = 0 then ~vp is parallel to the face defined by ~xn.A special check is needed in case two, or more, faces share the same normalvector.

6.5 Interpolating velocities

The Lagrangian procedure described here requires that the local fluid velocityat some point within a cell is available. One possible method is to start directlyfrom the cell centred velocity components and interpolate from all neighbouringcells. This path will lead to large interpolating molecules surrounding the cellthe particle is currently in.

Another method is based on interpolating the velocities on to the corner nodes ofthe cells first (using the cell centred values and the velocity gradients) and thenuse these velocities as a starting point. Next the velocity inside the cell can beinterpolated using for example shape functions. Such functions, however, needto take into account the cell topology in order to be able to map parameters intoa computational domain. This method requires the cell topology to be used indolfyn which is not desirable.

The currently used interpolation method is based on weighting the (interpolated)velocity components on the nodes as in

d =Nnodes∑i=1

Wi di . (6.28)

Furthermore it is a requirement that when the interpolation point coincides witha node its value should be equal to the nodal value.

54

Page 67: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.5 Interpolating velocities Fluid DynamicsCYCLONE

Finally the interpolation method should yield values no smaller than the min-imum di and no larger than the maximum di. Thus

Nnodes∑i=1

Wi = 1 ,with 0 ≤Wi ≤ 1 . (6.29)

For any point within a cell the next weighting function is used

Wi =( 1ri

)2∑( 1ri

)2(6.30)

withri = ‖~xnode − ~xp‖ .

As the weight function is known the fluid velocity ~up at a particle position ~xp isthen simply

~up =Nnodes∑i=1

Wi ~unodei. (6.31)

CFD-08xxxx 55

Page 68: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

6.6 Examples

Figure 6.5: Free falling particles, influence of particle Courant number

56

Page 69: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.6 Examples Fluid DynamicsCYCLONE

Figure 6.6: Free falling particles, details showing steps within cells

CFD-08xxxx 57

Page 70: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

Figure 6.7: Particles in a stagnation flow

58

Page 71: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.6 Examples Fluid DynamicsCYCLONE

Figure 6.8: Particles in a stagnation flow, influence of particle Courant number

CFD-08xxxx 59

Page 72: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

Figure 6.9: Small particles/streamlines in a stagnation flow

60

Page 73: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

6.6 Examples Fluid DynamicsCYCLONE

Figure 6.10: Small particles/streamlines in an 45 angle test

CFD-08xxxx 61

Page 74: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

62

Page 75: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Appendices

CFD-08xxxx 63

Page 76: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE 6 Lagrangian particles

64

Page 77: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

A Geometry input files

You will need three geometry files casename.cel, casename.vrt, and casename.bnd,where casename as the name of your case. The preprocessor only needs thesesimple files:

• A file with cell definitions (*.cel)

• A file with the vertices (*.vrt)

• And the boundaries (*.bnd)

The results are stored in casename.geo.

The definitions of the cells in *.cel are:

nr , i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 , i d

With the cell number ‘nr’, and the 8 corner nodes of a hexaeder (i1 t/m i8). Eachcell has a pointer to an ‘id’ in a table. This ‘id’ is reserved for the future (for thetime being set it to ‘1’).

The accompanying ‘format statement’ is a ‘free format’ (*).

Cell shapes are defined as (see Figure A.1):

Hexaeder i1, i2, i3, i4, i5, i6, i7, i8

Prism or wedge i1, i2, i3, i3, i5, i6, i7, i7

Pyramid i1, i2, i3, i4, i5, i5, i5, i5

1 2

5 6

56

7 8

56

7 8

hexahedral prism or wedge pyramid tetrahedral

34

7

8

1 2

5 6

7

4 3

8

1

2

3 4

1

2 43

Figure A.1: Cell definitions

CFD-08xxxx 65

Page 78: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE A Geometry input files

Tetraeder i1, i2, i3, i3, i5, i5, i5, i5

The vertices in *.vrt are:

nr , x , y , z

With the number ‘nr’ and it’s position in 3D (x, y, z). The accompanying ‘formatstatement’ is: i9,6x,3g16.9.

Finally the boundaries in *.bnd are:

nr , i1 , i2 , i3 , i4 , i d

With number ‘nr’ and the 4 corner nodes of a face of a hexaeder (i1 t/m i4). Theboundaries point to an ‘id’ which values will be set in the control file (*.din).All boundary faces without an ‘id’ will be given the default id of ‘0’.

The accompanying ’format statement’ is in ’free format’ (*). Two variants aredefined:

Quad i1, i2, i3, i4

Tri i1, i2, i3, i3

66

Page 79: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

B Verification with equidistant Lid DrivenCavity tests

Following Roache [37] an error analysis has been performed using ‘RichardsonExtrapolation’ on various meshes and convective differencing schemes. All themeshes are simple orthogonal and equidistant. Although dolfyn contains non-orthogonal corrections etcetera, still this is a valuable test because all additionsshould not break the basic fundament of the code. The reference data is by Ghia,Ghia, and Shin [16].

The cavity has dimensions of one by one and the lid has a velocity of one, leavingthe (laminar) viscosity of the fluid with density one to determine the Reynoldsnumber (Re = ρVlidLlid/µ). The calculations were done with Gauss for thegradients and various convective differencing schemes:

UD Classic standard first order Upwind Differencing.

CD 0.8 Blend of 80% second order Central Differencing and 20% first orderupwind differencing.

CD1 Pure second order Central Differencing.

LUD Second order Linear Upwind Differencing with a Convection BoundedCriterion (UD outside the Normalised Variable range of 0 ≤ ΦC ≤ 1).

Gamma The Gamma CBC differencing scheme (blending with CD).

MinMod The MinMod CBC differencing scheme (based on LUD and CD).

LUX Pure LUD not based on NVD..

Shown are the u component velocity profiles half way the cavity (x = 0.5,0 ≤ y ≤ 1) for all the schemes at the finest mesh (128x128) and UD and LUXonly as a function of the mesh (8x8, 16x16, 32x32, 64x64, 128x128). And thedevelopment of the interpolated u component at x = 0.5, y = 0.5. The lattervalue has been linearly interpolated (which might have some effects on the finalresults) and is shown as a function of mesh size h (linear) and h2 (quadratic).A second order method will have to show up as a straight line at the smallestmeshes.

Also shown are streamlines based on the LUX data like in Figure B.1. Theywere made with OpenDX after the cell-centered velocties have been interpolatedto the nodes and creating streamlines (the ‘post’ and ‘streamline’ modules of

CFD-08xxxx 67

Page 80: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

OpenDX). Because of this procedure the streamlines will lose some of theiraccuracy near the walls. However nice closed streamlines do show up in thecenter of the main vortex.

In all this study is the result of at least 300 runs.

Brief discussion of the results:

Re 25 A very very viscous flow. The flow is dominated by the (second or-der) viscous forces. All convective schemes coincide on the largest mesh(128x128). The first order behaviour of UD is clearly visible as well asthe second order nature of CD1 and LUX (note that CD 0.8 lays nicely inbetween of CD1 and UD).

Re 100 The first case were data is available from Ghia et.al. As can be seenLUX on at a mesh of 32x32, or even 16x16, already produces the finalresult. The Richardson Extrapolation curves clearly supports this. Notethe start of the two lower corner vortices.

Re 400 A 16 times lower viscosity compared to Re 25 starts to show somedifferences especially with UD; a good result is only possible at the finest128x128 mesh. The second order schemes CD1 and LUX reproduce thereference data exactly, closely followed by CD 0.8. The LUX results arealready there on the 64x64 mesh (but the 32x32 are not bad either). Thelower right corner vortex increases.

Re 1,000 Basically the same results as for Re 400. In the top left the vortex isabout to appear.

Re 3,200 Now the differences between the schemes get very clear. Note that theNVD blended schemes follow the UD scheme whereas the two unboun-ded second order schemes provide the best result (again followed by theCD/UD blend). The LUX scheme is the best and the Richardson Extra-polation curve of h2 shows a ‘tail’ for the CD1 scheme. The latter is nowstarting to deteriorate.

Re 5,000 Now only LUX is the only one which follows the data, and only onthe finest 128x128 mesh. The ‘tail’ of CD1 in the h2 Richardson Extra-polation curve is more pronounced. In the paper by Ghia et.al the resultsare show on a 257x257 mesh and a second vortex starts to appear in thelower left corner (see Figure B.3).

Re 7,500 At Reynolds 7,500 and on a mesh of 128x128 even LUX is not able toreproduce the reference data. Also instabilities start to occur; see FigureB.10.

Re 10,000 The results of Reynolds 10,000 resemble the Reynolds 7,500 res-ults. The results in Figure B.11 are based on a 256x256 mesh and FigureB.12 shows the corresponding streamlines. It is clearly visible that the up-wind and CBC upwinded schemes are the most stable. The (unboudded)second order schemes CD1 and LUX show unsteady effects; the latter isalso visisble in the residual drop which do not reach machine accuracy

68

Page 81: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

levels anymore. The results in the reference paper are based on a highorder upwind scheme with a larger stencil (with a face based unstructuredsolver one has to restrict to a small stencil). Nevertehless at some pointinstabilities as can be seen in Figure B.12 will have to pop up at somepoint.

General conlusion is that dolfyn is a second order accurate code which providesfor this particular case and mesh topology very accurate and correct results.Also for testing purposes the lid driven cavity can be used at medium Reynoldsnumbers; for example only at Re 400 or the combination Re 100 and Re 1,000.

CFD-08xxxx 69

Page 82: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

Figure B.1: Streamlines at Reynolds 25, 100, 400, 1,000, 3,200, 5,000, 7,500and 10,000 with 128x128 and LUX

70

Page 83: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Figure B.2: Velocity magnitude at Reynolds 25, 100, 400, 1,000, 3,200, 5,000,7,500 and 10,000 with 128x128 and LUX

CFD-08xxxx 71

Page 84: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

Figure B.3: Results from Ghia et.al

72

Page 85: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 25, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

UD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 25, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

LUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 25, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.21

-0.2

-0.19

-0.18

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 25

0 0.004 0.008 0.012 0.016h2

-0.21

-0.2

-0.19

-0.18

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 25

Figure B.4: Reynolds 25

CFD-08xxxx 73

Page 86: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 100, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 100, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 100, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.21

-0.2

-0.19

-0.18

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 100

0 0.004 0.008 0.012 0.016h2

-0.21

-0.2

-0.19

-0.18

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 100

Figure B.5: Reynolds 100

74

Page 87: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 400, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 400, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 400, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.25

-0.2

-0.15

-0.1

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 400

0 0.004 0.008 0.012 0.016h2

-0.25

-0.2

-0.15

-0.1

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 400

Figure B.6: Reynolds 400

CFD-08xxxx 75

Page 88: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 1000, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 1000, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 1000, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.2

-0.15

-0.1

-0.05

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 1,000

0 0.004 0.008 0.012 0.016h2

-0.2

-0.15

-0.1

-0.05

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 1,000

Figure B.7: Reynolds 1,000

76

Page 89: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 3200, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 3200, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 3200, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.2

-0.15

-0.1

-0.05

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 3,200

0 0.004 0.008 0.012 0.016h2

-0.2

-0.15

-0.1

-0.05

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 3,200

Figure B.8: Reynolds 3,200

CFD-08xxxx 77

Page 90: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 5000, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 5000, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 5000, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.1

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 5,000

0 0.004 0.008 0.012 0.016h2

-0.1

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 5,000

Figure B.9: Reynolds 5,000

78

Page 91: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 7,500, U(x=0.5)

Mesh 128 x 128

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128

Lid Driven Cavity, Re 7,500, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128

Lid Driven Cavity, Re 7,500, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 7,500

0 0.004 0.008 0.012 0.016h2

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 7,500

Figure B.10: Reynolds 7,500

CFD-08xxxx 79

Page 92: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Lid Driven Cavity, Re 10,000, U(x=0.5)

Mesh 256 x 256

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataUD 8x8UD 16x16UD 32x32UD 64x64UD 128x128UD 256x256

Lid Driven Cavity, Re 10,000, U(x=0.5)

UD only

0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Roache/Ghia dataLUD (no CBC) 8x8LUD (no CBC) 16x16LUD (no CBC) 32x32LUD (no CBC) 64x64LUD (no CBC) 128x128LUD (no CBC) 256x256

Lid Driven Cavity, Re 10,000, U(x=0.5)

LUD (no CBC) only

0 0.025 0.05 0.075 0.1 0.125h

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 10,000

0 0.0005 0.001 0.0015 0.002h2

-0.08

-0.06

-0.04

-0.02

0

U(x

=0.

5,y=

0.5)

UDCD (0.8)CD1 (no CBC)LUD (CBC)GammaMinModLUD (no CBC)

Re = 10,000

Figure B.11: Reynolds 10,000

80

Page 93: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Figure B.12: Reynolds 10,000 at 256x256 and influence of differencing scheme(UD, CD, CD1, LUD, Gamma, MinMod, LUX)

CFD-08xxxx 81

Page 94: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE B Verification with equidistant Lid Driven Cavity tests

82

Page 95: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

C Various tests

C.1 C1 Unstructured

Figure C.1: C1 UD, CD(0.8), CD1, CD2, LUD, Gamma

CFD-08xxxx 83

Page 96: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

C.2 C3 Leonard tests

Figure C.2: Leonard step UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod,LUX

84

Page 97: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Figure C.3: Leonard semi UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod,LUX

CFD-08xxxx 85

Page 98: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

Figure C.4: Leonard sin2 UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod,LUX

86

Page 99: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

C.3 C6 Wedges

Figure C.5: C6 Wedges UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod,LUX

CFD-08xxxx 87

Page 100: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

C.4 C7 Mesh jump

Figure C.6: C7 Jump UD, CD(0.8), CD1, CD2, LUD, Gamma, MinMod, LUX

88

Page 101: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

C.5 45 degrees lid driven cavity

Figure C.7: 45 degrees UD, CD(0.8), LUD, Gamma

CFD-08xxxx 89

Page 102: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

C.6 Lid driven cavity with tetrahedral cells only I

Figure C.8: m3a lid driven cavity, UD, CD(0.8), LUD, Gamma

90

Page 103: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

C.7 Lid driven cavity with tetrahedral cells only II

Figure C.9: m5a lid driven cavity, UD, CD(0.8), LUD, Gamma

CFD-08xxxx 91

Page 104: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

C.8 Walls with tetrahedral cells only

Figure C.10: m5b left to right with UD, CD(0.8), LUD, Gamma

92

Page 105: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

C.9 Stagnation flow with tetrahedral cells only

Figure C.11: m5c stagnation flow with UD, CD(0.8), LUD, Gamma

CFD-08xxxx 93

Page 106: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE C Various tests

C.10 Stagnation flow with polyhedral cells

Figure C.12: m6 stagnation flow with UD, CD(0.8), LUD, Gamma

94

Page 107: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

D Mathematical toolbox

D.1 Gauss’ theorem

Let V be a volume in R3 with a smooth and closed surface S with an outwardsfacing normal ~n = (n1, n2, n3). Further let ~w = (w1, w2, w3) be a differentiablevector field then ∫∫∫

Vdiv(~w) dx dy dz =

∫∫S~w · ~n dS (D.1)

The integral∫∫S ~w · ~n dS (or

∫∫S ~w · ~n dΩ, or

∮S ~w · ~n dΩ) is called the flux of

~w through S.

D.2 Sum of two vectors

Graphically, a vector is represented by an arrow, defining the direction, and thelength of the arrow defines the vector’s magnitude. If one end of the arrow isthe origin O and the tip of the arrow is A. Then the vector may be representedalgebraically by OA (also as ~a, a, or a (bold)) with magnitude ||~a||.

Two vectors, ~a and ~b are equal if they have the same magnitude and direction,regardless of whether they have the same initial points. A vector having thesame magnitude as ~a but in the opposite direction to ~a is denoted by −~a.

The sum of two vectors is defined by:

~c = ~a+~b (D.2)

orci = ai + bi

when ~a+~b = ~0 then~b = −~a or bi = −ai. Following properties hold:

1. ~a+~b = ~b+ ~a (commutative property)

2. ~a+ (~b+ ~c) = (~a+~b) + ~c (associative property)

3. ~a+~0 = ~a

4. ~a+ (−~a) = ~0

CFD-08xxxx 95

Page 108: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE D Mathematical toolbox

a c

b

y

x

AC

B

Figure D.1: Sum of two vectors

Vector subtraction is defined as the difference of two vectors, ~a −~b, is a vector~c that is, ~c = ~a−~b, or ~c = ~a+ (−~b).Thus vector subtraction can be representedas a vector addition.

D.3 Multiplying a vector

Is λ ε R, (λ 6= 0), and ~a a vector, ~a 6= ~0, then the length of ||λ~a|| = |λ| ||~a||.For λ = 0, or ~a = 0, is λ~a = ~0.

Following multiplication properties hold:

1. λ(µ~a) = (λµ)~a (associative property)

2. 1~a = ~a

3. λ(~a+~b) = λ~a+ λ~b (distributive property)

4. (λ+ µ)~a = λ~a+ µ~a (distributive property)

D.4 Length of a vector and vector products

Is λ ε R, (λ 6= 0), and ~a a vector, ~a 6= ~0, then the length of ||λ~a|| = |λ| ||~a||.For λ = 0, or ~a = 0, is λ~a = ~0.

A unit vector is one which has a magnitude of 1. Is ~a a vector (~a 6= ~0), then theunit vector in the direction of ~a is a. Suppose a = λ~a (λ > 0), then

1 = ||a|| = λ~a (D.3)

and soλ =

1||~a||

96

Page 109: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

c

a

y

x

A

B

C

Figure D.2: Inner product of two vectors (hashed area of outer product)

The unit vector in the direction of ~a is

a =~a

||~a||(D.4)

Replacing ~a by a is called normalising of ~a (not defined for ~a = ~0).

The breaking up of a vector into it’s component parts is known as resolving avector. Notice that the representation of ~a by it’s components, eg. ax and ay isnot unique. Depending on the orientation of the coordinate system with respectto the vector in question, it is possible to have more than one set of components.

The inner product, scalar, or dot product is defined by:

~a ·~b =∑i

aibi (D.5)

which results in a scalar.

The scalar product of two vectors, ~a and ~b denoted by ~a · ~b, is defined as theproduct of the magnitudes of the vectors times the cosine of the angle betweenthem, as illustrated in Figure D.2.

~a ·~b = ||~a|| ||~b|| cosφ (D.6)

or

cosφ =~a ·~b||~a|| ||~b||

(D.7)

And in particular when a · a = b · b = 1, since the angle between a vector anditself is 0 and the cosine of 0 is 1.

Alternatively, when a · b = 0, since the angle between ~a and ~b is 90 and thecosine of 90 is 0.

In general then, if a · b = 0 and neither the magnitude of ~a nor~b is 0, then ~a and~b must be perpendicular.

CFD-08xxxx 97

Page 110: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE D Mathematical toolbox

Following properties hold:

1. ~a ·~b = ~b · ~a (commutative property)

2. ~a · (~b+ ~c) = ~a ·~b+ ~a · ~c (distributive property)

3. (λ~a) ·~b = ~a · (λ~b) = λ(~a ·~b)

4. When ~a · ~a ≥ 0 and ~a · ~a = 0 then ~a = 0.

Let a vector normal (a vector perpendicular to a plane) be denoted as ~n, a posi-tion vector of some point in a plane denoted as ~a and a typical point on the planedenoted as ~r. Then the vector~b = ~r−~a lies within the plane and is perpendicularto ~n. Thus the vector equation for a plane is:

(~r − ~a) · ~n = 0 (D.8)

The cross or outer product ~a×~b of two vectors ~a and~b inR3 is defined as:

~a×~b =

a2b3− a3b2a3b1− a1b3a1b2− a2b1

(D.9)

which is a vector with length

||~a×~b|| = ||~a|| ||~b|| sinφ (D.10)

where φ is the angle between ~a and~b (0 ≤ φ ≤ π).

Following properties hold:

1. ~a×~b = −~b× ~a

2. (~a+ ~a′)×~b = ~a×~b+ ~a′ ×~b

3. ~a× (~b+ ~b′) = ~a×~b+ ~a× ~b′

4. (λ~a)×~b = ~a× (λ~b) = λ(~a×~b)

Using the elementary trigonometric definition of the cosine in Figure D.3:

cosα =||~un||||~uP ||

From the definition of the dot product:

cosφ =~a ·~b||~a|| ||~b||

or here with the surface normal ~xn′ facing inwards:

cosφ =~xn′ · ~uP||~xn′ || ||~uP ||

98

Page 111: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

ut

un

x n

x n’

uP

α

y

x

P

face

Figure D.3: Vector components near a wall

The length of the normal ~xn′ is by definition 1, thus

||~un||||~uP ||

=~xn′ · ~uP||~uP ||

or||~un|| = ~xn′ · ~uP (D.11)

Now only the length of ~un is known (||~un||) without a direction. Vector ~unpoints in the direction of ~xn′ thus multiplying the normal with the length resultsin

||~un|| ~xn′ = (~xn′ · ~uP ) ~xn′

or simply~un = (~xn′ · ~uP ) ~xn′

Next recall that the normal should face outwards, and with ~xn′ = (−~xn) follows

~un = ((−~xn) · ~uP ) (−~xn)

Pulling −1 out~un = (~xn · ~uP )(−1)(−1)~xn

results in~un = (~xn · ~uP ) ~xn (D.12)

With other words the resulting vector ~un is independent of the choice of thenormal (pointing inwards or outwards).

The tangential component then follows from an subtraction of the now twoknown vectors (~uP and ~un):

~ut = ~uP − ~un (D.13)

CFD-08xxxx 99

Page 112: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

100

Page 113: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Bibliography Fluid DynamicsCYCLONE

Bibliography

[1] M.A. Alves, P. Cruz, A. Mendes, , F.D. Magalh aes, and P.J. Pinho,F.T.Oliveira. Adaptive multiresolution approach for solution of hyperbolicPDEs. Comput. Methods Appl. Mech. Engrg., 191:3909–3928, 2002.

[2] M.A. Alves, P.J. Oliveira, and F.T. Pinho. A convergent and universallybounded interpolation scheme for the treatment of advection. Int. J. Numer.Methods Fluids, 41:47–75, 2003.

[3] A.A. Amsden. KIVA-3: A KIVA program with block-structured mesh forcomplex geometries. Technical Report LA-12503-MS, Los Alamos Nat.Lab., March 1993.

[4] A.A. Amsden. KIVA-3V: A block-structured KIVA program for engineswith vertical or canted valves. Technical Report LA-13313-MS, LosAlamos Nat. Lab., July 1997.

[5] A.A. Amsden and F.H. Harlow. The SMAC method: A numerical tech-nique for calculating incompressible fluid flows. Technical Report LA-4370, Los Alamos Nat. Lab., February 1970.

[6] A.A. Amsden, P.J. O’Rourke, and T.D. Butler. KIVA-II: A computer pro-gram for chemically reactive flows with sprays. Technical Report LA-11560-MS, Los Alamos Nat. Lab., February 1989.

[7] A.A. Amsden, J.D. Ramshaw, L.D. Cloutman, and P.J. O’Rourke. Im-provements and extensions to the KIVA computer program. Technical Re-port LA-10534-MS, Los Alamos Nat. Lab., October 1985.

[8] A.A. Amsden, J.D. Ramshaw, P.J. O’Rourke, and J.K. Dukowicz. KIVA:A computer program for two and three-dimensional fluid flows with chem-ically reactions and fuel sprays. Technical Report LA-10245-MS, LosAlamos Nat. Lab., February 1985.

[9] J.D. Anderson. Computational Fluid Dynamics, the basics with applica-tions. McGraw-Hill, 1995.

[10] T.J. Barth and D.C. Jespersen. The design and application of upwindschemes on unstructured meshes. In Proceedings of the AIAA 27thAerospace Sciences Meeting, Reno, Nevada, January 1989.

[11] M.S. Darwish and F. Moukalled. Normalized variable and space formula-tion methodology for high-resolution schemes. Num. Heat Transfer, PartB, 30:217–237, 1994.

[12] J.H. Ferziger and M. Períc. Computational Methods for Fluid Dynamics.Springer, Berlin, 1996.

CFD-08xxxx 101

Page 114: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

[13] J.H. Ferziger and M. Períc. Computational methods for fluid dynamics. 3rdrev. ed. Springer, Berlin, 2002.

[14] J.E. Fromm and F.H. Harlow. Numerical solution of the problem of vortexstreet development. Physics of fluids, 6, July 1963.

[15] R.A. Gentry, B.J. Daly, and A.A. Amsden. KIVA-COAL: A modified ver-sion of the KIVA program for calculating the combustion dynamics of acoal-water slurry in a Diesel engine cylinder. Technical Report LA-11045-MS, Los Alamos Nat. Lab., October 1987.

[16] U. Ghia, K. N. Ghia, and C. T. Shin. High-re solutions for incompressibleflow using the navier-stokes equations and a multigrid method. Journal ofComputational Physics, 48:387–411, 1982.

[17] A.D Gosman, W.M. Pun, A.K. Runchal, B.D. Spalding, and M. Wolfh-stein. Heat and mass transfer in recirculating flows. Academic Press,1969.

[18] F.H. Harlow and C.W. Hirt. Generalized transport theory of anisotropicturbulence. Technical Report LA-4086, Los Alamos Nat. Lab., May 1969.

[19] F.H. Harlow and P.I. Nakayama. Turbulence transport equations. Physicsof fluids, 10, November 1967.

[20] F.H. Harlow and P.I. Nakayama. Transport of turbulence energy decay rate.Technical Report LA-3854, Los Alamos Nat. Lab., February 1968.

[21] F.H. Harlow and J.E. Welch. Numerical calculation of time-dependentviscous incompressible flow of fluid with free surface. Phys. Fluids, 8,1965.

[22] J.O. Hinze. Turbulence. McGraw-Hill, 1975.

[23] C.W. Hirt, A.A. Amsden, and J.L. Cook. An arbitrary lagrangian-eulerianmethod for all flow speeds. J. Comput. Phys., 14:227–253, 1974.

[24] C.W. Hirt, B.D. Nichols, and N.C. Romero. SOLA: A numerical solutionalgorithm for transient fluid flows. Technical Report LA-5852, Los AlamosNat. Lab., April 1975.

[25] H. Jasak. Error analysis and estimation in the Finite Volume method withapplications to fluid flows. PhD thesis, Imperial College, University ofLondon, 1996.

[26] H. Jasak, H.G. Weller, and A.D. Gosman. High resolution NVD differen-cing scheme for arbitrarily unstructured meshes. Int. J. Numer. MethodsFluids, 31(2):431–449, 1999.

[27] N.L. Johnson. The legacy and future of CFD at Los Alamos.

[28] K. Michalak and C. Ollivier-Gooch. Limiters for unstructured higher-orderaccurate solutions of the euler equations. In Forty-sixth Aerospace SciencesMeeting, 2008.

[29] Y. Nakayama. Visualized flow; fluid mootion in basic and engineeringsituations revealed by flow visualization. Pergamon Press, 1988.

102

Page 115: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Bibliography Fluid DynamicsCYCLONE

[30] B.D. Nichols, C.W. Hirt, and R.S. Hotchkiss. SOLA-VOF: A solutionalgorithm for transient fluid flow with multiple free boundaries. TechnicalReport LA-8355, Los Alamos Nat. Lab., August 1980.

[31] S.V. Patankar. Numerical heat transfer and fluid flow. Hemisphere Publ.Corp.; McGraw-Hill, 1980.

[32] M. Períc. A finite volume method for the prediction of three-dimensionalfluid flow in complex ducts. PhD thesis, Imperial College, University ofLondon, August 1985.

[33] S.B. Pope. Turbulent flows. Cambridge University Press, 2000.

[34] C.M. Rhie and W.L. Chow. Numerical study of the turbulent flow past anairfoil with trailing edge separation. AIAA Journal 21 (11), 1983.

[35] W.C. Rivard, O.A. Framer, and T.D. Butler. RICE: A computer program formulticomponent chemically reactive flows at all speeds. Technical ReportLA-5812, Los Alamos Nat. Lab., March 1975.

[36] P.J. Roache. Computational fluid dynamics. Hermosa Publishers, Al-buquerque NM, 1972.

[37] P.J. Roache. Verification and Validation in Computational Science andEngineering. Hermosa Publishers, Albuquerque NM, 1998.

[38] H. Schlichting. Boundary-layer theory. Transl. by J. Kestin. 7th ed.McGraw-Hill, 1979.

[39] C.T. Shaw. Using computational fluid dynamics. Prentice Hall, 1992.

[40] B.D. Spalding. A novel finite difference formulation for differential ex-pressions involving both first and second derivates. Int.J. for numericalmethods in engineering, 4:551–559, 1972.

[41] J. C. Tannehill, D. A. Anderson, and R. H. Pletcher. Computational FluidMechanics and Heat Transfer. Taylor and Francis, Washington, D.C.,1997.

[42] H. Tennekes and J. L. Lumley. A First Course in Turbulence. MIT Press,Cambridge, MA, 1983.

[43] G.D. van Albada, B. van Leer, and W.W. Roberts. A comparative studyof computational methods in cosmic gas dynamics. Astronomy and Astro-physics, 108:76–84, 1982.

[44] M. Van Dyke. An Album of Fluid Motion. The Parabolic Press, 1982.

[45] V. Venkatakrishnan. On the accuracy of limiters and convergence to steadystate solutions. In Proceedings of the AIAA 31st Aerospace Sciences Meet-ing, Reno, Nevada, January 1993.

[46] H.K. Versteeg and W. Malalasekera. An Introduction to ComputationalFluid Dynamics. Longman, 1995.

[47] H.K. Versteeg and W. Malalasekera. An Introduction to ComputationalFluid Dynamics, The Finite Volume Method. Pearson, 2nd edition, 2007.

CFD-08xxxx 103

Page 116: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

[48] J.E. Welch, F.H. Harlow, J.P. Shannon, and B.J. Daly. The MAC method: Acumputing technique for solving viscous, incompressible, transient fluid-flow problems involving free surfaces. Technical Report LA-3425, LosAlamos Nat. Lab., March 1966.

[49] P. Wesseling. Principles of computational fluid dynamics. Springer, Berlin,2000.

[50] D.C. Wilcox. Turbulence Modeling for CFD. DCW Industries, 1993.

[51] M. Zijlema, A. Segal, and P. Wesseling. Finite volume computation of 2Dincompressible turbulent flows in general coordinates on staggered grids.Technical Report 94-24, TU Delft, 1994.

104

Page 117: dolfyn.netdolfyn.net/dolfyn/files/devguide.pdf · Fluid Dynamics CYCLONE Preface This is just a collection of notes, thoughts and ideas about the dolfyn code. Do not expect a decent

Fluid DynamicsCYCLONE

Index

blending, 22body force, 13boundary

definition, 66shapes, 66

boundness, 22

CBC, 23CD, 21CD2, 21CD3, 21CDS, 11, 21cell

definitions, 65shapes, 66

centroid, 9combustion, 4Convection Boundness Criterion, 23

deffered correction, 12differencing scheme

central, 11, 21central average, 21central w. gradients, 21fixed blending, 22, 26gamma scheme, 28hybrid scheme, 26linear upwind, 27minmod scheme, 28power law, 26quick scheme, 27upwind, 11, 22, 25

FluxUVW, 15

g95, iiiGamma scheme, 28Gauss, 33GradientPhi, 33GradientPhiGauss, 11, 33GradientPhiLeastSquares, 34

hexaeder, 66

Least Squares, 33lid driven cavity, 67, 83Los Alamos, 4LUD, 27LUX, 27

non-orthogonal diffusion, 14Normalised Variable Approach, 22Normalised Variable Diagram, 23NVA, 22NVD, 23

OpenDX, iiiover-relaxed approach, 14

preprocessor, 65prism, 66pyramid, 66

Richardson Extrapolation, 67

Sparc, iiiSparsekit2, iiistress tensor, 13subroutine

FluxUVW, 15GradientPhi, 33GradientPhiGauss, 11, 33GradientPhiLeastSquares, 34

tests, 83tetraeder, 66

UDS, 11, 22

vectorsurface, 10

verification, 67vertices, 66

wedge, 66

105