21
OpenFlower CFD Software R EFERENCE M ANUAL Version 0.1 Edited on July 10, 2004

Open Flower Reference Manual

Embed Size (px)

Citation preview

Page 1: Open Flower Reference Manual

OpenFlower CFD Software

REFERENCE MANUAL

Version 0.1Edited on July 10, 2004

Page 2: Open Flower Reference Manual

2

Page 3: Open Flower Reference Manual

Contents

I OpenFlower: A Free Open-Source CFD Software 7

1 Getting started 91.1 Retrieve the source files of OpenFlower . . . . . . . . . . . . . . . . . . . . . . 91.2 Starting with the provided example files . . . . . . . . . . . . . . . . . . . . . . 9

II Numerical and Physical Overview of OpenFlower 11

2 Choices made in OpenFlower and objectives 132.1 Governing equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.1.1 Mass conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.1.2 Navier-Stokes equation . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.1.3 Temperature equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Physical modeling 15

4 Numerical overview 174.1 Diffusive fluxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

References 21

3

Page 4: Open Flower Reference Manual

4 CONTENTS

Page 5: Open Flower Reference Manual

Introduction

OpenFlower development was first launched on february 2004 by some CFD research engi-neers, willing to encourage common effort in research and developments in the area of Computa-tional Fluid Dynamics. The main reason for this was (among other things) to federate the work ofa multitude of PhD students and scientists who develop their own specific and effective codes, butwhich one day or the other will vanish as they change area of interest, or become unusable as timepasses by... Moreover, the general trend shows that only some (expensive) commercial codes areavailable to treat complex geometries, whereas scientists in research labs can only mainly rely onthese to accomplish research contracts with industry, when their home applications can only solvespecific academic applications.

The objective of an open-source CFD software 1 such as OpenFlower becomes clear then :provide in a ”give & ask” basis a reliable CFD platform to develop models, numerical techniquesand be available to respond to the increase of industrial needs in the field of CFD. OpenFlowerdevelopment will mainly rely on:

• the maintainment and developments integration of contributions coming from private insti-tutes, research labs, PhD students... by the project administrators, who also provide the maindevelopment guidelines and starting basis;

• the feedback of OpenFlower users, such as bug reports, patches, code development andoptimisations

The scientific exchange of thousands of researchers and students of numerous fields of interestand skills can only be benefic in such an open-source code development environment, which surelywill become an interesting way around closed commercial CFD codes.

The main strength of OpenFlower will not only be its open-source community working andhacking on it, but also a reliable colloborative framework and a well documented source of infor-mation for the fast development in the code and understanding its basic concepts and implementedphysical modelings.

OpenFlower (litteraly Open Source Flow Solver) is a free open-source finite volume Computa-tional Fluid Dynamics software, mainly devoted to the resolution of the turbulent incompressibleNavier-Stokes equations, with scalar transport. It can deal with arbitrary complex geometries withhybrid meshes (supporting tetrahedrals, prisms, pyramids and hexahedrals), and is mainly devotedto the Large Eddy Simulation of turbulent flows, an area which is being greatly supported and hasreceived all the attention of the CFD community for the past 20 years. It is likely that this will bethe most interesting approach for the simulation of turbulent flows, as computers are being fasteryear after year with their prices being more and more affordable for industries and universities.

1see the argument (english) made by Stephane Zaleski for the open sourcing of CFD codes @http://www.lmm.jussieu.fr/ zaleski/OpenCFD.html

5

Page 6: Open Flower Reference Manual

6 CONTENTS

Page 7: Open Flower Reference Manual

Part I

OpenFlower: A Free Open-Source CFDSoftware

7

Page 8: Open Flower Reference Manual
Page 9: Open Flower Reference Manual

Chapter 1

Getting started

1.1 Retrieve the source files of OpenFlower

If you have cvs version 1.10 or higher installed, you should do the following to get the initialcopy of the repository:% mkdir OpenFlower% cd OpenFlower% cvs -d:pserver:[email protected]:/cvsroot/openflower login% cvs -z3 -d:pserver:[email protected]:/cvsroot/openflower co openflower-v0.1.1

You’ll have to hit return at the password prompt after cvs login. (If you cannot login, check ifyou really have cvs version 1.10 or higher!) After that you can use :% cvs co openflower-v0.1.1% cd openflower-v0.1.1% ./first construction% make

To force a fresh release after an earlier check-out do:% make distclean% cvs update -d -P% ./configure% make

from the OpenFlower directory to update your working copy. After the binaries have been built,you can use:% make install

to install them.It is not possible to commit changes unless you are a member of the OpenFlower development

team, but you can send us patches and we’ll include them in the next release of the project. Or youcan post a request for officially joining the project in the proper Forum1.

1.2 Starting with the provided example files

Example files are available in the /examples/ directory.

1http://sourceforge.net/forum/?group id=104134

9

Page 10: Open Flower Reference Manual

10 CHAPTER 1. GETTING STARTED

OpenFlower input files are denoted by *.flw (eg. prisms and hexas.flw). These contain severalinstructions concerning all the necessary instructions for creating and running a CFD simulation.Before explaining the content of the input files format, the user needs to create the geometryand the related mesh of the configuration. As for now, only the Gmsh2 format is available as anOpenFlower input.

Gmsh is a three-dimensional unstructured mesh generator, with some built-in post-processingfacilities. It can generate multi-element meshes (tetrahedral, hexahedral, prism and pyramids) andit is freely downloadable from the web-site of C. Geuzaine.

OpenFlower already provides several *.geo files (the Gmsh format for CAD and meshingdirectives), in order for the beginner to quickly create a first mesh (eg. prisms and hexas.geo).Launch Gmsh with the selected .geo file:% gmsh prisms and hexas.geoselect the ”Mesh” item from the drop-down menu of the Gmsh interface, then generate the meshby clicking and choosing a 3D mesh: the generated mesh is then displayed in the visaulizationwindow. Save the mesh by clicking in the ”Save” button: a *.msh file will be created containingall the mesh characteristics (see Gmsh Reference Manual for details concerning the mesh fileformat). The file (eg. prisms and hexas.msh) can now be used by the OpenFlower interface (viathe input .flw file) for solving a problem.

Then, to launch OpenFlower on a test case, simply type:% openflower file.flw 1>out 2>err

The parser of OpenFlower then reads the input .flw file and eventually outputs some informa-tion in the out and err files (or other post-processing files if any).

2see Gmsh website maintained and developped by Christophe Geuzaine @ http://www.geuz.org/gmsh

Page 11: Open Flower Reference Manual

Part II

Numerical and Physical Overview ofOpenFlower

11

Page 12: Open Flower Reference Manual
Page 13: Open Flower Reference Manual

Chapter 2

Choices made in OpenFlower andobjectives

OpenFlower is intended to solve the incompressible Navier-Stokes equations in their conser-vative form and on unstructured meshes. The governing equations are solved with a finite-volumeapproach and a co-located arrangement of the variables (velocity, pressure, and temperature).

2.1 Governing equations

2.1.1 Mass conservation

The mass conservation equation, assuming an incompressible flow at constant density ρ, readsas:

∂ui

∂xi= 0 (2.1)

2.1.2 Navier-Stokes equation

The Navier-Stokes equation, in its conservative form reads as:

∂ui

∂t+

∂xj(uiuj) = −

1

ρ

∂p

∂xi+

∂xj(2νSij) + fi (2.2)

where:

• ui is the velocity component in the ith direction;

• p denotes the pressure field;

• fi relates to a source term (buoyancy force, mass flow-rate conservation term...);

• ν is the cinematic viscosity (= µ/ρ)

• and Sij is the strain rate tensor given by:

Sij =1

2

(

∂ui

∂xj+

∂uj

∂xi

)

(2.3)

13

Page 14: Open Flower Reference Manual

14 CHAPTER 2. CHOICES MADE IN OPENFLOWER AND OBJECTIVES

2.1.3 Temperature equation

The temperature (or scalar transport) equation is given by:

∂T

∂t+

∂xj(ujT ) =

∂xj

(

α∂T

∂xj

)

+ Q (2.4)

where α = λ/ρCp is the (thermal) diffusivity and Q is a source (or sink) term.

Page 15: Open Flower Reference Manual

Chapter 3

Physical modeling

15

Page 16: Open Flower Reference Manual

16 CHAPTER 3. PHYSICAL MODELING

Page 17: Open Flower Reference Manual

Chapter 4

Numerical overview

The discretized set of governing equations is written in its integral form, and following theGauss theorem, as:

V

∂ui

∂tdV +

∂V

uj uinj dS = −

V

1

ρ

∂p

∂xidV +

∂V

2(ν + νt)Sijnj dS (4.1)∫

∂V

uini dS = 0 (4.2)∫

V

∂T

∂tdV +

∂V

ui Tni dS =

∂V

(αf + αt)∂T

∂xini dS (4.3)

~n being the outward normal unit surface vector of control volume V centered on point E.

4.1 Diffusive fluxes

The diffusion term appears in the discretized governing equations as:

D =1

V

∂V

Γ∂φ

∂xini dS =

1

V

Neibrs(E)∑

f

(

Γf∂φ

∂xini

)

f

Sf (4.4)

where Γ is the total diffusivity. For example Γ = (α + αt) for a scalar field.Consider a scalar field φ, located at CV centroids (center of elements) E and P . E represents thecenter of the element for which we want to calculate diffusion, P is one of its neighbours (seefigure 4.1).

We define point I as the intersection between the face f (with neighbours E and P ) and thestraight line between E and P . Note that in non-orthogonal meshes, point I differs from thecenter of the face f . We also define points E ′ and P ′ which are obtained by projecting E and Porthogonally on the line normal to face f and passing through point f . V is the volume of cell Eand Sf is the surface of the face centered on f between cells E and P .Consider a scalar field φ, located at CV centroids (center of elements). E denotes the present CVand P one of its neighbor elements sharing face i (see figure 4.1). The objective is to determinethe diffusive flux going out of element E.

Given these notations, the gradient normal to the face at f between E and P is then given by[1]:

(

∂φ

∂xini

)

f

'φP ′ − φE′

dE′P ′

(4.5)

17

Page 18: Open Flower Reference Manual

18 CHAPTER 4. NUMERICAL OVERVIEW

�� ��

��

��

� �

� �� � � � �� � � � �� � � � �� � � � �� � � � �� � � � �� � � � �

� �� �� �� �

� �� �� �� �

PSfrag replacements

~n

P

E

P ′

E′

I

f

Figure 4.1: Notations for the estimation of the diffusive fluxes and gradients

dE′P ′ being the distance between points E ′ and P ′. The values of φP ′ and φE′ are determinedusing a second order approximation:

φE′ = φE +(

−→Oφ

)

E

−−→EE′ (4.6)

Gradient of the scalar field at control volume centers are given by:

(

∂φ

∂xi

)

E

=1

V

Neibrs(E)∑

f

φfniSf (4.7)

The evaluation of the face center value φf at f can not be a simple linear interpolation betweenpoints E and P since it would provide an evaluation of φ at point I:

φI = γfφE + (1 − γf ) φP (4.8)

where:

γf =dIP

dEP

(4.9)

A second order approximation for φf is given by the following expression, where the gradientused to correct the estimation at point f is given at the previous time step old:

φf = φI +(

−→Oφ

)old

I

−→If (4.10)

(

−→Oφ

)old

I=

1

2

(

(

−→Oφ

)old

E+

(

−→Oφ

)old

P

)

(4.11)

Gradient at the center of element E is evaluated following (similar reasoning for element P ):

~5ΦE =1

VE

i

Φi Si ~n (4.12)

Page 19: Open Flower Reference Manual

4.1. DIFFUSIVE FLUXES 19

Now, Φi is approximated using the previous value (at the previous time step) of the gradientof Φ by:

Φi = ΦF +(

~5ΦF .~dFi

)old

(4.13)

Page 20: Open Flower Reference Manual

20 CHAPTER 4. NUMERICAL OVERVIEW

Page 21: Open Flower Reference Manual

Bibliography

[1] FERZIGER, J., AND PERIC, M. Computational Methods for Fluid Dynamics. Springer, 1997.

21