0% found this document useful (0 votes)
296 views

CS Theory

This document provides a theory guide for Code Saturne, an open-source computational fluid dynamics (CFD) software. It describes the governing equations solved in Code Saturne, including the Navier-Stokes equations, and details the numerical methods used, such as the finite volume spatial discretization and pressure-based time stepping approach. It also summarizes advanced physical models in Code Saturne, like turbulence modeling, combustion, compressible flows, and others. The guide is intended to help developers understand and update the algorithms in Code Saturne.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
296 views

CS Theory

This document provides a theory guide for Code Saturne, an open-source computational fluid dynamics (CFD) software. It describes the governing equations solved in Code Saturne, including the Navier-Stokes equations, and details the numerical methods used, such as the finite volume spatial discretization and pressure-based time stepping approach. It also summarizes advanced physical models in Code Saturne, like turbulence modeling, combustion, compressible flows, and others. The guide is intended to help developers understand and update the algorithms in Code Saturne.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 403

EDF R&D

Fluid Dynamics, Power Generation and Environment Department


Single Phase Thermal-Hydraulics Group

6, quai Watier
F-78401 Chatou Cedex

Tel: 33 1 30 87 75 40
Fax: 33 1 30 87 79 16 APRIL 2015

Code Saturne documentation

Code Saturne 4.0.0 Theory Guide

contact: [email protected]
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 1/402
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 2/402

ABSTRACT

Code Saturne solves the Navier-Stokes equations for 2D, 2D axisymmetric, or 3D, steady or unsteady,
laminar or turbulent, incompressible or dilatable flows, with or without heat transfer, and with possible
scalar fluctuations. The code also includes a Lagrangian module, a semi-transparent radiation module,
a gas combustion module, a coal combustion module, an electric module (Joule effect and electric
arc) and a compressible module. In the present document, the gas combustion, coal combustion,
electric and compressible capabilities of the code will be referred to as particular physics. The
code uses a finite volume discretization. A wide range of unstructured meshes, either hybrid (containing
elements of different types) and/or non-conform, can be used.
This document constitutes the theory guide associated with the kernel of Code Saturne. The system
of equations considered consists of the Navier-Stokes equations, with turbulence and passive scalars.
Firstly, the continuous equations for mass, momentum, turbulence and passive scalars are presented.
Secondly, information related to the time scheme is supplied. Thirdly, the spatial discretisation is
detailed: it is based on a co-located1 finite volume scheme for unstructured meshes. Fourthly, the
different source terms are described. Fithly, boundary conditions are detailed. And finally, some
algebrae such as how to solve a non-linear convection diffusion equation and some linear algebrae
algorithms are presented.
In a seconde part, advanced modellings such as Combustion, electric and compressible flows are pre-
sented with their particular treatments.
To make the documentation suitable to the developers needs, the appendix has been organized into
sub-sections corresponding to the major steps of the algorithm and to some important subroutines of
the code.
During the development process of the code, the documentation is naturally updated as and when
required by the evolution of the source code itself. Suggestions for improvement are more than
welcome. In particular, it will be necessary to deal with some transverse subjects (such as parallelism,
periodicity) which were voluntarily left out of the first versions, to focus on the algorithms and their
implementation.
To make it easier for the developers to keep the documentation up to date during the development
process, the choice is made to not based this document on the implementation (except in the appendix)
but to keep as much as possible a general formulation. For developers who are interested in the way
theory is implemented, please refer to the doxygen documentation. A special effort will be made to
link this theory guide to the doxygen documentation.
Code Saturne is free software; you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version. Code Saturne is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

1 All the variables are located at the centres of the cells.


Table of contents

1 Introduction 9
1.1 Aims of the document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

I Generic solver capabilities 11

2 Governing equations 12
2.1 Continuous mass and momentum equations . . . . . . . . . . . . . . . . . . . . 13
2.2 Thermal equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 Equations for scalars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3 Time stepping 21
3.1 Time discretisation of a transport equation . . . . . . . . . . . . . . . . . . . . 22
3.2 Pressure-based velocity-pressure solver . . . . . . . . . . . . . . . . . . . . . . 24

4 Space discretization 26
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 Convective term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Diffusive term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Gradient calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5 Advanced topic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

5 Boundary conditions 41
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.2 Standard user boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.3 Internal coding of the boundary conditions Discretization . . . . . . . . . . 44
5.4 Wall boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6 Algebrae 58
6.1 Iterative process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.2 Linear algebrae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 4/402

II Advanced modelling 60

7 Turbulence modelling 61
7.1 Eddy viscosity Models (EVM ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.2 Differential Reynolds Stress Models (DRSM ) . . . . . . . . . . . . . . . . . . 68
7.3 Large-Eddy Simulation (LES ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

8 Compressible flows 72
8.1 Density-based solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

9 Combustion 74
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.2 Thermodynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
9.3 Gas combustion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
9.4 Coal, Biomass, Heavy Oil combustion . . . . . . . . . . . . . . . . . . . . . . . 88

10 Groundwater flows 104


10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.2 Groundwater flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.3 Soil-water relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.4 Solving of the Richards equation . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.5 Groundwater Transferts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

11 Magneto-Hydro Dynamics 114

12 Lagrangian particle tracking 115

13 Cavitation modelling 116


13.1 System equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
13.2 Vaporization source term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
13.3 Time stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

III Appendices 119

IV Base module 122

A- bilsc2 routine 124

B- clptur routine 136


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 5/402

C- clptrg routine 152

D- clsyvt routine 162

E- codits routine 170

F- condli routine 176

G- covofi routine 186

H- gradmc routine 204

I- gradrc routine 210

J- inimas routine 220

K- itrmas/itrgrp routine 224

L- matrix routine 226

M- navstv routine 232

N- predvv routine 242

O- resopv routine 254

P- turbke routine 264

Q- turrij routine 270

R- viscfa routine 284

S- visort routine 286

T- visecv routine 290

U- vortex routine 294

V Compressible module 300

A- cfbl** routine 302

B- cfener routine 320


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 6/402

C- cfmsvl routine 326

D- cfqdmv routine 332

E- cfxtcl routine 336

VI Electric Arcs 356

A- elec** routine 358

VII Mesh Handling 376

B Mesh Algorithms 377

C Mesh Quality 394

VIII Appendices 397


C.1 Tensorial and index notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
C.2 Diffenrential operators and standard relationships . . . . . . . . . . . . . . . . 398

IX References 400
Nomenclature

Greek symbols
1 mass fraction of the continuous phase
2, i mass fraction of the particle class i
turbulent kinetic energy dissipation tensor m2 .s3

turbulent kinetic energy dissipation m2 .s3


mass source term

dynamic viscosity kg.m1 .s1


l dynamic molecular viscosity kg.m1 .s1
i the cell i

|i | volume of the cell i m3


pressure-velocity correlation tensor kg.s3

density field kg.m3


m bulk density kg/m3
total stress tensor Pa

viscous stress tensor, which is the deviatoric part of the stress tensor Pa
Operators
D
. deviatoric part of a tensor
: double dot product
S
. symmetric part of a tensor

tr . trace of a tensor

Roman symbols
G turbulent kinetic energy buoyancy term kg.m1 .s3
G turbulent buoyancy term for dissipation
G turbulent buoyancy production tensor kg.m1 .s3

C 1 constant of the standard k model


C 2 constant of the standard k model
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 8/402

C 3 constant of the standard k model depending on the buoyancy term


C eddy viscosity constant

f interior or boundary cell face


Fi group of all faces of the cell i
F center of the face fij between cells i and j
Hm bulk enthalpy J/kg

I centre of i
k turbulent kinetic energy m2 .s2
K tensor of the velocity head loss kg.m3 .s1

P pressure field Pa
Pfij average of the pressure field on the interface between the neighbouring cells i and j Pa
Pm pressure of the bulk Pa
P turbulent kinetic energy production kg.m1 .s3

P turbulent production tensor kg.m1 .s3

Rij componant ij of the Reynolds stress tensor m2 .s2


r velocity density correlation vector 0 u0 , generally modelled by a Generalized Gradient Diffusion
C
Hypothesis (GGDH): 32 t k R

R Reynolds stress tensor m2 .s2


S fi outward normal vector of the face f of the cell i, normalized by the surface |S|

S strain rate tensor s1

ST additional turbulent dissipation source term kg.m1 .s4

STk additional turbulent kinetic energy source term kg.m1 .s3


ST u explicit additional momemtum source terms kg.m2 .s2
t time [s]

um bulk velocity m/s


u velocity field m.s1
Yi mass fraction of constituant i
Chapter 1

Introduction
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 10/402

Disclaimer
Code Saturne is free software; you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Code Saturne is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.1

1.1 Aims of the document


This chapter constitutes an introduction to the theory guide associated with the kernel of Code Saturne.
The system of equations considered consists of the Navier-Stokes equations, with turbulence and pas-
sive scalars. Firstly, the continuous equations for mass, momentum, turbulence and passive scalars
are presented. Secondly, information related to the time scheme is supplied. Thirdly, the spatial
discretisation is detailed: it is based on a co-located2 finite volume scheme for unstructured meshes.
Fourthly, the different source terms are described. Fifthly, boundary conditions are detailed. And
finally, some algebrae such as how to solve a non-linear convection diffusion equation and some linear
algebrae algorithms are presented.
In a second part, advanced modellings are presented with their particular treatments.
To make the documentation suitable to the developers needs, the appendix has been organized into
sub-sections corresponding to the major steps of the algorithm and to some important subroutines of
the code.
During the development process of the code, the documentation is naturally updated as and when
required by the evolution of the source code itself. Suggestions for improvement are more than
welcome. In particular, it will be necessary to deal with some transverse subjects (such as parallelism,
periodicity) which were voluntarily left out of the first versions, to focus on the algorithms and their
implementation.
To make it easier for the developers to keep the documentation up to date during the development
process, the choice is made not to based this document on the implementation (except in the appendix)
but to keep as much as possible a general formulation. For developers who are interested in the way
theory is implemented, please refer to the doxygen documentation (see local html documentation). A
special effort will be made to link this theory guide to the doxygen documentation.

1 You should have received a copy of the GNU General Public License along with Code Saturne; if not, write to the

Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2 All the variables are located at the centres of the cells.
Part I

Generic solver capabilities


Chapter 2

Governing equations
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 13/402

2.1 Continuous mass and momentum equations


This section presents the continuous equations. It is no substitute for the specific sub-sections of this
documentation: the purpose here is mainly to provide an overview before more detailed reading.

Balance methodology: The continuous equations can be obtained applying budget on the mass,
momentum, or again on mass of a scalar. A useful theorem, the so-called Leibniz theorem, states that
the variation of the integral of a given field A over a moving domain reads:

Z  Z Z
d A
Ad = d + Av dS, (I.2.1)
dt t
where v is the velocity of the boundary of and is the boundary of with a outward surface
element dS.

2.1.1 Laminar flows


Mass equation: Let now apply (I.2.1) to a fluid volume1 , so moves with the fluid velocity
denoted by u, and to the field A = , where denotes the density:
Z  Z Z
d
d = d + u dS,
dt t
Z   (I.2.2)

= + div (u) d,
t
d R 
the second line is obtained using Green relation. In (I.2.2), the term
d is zero because2
dt
it is the variation of the mass of a fluid volume. This equality is true for any fluid volume, so if the
density field and the velocity field are sufficiently regular then the continuity equation holds:


+ div (u) = 0. (I.2.3)
t
Equation (I.2.3) could be slightly generalized to cases where a mass source term exists:

+ div (u) = , (I.2.4)
t
but is generally taken to 0.

Momentum equation: The same procedure on the momentum gives:


Z  Z Z
d (u)
ud = d + u (u) dS,
dt t
Z
(I.2.5)
(u)
= + div (u u) d,
t
once again, the Green relation has been used to obtain the second line. One then invokes Newtons
second law stating that the variation of momentum is equal to the external forces:
Z  Z Z
d
ud = dS + gd ,
dt
(I.2.6)
| {z } | {z }
boundary force volume force
Z

= div + gd,

1A fluid volume consists of fluid particles, that is to say it moves with the fluid velocity.
2 it can be non-zero in some rare cases when fluid is created by a chemical reaction for instance.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 14/402

where is the Cauchy stress tensor3 , g is the gravity field. Other source of momentum can be added
in particular case, such as head losses or Coriolis forces for instance.
Finally, bringing (I.2.5) and (I.2.6) all together the momentum equation is obtained:

(u) + div (u u) = div + g + ST u K u + uin ,

(I.2.7)
t
where ST u and K u stand for explicit and implicit additional momentum Source Terms which may
be prescribed by the user (head loss, uin contribution associated with a user-prescribed mass source
term...). Note that K is a symmetric positive tensor, by definition.
In order to make the set of Equations (I.2.4) and (I.2.7) closed, the Newtonian state law linking the
deviatoric part of the stress tensor to the velocity field (more precisely to the rate of strain tensor
S) is introduced:
2
= 2S D = 2S tr S 1,

(I.2.8)
3
where = l is called the dynamic molecular viscosity, whereas is the viscous stress tensor and the
pressure field are defined as:
P = 1 tr ,


3 (I.2.9)

= P 1.

and S , the strain rate tensor, as:


1
u + uT .

S= (I.2.10)
2
Note that a fluid for which (I.2.8) holds isS called a Newtonian fluid, it is generally the case for water,
air, but not the case of a paint because the stresses do not depend linearly on the strain rate.

Navier-Stokes equations: Injecting Equation (I.2.8) into the momentum Equation (I.2.7) and
combining it with the continuity Equation (I.2.4) give the Navier-Stokes equations:

+ div (u) = ,
t   
2 
(u) + div (u u) = P + div u + uT tr u Id + g + ST u K u + uin ,

t 3
(I.2.11)
The left hand side of the momentum part of Equation (I.2.11) can be rewritten using the continuity
Equation (I.2.4):
u
(u) + div (u u) = + u +div (u) u + u (u) . (I.2.12)
t t t
|{z} | {z }
[div (u)]u convection

Then the Navier-Stokes equations read in non-conservative form:

+ div (u) = ,
t   
u 2  
+ u (u) = P + div u + uT tr u Id + g + ST u K u + uin u ,

t 3
(I.2.13)
This formulation will be used in the following. Note that the convective term is nothing else but
u (u) = div (u u) div (u) u, this relationship should be conserved by the space-discretized
scheme (see Chapter 4).
3 dS represents the forces exerted on the surface element dS by the exterior of the domain .
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 15/402

2.1.2 Turbulent flows with a Reynolds-Averaged Navier-Stokes ap-


proach (RANS ):
When the flow becomes turbulent, the RANS approach is to consider the velocity field u as stochastic
and then splat into a mean field denoted by u and a fluctuating field u0 :
u = u + u0 . (I.2.14)
The Reynolds average operator () is applied to Navier-Stokes Equation (I.2.11):



+ div (u) = ,


t   
u 2

T
 
+ u (u) = P + div u + u tr u Id + g div R (I.2.15)


t 3


+ ST u K u + uin u ,


Only the mean fields u and P are computed. An additional term R appears in the Reynolds Equations
(I.2.15) which is by definition the covariance tensor of the fluctuating velocity field and called the
Reynolds stress tensor:
R u0 u0 . (I.2.16)
the latter requires a closure modelling which depends the turbulence model adopted. Two major types
of modelling exist:

i/ Eddy Viscosity Models (EVM ) which assume that the Reynolds stress tensor is aligned with the
strain rate tensor of the mean flow (S 21 u + uT ):


2 D
R = k1 2T S , (I.2.17)
3
where the turbulent kinetic energy k is defined by:
1 
k tr R , (I.2.18)
2
and T is called the dynamic turbulent viscosity and must be modelled. Note that the viscous
D D
part T S of the Reynolds stresses is simply added to the viscous part of the stress tensor l S
so that the momentum equation for the mean velocity is similar to the one of a laminar flow
with a variable viscosity = l + T . Five EVM are available in Code Saturne: k , k
with Linear Production (LP ), k SST, Spalart Allmaras, and an Elliptic Blending model
(EB-EVM ) Bl v 2 k ([BL12]).
ii/ Differential Reynolds Stress Models (DRSM ) which solve a transport equation on the components
of the Reynolds stress tensor R during the simulation, and are readily available for the momentum
equation (I.2.15). Three DRSM models are available in Code Saturne: Rij proposed by
Launder Reece and Rodi (LRR) in [LRR75], Rij proposed by Speziale, Sarkar and Gatski
(SSG) in [SSG91] and an Elliptic Blending version EB-RSM (see [MH02]).

2.1.3 Large Eddy Simulation (LES ):


The LES approach consists in spatially filtering the u field using an operator denoted by ().
f Applying
the latter filter to the Navier-Stokes Equations (I.2.22) gives:



+ div (e u) = ,
t
eu e D + g div u^
     
0 u0 + ST K u in
+ u e (e
u) = Pe + div 2S u e + u
e u
e ,
t
(I.2.19)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 16/402

where u0 are non-filtered fluctuations. An eddy viscosity hypothesis is made on the additional resulting
tensor:
2
0 u0 = kId 2 S eD,
u^ T (I.2.20)
3
where the above turbulent viscosity T now accounts only for sub-grid effects.

2.1.4 Formulation for laminar, RANS or LES calculation:


For the sake of simplicity, in all cases, the computed velocity field will be denoted by u even if it is
about RANS velocity field u or LES velocity field u e.
Moreover, a manipulation on the right hand side of the momentum is performed to change the meaning
of the pressure field. let P ? be the dynamic pressure field defined by:
2
P ? = P 0 g x + k, (I.2.21)
3
where 0 is a reference constant density field. Then the continuity and the momentum equations read:



+ div (u) = ,
t




u
+ u (u) = P ? + div 2 (l + T ) S D div R 2T S D + ( 0 ) g (I.2.22)
 



t

+ ST K u + uin u .


u

2.2 Thermal equations


2.2.1 Energy equation
The energy equation reads:
de
= div q 00 + q 000 P div (u) + S 2 ,

(I.2.23)
dt
where e is the specific internal energy, q 00 is the heat flux vector, q 000 is the dissipation rate or rate of
internal heat generation and S 2 is scalar strain rate defined by

S 2 = 2S D : S D . (I.2.24)

The Fourier law of heat conduction gives:

q 00 = T, (I.2.25)

where is the thermal conductivity and T is the temperature field.

2.2.2 Enthalpy equation


Thermodynamics definition of enthalpy gives:
1
h e + P. (I.2.26)

d
Applying the Lagrangian derivative to h:
dt
dh de 1 dP P d
= + 2 , (I.2.27)
dt dt dt dt
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 17/402

then
dh dP d
= div (T ) + q 000 P div u + S 2 + P
,
dt dt dt

dP d
= div (T ) + q 000 + S 2 + P
dt + div u ,
(I.2.28)
dt | {z }
=0
dP
= div (T ) + q 000 + S 2 + .
dt
To express (I.2.28) only in terms of h and not T , some thermodynamics relationships can be used. For
a pure substance, Maxwells relations give:
1
dh = Cp dT + (1 T ) dP, (I.2.29)

where is the thermal expansion coefficient defined by:

1
= . (I.2.30)
T P

The equation (I.2.28) then becomes:


  
dh 1 T dP
= div h P + q 000 + S 2 + . (I.2.31)
dt Cp dt

Remark 2.1 Note that for incompressible flows, T is negligible compared to 1. Moreover, for ideal
gas, = 1/T so the following relationship holds:

dh = Cp dT. (I.2.32)

2.2.3 Temperature equation


In order to rearrange the enthalpy Equation (I.2.28) in terms of temperature (I.2.29) is used:

s (1/) 1
= = 2
= , (I.2.33)
P T T P T P
and also:  
1 T
h P = T, (I.2.34)
Cp
and Equation (I.2.31) becomes:
dT dP
Cp = div (T ) + T + q 000 + S 2 . (I.2.35)
dt dt

The Eq. (I.2.35) can be reduced using some hypothesis, for example:

1
If the fluid is an ideal gas, = and it becomes:
T
dT dP
Cp = div (T ) + + q 000 + S 2 . (I.2.36)
dt dt

If the fluid is incompressible, = 0, q 000 = 0 and we generally neglect S 2 so that it becomes:


dT
Cp = div (T ) . (I.2.37)
dt
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 18/402

2.3 Equations for scalars


Two types of transport equations are considered:

i/ convection of a scalar with additional source terms:

(a)
+ div (a u)) div (Ka) = STa + ain , (I.2.38)
t | {z } | {z }
advection diffusion

g2 with additional source terms:


ii/ convection of the variance a
 
ag2     in
+ div a g2 u div K a g2 = STa g2
g2 + a
t | {z } | {z }
advection diffusion (I.2.39)
t 2 g2
+2 a)
(e a ,
t Rf k
| {z }
production and dissipation

The two previous equations can be unified formally as:

(Y )
+ div (uY ) div (KY ) = STY + Y in + PY Y (I.2.40)
t
with:

0
for Y = a ,
PY  Y = (I.2.41)
g2
2 t (e
a)2 g2 .

a for Y = a
t Rf k

STY represents the additional source terms that may be prescribed by the user.

2.3.1 Equations for scalars with a drift


The Diffusion-Inertia model is available in Code Saturne; it aims at modelling aerosol transport, and
was originally proposed by Zaichik et al. [ZSSA04]. Details on the theoretical work and implementation
of the model in the framework of Code Saturne can be found in technical note H-I81-2013-02277-EN.

Aerosol transport numerical model


The so-called diffusion-inertia model has been first proposed by Zaichik et al. [ZSSA04]. It is based on
the principle that the main characteristics of the aerosol transport in turbulent flows can be described
by solving a single transport equation on the particle mass concentration, which reads (using the
notations of P. Nerisson [Ner09]):
     
C Uf,i Uf,i T
+ Uf,i + p gi p + Uf,k Db ik + Dik C = (I.2.42)
t xi t xk xk 1+
 
T
 C
Db ik + Dp,ik
xi xk

In this equation:

C represents the particle mass concentration;


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 19/402

Uf,i is the i component of the fluid velocity;


p is the particle relaxation time;
gi is the i component of the gravity acceleration;
T
Db and Dij are respectively the coefficient of Brownian diffusion and the tensor of turbulent
diffusivity.

A physical interpretation of the different terms involved in the transport equation of the aerosols
follows:

p gi represents the transport due to gravity;


 
Uf,i Uf,i
p + Uf,k represents the deviation of the aerosol trajectory with respect to the
t xk
fluid (zero-inertia) particle due to particle inertia (which may be loosely referred to as centrifu-
gal effect);

Db ik is the transport of particles due to the gradient of temperature (the so-called ther-
xk
mophoresis);
 
T
D is the transport of particles due to the gradient of kinetic energy (the so-called
xi + 1 ik
turbophoresis, or turbophoretic effect).

If the particulate Reynolds number is sufficiently small, the particle relaxation time p can be defined
as
p d2p
p = (I.2.43)
18f
with p the particle density, f the fluid dynamic viscosity and dp the particle diameter. It should be
underlined that to take advantage of the classical transport equation of the species in Code Saturne,
Eq. (I.2.42) is reformulated by considering the variable Y C/f (with f considered as a good
enough approximation of the density of the particle-laden flow) and actually solving an equation on
this variable. With a vectorial notation, this equation reads4 :
Y h i 
+ div ([uY ] Y ) div (uY ) Y + div (uY u) Y = div Db 1 + DTp Y (I.2.44)
t
where the additional convective flux is:
 
du t
(uY u) = p g p div Db 1 + D (I.2.45)
dt 1+ p

Brownian diffusion
Let us detail Eq. (I.2.42) in case all terms are canceled except the diffusion one:
Y h i 
= div Db 1 + Dtp Y (I.2.46)
t

The coefficient Db is theoretically given by the Stokes-Einstein relation:


kB T
Db = dp
(I.2.47)
6f 2

with kB the Boltzmann constant equal to 1.38 1023 J.K1 .


4 This equation is not exact. In the second member, density has been extracted from the gradient operator, and in the

additional convective flux density was integrated inside the divergent operator, for compatibility reason with Code Saturne
construction. These approximations do not have major impact.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 20/402

Sedimentation terms
Let us now focus on the term simulating transport by the gravity acceleration, in case all terms that
model particle transport and diffusion are set to zero except gravity and the fluid velocity, the scalar
speed uY reduces to:
uY = u + p g (I.2.48)

Turbophoretic transport
Cancelling all but turbophoresis transport terms (no gravity, no turbulent diffusion, etc.), the scalar
associated velocity uY becomes:
 

uY = u div DTp (I.2.49)
1+

Turbophoresis should move the particles from the zones with higher turbulent kinetic energy to the
lower one. The fluid turbulent diffusion tensor can be expressed as:

DTp = T hu0 u0 i (I.2.50)

With a Eddy Viscosity turbulence Model (EVM), one has


2
hu0 u0 i = k1 T S (I.2.51)
3
Also, for the k model:
3 C k
T = (I.2.52)
2 T
where C = 0.09 is a constant and T the turbulent Schmidt, and is defined by:
p
= (I.2.53)
fT p

3 C k
with fT p = T = .
2
Chapter 3

Time stepping
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 22/402

3.1 Time discretisation of a transport equation


At first, the physical properties of the flow are computed (density, viscosity, specific heat etc.): indeed,
they may depend upon the variables (such as the temperature for example).
The time scheme is a -scheme:


=1
for an implicit first order Euler scheme,
(I.3.1)
1

=
for second order Crank-Nicolson scheme.
2

For the second order scheme, the time step is assumed to be constant.
If required, the equations for the turbulent variables are solved (turbulent kinetic energy and dissipation
or Reynolds stresses and dissipation), using a -scheme again. For the k model, an additional step
is carried out to couple the source terms. For the Reynolds stress model, the variables (turbulent
stresses and dissipation) are solved sequentially, without coupling.
Next, the equations for the scalars (enthalpy, temperature, tracers, concentrations, mass fractions...)
are solved, also with a -scheme.
Finally, all the variables are updated and another time step may start.
The general equation for advection (valid for the velocity components, the turbulent variables and the
scalars) is re-written as follows in a condensed form; the mass equation (
t +div (u) = see Equation
(I.2.4)) has been used to split the time derivative:
Y
+ Y (u) div (u) Y div (KY ) = Si (, ) Y + Se (, ) + Y Y in .

(I.3.2)
t
In Equation I.3.2, represents the physical properties such as (, K, t , ...), represents the variables
of the problem such as (u, k, , ...), Si (, ) Y is the linear part of the source terms and Se (, )
includes all other source terms.
Therefore, four different time steppings are used, they all define the time at which the quantities are
evaluated:

i/ is the time stepping applied to the variable Y n+ Y n+1 + (1 ) Y n ,


ii/ is the time stepping applied to the physical properties,
iii/ F is the time stepping applied to the mass flux,
iv/ S is the time stepping applied to the source terms,

If = 1/2, or if an extrapolation is used, the time step t is constant in time and uniform in space.

3.1.1 Physical properties


The physical properties of the flow (density, viscosity, specific heat...) are:

either explicit, defined at the time step n.


or extrapolated at n + using the Adam-Bashforth time scheme (in this case, the time step is
assumed to be constant).

Under a more general form, this reads:

n+ (1 + ) n n1 , (I.3.3)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 23/402






= 0 standard explicit formulation,


= 1/2 second order extrapolation at n + 1/2, (I.3.4)





= 1
first order extrapolation at n + 1.

3.1.2 Mass flux


For the mass flux, three time schemes are available. The mass flux may be:

explicit, taken at time step n for the momentum equations and updated with its value at time
step n + 1 for the equations for turbulence and scalars (standard scheme).

explicit, taken at time step n for the momentum equations and also for the equations for turbu-
lence and scalars.
n2+
taken at n + F (second order if F = 1/2). To solve the momentum equations, ( u) F

n1+F
and ( u) are known. Hence, the value at n + F is obtained as a result of the following
extrapolation:
n+ n1+F n2+F
(u) F = 2 (u) (u) . (I.3.5)
n+1
At the end of this phase (after the pressure correction step), ( u) is known and the following
interpolation is used to determine the mass flux at n + F that will be adopted for the equations
for turbulence and scalars:
n+F 1 n+1 1 F n1+F
( u) = (u) + (u) . (I.3.6)
2 F 2 F

3.1.3 Source terms


As for the physical properties, the explicit source terms are:

explicit:
n
[Se (, )] = Se n+ , n ,

(I.3.7)

extrapolated at n + S using the Adams-Bashforth scheme:


n+S
= (1 + S ) Se (n , n ) S Se n1 , n1 .

[Se (, )] (I.3.8)

By default, to be consistent and preserve the order of convergence in time, the implicit source terms are
discretized with the same scheme as that is used for convection-diffusion of the unknown considered,
i.e. taken at n + :
n+
= Si (n+ , n ) Y n+1 + (1 ) Y n .
 
[Si (, ) Y ] (I.3.9)

Remark 3.1 The implicit source terms taken also at n + for S 6= 0, while for S = 0, the implicit
source terms are taken at n + 1 , this to enhance stability.

3.1.4 General time discretized form


For the sake of clarity, it is assumed hereafter that, unless otherwise explicitly stated, the mass flux
is taken at n + F and the physical properties are taken at n + , with F and dependent upon
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 24/402

the specific schemes selected for the mass flux and the physical properties respectively and all s are
denoted by .
Under a general form, the discrete counterpart of Equation (I.3.2) at n + reads:
n+ n+
Y n+1 Y n + Y n+ (u) div KY n+ = [Si (, )Y ]
 
+ [Se (, )] . (I.3.10)
t

Using the standard -scheme Y n+ = Y n+1 + (1 ) Y n , the equation reads:


Y n+1 Y n + Y n+1 (u) div KY n+1 = (1 ) [Y n (u) div (KY n )]
  
t
  n+
+ Si (, n ) Y n+1 + (1 ) Y n + [Se (, )] .
(I.3.11)
For numerical reasons, the system is solved in an iterative and incremental manner, with the help of
n+1 n+1
the series Yk+1 = Yk+1 Ykn+1 (with, by definition, Y0n+1 = Y n ). More theoretical details of such
an iterative process are given in 6.1.

3.2 Pressure-based velocity-pressure solver


The aim of this section is to describe how Navier Stokes equations are solved for an incompressible or
weakly compressible (dilatable or Low Mach algorithm) combined with a implicit Euler time stepping
or a second order Crank Nicolson time stepping.
The set of equations to be solved is

u + u (u) = div () div (R) + ST u K u + g + uin u ,


t (I.3.12)
+ div (u) = ,


t
where is the density field, u is the velocity field to be solved, [ ST u K u+g ] are sources terms (note
that K is expected to be a positive definite tensor), is the stress tensor, composed of the viscous
tensor and of the pressure field as follows

P Id,



=

 
2

= 2S + tr S 1, (I.3.13)


3
1


S = u + uT .

2
where is the dynamic molecular viscosity the volume viscosity (also called the second viscosity,
usually neglected in the code, excepted for compressible flows). S is called the strain rate and is an
eventual mass source term.

3.2.1 Segregated solver: SIMPLEC


A fractional step scheme is used to solve the mass and momentum equations (see Chorin [Cho68]).
The first step (predictor step) provides predicted velocity components: they are determined in a
coupled way solving a 3Ncell 3Ncell system. The mass equation is taken into account during the
second step (corrector step): a pressure Poisson equation is solved and the mass fluxes at the cell faces
are updated.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 25/402

Prediction step
In this section, a predicted velocity field u
e is obtained by solving the momentum equation of (I.3.12)

u 2
div uT
  
+ u (u) = div u + tr u
t | {z } | {z } | {z } | 3 {z }
convection diffusion transpose of the velocity gradient term secondary viscosity



(P ) div R + ( 0 ) g (I.3.14)

uin u K u + ST exp imp



+ u + ST u u
| {z } | {z } | {z }
Mass source term Head loss user source terms

For more details, see M and N.

Correction step
The predicted velocity has a priori non-zero divergence. The second step corrects the pressure by
imposing the nullity1 of the stationary constraint for the velocity computed at time instant tn+1 . We
then solve:
n+1
(u) u)n+1
(e
= P n+ ,


t (I.3.15)
div (u)n+1 = ,


where the pressure increment P n+ is defined as:

P n+ = P n+ P n1+ . (I.3.16)

Remark 3.2 The and quantities remain constant over the course of both steps. If there has been
any variation in the interval, their values will be modified at the start of the next time step, after the
scalars (temperature, mass fraction,...) have been updated.

For more details, see M and O.

1 or the density time-variation is the corresponding algorithm is chosen.


Chapter 4

Space discretization
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 27/402

4.1 Introduction
4.1.1 Definition and notations
Within the framework of the finite volume approach, the equations are integrated over each cell of
the mesh (or control volume i ). This section is limited to a brief description of the way 0th -order,
convection, diffusion and gradient terms appearing in the equations are integrated using the budget
methodology. Specific attention is devoted to the calculation of gradients, since it is a major charac-
teristic of the co-located finite volume method (all the variables are associated with the same point,
namely the cell centre1 ).
Let Ncell be the number of cells, then each discretized field Y has Ncell degrees of freedom, which are
denoted by Yi , i [1, , Ncell ] given by definition by:
Z
1
Yi Y d. (I.4.1)
|i | i

As each discretized field Y is supposed to be linear in every single cell, Yi can be identified by the
value of the field in I, the cell center of i :
YI = Yi . (I.4.2)

0th -order terms: Then, terms of order 0 (i.e. terms that are not space derivatives) are integrated
to introduce their average over the cell. For example, g becomes |i | i g. In this expression, |i | is
the measure of cell volume i and i denotes the average of over the control volume (the cell) i
applying (I.4.1).

Divergence operatorconservative gradient terms: The divergence terms (or flux terms, or
again conservative terms) are integrated using the Green relation
 to introduce cell faces values so that
fluxes appear naturally. For example, a term such as div Y 1 becomes2
Z X

div Y 1 d = Yf S fi . (I.4.3)
i f Fi

In expression (I.4.3), face values of the field Y appear. They are defined as:
Z
1
Yf Y dS, (I.4.4)
|S|f f
so that the relationship (I.4.3) is exact. As the field Y is linear over the face f , Yf can be associated
to the face centre F :
YF = Yf . (I.4.5)

In the following sections, faces Fi are usually split into two categories: the interior faces fij Fiint
separating two neighbouring cells i and j; and the boundary faces fb Fiext . Outward (with respect
to the cell i) normals are respectively denoted S ij and S ib , which means that S ij is oriented from i
toward j.
Then YF is expressed as an average of the degree of freedom, which are for the interface fij the value
of Yi and Yj but also the gradients in these cells. The use of gradients to reach an
R higher order
 in
space is called reconstruction in the coming sections. The detailed computation of i div Y 1 d is
given in 4.4.1.
1 The centre of a cell is a geometric point associated with the cell and located preferably inside the cell. Nevertheless,

the word centre


  shall not be taken literally, especially in the case of polyhedral cells that do not have a regular shape.
2 in div Y 1 , Y might be the pressure field P , this term then corresponds to the pressure gradient in the momentum

equation.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 28/402

Convection operatormass flux terms: Let us now focus on the convective term div (Y u). This
(Y )
term and the unsteady term will be treated together. As a matter of fact, if the field Y is
t
transported by the convective field u, the balance of the quantity Y over a cell i is written using
Leibniz theorem as:
Z  Z Z
d Y
Y d = d + Y u dS,
dt i t
Zi i
(I.4.6)
Y
= + div (Y u) d,
i t

the second line is obtained using Green relation.


Moreover, the unsteady and convection terms are usually written in a non-conservative form that is
in continuous formalism:
(Y ) Y
+ div (Y u) = + Y (u) + Y. (I.4.7)
t t
Note that for (I.4.7) to hold, the continuity equation (I.2.4) must be fulfilled. If (I.4.7) is required even
for discrete volumes, the convection term must be defined as:
Z Z Z
Y (u) d div (Y u) d Yi div (u) d,
i
Zi Z i

= Y u dS Yi u dS, (I.4.8)
i i
X
= (Yf Yi ) (u)f S fi ,
f Fi

the second line is obtained using once again Green relation. In formula (I.4.8), one still has to express
the face value Yf and also the value of the mass flux (u)f S fi : all the available convective schemes
(upwind, centred, SOLU, etc.) are presented in 4.2. Let m fi be the outgoing mass flux from cell i
through the face f :
m fi (u)f S fi , (I.4.9)
note that this convective flux is naturally defined at cell faces and thus is stored over there in the code.
In the following, the convection term is denoted as follows:
Z X
Y (u) d = Cfi (m fi , Y ) , (I.4.10)
i f Fi

where Cfi (m
fi , Y ) is defined by:
f , Y ) (Yf Yi ) m
Cfi (m fi . (I.4.11)

Laplacian operatordiffusive terms: Let us discretize the diffusive term div (KY ):
Z X
div (KY ) d Kf f Y S fi , (I.4.12)
i f Fi

where Kf is the face diffusivity, and f Y is the face gradient, their computation will be detailed in
4.3. In the following, the diffusive term is denoted as follows:
Z X
div (KY ) d = Dfi (Kf Y ) , (I.4.13)
i f Fi

where the diffusive flux Dfi (Kf Y ) over the face f is defined by:
Dfi (Kf , Y ) Kf f Y S fi . (I.4.14)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 29/402


Note that the diffusive flux Dij Kfij , Y over the interior face fij lost by the cell i is gained by j, in
other words:  
Dij Kfij , Y = Dji Kfij , Y . (I.4.15)

Remark 4.1 The diffusion operator can be extended to anisotropic tensor diffusivity K.

More geometrical quantities: To end up the general description of the discretized operators, let us
introduce some geometrical quantities which will be used during the approximation process of linking
face fluxes to cell centred quantities. For consistency and to reach a higher order in space, the values
of the variables at points I 0 and J 0 have to be used. These points are respectively the projection of the
centres I and J along the orthogonal line to the interior face fij passing through F . When considering
a boundary face fb , I 0 is defined as the projection of I on the normal to the boundary face fb passing
through F . All the geometrical definitions are recalled in Figure I.4.1. Using Taylor series from the
values at I and J and from the cell gradient in the respective cells, one can write for any field Y :

YI 0 ' YI + i Y II 0 = Yi + i Y II 0 ,


(I.4.16)
YJ 0 ' YJ + j Y JJ 0 = Yj + j Y JJ 0 .

Note that for orthogonal meshes (where I 0 = I for all faces of all cells), no reconstruction (I.4.16) is
needed, and therefore the distance |II 0 | measures the non-orthogonality of the mesh. The computation
of i Y is presented in 4.4.1 and I.
Furthermore, the intersection between IJ and the corresponding interior face fij is denoted by O. The
distance |OF | measures the offset of the mesh.
Eventually, a weighting factor ij is defined to measure the distance of the cell center I to the face fij
relatively to the other cell center J:
F J0
ij = 0 0 . (I.4.17)
IJ
Note that the distances I 0 J 0 and F J 0 are defined algebraically, that is:
I 0 J 0 S ij
I 0J 0 ,
S ij
(I.4.18)
F J 0 S ij
F J0 ,
S ij

and are supposed to be positive if the mesh is star-shaped. Note also that ij is oriented from i to j
and
ij + ji = 1. (I.4.19)

4.2 Convective term


Using the notations adopted in 4.1.1, the explicit budget corresponding to the integration over a cell
i of the convective part i Y (u) has been written as a sum of the numerical fluxes Cij (m ij , Y )
calculated at the interior faces, and the numerical fluxes Cib (m
ib , Y ) calculated at the boundary faces
of the computational domain defined by Equation (I.4.11).
Note that Cib (m
ib , Y ) makes appear the boundary conditions of the field Y and are described in detail
in Chapter 5. The value of Yfb is expressed as follows:
Yfb Agfb + Bfgb YI 0 . (I.4.20)

The value of the convective flux Cij m fij , Y depends on the numerical scheme. Three different types
of convection schemes are available in Code Saturne.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 30/402

Sij

11
00
00
11
00
11
00
11
00
11
00
11
i 00
11
00
11
00
11
J 00
11
F 00
11
I J 00
11 F I
Sb 00
11
00
11
00
11
O 00
11
00
11
j 00
11
00
11
00
11
00
11 I
00
11
00
11
00
11
I 00
11
00
11
00
11 i
00
11

(a) Internal face (b) Boundary face

Figure I.4.1: Sketch of geometric entities.

4.2.1 Upwind
For a 1st -order upwind scheme, the convective flux reads:
 
upwind
Cij ij , Y ) Yfupwind
(m ij
Yi m ij , (I.4.21)
with

Yi if m
ij > 0,
Yfupwind
ij
= (I.4.22)

Yj if m
ij < 0.

4.2.2 Centred
For a centred scheme, the convective flux reads:
 
centred
Cij ij , Y ) Yfcentred
(m ij
Yi m
ij , (I.4.23)
with
Yfcentred
ij
= ij YI 0 + (1 ij ) YJ 0 . (I.4.24)

Remark 4.2 We actually write


1
Yfcentred

= ij Yi + (1 ij ) Yj + i Y + j Y OF , (I.4.25)
ij
2
1
which ensures the second-order discretization in space for Y . The factor 2 is used for numerical
stability reasons.

4.2.3 Second Order Linear Upwind (SOLU)


For a 2nd -order linear upwind scheme, the convective flux reads:
 
SOLU
Cij ij , Y ) YfSOLU
(m ij
Yi m
ij , (I.4.26)
2 Extrapolation of the upwind value at the faces centre.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 31/402

with

Yi + i Y IF
if m
ij > 0,
YfSOLU
ij
= (I.4.27)

Yj + j Y JF
if m
ij < 0.

SOLU
The boundary value of Cib is calculated as:


Yi + i Y IF
if m
ib > 0,
SOLU
Yfb = (I.4.28)
Agf + Bfg YI 0


b b
if m
ib < 0.

Remark 4.3 A slope test (which may introduce non-linearities in the convection operator) allows
to switch from the centred or SOLU scheme to the first-order upwind scheme (without blending).
Additionally, the default option to deal with Yfij is computed as a weighted average between the upstream
value and the centred value (blending), according to users choice.

4.3 Diffusive term


Using the notations adopted in 4.1.1, the explicit budget corresponding to the integration over a cell
i of the diffusive term div (KY ) has been written as a sum of the numerical fluxes Dij Kfij , Y
calculated at the internal faces, and the numerical fluxes Dib (Kfb , Y ) calculated at the boundary faces
of the computational domain defined by Equation (I.4.14).
Note that Dib (Kfb , Y ) makes appear the diffusion boundary conditions of the field Y and are de-
scribed in detail in Chapter 5. The value of flux Dib of the Yfb is expressed as follows:

Dib
Afib + Bib
f
YI 0 . (I.4.29)
|S|fb

The value of the diffusive flux Dij depends on the reconstruction of the field Y and also on the
interpolation at the face of the diffusivity K from the cell values. Two interpolations are available:

i/ a harmonic interpolation which reads:


Ki Kj
Kfharmonic (I.4.30)
ij
ij Ki + (1 ij ) Kj

ii/ an arithmetic interpolation which reads:


1
Kfarithmetic (Ki + Kj ) (I.4.31)
ij
2

Note that to ensure flux continuity at the internal faces fij , one should use the harmonic mean,
whereas the arithmetic mean is set as the default option because it has been proven to be more robust
numerically.

4.3.1 Without reconstruction


For a non-reconstructed field, the diffusive flux reads:

N Rec
 Kfij S ij
Dij Kfij , Y = (Yi Yj ) . (I.4.32)
I 0J 0
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 32/402

4.3.2 Reconstructed
For a reconstructed field, the diffusive flux reads:

Rec
 Kfij S ij
Dij Kfij , Y = (YI 0 YJ 0 ) . (I.4.33)
I 0J 0

Remark 4.4 In fact, it is actually written that



Rec
 Kfij S ij
Dij Kfij , Y = (Yi Yj )
I 0 J 0 (I.4.34)
Kfij S ij 1
i Y + j Y (II 0 JJ 0 ) ,

0 0
IJ 2
1
which ensures the second-order discretization in space for Y . The factor 2 is used for numerical
stability reasons.

4.4 Gradient calculation


The aim of the present section is to describe the algorithms available in Code Saturne to compute
cell gradient for scalar or vector fields. The first one uses an iterative process to handle with non-
orthogonalities. It is robust but requires computational effort. The second one, the least square
method, minimizes a function. It is quick, but less accurate.
For both methods, the adaptation to gradients of vectorial fields is also presented.

4.4.1 Standard method: iterative process


General description

Sij

11
00
00
11
00
11
00
11
00
11
i 00
11
00
11
00
11
J 00
11
F 00
11
00
11
I J 00
11
00 F I
Sb 11
00
11
00
11
00
11
O 00
11
j 00
11
00
11
00
11
00
11
00
11 I
00
11
00
11
I 00
11
00
11
00
11
00
11 i

(a) Internal face (b) Boundary face

Figure I.4.2: Sketch of geometrical quantities.

Notations of the geometrical quantities are recalled in Figure I.4.2. To compute the cell gradient i Y
of the scalar field Y let us start by its definition:
Z Z
|i | i Y Y d = Y dS. (I.4.35)
i i

In order to take the mesh non-orthogonality into account, a Taylor series (1st -order) of i Y is used as
follows:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 33/402

Z X X
|i | i Y Y d = Yfij S ij + Yfb S ib ,
i
fij Fiint fb Fiext
X X
= YF S ij + YF S ib ,
fij Fiint fb Fiext
X X
' [YO + O Y OF ] S ij + [Y Afb + Bfb YI 0 ] S ib , (I.4.36)
fij Fiint fb Fiext
X X h i
= [(ij YI + (1 ij )YJ )] S ij + fij Y OF S ij
fij Fiint fij Fiint
X
+ [Y Afb + Bfb YI 0 ] S ib .
fb Fiext

The variable Y is set to 0 for an increment of a variable3 , to 1 for the variable itself in order to take
correctly the boundary condition into account.
Using the following 1st -order in space approximation

f Y = 1 [I Y + J Y ] ,


ij
2
YI 0 = YI + I Y II 0 .


Equation (I.4.36) becomes:


 
X 1 
|i | i Y = ij Yi + (1 ij )Yj + i Y + j Y OF S ij
int
2
fij Fi
X
+ [Y Afb + Bfb Yi + Bfb i Y II 0 ] S ib .
fb Fiext

Bringing i Y terms all together on the left hand side, we have:


X 1 X X
Bfb i Y (II 0 S ib )

|i | i Y i Y OF S ij = [(ij Yi + (1 ij )Yj )] S ij
2
fij Fiint fb Fiext fij Fiint
X 1 
+ j Y OF S ij
2
fij Fiint
X
+ [Y Afb + Bfb Yi ] S ib .
fb Fiext
(I.4.37)

Without reconstruction

On an orthogonal mesh, or if chosen, only 0th -order contributions are considered. Everything is as if
II 0 = 0 and OF = 0 in the previous calculation:
Z X X
|i | i Y Y d = Yfij S ij + Yfb S ib ,
i
fij Fiint fb Fiext
X X
= [ij YI + (1 ij )YJ ] S ij + [Y Afb + Bfb YI ] S ib ,
fij Fiint fb Fiext

3 Then a homogeneous condition has to be imposed.


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 34/402

hence

1 X X
N
i
Rec
Y = [ij YI + (1 ij )YJ )] S ij + (Y Afb + Bfb YI )S ib . (I.4.38)
|i |
fij Fiint fb Fiext

Remark 4.5 The non-reconstructed gradient is denoted by N i


Rec
Y , and is then very easy to compute
thanks to the Equation (I.4.38). However, it is neither accurate nor consistent on a non-orthogonal
mesh.

Handling with reconstruction: iterative process

In order to solve system (I.4.37), all terms containing i Y are implicit, whereas all terms with j Y
 
are explicit, we then use the series ki Y defined by:
kN

0i Y = N Rec


i Y,
(I.4.39)
k+1 = k+1 Y ki Y,


i Y i

and the associated system is:


X 1 X X
k+1
i Y |i | 1 OF S ij Bfb II 0 S ib = [(ij Yi + (1 ij )Yj )] S ij
2
fij Fiint fb Fiext fij Fiint
X 1 k 
+ j Y OF S ij
2
fij Fiint
X
+ [Y Afb + Bfb Yi ] S ib ,
fb Fiext
(I.4.40)
or, as the following relationship stands:

k+1
i Y = ki Y + k+1
i Y,


X 1 X X
k+1
i Y |i | 1 OF S ij Bfb II 0 S ib = |i | ki Y + [(ij Yi + (1 ij )Yj )] S ij
2
fij Fiint fb Fiext fij Fiint
X 1 k 
i Y + kj Y OF S ij

+
2
fij Fiint
X h  i
+ Y Afb + Bfb Yi + ki Y II 0 S ib .
fb Fiext
(I.4.41)
The Equation (I.4.41) is a local 3 3 matrix which unknowns are each of the three components of the
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 35/402

vector k+1
i Y . Finally, for each cell i we get:

k+1
i,x Y Ci,xx Ci,xy Ci,xz k+1
Ri,x


C
= Ri,y
k+1 Y Ci,yy Ci,yz k+1 , (I.4.42)
i,y i,yx


k+1
i,z Y Ci,zx Ci,zy Ci,zz k+1
Ri,z
| {z } | {z } | {z }
k+1 Y C Rk+1
i i i

with:
X 1 X
Bfb II 0 S ib ,


Ci = |i | 1 OF S ij
2





fij Fiint fb Fiext

X
Rk+1 = |i | ki Y +


[(ij Yi + (1 ij )Yj )] S ij
i


fij Fiint
(I.4.43)
X 1 k 
i Y + kj Y OF S ij


+
2





fij Fiint

X h  i
Y Afb + Bfb Yi + ki Y II 0 S ib .




+

fb Fiext

   
The invert of the matrix C i is used to compute k+1
i Y and so k+1
i Y . The iterative process
stops as soon as the Euclidean
 norm of the right-hand-side Rk+1
i tends toward zero (i.e. when the
k
Euclidean norm of i Y tends to zero) or when the number of iterations reaches the maximal
number of iterations.

4.4.2 Standard method: iterative process for vectorial fields


In this section, the adaptation of the calculation presented in 4.4.1 is adapted to vectorial fields. Some
minor modifications are required, especially for the boundary condition treatment, but the core of the
formulae are the very similar. The notations of the geometrical quantities are recalled in Figure I.4.2.
The definition of i v reads:
Z Z
|i | i v v d = v dS. (I.4.44)
i i

The same Taylor series as (I.4.36) of i v is used:

Z X X
|i | i v v d = v fij S ij + v fb S ib ,
i
fij Fiint fb Fiext
X X
= v F S ij + v F S ib ,
fij Fiint fb Fiext
X h i X h i
' v O + O v OF S ij + v Afb + B f v I 0 S ib , (I.4.45)
b
fij Fiint fb Fiext
X X h i
= [(ij v I + (1 ij )v J )] S ij + f v OF S ij
ij
fij Fiint fij Fiint
X h i
+ v Afb + B f v I 0 S ib .
b
fb Fiext
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 36/402

Once again, the variable v is set to 0 for an increment of a variable, to 1 for the variable itself in
order to take correctly the boundary condition into account.
The same 1st -order in space approximation as in the scalar gradient calculation is used:

v = 1 v+ v ,
h i

fij 2 I J

= v + v II 0 .


v I0 I I

Equation (I.4.45) becomes:


 
X 1 
|i | i v = ij v i + (1 ij )v j + i v + j v OF S ij
int
2
fij Fi
X h  i
+ v Afb + B f v i + B f i v II 0 S ib .
b b
fb Fiext

Note that, there is no simple possibility here to bring i v terms all together on the left hand side,
 
because the term B f i v (II 0 S ib ) cannot be factorised easily, and thus will be explicit:
b

X 1  X  
|i | i v i v OF S ij = (ij v i + (1 ij )v j ) S ij
2
fij Fiint fij Fiint
X 1 
+ j v OF S ij
2
fij Fiint
X h i X
+ v Afb + B f v i S ib + B f i v (II 0 S ib ) .
b b
fb Fiext fb Fiext
(I.4.46)

Without reconstruction
Without reconstruction, the vectorial gradient reads:

1 X X
N Rec
v = [ij v I + (1 ij )v J )] S ij + (v Afb + B f YI ) S ib . (I.4.47)
i |i | b
int fij Fi fb Fiext

Handling with reconstruction: iterative process


 
The series ki v is defined by:
kN

0i v = N Rec



i
v,
(I.4.48)
k+1 v k+1 ki v,


i
= i
v

A system similar to Equation (I.4.41) is obtained for each cell i

k+1
i
v C i = Rk+1
i
(I.4.49)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 37/402

with:
1 X 1

Ci = 1 OF S ij ,
|i | 2





fij Fiint

1 X
Rk+1 ki Y +


= [(ij Yi + (1 ij )Yj )] S ij
i |i |


fij Fiint
(I.4.50)
1 X 1 k 
i Y + kj Y OF S ij


+
|i | 2





fij Fiint

1 X h  i
Y Afb + Bfb Yi + ki Y II 0 S ib .


+
|i |



fb Fiext

Remark 4.6 Note that the matrix C i in (I.4.50) is not the same as in (I.4.43). First of all, there is
no boundary term and thus its invert has not to be recomputed at each iteration (except if the mesh
is not modified). This matrix thus only measure the quality of the mesh (if the mesh is orthogonal,
C i = 1 for all cells). Secondly, this matrix is dimensionless, whereas in (I.4.43) C i has the dimension
of a volume. This choice has been motivated to minimize truncature errors.

4.4.3 Least-square method


Notations of the geometrical quantities are recalled in Figure I.4.2. The aim of the present algorithm
is to compute the cell gradient i Y of the scalar field Y using a least square method. The idea is to
evaluate the gradient of the variable at the cell faces using the value of the gradient at the cell centres.
The method is supposed to be not as robust as the iterative process presented in 4.4.1, but much
more efficient.
Let introduce fij Y dij an estimation at the internal face fij of the gradient projected in the direction
dij (which will be chosen afterwards). Let also define the analogous quantity for boundary faces fb :
fb Y dib (dib will also be chosen afterwards).
The goal would be to find i Y such that, for all faces the following relationships hold:


i Y dij = f Y dij ,

ij
(I.4.51)

i Y dib
= fb Y dib .

The previous equality is generally not reachable for all the faces, so the problem is reformulated as the
minimisation of the Fi function:
1 X h i2 1 X  2
Fi (v) = v dij fij Y dij + v dib fb Y dib , (I.4.52)
2 2 ext
jN eigh(i) fb Fi

where j N eigh (i) is the neighbouring of the cell i. By default, the neighbouring is composed of cells
which share at least a face with i. But extended neighbouring can be used.
To minimize Fi , derivatives with respect to the components of the vector v are computed, the resulting
system is solved and i Y is defined as v min such that Fi (v min ) is minimum.
In order to solve the systems for each cell i separately from one to an other, vectors dij and dib are
chosen so that the quantities fij Y dij and fb Y dib do not depend on neighbouring cell gradients
j Y . The following choice makes it possible:

IJ
dij = ,
|IJ| (I.4.53)
I 0F
dib = = nib .
|I 0 F |
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 38/402

Thus, for internal faces fij , dij is the normalized vector joining the centres I and J oriented from cell
i to j. The quantity fij Y dij is given by:

Yj Yi
fij Y dij = . (I.4.54)
|IJ|

For boundary faces, the choice dib to be the outward normal implies:
Yfb YI 0
fb Y dib = , (I.4.55)
|I 0 F |

where Yfb is expressed thanks to the boundary conditions (see Chapter 5) and the value YI 0 is given
by formula (I.4.16) recalled hereafter:

YI 0 = Yi + i Y II 0


(I.4.56)
Yfb = Agf + Bfg YI 0 = Agf + Bfg (Yi + i Y II 0 )


b b b b

Eventually we get:  
Agfb + Bfgb 1 (Yi + i Y II 0 )
fb Y dib = , (I.4.57)
|I 0 F |

Equation (I.4.57) makes appear a term in i Y and thus should be injected into Equation (I.4.52)
before deriving it. Thus (I.4.52) becomes:

1 X h i2
Fi (v) = v dij fij Y dij
2
jN eigh(i)
  2 (I.4.58)
Bfgb 1 0 Agfb + Bfgb 1 Yi
!
1 X
v
+ dib II .
2 |I 0 F | |I 0 F |
fb Fiext

Then we cancel the derivatives of Fi (v) with respect to the v components:

Fi X h    i
(v) = v dij dij fij Y dij dij
v
jN eigh(i)  
!
Bfgb 1 Bfgb 1 Agfb + Bfgb 1 Yi Bfgb 1
!! !
X
+ v dib II 0 dib II 0 dib II 0 .
|I 0 F | |I 0 F | |I 0 F | |I 0 F |
fb Fiext
(I.4.59)
Fi
A 3 3 system for each cell i is got by writing (i Y ) = 0:
v
i Y C i = R i , (I.4.60)

with

Bfgb 1 Bfgb 1
! !
X X
0 0

C = dij dij + dib II dib II ,


i |I 0 F | |I 0 F |



jN eigh(i) fb Fiext
  (I.4.61)
Agfb + Bfgb 1 Yi Bfgb 1
!
X   X
0

R = fij Y dij dij + dib II ,
i

|I 0 F | |I 0 F |


jN eigh(i) fb Fiext
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 39/402

using (I.4.53) this gives:



Bfgb 1 Bfgb 1
! !
X IJ IJ X
0 0
Ci = + nib II nib II ,


2 |I 0 F | |I 0 F |
|IJ|


jN eigh(i) fb Fiext

  (I.4.62)
Agfb + Bfgb 1 Yi Bfgb 1 0
!

X IJ X
R = (Yj Yi ) + nib II .
i

2 |I 0 F | |I 0 F |

jN eigh(i)
|IJ| fb Fiext

Remark 4.7 i/ Note that the 3 3 C i tensor is symmetric.


ii/ For cells i having at least a boundary face fb , the tensor C i must be recomputed at each time
step, for the other, the tensor C i only have to be recomputed when the mesh is updated (in ALE
for instance).
iii/ If the user chooses not to reconstruct the gradients (which introduces a lack of consistency on
non-orthogonal meshes), then the gradient is computed thanks to formula (I.4.38).
iv/ For highly non-orthogonal meshes, an extended support4 can be used (see different support in
Figure I.4.3) and can drastically improve the results when using tetrahedral meshes.

1
0
0
1

I
1
0
0
1 Support actuel
1
0
0
1 1
0
0
1 Support etendu

Cellule courante : I

Figure I.4.3: Available supports for computing the gradient with the least square method.

4.4.4 Least-square method for vectorial fields


In this section, the adaptation of the calculation presented in 4.4.3 is adapted to vectorial fields. Some
minor modifications are required, especially for the boundary condition treatment, but the core of the
formulae are the very similar. The notations of the geometrical quantities are recalled in Figure I.4.2.
The functional to be minimized is defined by
 1 X 2 1 X 2
Fi t = t dij fij v dij + t dib f v dib , (I.4.63)

2 2 b
jN eigh(i) fb Fiext

4 the support is the set of neighbouring cells used in the cell gradient computation.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 40/402

To minimize Fi , derivatives with respect to the components of the vector t are computed, the resulting
 
system is solved and i v is defined as tmin such that Fi tmin is minimum.

In order to obtain a simple system, the same choice as in (I.4.53) is made on dij . Concerning dib , an
other choice ensuring that fb Y dib does not depend on i Y is made:

IJ
dij = ,
|IJ| (I.4.64)
IF
dib = .
|IF |

Thus, for internal faces fij , dij is still the normalized vector joining the centres I and J oriented from
cell i to j. The quantity f v dij is given by:
ij

vj vi
f v dij = . (I.4.65)
ij |IJ|

For boundary faces, the choice dib implies:


v fb v i
f v dib = , (I.4.66)
b |IF |

where v fb is expressed thanks to the boundary conditions (see Chapter 5).



Then we cancel the derivatives of Fi t with respect to the t components:
Fi  
A 3 3 system for each cell i is got by writing i v = 0:
t

i v C i = R i , (I.4.67)

with

X X
C = dij dij + dib dib ,


i



jN eigh(i) fb Fiext
  (I.4.68)
X  X Agfb + B gf 1 v i
b

Ri

= f v dij dij + dib .
|IF |
ij
jN eigh(i) fb Fiext

Remark 4.8 Note that the 3 3 C i tensor is slightly different from (I.4.60) and does not depend on
boundary condition coefficients (and thus does not require re-computation if the mesh is not modified.

4.5 Advanced topic


4.5.1 Rhie & Chow filter
4.5.2 Handling of the hydrostatic pressure
4.5.3 Pressure extrapolation at the boundaries
Chapter 5

Boundary conditions
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 42/402

5.1 Introduction
Boundary conditions are required in at least three main cases:

calculation of the convection terms (first order derivative in space) at the boundary: the code
uses a mass flux at the boundary and requires the value of the convected variable when the flow
is entering into the domain (or more general wave relations in the sense of the characteristic
curves of the system entering the domain);
calculation of the diffusion terms (second order derivative in space): the code needs a method to
determine the value of the first order spatial derivatives at the boundary, these define e.g. the
stresses or the thermal fluxes at the wall;
calculation of the cell gradients: the variables at the boundary faces allow the code to define the
gradient inside the cell connected to the boundary (e.g. the pressure gradient or the transpose
gradient terms in the stress-strain relation).

These considerations only concern the computational field variables (velocity, pressure, Reynolds ten-
sor, scalars solution of a advection-diffusion equations etc.). For these variables 1 , the user has to
define the boundary conditions at every boundary face.
The boundary conditions could be of Neumann type (when the flux is imposed) or Dirichlet type (when
the value of the field variable is prescribed), or mixed type, also called Robin type (when a combination
linking the field variable to its derivative flux is imposed).
The code (see the programmers reference of the dedicated subroutine) transforms the boundary con-
ditions provided by the user into two internal formats of representation of the boundary conditions.
A particular treatment is performed on walls: wall functions are used to model the boundary layer
flow in the vicinity of the wall when the mesh is too coarse to correctly capture the sharp variations
of the fields with a linear profile in the near wall cell. This will be detailed in the next sections.
A particular treatment on symmetry boundaries is also performed for vectors and tensors whereas a
symmetry boundary is equivalent to an homogeneous Neumann condition (zero normal gradient) for
scalar fields.
The physics model that the user wishes to apply needs to be translated into pairs of coefficients entering
the linear system of equations that the code will solve. For any variable Y for every boundary faces
fb these coefficients are:
 
Agfb , Bfgb used by the gradient operator and by the advection operator. The value at the
boundary face fb of the variable Y is then defined as:
Yfb Agfb + Bfgb YI 0 . (I.5.1)
 
Afib , Bib
f
used by the diffusion operator. The value at the boundary face fb of the diffusive flux
qib of the variable Y is then defined as (see Equation (I.4.29)):
Dib (Kfb , Y )
qib = Afib + Bib
f
YI 0 . (I.5.2)
|S|fb
Note that the diffusive boundary coefficients are oriented, which means that they are such that
Dib (Kfb , Y ) is positive, this flux is gained by Yi .

The definitions are recalled on Figure I.5.1.


1 The other variables (the physical properties for instance) have a different treatment which will not be detailed here

(for instance, for the density, the user defines directly the values at the boundary. This information is then stored; one
is referred to cs user physical properties (see the programmers reference of the dedicated subroutine) or phyvar for
more information).
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 43/402

Bord du domaine de calcul


Sb
11111111
00000000
Domaine de calcul 00000000
11111111
00000000
11111111
I 00000000
11111111
00000000
11111111 n normale sortante
00000000
11111111
I F 00000000
11111111
00000000
11111111
de norme 1
00000000
11111111
y 00000000
11111111
f 00000000
11111111
fI b,int 00000000
11111111
fb,ext fimp,ext
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
Coefficients dechange
h himp,ext
int
h
b
Figure I.5.1: Boundary cell.

Example 5.1 The heat flux qw from a solid wall to a laminar flow is defined and discretised as
TI 0 TF
qw = T nib = = hint (TI 0 TF ) , (I.5.3)
I 0F
where hint /I 0 F is the exchange coefficient between the wall and the fluid point I 0 .

If the wall temperature Tw is known, TF = Tw is set as Dirichlet condition, qw will be a result of


the simulation, and the gradient and diffusive flux coefficients are as follows:

g
Af = Tw ,
Afib = hint Tw ,


b
(I.5.4)
Bfg = 0, f

Bib
= hint .
b

If the wall heat flux qw is known, this is a Neumann condition and TF = Tw will be a result of
the simulation and the gradient and diffusive flux coefficients are as follows:

g qw
Afib = qw ,

Af =
,
b
hint (I.5.5)
B g = 1,

Bib f

fb
= 0.

5.2 Standard user boundary conditions


The user generally gives standard boundary conditions, which are:

Inlet: it corresponds to a Dirichlet boundary condition on all the transported variables (and should
therefore be given by the user) and to a homogeneous Neumann on the pressure field.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 44/402

Outlet: it correspond to a homogeneous Neumann boundary condition on all the transported vari-
2P
ables. For the pressure field, a Dirichlet boundary condition which is expected to mimic =0
n
for any vector parallel to the outlet face (see 5.4.4 for more details). This condition means
that the pressure profile does not vary in the normal direction of the outlet. Warning: if the
outgoing mass-flux is negative, i.e. if the outlet becomes an inlet, then the mass-flux is clipped
to zero. Moreover, since the pressure field is defined up to a constant, it is fixed to a reference
pressure P0 at an arbitrary chosen outlet boundary face. The user can choose an other desired
face where a Dirichlet on pressure is prescribed.
Free inlet/outlet: it corresponds to the standard outlet when the flow is outgoing (see 5.4.4), but
to a free inlet when the flow is ingoing. The Bernoulli relationship is used to derive a boundary
condition on the pressure increment to couple velocity and pressure at these free inlet faces. Note
that no clipping on the velocity is imposed. The same boundary conditions as for outlet on the
other variables is imposed. For more details please refer to 5.4.5.
Walls: This particular treatment will be detailed in the following sections. For the velocity, the aim
is to transform the Dirichlet boundary condition (the velocity at the wall is equal to zero, or the
velocity of a moving wall) into a Neumann boundary condition where the wall shear stress is
imposed function of the local flow velocity and the turbulence characteristics. A similar treatment
using wall functions is done on every transported variable if this variable is prescribed. The
boundary condition on the pressure field is a homogeneous Neumann by default, or alternatively
an extrapolation of the gradient.
Symmetries: This condition corresponds to a homogeneous Neumann for the scalar fields (e.g. the
pressure field or the temperature field). For vectors, such as the velocity, it corresponds to impose
a zero Dirichlet on the component normal to the boundary, and a homogeneous Neumann on
the tangential components. Thus, this condition couples the vector components if the symmetry
faces are not aligned with the reference frame. The boundary condition for tensors, such as the
Reynolds stresses, will be detailed in the following sections.

5.3 Internal coding of the boundary conditions Discretiza-


tion
As already mentioned, the  boundary  conditions set by the user for the variable Y are translated into
two pairs of coefficients Agfb , Bfgb which are used by the gradient operator and by the advection
 
operator, and Afib , Bib
f
for use by the diffusion operator, this for all the boundary faces fb .

Let us first recall the general form of the transport equation of a variable Y , which could be a scalar,
a vector or a tensor:
Y
C + CY (u) = div (K Y ) + STY . (I.5.6)
t

In the Equation (I.5.6) is the density of the fluid, (u) the convective mass flux of the variable Y , K
its conductivity or diffusivity and S any additional source terms. Note that K is the sum of molecular
and turbulent diffusivity in case of RANS modelling with an eddy viscosity model. The dimension of
K for different variables is displayed in Table 5.1. The value of C is 1 for all the variables except for
the temperature where C is the specific heat Cp . If the variable Y is the variance of another scalar,
then its diffusivity is deduced from the scalar itself.

5.3.1 Basic Dirichlet boundary conditions


Imposing a basic Dirichlet condition Yfimp
b
on a boundary face fb is translated into:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 45/402

Y K

symbol name units symbol name units


1
ui velocity m.s or + t dynamic viscosity kg.m1 .s1

P pressure kg.m1 .s2 t time step s

T temperature K thermal conductivity kg.m.s3 .K 1

= W.m1 .K 1

h enthalpy m2 .s2 /Cp thermal conductivity over specific heat kg.m1 .s1

= J.kg 1

Y variable unit of (Y ) K conductivity or diffusivity kg.m1 .s1

Table 5.1: Values and unit of common cases.


Agf Yfimp Afib = hint Yfimp


b
= b
,
b
,
(I.5.7)
Bfg f


b
= 0, Bib
= hint .

The term hint is a internal coding coefficient (automatically provided by the code) similar to an
exchange coefficient. Its value for particular variables is given in Table 5.2.

Remark 5.1 Yfimp


b
must be specified by the user. The boundary type code is 1 (see Table 5.3).

5.3.2 Neumann boundary conditions


imp
Imposing a Neumann condition Dib on a boundary face fb is translated into

Dimp
Agf = ib , Afib imp

= Dib ,
b
hint (I.5.8)
Bg
f
Bib

fb = 1,
= 0.

imp
Remark 5.2 Dib must be specified by the user. The boundary type code is 3 (see Table 5.3).

5.3.3 Mixed or Robin boundary conditions


As explained in the introduction 5.1, the simple case of a heat flux qw from a solid wall reads: qw =
TI 0 TF
T nib = = hint (TI 0 TF ) where hint = 0 is displayed in Table 5.2. As presented
I 0F IF
in 5.3.1, Dirichlet condition TF = Tw simply leads to Af = hint Tw and B f = hint . In some
cases, heat transfer outside the flow domain is described by a one-dimensional conduction equation
q = hext (TREF Tw ) in which some reference temperature TREF is given and the coefficient hext is
known from an analytical or experimental correlation. Equaling this to the heat flux computed in the
first fluid cell at the boundary gives hext (TREF Tw ) = hint (TI 0 TF ). This relation between the
variable and its gradient at the boundary is called a Robin or mixed boundary condtion.
More generally, to impose an external Dirichlet Y imp, ext at some distance outside the boundary face,
this is done by a user prescribed external coefficient hext (see Figure I.5.1), and the boundary condition
coefficients then read:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 46/402


hext
Agfb imp, ext Afib = heq Y imp, ext ,

= Y ,
hint + hext (I.5.9)
Bfg =
hint f
, Bib
= heq ,
b
hint + hext
hint hext
where heq is defined by heq = . The harmonic mean (as in (I.4.30)) comes from summing
hint + hext
of resistances instead of conductances. Note that this case reduces to Dirichlet condition if hext tends
to the infinity.

Remark 5.3 Both Y imp, ext and hext must be specified by the user. The boundary code is 1 (see
Table 5.3). Take care that an outgoing flux is counted positively.

5.3.4 Convective outlet boundary conditions


If the user wishes to impose a convective outlet (also called radiative outlet) condition which reads:
Y Y
+C = 0, (I.5.10)
t n
where C denotes the convective celerity, then the internal coding reads:

1 hint
Agf Y n, Afib Y n,

= =
b
1 + CF L fb 1 + CF L fb (I.5.11)
Bfg
CF L f hint
= , Bib
= ,
b
1 + CF L 1 + CF L
Ct
where CF L .
I 0F

Remark 5.4 Both C and Yfnb must be specified by the user, the boundary code is 2 (see Table 5.3).

5.4 Wall boundary conditions


This section is dedicated to wall boundary conditions for the velocity, and any transported scalar (such
as the temperature, the enthalpy, etc.) when a wall boundary value is prescribed and a wall function is
set by the user. The dedicated boundary conditions of the turbulent variables (k, , Rij ) are detailed
in Chapter 7. Here is a link to the programmers reference of the dedicated subroutine.
Simplified balance analysis proves that the fluid velocity profile or the Temperature profile are highly
non-linear for turbulent flows in the vicinity of walls.
The aim of wall functions is to model the vicinity of the wall by substituting the Dirichlet condition on
the fluid velocity and on the scalars such as the temperature (ufb = v wall , Tfb = Twall where v wall is
the velocity of the wall and Twall is the temperature of the wall) by a Robin-type boundary condition
linking the wall shear stress to the velocity of the fluid, and the thermal wall flux to the temperature
within the first cell.

5.4.1 Velocity boundary condition for smooth walls and rough walls
We assume it is projected onto the tangent plane to the wall (if it is not, then the code projects it).
The fluid velocity in thereference frame attached to the wall (relative velocity) projected to the wall
writes urI 0 1 n n (uI 0 v wall ).
= (t, n, b):
The orthonormal coordinate system attached to the wall writes R
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 47/402

Y hint

symbol name units homogeneous to units


+ t
u velocity m.s1 kg.m2 .s1
I 0F
t
P pressure kg.m1 .s2 s.m1
I 0F
+ Cp t /t
T temperature K kg.s3 .K 1
I 0F
W.m2 .K 1
+ Cp t /t
h enthalpy m2 .s2 kg.m2 .s1
I 0F
J.kg 1
K
Y scalar unit of(Y ) kg.m2 .s1
I 0F

Y Dimp

symbol name units homogeneous to units

u velocity m.s1 (( + t ) u) n kg.m1 .s2

p pressure kg.m1 .s2 (tP ) n kg.m2 .s1

T temperature K (( + Cp t /t )T ) n kg.s3

W.m2

h enthalpy m2 .s2 (/Cp + t /t )H) n kg.s3

J.kg 1 W.m2

Y scalar unit of (Y ) K Y n kg.m2 .s1 . unit of (Y )

Table 5.2: Values and unities of hint et Dimp is common cases.


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 48/402

urI 0
t= is the unit vector parallel to the projection of the relative velocity at I 0 , urI 0 , in the
|urI 0 |
plane tangent to the wall (i.e. orthogonal to n),
n is the unit vector orthogonal to the wall and directed towards the interior of the computational
domain,
b is the unit vector which completes the positively oriented coordinate system.

In this reference-frame the wall distance of the cell centre to the wall I 0 F is denoted by y.
The objective of wall functions is to increase the exchange coefficient to reflect the higher level of mixing
effectively taking place in the near wall cell due to turbulence and due to effectively much sharper
gradients of the computed variable than the linear profile assumed inside each cell by Finite Volumes
discretisation. The end result (Cf (I.5.27)) will be to correct the laminar coefficient, hint = /y, by a
dimensionless analytical function (a wall function) u+ that represents the realistic non-linear profile.
The correction is moreover proportional to the cell centre to wall dimensionless distance, y + , over
which a linear profile assumption may or may not be appropriate. These functions u+ and y + that
depends on the level of turbulent kinetic energy, are made dimensionless by:

either the wall shear stress wall only (this is called one scale friction velocity wall function),
or by the wall shear stress wall and the turbulent kinetic energy (this is called two friction
velocity scales).

When the mesh is made fine enough to capture the sharp variations of the variables near the wall,
wall functions are no longer needed, variables are simply given Dirichlet values at the wall and the
laminar exchange coefficient is correct. However the more basic versions of the turbulence models
(high Reynolds k or Reynolds stress transport) will not be able to automatically relaminarise
(i.e. reduce the turbulent mixing effect to zero at the correct rate of decay as y tends toward 0) and
erroneous predictions will result (generally too much friction or heat transfer). When using a refined
near wall mesh, down to the wall or low Reynolds versions of the turbulence models must be
selected (e.g. v 2 f or elliptic blending models). However in this case one must make sure the mesh
is fine enough.
To allow use of standard high Reynolds models whatever the mesh density, scalable wall functions
can be activated. This consist in shifting slightly the wall outside of the mesh if the first cell lies in the
viscous sub-layer. Scalable wall function only work with the two friction velocity scales version.
The wall functions are usually derived from Eddy Viscosity Models such as k , thus the coming
2
sections assume that R = k1 T S.
3

One friction velocity scale


The simplified momentum balance in the first boundary cell reads:
u
( + T ) = wall . (I.5.12)
y

Let u? be the friction velocity defined by:


r
wall
u? , (I.5.13)

the equation (I.5.12) can be rewritten:

T u+
 
1+ = 1, (I.5.14)
y +
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 49/402

where u+ |urI 0 | /u? and y + yu? /.


ur
The mixing length model states T = L2m S, where the stain rate S reduces to yI 0 in the wall vicinity.
The mixing length is proportional to the wall distance according to the Prandtl model

Lm = y, (I.5.15)

where = 0.42 is the Karman constant.


Two areas are therefore defined, one where T /  1 called the viscous sub-layer where T / is
neglected in (I.5.14) the velocity profile is found to be linear:

u+ = y + , (I.5.16)
T
the other where  1 and the velocity profile becomes logarithmic:

1
u+ = ln y + + Clog ,

(I.5.17)

where Clog = 5.2.
(I.5.16) is valid for y + < 5 and (I.5.17) for y + > 30 so there is a gap (corresponding to the so called
buffer layer) which more sophisticated models can cover, but they are not detailed here. Instead
we introduce a dimensionless limit distance which crudely separates the viscous sub-layer from the
+
logarithmic region writes ylim . Its value is 1/ in general (to ensure the continuity of the velocity
gradient) and 10.88 in LES (to ensure the continuity of the velocity).
The u? is computed by iteratively solving(I.5.16) or (I.5.17):

|urI 0 | |y urI 0 |
r
? +2
u = if < ylim ,
y
0
(u? )


= exp (Clog )
y



q
q+1 |urI 0 | + (u? ) otherwise solve iteratively in q
(u? ) = q .
y (u? )

 

ln + Clog + 1




(I.5.18)
+
y
Therefore, the value of u+ in the two layers reads:

y+ +
if y + < ylim

u+ = 1 ,



y+ y+ (I.5.19)
= otherwise.
u

+ 1
ln (y + ) + Clog

Two friction velocity scales


The simplified momentum balance (I.5.12) still holds, but is non-dimensioned not only by the wall
qp
shear stress but also the turbulent kinetic energy. More precisely, let uk = C k be the friction
velocity based on the turbulent kinetic energy in the first cell.
This definition is in fact valid only for high-y + values and a blending is performed in case of the
intensity of turbulence is very low:
s
|urI 0 | p
uk g + (1 g) C k, (I.5.20)
y
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 50/402

!
ky
where g is a blending factor defined by g = exp (see []).
11
The friction velocity u? is now defined by:
wall
u? . (I.5.21)
uk

Equation (I.5.12) can now be rewritten:


T u+
 
1+ = 1, (I.5.22)
yk+
|urI0 | yuk
where u+ u? but yk+ .
3 3
k21 3 3 k2
Let us now remark that T = C kC 4
= uk Lm where Lm = C4
4
is the integral length scale.
 
Again using the Prandtl model (I.5.15), the following equation is obtained:
  +
1 u
1+ + = 1. (I.5.23)
yk yk+

The two areas defined in the previous section (I.5.19) that are the viscous sub-layer and the logarithmic
layer still hold, but with yk+ instead of y + :

y+
k = 1 if yk+ < ylim
+


u+
,
+ + (I.5.24)
yk yk
= otherwise.
u
+ 1
ln yk+ + Clog



Rough wall functions


y+
When specifying a rough wall function with z0 as roughness, the value of u+ reads:
y+ y+
+
=   . (I.5.25)
u 1 y + z0
ln + Clog
z0

Wall shear stress with wall functions


The previous sections can be summarized as follows:

y+ 
n=
0 +
1 n n (uI 0 uwall ) (I.5.26)
IFu
+
where the rescaling factor uy + depends on the wall function is given in (I.5.19) or (I.5.24). Note that
the wall shear stress is therefore parallel to the wall and fully implicit if the -scheme on the velocity
is implicit.
The internal pair of boundary condition coefficient for the diffusive term for the velocity are

Afib = hf luid 1 n n uwall hhint (n uwall ) n,


(I.5.27)
Bf


ib
= hf luid 1 n n + hint n n,

where
y+
hf luid = . (I.5.28)
I 0 F u+
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 51/402

Velocity gradient boundary condition with wall functions


The gradient of the fluid velocity is of great importance for turbulence models as it appears in the
production term. Moreover the profile of dissipation is even less linear than u+ (it is hyperbolic) and
would also require a wall function. A common correction in open literature is to directly modify these
source term in the near wall cell volume integral. However this deeply modifies the code structure
and the linear system solver. In order to implement this while still remaining within the standard
boundary condition structure, ther current code version follows the suggestion of [BM00] which consists
in prescribing a slip velocity at the wall so that the velocity gradient evaluated inside the cell by the
standard Finite Volumes linear profile is more consistent with wall function.
A dedicated boundary condition for the velocity gradient is therefore derived in presence of wall
function.
To be consistent with the logarithmic law giving the ideal tangential velocity profile. On the first hand,
the theoretical gradient is:

theo
ur u?

= (I.5.29)
y I0 y

On the other hand, the normal finite volumes gradient of the tangential velocity reduces in the case of
a regular orthogonal mesh (see notations in Figure I.5.2):

urI + urJ

ur
calc
ur urF urF
= G = 2 (I.5.30)
y I0 2y 2y

Bord du domaine de calcul

Domaine de calcul 11
00
00
11
00
11
00
11n
00
11
00
11
normale sortante
00
11
de norme 1
J G I M F 00
11
y d/2 d/2
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
d d d 00
11
00
11
00
11
Figure I.5.2: Boundary cell - Orthogonal mesh.

We then assume that urJ can be obtained from urI and from the gradient of ur calculated in G from
u?
the logarithmic law urJ = urI + 2y and we thus obtain equalizing (I.5.29) and (I.5.30) (the formula
2y
is extended without any precaution to non-orthogonal meshes):

3u?
urF = urI 0 (I.5.31)
2
The normal derivative at the wall is prescribed to zero. If the value obtained for y + at the wall is lower
+
than ylim , a no-slip condition is prescribed. Finally, one can also make explicit the velocity of the wall
in the final expression: The internal pair of boundary condition coefficient for the diffusive term for
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 52/402

the velocity are


Agib

= (1 cof imp) 1 n n uwall + (uwall n) n,
(I.5.32)
Bg


ib
= cof imp 1 n n ,
3 +
where cof imp = 1 if y + > ylim , and cof imp = 0 otherwise.
2u+

5.4.2 Scalar boundary condition for smooth walls


In this section, the wall functions applied to transported scalars Y (such as the temperature T for
instance) are described. The reference Convection Heat Transfer, Vedat S. Arpaci and Poul S.
Larsen, Prentice-Hall, Inc was used. The approach is really similar to what is performed on the fluid
velocity:

if the wall value Ywall is imposed, the Dirichlet boundary condition is substituted by a Robin-type
one where the diffusive flux is function of the cell centre scalar value,
if a Neumann value is imposed (that is to say that the user has prescribed the flux of Y ), then
the wall function is used to evaluate the corresponding wall value Ywall which is displayed by the
code.

Let us recall that qib (Kfb , Y ) is the wall diffusive flux for the scalar Y , and the simplified scalar
balance reads:  
T Y
qib (Kfb , Y ) = Kfb + C (I.5.33)
T y

Remark 5.5 the flux is positive if it enters the fluid domain, as shown by the orientation of the y
axis

The following considerations are presented using the general notations. In particular, the Prandtl-
C
Schmidt number writes = . When the considered scalar Y is the temperature T , we have
K

C = Cp (specific heat capacity),


= (molecular conductivity),
Cp
= = P r (Prandtl number),

T = P rT (turbulent Prandtl number),
 
Dib (fb , T ) Cp T T
qib = = + (flux in W.m2 ).
|S|fb T y

In order to make (I.5.33) dimensionless, we introduce Y ? defined using the flux at the boundary qib :
qib
Y? (I.5.34)
C uk
For the temperature, we thus have:
qib
T? (I.5.35)
Cp uk

We then divide both sides of equation (I.5.33) by qib and after some algebrae it comes:
1 T Y +
 
1
1= + (I.5.36)
T y +
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 53/402

where
T y uk Y Ywall
= T = y+ = Y+ = (I.5.37)
Y?

5.4.3 The three layers wall function of Arpaci and Larsen


In order to compute the theoretical scalar profile, we integrate equation (I.5.36) to obtain YI+0 . The
1 1 T
only difficulty then consists in prescribing a variation law of K = + .
T
In the fully developed turbulent region (far enough from the wall, for y + > y2+ ), a mixing length
hypothesis models the variations of T :
T = y u k (I.5.38)
Additionally, the molecular diffusion of Y (or the conduction when Y represents the temperature) is
1 1 T
negligible compared to its turbulent diffusion: therefore we neglect compared to . Finally we
T
have:
y+
K= (I.5.39)
T

On the contrary, in the near-wall region (for y + < y1+ ) the turbulent contribution becomes negligible
1 T 1
compared to the molecular contribution and we thus neglect compared to .
T
It would be possible to restrict ourselves to these two regions, but Arpaci and Larsen suggest the
model can be improved by introducing an intermediate region (y1+ 6 y + < y2+ ) in which the following
hypothesis is made:
T 3
= a1 y + (I.5.40)

where a1 is a constant whose value is obtained from experimental correlations:
T
a1 = (I.5.41)
1000

Thus the following model is used for K (see a sketch in Figure I.5.3):

1

if y + < y1+




1 a1 (y + )3
K= + if y1+ 6 y + < y2+ (I.5.42)

T
+
y
if y2+ 6 y +



T

The values of y1+ and y2+ are obtained by calculating the intersection points of the variations laws used
for K.
The existence of an intermediate region depends upon the values of . Lets first consider the case
where cannot be neglected compared to 1. In practise we consider > 0, 1 (this is the common
case when scalar Y represents the air or the water temperature in normal temperature and pressure
1 a1 (y + )3
conditions). It is assumed that can be neglected compared to in the intermediate region.
T
We thus obtain:  1 r
+ 1000 3 + 1000
y1 = y2 = (I.5.43)
T
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 54/402

14

12 1/Pr
0.42 y+/Prt
a1 (y+)**3/Prt
10

8 y+
2
K

2 y+
1

0
0 10 20 30
y+

1 1 T
Figure I.5.3: + T as a function of y + obtained for = 1 and T = 1.

The dimensionless equation (I.5.36) is integrated under the same hypothesis and we obtain the law of
y+
:
Y+ +
y 1
+ = if y + < y1+




Y
+
y =
y+
if y1+ 6 y + < y2+

Y + T
a2 (I.5.44)


2 a1 (y + )2
+
y y+
= T if y2+ 6 y +


+

Y

ln (y + ) + a3

where a2 and a3 are integration constants, which have been chosen to obtain a continuous profile of
Y +:   
2 2 T 1000
a2 = 15 3 a3 = 15 3 1 + ln (I.5.45)
2 T

Lets now study the case where is much smaller than 1. In practise it is assumed that 6 0.1 (this is
for instance the case for liquid metals whose thermal conductivity is very large, and who have Prandtl
number of values of the order of 0.01). The intermediate region then disappears and the coordinate
of the interface between the law used in the near-wall region and the one used away from the wall is
given by:
T
y0+ = (I.5.46)

The dimensionless equation (I.5.36) is then integrated under the same hypothesis, and the law of Y +
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 55/402

is obtained: +
y 1
= if y + 6 y0+


Y+


y+ y+ (I.5.47)
= if y0+ < y +
Y+ y+
 
t


+ y0+

ln
y0+

Wall diffusive flux with wall functions


The previous sections can be summarized as follows:

C y +
qib = (YI 0 Ywall ) (I.5.48)
I 0F Y +
y+
where the rescaling factor Y+ depends on the wall function is given in (I.5.44) if > 0.1 or (I.5.47) if
0.1.
The internal pair of boundary condition coefficient for the diffusive term for the variable Y are

Afib = hf luid Ywall ,


(I.5.49)

Bibf
= hf luid ,

C y +
where hf luid = .
I 0F Y +

5.4.4 Outlet boundary condition on the pressure


In this section the boundary condition on the pressure at the outlet is detailed. Some assumptions are
made to derive this boundary condition which consists of a Dirichlet (combined with a homogeneous
Neumann on the velocity) based on the pressure field at the previous time step. On basic configurations
such as a channel or a pipe where the outlet is orthogonal to the flow, the shape of the pressure profile
in a surface parallel to the outlet is approximately the shape of the pressure profile at the outlet. This
hypothesis is valid for established flows, far from any perturbation. In this configuration one can write:

2P
= 0,
n
where n is the outward normal vector and is any vector in the boundary face.
Then remark that the value at the boundary face fb is linked to the pressure value in I 0 by the
relationship:
Pfb = PI 0 + i P I 0 F .
If moreover we assume that the pressure gradient in the normal direction is uniform, and that all the
I 0 related to the outlet faces are on a single plane parallel to the outlet, then the value of i P I 0 F is
constant for all the faces and denoted R.
Furthermore, the pressure is defined up to a constant, so the code chooses to fix the pressure at
P0 to a given outlet boundary
 face fb imp . Therefore the pressure field is shifted by the constant
imp imp
R0 = P0 Pfb = P0 PI 0 + R .
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 56/402

All that together gives


Pfb = PI 0 + R + R0 ,
 
= PI 0 + R + P0 PIimp
0 +R ,
(I.5.50)
= PI 0 + P0 P imp
0 ,
| {z I }
constant denoted by R
e

= PI 0 + R.
e

To conclude, the outlet boundary condition on the pressure is a Dirichlet based on the value in I 0 (at
the previous time step) and shifted to imposed the value P0 at a given face fb .

5.4.5 Free inlet/outlet boundary condition on the pressure incre-


ment
In this section the boundary condition on the pressure increment at the free inlet is detailed. For the
other variables (even the pressure itself), the treatment is similar to 5.4.4.
Let us start with the Bernoulli relation ship between a boundary face f linked to a point on the same
stream line far away from the computational domain:
 1+K 1
Pf f g xf x0 + f uf uf = P g (x x0 ) + u u , (I.5.51)
2 2
where K is a possible head loss of the fluid between the infinity and the boundary face entrance (which
the user may play with to model the non-computed domain).
Assuming that the stream line is horizontal, that the density is constant over the stream line and that
the fluid velocity is zero at the infinity, the Equation (I.5.51) becomes:
1+K
Pf? = f uf uf , (I.5.52)
2
where we recall that P ? is the dynamic pressure.
For stability reasons, the Equation (I.5.52) is implicit in time as follows:
1+K
Pf?,n+1 = f unf un+1
f . (I.5.53)
2
This implicitation is crucial to make the calculations stable.
The prediction-correction velocity-pressure coupling algorithm requires boundary conditions on the
pressure increment (computed in the correction step), and therefore relation (I.5.53) is derived to
obtain boundary conditions on the pressure increment. Recall that the correction step reads:
n+1
(u) (n u
e)
= P, (I.5.54)
t
the pressure increment P = P ?,n+1 P ?,n at the face is consequently given by:
 
1+K t
Pf = Pf?,n f unf ue P . (I.5.55)
2 f

n n m
f
Neglecting the tangencial velocity component at the entering faces ((u)f ' (u)f n n = n) and
|S|f
approximating Pf?,n with its cell-center value, Equation I.5.55 reads:
 
1+K m f t P
Pf = Pi?,n en
u . (I.5.56)
2 |S|f n f
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 57/402

Variable Admissible Values

Velocity u 1 2 3 4 5 6 9

Pressure P 1 2 3

Scalar turbulent variables k, , , f, 1 2 3 5 6

Reynolds stresses Rij 1 2 3 4 5 6

Y (except variances) Y 1 2 3 5 6

Variance of a variable Y 1 2 3

Table 5.3: Admissible values of boundary conditions for all variables.


P Pf Pi
Noting that = , (I.5.56) is rewritten as:
n f I 0F

Pf = AgP + BP
g
Pi , (I.5.57)

with: !
1 1 + K m
f
AgP = Pi?,n e n ,
u
1 + CF L 2 |S|f f
(I.5.58)
g CF L
BP = ,
1 + CF L
where the CF L is defined as:
1 + K tm
f
CF L = . (I.5.59)
2 f |S|f

Remark 5.6 CF L is a positive quantity for ingoing flows, which ensures stability.

Remark 5.7 The formulation (I.5.59) is nothing else but a convective outlet on the pressure increment
(see 5.3.4).

Checking step

Before computing the pairs of boundary condition coefficients, a step of checking is performed. Basi-
cally, the code checks that the user has given a boundary condition to all boundary faces, and that
the setting between all the variables is compatible (see Table 5.3).
Chapter 6

Algebrae

See E.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 59/402

6.1 Iterative process


6.2 Linear algebrae
Part II

Advanced modelling
Chapter 7

Turbulence modelling
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 62/402

7.1 Eddy viscosity Models (EVM )


In this section eddy viscosity hypothesis is made which states that the Reynolds stress tensor is aligned
with the rate of strain S:
2
R = k1 2T S D (II.7.1)
3

7.1.1 Equations for the variables k and (standard k model)

  
k t
+ k (u) div + k = P + G + k in + STk ,


t k
2
  
+ (u) div

+
t
=

[P + (1 C3 )G] C2 + in + ST ,
C1
t k k
(II.7.2)
where P is the production term created by mean shear:
 
D 2
P = R : u = 2t S + k1 : S,
3 (II.7.3)
2
= 2t S D : S D ktr u ,

3
and G is the production term created by gravity effects:
1 t
G= g. (II.7.4)
t

The dynamic turbulent viscosity reads:


k2
t = C. (II.7.5)

STk and ST stand for the additional source terms prescribed by the user (in rare cases only).
The constants of the model are given in the Table (7.1):

C C 1 C 2 k

0.09 1.44 1.92 1.0 1.3

Table 7.1: Standard k model constants [LS74].

C3 = 0 if G > 0 (unstable stratification) and C3 = 1 if G 6 0 (stable stratification).

7.1.2 k  v 2 /k elliptic blending turbulence model


The BL-v 2 /k [BL12] is a elliptic-blending based v 2 f model. It is a low Reynolds number model
and as such the wall distance of the first off-wall cell centre must be of order of unity when expressed
in viscous unit.
The following gives details about the model followed by some description of its implementation into
Code Saturne.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 63/402

Model description
This eddy viscosity model solves for k and as turbulence variables, representing respectively the
turbulent kinetic energy and its dissipation rate, as well as two non-dimensional variables, = v 2 /k
and . The first of these latter two represents the ratio of wall normal Reynolds stress to turbulent
kinetic energy (thus being a measure of the near-wall turbulence anisotropy) and the second is a wall
proximity sensitive quantity (i.e. it takes the value 0 at a wall and 1 in the far field). The coefficient
is solved for via an elliptic equation (L representing the turbulence length-scale):

L2 = 1 (II.7.6)

The transport equation reads:


  
d 2 t t
= 1 3 fw + 3 fh P +

k + div + (II.7.7)
dt k k k 2

The aim of the BL-v 2 /k model is to stand as a code-friendly version of the v 2 f model of [Dur91].
In both the wall normal stress v 2 is used in the T definition to correctly represent the near-wall
turbulence damping (T is the turbulence time-scale and C = 0.22 is calibrated in the logarithmic
layer of a channel flow):
T = C k T (II.7.8)

The elliptic blending approach mainly allows for an improved robustness. Indeed, the original v 2 f
approach solves for the quantity v 2 and a variable f derived from the wall normal pressure term1 and
defined as:

1 2 v2
f= vy p 2v v + (II.7.9)

k k
| {z }

22

with f being solved using an elliptic equation:

f L2 f = fh (II.7.10)

Similarly to the equation, this elliptic operator allows to represent the non-local effects induced by
the incompressibility of turbulence. The quantity fh is obtained by considering homogeneous modelling
(i.e. f = 0) of f using for pressure strain-rate term the model of [LRR75]. The correct asymptotic
behaviour of the variable v 2 is ensured by the following boundary condition:

20 2 v 2
lim f = lim (II.7.11)
y0 y0 y 4

This requires a balance between O(y 4 ) terms which proves to be numerically problematic. In the
BL-v 2 /k model the elliptic equation is simply solved for a non-dimensional quantity with an homo-
geneous Dirichlet boundary condition, therefore alleviating the stiffness associated to the boundary
condition of the elliptic variable. The inclusion of in the definition of f allows a blending between
the near-wall and the homogeneous form f = (1 3 )fw + 3 fh in the equation. For the fh model
the proposal of [SSG91] is preferred for its better reproduction of the pressure term in a boundary
layer.
The model also solves a k- system somewhat modified compared to the one generally adopted by
v 2 f models. The k and equations adopted by the BL-v 2 /k model read:
  
dk t k
= P + div + k C3 (1 )3 2t (k j Ui ) (k j Ui ) (II.7.12)
dt 2 k
1 the pressure term 22 is not decomposed but modelled as a whole
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 64/402


  
d C1 P C2 t
= + div + (II.7.13)
dt T 2

The k equation includes the so-called E term dependent on the second velocity derivatives squared,
similar to that introduced into the equation by [JL72], and the homogeneous part of the dissipation
rate is independently accounted for (following the suggested formulation of [JH02]). This implies that
the quantity resolved by the model has a different definition to that conventionally employed in k-
schemes (i.e. a change of variable + (1 )3 k E + 21 jj k). This has the beneficial effect of
reducing the Reynolds number dependence of the near-wall value of the turbulence variables and of
the time and length scales, T and L respectively, yielding better near-wall prediction of the blending
variable and the turbulent viscosity, and hence mean flow quantities, for both low and high Reynolds
numbers.
A further feature is that the coefficient C2 is taken as a function of the turbulent transport of k to
ratio (as proposed by [PLD96]):

3/2 !
div ( t / k k)
= C2 3 (0.4 C2 ) tanh

C2 (II.7.14)

This improves the predictions of the dissipation rate in the defect layer of a channel flow (where the
turbulent transport becomes significant) and yields better results in wake flows [PLD96]. Full details
of the scheme can be found in [BL12].

in extenso definition

Equations: Equations for the turbulence kinetic energy k, the turbulence dissipation rate , the non-
dimensionnal wall-normal Reynolds stress component = v 2 /k and the elliptic blending parameter
are given in Eq. (II.7.12), Eq. (II.7.13), Eq. (II.7.7) and Eq. (II.7.6) respectively.

Scales and constants: The definition of the turbulent viscosity is given in Eq. (II.7.15). The near-
wall and far field models, fw and fh for the source term, f are expressed in Eq. (II.7.16) and
Eq. (II.7.17). The definition of the variable coefficient C2 is given in Eq. (II.7.18)
Finally the time and length scales entering the definition of t , the equation of and the definition of
fh as well as the equation of are given in Eq. (II.7.19). The viscous limiter used as lower bound of the
time scale has a finite wall value and therefore enables avoid the singularity consecutive to the definition
2

of the sink term if the term C2 were used in place of C2 . Similarly a viscous (Kolmogorov)
k T
limiter is used for the length-scale definition L to avoid numerical problems which would raise in the
equation numerical resolution if the length-scale were to tend to zero at wall. The upper limiter
Tlim is used to enforce the Bradshaw hypothesis (proportionality
between shear stress and turbulent
kinetic energy in a boundary layer uv/k = C(= 0.6/ 3 with the present approach)), and corrects, in
a wider range of cases, the excessive production rate returned by the eddy viscosity formulation (i.e.
allowing a linear rather than a quadratic dependance on S for large strain rate).

t = C k min(T, Tlim ) (II.7.15)


fw = (II.7.16)
 2 k  
1 P 2
fh = C1 1 + C2 (II.7.17)
T 3
!
div (t /k k) 3/2

3
C2 = C2 + (C4 C2 ) tanh (II.7.18)

Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 65/402

s 
k3 3/2



L = C 2 + C 2
L 1/2
2




r
2
k (II.7.19)
T = 2
+ CT2



0.6


Tlim =


p
6C S : S

Constants: Table 7.2 gives the value adopted for the constants of the model.

C1 C2 C3 C4 k

1.44 1.83 2.3 0.4 1 1.5

C CT CL C C1 C2

0.22 4 0.164 75 1.7 0.9 1

Table 7.2: Constants of the BL-v 2 /k model

Boundary conditions
The turbulent variables wall boundary conditions are given in Eq. (II.7.20) (y being the wall-distance)2 :

lim k = 0
y0


lim = lim k



y0 y0 y 2 (II.7.20)

lim = 0


y0

lim = 0

y0

Remaining issues
3 X
X 3 X
3
2
The actual source term (k j Ui ) (k j Ui ) should be written as (k j Ui ) and not
i=1 j=1 k=1
2
3
X X3 X
3
(k j Ui ) as it is, incorrectly, in the present implementation.
i=1 j=1 k=1

Issues regarding grid/code dependancy of this term have already been raised [Iac01]. Alternatives
2
may be worth investigating, such as (jj Ui ) .

7.1.3 Spalart-Allmaras model


The Spalart-Allmaras turbulence model [SA92] is an EVM RANS model developed in the 90s in
aeronautics, and is therefore well suited for studying a flow around an air-plane wing for instance.
2 Note that the wall boundary condition is halved compared to what is used in the f model (iturb=50)
consequently to the change of variable described above
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 66/402

Model description
It consists of a transport equation of a scalar nu
dirctly linked to the turbulent viscosity T .
More recently, this model has been extended by Aupoix [AS03] to rough wall for studying atmospheric
flows. It was also successfully applied to flow in turbo-machinery where variants of this model has
been developed.
The transport equation of (pseudo turbulent viscosity, which tends to it far from walls) reads3
 2
1h 2
i
(u) = cb1 Scw1 fw | + in n +ST imp +ST exp

+ + div (( + ) + cb2 |
)
t d
(II.7.21)
where in is the injection value of in case of any mass source term, and STimp and STexp are
respectively the implicit and explicit additional user source terms and where

T = fv1
3
fv1 =
3 + c3v1

=


S = + 2 2 fv2
d
(II.7.22)
fv2 = 1
+ fv1
1
1 + c6w3 6

fw = g 6
g + c6w3

g = r + cw2 r6 r
 

r = min ; 10
2 d2
S
The constants are defined in Table 7.3.

cb1 cb2 cw2 cw3 cv1 cw1

2 cb1 1 + cb2
3 0.1355 0.622 0.41 0.3 2 7.1 +
2
Table 7.3: Constants of the Spalart Allmaras model.

3 the present formulation is a simplified one presented by Aupoix [AS03] where transition terms have been neglected.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 67/402

Time stepping
Equation (II.7.21) can be rewritten with the -scheme presented in Chapter 3 as
implicit term
z }| {
n
 
0 Ts +
imp n
+ max cw1 fw 2 cb1 S, n+1
t
d
 
+

+ n+1 (u)
div n+1




| {z }
implicit part of the convection | {z }
(II.7.23)
implicit part of the diffusion

=
 
n + n
(u) + div


 2
cb2 2
+cb1 Sn cw1 fw

+ | + in n + ST imp n + ST exp
|
d
n+1 n+1 n .
where

n
 

Remark 7.1 The term cw1 fw 2 cb1 S is implicit so that does not require any clipping to
d
remain positive if an upwind convective scheme and no flux reconstruction are chosen.

Boundary conditions
Smooth walls: the boundary condition on is a standard zero Dirichlet boundary condition on the
walls (see Chapter 5 for the encoding of standard Dirichlet conditions).
Note that the model gives a log law outside of the viscous sub-layer, i.e.:

' u? d
(II.7.24)
u?
S '
d

Rough walls: In case of rough walls, let us define:

hs
rough = + cR1
drug
drough = d + d0 (II.7.25)

d0 = exp (8.5) hs ' 0.03hs

where hs is the roughness size. The Dirichlet boundary conditions is replaced by the following Neumann
boundary condition:
|fb


= (II.7.26)
n d0 fb
A development in series in then written:
fb = I 0 fb I 0 F (II.7.27)
Finally, that is a Robbin type boundary condition formulated as follows in Code Saturne: which reads
as follows in Code Saturne:
fb = Agfb Bfgb I 0 (II.7.28)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 68/402

with Agfb = 0 and


d0
Bfgb = (II.7.29)
d0 + I 0 F

Inlet: the profile of is imposed, the value is deduced from the profiles imposed on k and for a
k turbulence model assuming ' T .

7.2 Differential Reynolds Stress Models (DRSM )


In this section, the presented models solve a differential transport equation on the Reynolds stresses
tensor.

7.2.1 Equations for the Reynolds stress tensor components Rij


and (LRR model)

R  
+Rin + ST R ,


+ R (u) div R = d + P + G +
t ij

2
+in + ST ,


+ (u) div () = d + C1 [P + G ] C2
t k k
(II.7.30)
where P stands for the turbulence production tensor associated with mean flow strain-rate and G is
stands for the production- tensor associated with buoyancy effects:

= R uT + u R ,
 
P
(II.7.31)
 
G = rg+gr .

3 C k
where r 0 u0 is modelled through a Generalized Gradient Diffusion Hypothesis (GGDH): r ' 2 t R
 
and G = Max 0, 12 trG .

Remark 7.2 Under Boussinesq assumption ( varies only in the buoyancy term in the momemtum
equation, lineraly with respect to , the velocity density correlation becomes 0 u0 .

With these definitions the following relations hold:

1
k = 2 trR,
(II.7.32)
1

P = 2 tr P ,

is the term representing pressure-velocity correlations:

= + + + , (II.7.33)
1 2 3 w


= C1 RD ,
1 k
= C2 P D , (II.7.34)
2

= C3 GD .
3
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 69/402

The term is called wall echo term (by default, it is not accounted for: see html programmers
w
documentation of the subroutine and the appendix Q).
The dissipation term, , is considered isotropic:
2
= 1. (II.7.35)
3

The turbulent diffusion terms are:


 
k
d = CS div R R ,

  (II.7.36)
k
d = C div R .

in
In the rare event of mass sources, Rij and i are the corresponding injection terms. STRij and ST
are also rarely used additional source terms that can prescribed by the user.

C C C1 C2 C1 C2 C3 CS C10 C20

0.09 0.18 1.44 1.92 1.8 0.6 0.55 0.22 0.5 0.3

Table 7.4: Model constants of the LRR Rij model [LRR75].

7.3 Large-Eddy Simulation (LES )


7.3.1 Standard Smagorinsky model

2 q
t = Cs 2S : S, (II.7.37)

where S the filtered strain rate tensor components:

S 1h T i
S=S = u + u . (II.7.38)
2
Here, ui stands for the ith resolved velocity component 4 .
C is the Smagorinsky constant. Its theoretical value is 0.18 for homogeneous isotropic turbulence, but
the value 0.065 is classic for channel flow.
is the filter width associated with the finite volume formulation (implicit filtering which corresponds
1
to the integration over a cell). The value recommended for hexahedral cells is: = 2 |i | 3 where |i |
is the volume of the cell i.

7.3.2 Dynamic Smagorinsky model


A second filter is introduced: it is an explicit filter with a characteristic width
e superior to that of
the implicit filter (). If Y is a discrete variable defined over the computational domain, the variable
obtained after applying the explicit filter to Y is noted Y . Moreover, with:
4 In the case of implicit filtering, the discretization in space introduces a spectral low pass filter: only the structures

larger that twice the size of the cells are accounted for. Those structures are called the resolved scales, whereas the
rest, ui ui , is referred to as unresolved scales or sub-grid scales. The influence of the unresolved scales on the
resolved scales have to be modelled.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 70/402

L = u
^ uu
eu
e,

= u u u u, (II.7.39)

T ^
= u uu
eu
e,

Germano identity reads:


L=T e
. (II.7.40)

Both dynamic models described hereafter rely on the estimation of the tensors T and as functions
of the filter widths and of the strain rate tensor (Smagorinsky model). The following modelling is
adopted5 :

Tij 13 trT ij = e 2 |D
2C g |D
ij
g,
ij
(II.7.41)
1 2
ij 3 ij = 2C |Dij |Dij ,

where u stands for the implicit-filtered value of a variable u defined at the centres of the cells and
u represents the explicit-filtered value associated with the variable u. It follows that the numerical
computation of Lij is possible, since it requires the explicit filtering to be applied to implicitly filtered
variables only (i.e. to the variables explicitly computed).
On the following assumption:

C = C , (II.7.42)
and assuming that C is only slightly non-uniform, so that it can be taken out of the explicit filtering
operator, the following equation is obtained:
 
LD = C e , (II.7.43)

with:
ij e 2 |D
= 2 g |D
ij
g,
ij
(II.7.44)
2
ij = 2 |Dij |Dij .

Since we are left with six equations to determine one single variable, the least square method is used6 .
With:  
E = L C e , (II.7.45)

the value for C is obtained by solving the following equation:


E : E
= 0. (II.7.46)
C

Finally:
M :L
C= , (II.7.47)
M :M
with
M = .
e (II.7.48)
5
ij stands for the Kroeneker symbol.
6 trL has no effect for incompressible flows.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 71/402

This method allows to calculate the Smagorinsky constant dynamically at each time step and at
each cell. However, the value obtained for C can be subjected to strong variations. Hence, this
approach is often restricted to flows presenting one or more homogeneous directions (Homogeneous
Isotropic Turbulence, 2D flows presenting an homogeneous span-wise direction...). Indeed, in such
cases, the model can be (and is) stabilized by replacing C by an average value of C computed over the
homogeneous direction(s).
For a general case (without any homogeneous direction), a specific averaging is introduced to stabilize
the model: for any given cell of the mesh, the averaged Smagorinsky constant is obtained as an average
of C over the extended neighbouring of the cell (the set of cells that share at least one vertex with the
cell considered). More precisely, the average value (also denoted C hereafter) is calculated as indicated
below:

M
^ :L
C= (II.7.49)
M
^ :M
Chapter 8

Compressible flows

See A.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 73/402

8.1 Density-based solver


Chapter 9

Combustion
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 75/402

9.1 Introduction
9.1.1 Use & call
From a CFD point of view, combustion is a (sometimes very) complicated way to determine , the
density.
Depending on the presence of a match or not, two solutions exist, known as ignited and extinguished.
From a numerical point of view, it means that these two solutions have two attraction basin; the more
representative the model, the more difficult the stabilisation of the combustion (may be difficult to
ignite).
However, combustion models needs few extra fields of scalar with regular transport equations, some of
them with a reactive or interfacial source term.
This version of Code Saturne focuses on steady industrial combustion processes; propagating fires are
out of the present range (but in the short coming release).
In Code Saturne modelling of combustion is able to deal with gas phase combustion (diffusion, premix,
partial premix), and with solid or liquid finely dispersed fuels (fixed and fluidised beds are out of
range).
Combustion of condensed fuels involves one-way interfacial flux due to phenomena in the condensed
phase (evaporation or pyrolisis) and reciprocal ones (heterogeneous combustion and gasification). Many
of the species injected in the gas phase are afterwards involved in gas phase combustion.
That is the reason why many modules are similar for gas, coal and fuel oil combustion modelling.
Obviously, the thermodynamical description of gas species is similar in every version as close as possible
to the JANAF rules.
All models are developed in both adiabatic and unadiabatic (permeatic : heat loss, e.g. by radiation)
version, beyond the standard (-1, 0, 1), the rule to call models in usppmo is:

ippmod(index ; model) = 1 unused


ippmod(index ; model) = 0 simplest adiabatic version
ippmod(index ; model) = 1 simplest permeatic version (II.9.1)
and possibly:
ippmod(index ; model) = 2.p p adiabatic version
ippmod(index ; model) = 2.p + 1 p permeatic version

Every permeatic version involves the transport of enthalpy (one more variable).

9.1.2 Gas combustion modelling


Gas combustion is limited by disponibility (in the same fluid particle) of both fuel and oxidizer and
by kinetic effects (a lot of chemical reactions involved can be described using an Arrhenius law with
high activation energy). The mixing of mass (atoms) incoming with fuel and oxydizer is described
by a mixture fraction (mass fraction of matter incoming with fuel), this variable is not affected by
combustion.
A progress variable is used to describe the transformation of the mixture from fuel and oxydant to
products (carbon dioxyde and so on). Combustion of gas is, traditionnaly, splitted in premix and
diffusion regimes.
In premixed combustion process a first stage of mixing has been realised (without blast ...) and
the mixture is introduced in the boiler (or combustor can). In common industrial conditions the
combustion is mainly limited by the mixing of fresh gases (frozen) and burnt gases (exhausted) resulting
in the inflammation of the first and their conversion to burnt ones ; so an assumption of chemistry
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 76/402

much faster than mixing (characteristic time for chemistry much smaller than characteristic time for
turbulent mixing) induces an intermittent regime. The gas flow is constituted of totally fresh and
totally burnt gases (the flamme containing the gases during their transformation is extremely thin).
With this previous assumptions, Spalding [S71] established the Eddy Break Up model, which allows
a complete description of the combustion process with only one progress variable (mixture fraction is
both constant - in time - and homogeneous - in space).
In diffusion flames the fuel and the oxydant are introduced by, at least, two inlets. In ordinary
industrial conditions, their mixing is the main limitation and the mixture fraction is enough to qualify
a fluid particle, but in turbulent flows a Probability Density Function of the mixture fraction is needed
to qualify the thermodynamical state of the bulk. So, at least, both the mean and the variance of
the mixture fraction are needed (two variables) to fit parameters of the pdf (the shape of whose is
presumed).
Real worlds chemistry is not so fast and, unfortunately, the mixing can not be as homogeneous as
wished. The main part of industrial combustion occurs in partial premix regime. Partial premix
occurs if mixing is not finished ( at molecular level) when the mixture is introduced, or if air or fuel,
are staggered, or if a diffusion flame is blown off. For these situations, and specifically for lean premix
gas turbines [LW00] developed a model allowing a description of both mixing and chemical limitations.
A collaboration between the LCD Poitiers [RCP04] and EDF R&D has produced a simpler version of
their algorithm. Not only the mean and the variance of both mixture fraction and progress variable
are needed but also their covariance (five variables).

9.1.3 Two-phase combustion modelling


Coal combustion is the main way to produce electricity in the world. Heavy fuel oil combustion have
been hugely used to produce electrical energy. Biomass is a promising fuel to be used alone or in blend.
Advanced combustion process may include exhaust gases recycling, pure oxygen or steam injection, so
this release of Code Saturne takes into account three oxidizers (tracked by three mixture fractions).
Coal is a natural product with a very complex composition. During the industrial process of milling,
the raw coal is broken in tiny particles of different sizes. After its introduction in the boiler, coal
particles undergoes drying, devolatilisation (heating of coal turn it in a mixture of char and gases),
heterogenous combustion (of char by oxygen in carbon monoxide), gasification (of char by carbon
dioxide or by water steam in carbon monoxide), leaving ash particles.
The description of fuel evaporation is done with respect to its heaviness : after a minimum temperature
is reached, the gain of enthalpy is splitted between heating and evaporation. This way the evaporation
takes place on a range of temperature (which can be large). The total evaporation is common for
light (domestic) oil but impossible for heavy ones : at high temperature, during the last evaporation,
a craking reaction appears : so a particle similar to the char is leaved. The heterogeneous oxydation
of this char particle is very similar to coal char ones.
Each of these phenomena are taken into account for some classes of particles : a solid class is carac-
terised by a coal (it is useful to burn mixture of coals with differents ranks or mixture of coal with
biomass ...) and an initial diameter, for heavy fuel oil, liquid classes refer to initial diameter (neither
possibility of blending after injection nor cofiring with oil and coal). Code Saturne computes the num-
ber, the mass and the enthalpy for each class of particles by unit of mass of mixture; allowing the
determination of local diameter and temperature (for each class; e.g. the finest will be be heated the
fastest).
The main assumption is to solve only one velocity (and pressure) field: it means that the discrepancy
of velocity between coal particles and gases is assumed to be negligible.
Due to the radiation, evaporation and heterogeneous combustion, temperature can be different for gas
and different size particles : so the specific enthalpy of each particle class is solved.
The description of coal pyrolysis proposed by [K76] is used, leading to two source terms for light and
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 77/402

heavy volatile matters (the moderate temperature reaction produces gases with low molecular mass,
the high temperature reaction produces heavier gases and less char) represented by two passive scalars
: mixture fractions. The description of the heterogeneous reaction (which produce carbon monoxide)
produces a source term for the carbon: the corresponding mixture fraction is bounded far below one
(the carbon cant be free, it is always in carbon monoxide form, mixed with nitrogen or other).
The retained model for the gas phase combustion is the assumption of diffusion flammelets surrounding
particle (for a single paticvle or a cloud), this diffusion flame establish itself between a mixing of the
previous gaseous fuels issued from fast phenomenon (pyrolysis or fuel evaporation) mixed in a local
mean fuel and the mixing of oxidizers, water vapor (issued from drying) and carbon monoxide issued
from slow phenomenon (heterogeneous oxydation and gasification of char). The PDF diffusion app-
rocah is used to describe the conversion of hydrocarbon to carbon monoxide (hydrocarbon conversion
is assumed fast vs. mixing); the further conversion of carbon monoxide to carbon dioxyde was (in
previous release, still existing for fast first evaluation of carbon dioxide usefull to initialize the kinetic
model) ruled by mixing or is (now recommended for better prediction of carbon monoxide at outlet
and corrosion risks) kineticaly ruled with respect to the mean mass fraction and temperature (reach
of equilibrium assumed slow vs. mixing). Special attention is paid to pollutant formation (conversion
of H2 S to SO2 involved in soot agglomeration, NOx formation).
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 78/402

9.2 Thermodynamics
9.2.1 Introductrion
The description of the thermodynamical of gaseous mixture is as close as possible to the JANAF
standard. The gases mixture is, often, considered as composed of some global species (e.g. oxidizer,
products, fuel) each of them beeing a mixture (with known ratio) of elementary species (oxygen,
nitrogen, carbon dioxide, ...).
A tabulation of the enthalpy of both elementary and global species for some temperatures is constructed
(using JANAF polynoms) or read (if the user found useful to define a global specie not simply related
to elementary ones; e.g. unspecified hydrocarbon known by C, H, O, N, S analysis and heating value).
The thermodynamic properties of condensed phase are more simple: formation enthalpy is computed
using properties of gaseous products of combustion with air (formation enthalpy of which is zero valued
as O2 and N2 are reference state) and the lower heating value. The heat capacity of condensed phase
is assumed constant and it is a data the user has to enter (in the corresponding data file dp FCP or
dp FUE).

9.2.2 Gases enthalpy discretisation


A table of gases (both elementary species and global ones) enthalpy for some temperatures (the user
choses number of points, temperature in dp *** file) is computed (enthalpy of elementary species is
computed using JANAF polynomia; enthalpy for global species are computed by weighting of elemen-
tary ones) or red (subroutine pptbht). Then the entahlpy is supposed to be linear vs. temperature
in each temperature gap (i.e. continuous piece wise linear on the whole temperature range). As a
consequence, temperature is a linear function of enthalpy; and a simple algorithm (subroutine cothht)
allows to determine the enthalpy of a mixture of gases (for inlet conditions it is more useful to indicate
temperature and mass fractions) or to determine temperature from enthalpy of the mixture and mass
fractions of global species (common use in every fluid particle, at every time step).

9.2.3 Particles enthalpy discretisation


Enthalpy of condensed material is rarely known. Usually, only the low heating value and ultimate
analysis are determined. So, using simple assumptions and the enthalpy of known released species
(after burning with air) the formation enthalpy of coal or heavy oil can be computed. Assuming the
thermal capacity is constant for every condensed material a table can be build with ... two (more
is useless) temperatures, allowing the use of the same simple algorithm for temperature-enthalpy
conversion. When intermediate gazeous species (volatile or vapour) are thermodynamically known,
simple assumptions (e.g.: char is thermodynamically equivalent to pure carbon in reference state;
ashes are inert) allow to deduce enthalpy for heterogeneous reactions (these energies have not to be
explicitely taken in account for the energy balance of particles).
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 79/402

9.3 Gas combustion


Flames with gaseous fuels can be categorized in premix, diffusion or partial-premix.

9.3.1 Premix: Eddy Break Up


The original Spalding model [S71] was written for a situation where the whole boiler is filled with the
same mixture (only one inlet); the motto of which is If it mixes, it burns. If the chemistry is fast
vs. mixing, fluid particles are made of fresh gases or of burned ones. This situation is described by a
progress variable (valued 0 in fresh gases and 1 in burnt ones) with a source term: the reaction one.
The mixture of totally fresh or totally burnt gases, called intermittency, leads to a maximal variance
of the progress variable determined by the mean value of the progress variable.

C2max = (Cmoy Cmin ).(Cmax Cmoy ) = Cmoy .(1 Cmoy ) (II.9.2)

The mixing of fresh and burnt gases is the dissipation of this variance and it induces the conversion of
fresh gases in burnt ones. So the source term for the (mean) progress variable is the dissipation of its
(algebraic) variance. Be careful: in Code Saturne the variable chosen to describe the reaction is the
mass fraction of fresh gases (valued 1 in fresh and 0 in burnt), so:

 
S(Yfg ) = Cebu Yfg 1 Yfg (II.9.3)
k

Where Cebu is a constant, supposedly universal, fitted around 1.6 (only advanced users may adjust
this value).
Some improvements have been proposed, and largely used, for situations with mixture fraction gradient
(staggering of reactant(s)) but are not theorically funded. The simplest extension is available (options
2 and 3 ) in Code Saturne with one extra equation solved for f the mean of mixture fraction: the
corresponding hypothesis is no variance for mixture fraction ... a little bit surprising in an EBU
context (maximal variance for progress variable). The choice of the fresh gas mass fraction appears
now to be quite relevant : the computation of species mass fraction can be done, with respect to the
mean mixture fraction, both in fresh (the mass fraction of which is Yfg ) where species mass fraction are
obvious and burnt gases (the mass fraction of which is (1 Yfg )) among which species mass fraction
come from a complete reaction assumption (as introduced hereafter for diffusion flame).

 
f fs
Yfuel = Yfg .f + (1 Yfg ). max 0 ;
1 fs
 
fs f
YOx = Yfg .(1 f ) + (1 Yfg ). max 0 ; (II.9.4)
fs
 
f 1f
Yprod = (1 Yfg ). ;
fs 1 fs

Where fs is the stoechiometric mixture fraction.


In adiabatic conditions the specific enthalpy of gases (in every combustion model the considered enthalpy
contains formation one and heat content, but no terms for velocity or pressure) is directly related to the
mixture fraction (as long as the inlet temperature for air and fuel is known). When heat losses, like
radiation, are taken into account, an equation has to be solved for the mean enthalpy (such an equation
is needed so when some inlets have different temperatures -partial preheat- enthalpy is then used as an extra
passive scalar). In industrial processes, the aim is often to transfer the heat from burnt gases to the
wall; even for heat loss the wall temperature is near to the fresh gases temperature and the main heat
flux takes place between burnt gases and wall. So, in Code Saturne, the specific enthalpy of the fresh
gases is supposed to be related to mixture fraction and the specific enthalpy of burnt gases is locally
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 80/402

computed to reach the mean specific enthalpy. By this way every heat loss removed from the mean
enthalpy is charged to the hottest gases.

Yfg . hfg (f)


h
= Yfg . hfg (f) + (1 Yfg ) . hbg
h hbg = (II.9.5)
1 Yfg
where f is here the local mean of the mixture fraction or a constant value (in the regular EBU model).

9.3.2 Diffusion: PDF with 3 points chemistry


In diffusion model, the combustion is assumed to be limited only by mixing (between air and fuel), so
the reaction is assumed to reach instantaneously its equilibrium state and the temperature and concen-
trations can be computed for every value of the mixture fraction. In Code Saturne the implemented
version uses an extra hypothesis: the reaction is complete; so if the mixture is stoechiometric, the
burnt gases contains only final products (none unburnt like CO, except definition of product including
a specified ratio of CO). As a consequence, every concentration is a piecewise linear function of the
mixture fraction (subroutines: d3pphy, d3pint, cpcym, fucym).

f
0 f fs ; Yi (f ) = Yair +(Ys Yair ) (II.9.6)
fs
f fs
fs f 1 ; Yi (f ) = Ys + (Yfuel Ys ) (II.9.7)
1 fs

Y
Products

Fuel

Oxidizer

fs 1 f

Figure II.9.1: Mass fraction of global species are piecewise linear with mixture fraction.

Where fs is the stoechiometric mixture fraction, Ys the concentrations in products of the complete
reaction of a stoechiometric mixture (in such products, the chemical reaction is no more possible :
inert). Beware to distinguish Yfuel mass fraction of a species (depending on f) and Yfuel mass fraction
of species in the inlet condition for the fuel stream (Yi,fuel = Yi (1) Yi,air = Yi (0)).
The diffusion model uses two equations for the mixture fraction and its variance. Both of them having
no reaction term. The mean and the variance of the mixture fraction are used to fit parameter of a
Probability Density Function, with a presumed form, for the mixture fraction. In Code Saturne the
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 81/402

shape proposed by [BD78] with a rectangle and Diracs peak is used (subroutines copdf, cppdf,
fupdf).

Fuel air ratio : lean


P(f)
Variance : moderate

Diracs peak for oxidizer

rectangle for mixture

0 1 f
Lean variance Strong variance

Fuel Diracs
Oxydizer Diracs peak
peak

Figure II.9.2: Examples of presumed PDF: cheapest form.

The determination of the mean concentration is done by integrating the local concentration weighted
by the probability density function. As a matter of fact, integrating the product of a piecewise linear
function by a constant (height of the rectangle) is a very simple exercise: analytic solution is available
(the original formulation [BD78] which uses function was much more computationaly expensive).
In adiabatic condition, the specific enthalpy of the mixture is a linear function of the mixture fraction
(the enthalpy is not modified by the reaction). As for premixed combustion, the following assumption
is done the hotter the gases, the worse the heat losses, so the enthalpy of pure oxidizer and fuel are
supposed to be not modified in permeatic conditions, the enthalpy of products hs (at the stoechiometric
mixture fraction) is an unknown or auxiliary variable. The enthalpy of the mixture is supposed linear
piecewise with f (like concentrations but with an unkwnon at fs ) and the resulting mean enthalpy
(weighted by PDF) is linear in hs . Fitting with the equation for the mean enthalpy (which takes in
account radiation and other heat fluxes), hs is determined and, consequently the temperature at fs
and the mean temperature can be computed.
As an example of the capabilities of the simple pdf used in Code Saturne, computations for the deter-
mination of the value of this auxiliary variable are detailed hereafter.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 82/402

hfuel

fresh mixture = enthalpy linear

hox

burnt mixture = enthalpy piece wise linear

hs
f

0 fs 1

Figure II.9.3: Enthalpy of products is determined to take in account the heat losses.

f
0 f fs ; h` = hOx + ( hs hOx )
fs
fs . hfuel hs f
fs f 1 ; hs = + (hs hfuel ) (II.9.8)
fs 1 fs 1
Z 1
h(f ).P (f )df = D0 .hOx + D1 .hfuel
0
Z f2,` = min(fs , f2 )
+ h` (f ).H.df (II.9.9)
f1,` = min(f1 , fs )
Z f2,r = max(fs , f2 )
+ hr (f ).H.df
f1,r = max(f1 , fs )
Z 1
h(f ).P (f )df = D0 .hOx + D1 .hfuel
0
( )
2 2
f2,` f1,`
+ H.hOx .(f2,` f1,` ) + H.(hs hair ) (II.9.10)
2 fs
( )
2 2
fs .hfuel hs f2,r f1,r
+ H. .(f2,r f1,r ) + H.(hs hfuel )
fs 1 2 (fs 1)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 83/402

Z 1
h(f ).P (f )df = D0 .hOx + D1 .hfuel
0
2 2
(f2,` f1,` )
+ H hOx (f2,` f1,` ) H hOx
2 fs
| {z }
HOx ; 2 terms
2 2
fs (f2,r f1,r ) (f2,r f1,r )
+ H hfuel H hfuel (II.9.11)
(fs 1) 2.(fs 1)
| {z }
Hfuel ; 2 terms
( )
2 2 2 2
(f2,` f1,` ) (f2,r f1,r ) (f2,r f1,r )
+ H.hs +
2 fs (fs 1) 2 (fs 1)
| {z }
H ; last terms

With h` enthalpy on the lean side of fs , hr enthalpy on the rich side; D0 the Diracs peak in pure air,
D1 Diracs peak in pure fuel, f1 begin of rectangle, f2 end of rectangle, H heigth of rectangle.
This expression for enthalpy includes a last term linear in hs , identification with the transported
enthalpy (solved with source term for radiation and so on) allows to determine its value:

1 [D0 .h + D1 .h
fuel + {HOx + Hfuel }]
Z
h air
h(f ).P (f )df = h hs = (II.9.12)
0 H

9.3.3 Partial premix: Libby Williams models


Code Saturne has been the test-bench for some versions of Libby-Williams model [LW00], like for the
models implemented and then incremented by [RCP04] and [R05].
The Libby & Williams model have been developed to address the description of the combustor can of
gas turbine in regime allowing a reduction of NOx production using (sometimes very) lean premix. By
this way, the combustion occurs at moderate temperatures avoiding the hot spots which are favourable
to thermal NOx production. Because of the moderate temperatures, the chemistry is no more so fast
and the stability is questionnable. To ensure it a diffusion flame called pilot takes place in the center of
the combustor. So, if the main flow is premixed, both pure fuel and pure oxidiser are introduced in the
combsutor leading to continuous variation of the equivalence ratio (always the mixture fraction).This
situation is clearly out of the range of both EBU and PDF models, moreover the limitation by the
chemistry is needed (for stability studies).
Originally, Libby & Williams proposed a presumed PDF made of two Diracs peaks, Ribert showed
that this PDF could be determined with only the mean and the variance of the mixture fraction and
a reactive variable (by now, the mass fraction of fuel is used). Then some undeterminations seem
awkward and Robin et al. propose a four Diracs peaks PDF whose parameters are determined with
the same variables and the solved (transported) covariance (of the reactive variable and the mixture
fraction) as an extra solved field. With the condition corresponding to every Diracs peak, a global
chemistry description is used (the source term for every variables is a weighting of the reaction fluxes).
With two peaks distribution, the two-variable PDF is restricted to one line, crossing the mean state
and the slope of which is the ratio of variances (choice of the sign is user free, ... but relevant: expertise
is needed). The correlation between variables is unity. On this line the distribution is supposed to
obey a modified Curl model [Cur63].
With three or four peaks distribution, the whole concentration space is available and the determination
of the covariance allows evolution of the correlation (with f and Y f , it has been shown that the
correlation is positive in mixing layer and can become negative across the flame: the particle nearer of
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 84/402

Fuel

Yf

Correlation = 1
The leaner gases are the hotter

fresh mixture

burnt gases
1D pdf support with C = +1

Ymean
f
Products
Oxidiser fmean fs 1D pdf support if C=1

Figure II.9.4: PDF recommended by Libby & Williams: still undetermined.

stoechiometry being able to burn -then destroy Yf- faster than the particles in poor regime).

Fuel

Yf

Curl distribution for f


Rich determination
Lean determination

LibbyWilliams with
fresh mixture four Diracs peak
covariance solved

burnt gases

Ymean
f
Products
Oxidiser fmean fs

Figure II.9.5: PDF form in LWP approach: succesive modified Curl distributions.

In adiabatic conditions, the temperature can be computed for every pair (f, Y f uel), allowing the
determination of the kinetic constant.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 85/402

As previously, with heat losses, it is assumed that the hottest gases have lost the more (of their
thermal enthalpy), the enthalpy of the products at stoechiometric point (f s, 0) is an auxiliary variable,
the enthaply being considered as a piecewise bilinear function. Fitting mean transported enthalpy and
integrated ones, allows to determine the enthalpy of stoechiometric products, then the enthalpy and
temperature in the peaks conditions and, in fine the reactions fluxes.

9.3.4 Numerical Recipies for PDF


Some applied mathematics are involved in pdf parameters determination (rectangle and modified Curl)
and for integration (species mass fraction, temperature, density and so on).
Some tests, done by [Sap11] show weak discrepancies between species mass fraction with respect to
the shape of the PDF (among Beta, rectangle and peaks, Curl; for similar mean during variance
dissipation).

Rectangle and Diracs peaks probability density function

This type of pdf is used in diffusion flames both for gas combustion or dispersed fuel ones (coal and
heavy fuel oil). In gas mixture, the pdf is build for an equivalence ratio for fuel (inert scalar variable)
ranging on [0, 1]. For dispersed fuel, due to vaporisation, or pyrolysis, and heterogeneous combustion
two or three gaseous fuels are taken in account, each of them having its own inert scalar, so the PDF is
build for an inert scalar which is the total of passive scalars for volatiles matter (coal and biomass) or
hydrocarbon vapor (heavy fuel oil). The algorithm for pdf parameters determination, can be written
in a general form on every variables range.
If the allowed range for the variable is [fmin ; fmax ], knowing the mean and variance of the variable allow
to determine first the shape (alone rectangle, rectangle and one Diracs peak at one boundary, two
Diracs peak at boundaries and rectangle) and then, the three pertinent parameters (three conditions
given by momenta m0 = 1, m1 = mean, m2 = mean2 + variance).

1. For a lonesome rectangle Diracs peak intensity is null, the three parameters are: the begining
and end values of the rectangle and its heigth.
2. For a rectangle with a Diracs peak at one boundary (which is determined during the choice of
shape), one of the rectangle edge is fixed at this boundary, so the three parameters are : the
other rectangle edge, height of rectangle, intensity of the Diracs peak.
3. For a two Diracs peak distribution, both rectangle edges are at the boudaries, so the parameters
are the rectangle height and the Diracs peak intensity.

The choice between the four possible forms can be done by previous test on the variance. Defining v1
and v2 by:
2
1 f f .(2 3.f )
f v1 = ; v2 = (II.9.13)
2 3 3
1 (1 f )2 (1 f ).(2 3.(1 f ))
f v1 = ; v2 = (II.9.14)
2 3 3
2
!
2
f (1 f )
f v1 = min ; (II.9.15)
3 3
 
f .(2 3.f ) (1 f ).(2 3.(1 f ))
f v2 = max ; (II.9.16)
3 3

Depending on the value of variance and naming D0 and D1 , the Diracs peak magnitude, f2 and f3
the begining and end of the rectangle and h its height, the determination is:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 86/402

1. if the variance is lower than v1 , the pdf is only made of a rectangle (symetrical with respect to
the mean) q q
00 2
D0 = D1 = 0 ; f2 = f 3f ; f2 = f 3fg
g 00 2
(II.9.17)

2. if the variance is greater than v2 , the pdf is made of two Diracs peak and a rectangle (over all
range); (be careful the mean of square is neither the variance nor the square of mean; but the
sum of them)
f2 = 0 ; f3 = 1 ; D0 = 3.ff2 4.f + 1 ; D1 = 3.ff2 2.f (II.9.18)

3. if the variance is greater than v1 and lower than v2 , the pdf is made of only one Diracs peak (in
0 if the mean is lower than one half in 1 otherwise) and a rectangle.
!
1 3.ff2 f
f D1 = 0 ; f2 = 0 ; f3 = ; D0 = 1 2. (II.9.19)
2 2.f f3

1 3.ff2 4.f + 1 2.f 1 f2


f D0 = 0 ; f3 = 1 ; f2 = ; D1 =
2 2.(f 1) 1 f2

4. every time, the height of the rectangle obeys the same relation :
1 D0 D1
h= (II.9.20)
f3 f2

Curl distribution

The Curl distribution is only composed of two Diracs peaks. Such a distribution needs four parameters
(two positions and two amplitudes), only two moments (mean and variance) are known, the completness
is the third, so an extra assumption is needed : the standard Curl distribution assumed amplitudes
values (the mean for the richer, the remainder to one for the leaner), a modification of the Curl
distribution is given by an extra constraint : use of recurrence relation between Beta function allows
to determine the third moment ( linked with skewness) and to modify amplitudes of peaks. In this
Code Saturne release, only regular Curl distribution is implemented and used (discrepancies in species
mass fractions using the modified Curl are not worthy of this option introduction). Looking for P1
and P2 the amplitudes, and f1 and f2 the positions, with constraints from completeness, mean and
variance, it comes :

P1 + P2 = 1 P2 = 1 P 1 (II.9.21)
f P1 .f 1
P1 .f1 + P2 .f2 = f f 2 = (II.9.22)
1 P1
P1 .f12 + P2 .f22 f 2
= f =f +f 2
2 g 00 (II.9.23)
r
00 2 .
1 P1
f1 = f fg (II.9.24)
P1
r
P1
f2 = f + fg 00 2 . (II.9.25)
1 P1

f1 and f2 may be inside [0, 1], the first proposal by Curl (in the context of liquid-liquid extraction,
the interfacial mass flux does not modify mass of each phases) is:

P1 = 1 f; P2 = f
s
f
g 2
f1 = f. 1 (II.9.26)
f.(1 f)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 87/402

Obviously, maximal value of variance induces Diracs peak positionned at boundaries.


Formulae in (II.9.21) can be used to determine the peaks magnitude if any extra condition is retained.
In the context of pdf, the Beta function have the fame of fairly good representation of micro-mixing,
so the third momentum of a Beta distribution is easy to determine (thanks to recurrency), used as a
constraint for a modified Curl model, it comes :
+ 2 f2
ff3 = .f (II.9.27)
++2
00 3 = 2.f
2
00 2 .
1 2.f
fg g (II.9.28)
f.(1 f) + fg
00 2
2 2

00 3
fg 00 3
fg
P12 4+ 3 P 1 4+ 3 +1=0 (II.9.29)
00 2
fg 00 2
fg

Some numerical evaluations dont show large discrepancies (among mass fraction or temperature) so this
option is not currently available.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 88/402

9.4 Coal, Biomass, Heavy Oil combustion


9.4.1 Introduction
Pulverised coal combustion is described (excluding grid burning) allowing the use of mixture of coals
(or of coal and biomass) and a description of granulometry (as many classes of initial diameter as
wished). After a particle enters the furnace, radiation increases its temperature.

1. As particles temperature increases, evaporation of free water (if any) begins. During evaporation,
the vapor pressure gradient extract some water from the particle. The interfacial mass flux brings
some mass, water and enthalpy (computed for water vapour) then latent heat is taken from the
particles enthalpy so the heating is slowed (during evaporation, the water cant reach the boiling
point). Fuel oil is supposed to be dry.
2. After drying is achevied, the temperature reaches higher level, allowing the pyrolysis phase to
take place. The pyrolysis is described by two competitive reactions: the first one with a moderate
activation energy is able to free peripherals atoms group from skeleton leaving to light gases and a
big amount of char; the second one with an higher activation enrgy is able to break links deeper
in the skeleton leaving to heavier gases (or tar) and less char (more porous). So a complete
description needs two sets of three parameters (two kinetics ones and a partitioning one):

Coal = (k01 , T01 ) Y1 {Light Volatiles } + (1 Y1 ) {Char},

Coal = (k02 , T02 ) Y2 {Heavy Volatiles } + (1 Y2 ) {Char},

where Y1 , the partitionning (or selectivity) factor of the low temperature reaction is less than
Y2 , the high temperature one. A practical rule is to consider that the same hydrogen can
bring twice more carbon by the second reaction than by the first one. When ultimate analysis
are available both for coal and for char, it is relevant to check partioning coefficient (Yi ) and
composition of volatiles matters (mainly ratio of Carbon monoxide and C/H in the hydrocarbon
fraction): assumptions on volatiles composition gives partitionning coefficients; assumptions on
Yi determine volatiles equivalent formulae. Pyrolisis interfacial mass flux brings energy of volatile
gases (computed at the particles temperature) in wihch the formation of enthalpy of gaseous
species differs from the coal ones, as a result, the enthalpy for pyrolisis reaction (the most ofen,
moderate) is taken from particle energy.
The heavy fuel oil undertakes a set of physico-chemical transformation: light hydrocarbons can
evaporate while the heaviest undergo a pyrolisis. With a few data, only a temperature range is
available for mass loss of droplets: the heat flux is shared out between warming of the remaining
liquid and evaporation enthalpy. At the very end of theses processes a solid particle is leaved,
mainly made of a porous carbon similar to char.
3. After pyrolysis and evaporation, when every volatiles are burnt, oxygen is able to reach the
surface of the char particle. So heterogenous combustion can take place: diffusion of oxygen
from bulk, heterogeneous reaction (kinetically limited) and back diffusion of carbone monoxide.
The heterogeneous oxidation interfacial mass flux is the difference of an incoming oxygen flux
and an outcoming carbon monoxide mass flux, each of them at their own temperature. The
incoming oxygen has a zero valued formation enthalpy (reference state) and the outcoming carbon
monoxide has a negative formation enthalpy, as a result, the enthalpy liberated by the first
oxidation of carbon is leaked in the particle energy, contributing to its heating. The heterogenous
combustion is complete if all the carbon of the char particle is converted, leaving an ash particle.
Unburnt carbon can leave the boiler as fly ash. The heterogeneous reaction is written as following:
1
Char + O2 = (k0,het , T0,het ) CO
2
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 89/402

4. In the same way, after pyrolysis vanishes, gasification can take place by :

Char + CO2 = (k0,gc , T0,gc ) 2CO,

Char + H2 O = (k0,gw , T0,gw ) CO + H2 .

This version is able to deal with many class of particles Nclasses , each class beeing described by an
initial diameter and a constituting coal. Every coal, among nchar is described by a complete set of
parameters: immediate and ultimate analysis, low heating value (at user choice on raw, dry or pure)
and kinetic parameters (for the two competitive pyrolysis reaction and for heterogeneous reaction).
This allows to describe the combustion of a mixture or coals or of coal and every material following the
same evolution kinetics (woods chips ...). It is, obviously, possible to mix fuels with (very) different
proximate analysis, like dry hard coal and wet biomass.
Subroutines allowing the user to describe inlets are dedicated to standard combustion: some inlets are
for coal (eventually blend)and a gaseous media, others for oxidizers. If needed, a deeper modification
allows to describe co-combustion of coal and some gases ... described as volatile matter from a coal.
The heavy fuel oil injection is described by a thermodynamic data file and granulometry, neither blend
nor coal / oil mixing is possible.

9.4.2 Enhancement of diffusion turbulent reaction for two phase


combustion
With a Probability Density Function and the assumption of concentrations piecewise linear vs. the
variable, it is quite easy to integrate and found the mean concentrations. For gas diffusion flame this
is done by d3pphy, d3pint, it seems more relevant to explain the algorithm in a more complicated
case: for coal, biomass and heavy fuel oil, in multiphase gas combustion five reactions can be
considered.

1. 1) gases issued from slow phenomena (vs. turbulent mixing) as heterogeneous combustion and
gasification, both by CO2 and H2 O are mixed with various oxidizers; if any gasification by H2 O
has been undertaken, some H2 is released. This (an industrial combustor is not a gasifier) amount
is supposed to recombine as a reaction prior to mixing and main turbulent combustion.
2. 2 and 3) Coal is assumed to undergos two competitves pyrolysis reactions, the first releasing
organic compound summarized as CHx1 , the second releasing CHx2 (with x1 > x2), both of
them releasing CO. The first reaction to occur in the gas phase is the partial dehydrogenation (
lowering saturation) of CHx1 to produce water vapor and CHx2 . Then the CHx2 (produced by
pyrolisis or by CHx1 partial oxydation) is converted to water vapor and carbon monoxide.
3. 3 and 4) Heavy fuel oil is supposed to undergos a progressive evaporation, releasing a fuel vapor
CHx (obviously unsaturated, close to CH2 ), CO, H2 S and a char particle. Two reactions are
supposed to succeed. First, the conversion of CHx to water vapor and CO. Then the oxidation
of H2 S to water vapor and SO2 .
4. 5) if conversion of CO to CO2 is assumed to be fast, this complete reaction is also ruled by the
variance dissipation. (Be careful, some CO (from heterogeneous oxidation and gasification) is
still mixed with the local mean oxidiser).

Both for coal and heavy fuel oil, the assumption of a diffusion flamelet surrounding the particles is
done. All of the reducing gases issued from fast phenomenon are supposed mixed (to constitue a local
mean fuel) and the diffusion flammelet takes place between this mixture and the mixture of oxidisers
(air, oxygen, recycled flue gas) and gases issued from slow phenomenon: water vapor (from drying),
carbon monoxide (from heterogeneous combustion and gasification of char if CO oxidation is not fast),
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 90/402

hydrogen (product of gasification by water vapor); then the mean local oxidizer is no more unreactive
and the recombination of hydrogen have to be done first. Depending on the composition of mean local
fuels and oxidizer, stoechiometries can be computed for the five (or four) successive reactions, molar
composition can be easily computed and weighted by the pdf (built on [0 , 1] for the sum of fast fuels).
If carbon monoxide final oxidation is not supposed to be fast, after this turbulent reaction, the amount
of carbon dioxide is null, an equilibrium value is computed (with respect to the total amount of
carbon and oxygen and to the enthalpy) and the value of carbon dioxide transported is compared
with the equilibrium, according to direction of the discrepancy, a relaxation term is computed with
a caracteristic time (oxidations one if the mass fraction is below the equilibrium, dissociations one
otherwise -situation encountered with exhaust gas recycling).
In this release, coal is not supposed to contain any sulphur and heavy fuel oil is supposed to release
only one (unsaturated) hydrocarbon. The general subroutine is then feeded with some nil values (e.g.
in heavy fuel computation, the tracer f 1 dedicated to saturated hydrocarbon is not resolved, and the
call of the subroutine is done with a zero scalar).
This structure is supposed to allow further developments: coal, or biomass, with sulphur, detailed
mechanism for heavy fuel oil decomposition (leading to both CHx1 and CHx2 ), and so on.

O2

CHx1

CHx2

CO H2S

0 fs4 fs1
fs3 fs2 1 F1+F2

Figure II.9.6: Condensed Fuels before any gas combustion.

Before reaction between gases, only exist species coming from inlets or interfacial source term: CO
in mean local fuel (i.e. f1 + f2 = 1) comes from devolatilisation, CO in mean local oxidizer (i.e.
f1 + f2 = 0) comes from heterogeneous reactions of char.
During pulverised coal combustion, two kinds of volatile matters are considered and the sketch of
concentrations during the three successive reactions is quite similar.
Every reaction (but, possibly the final conversion of CO to CO2 ) are supposed to be fast compared
to the turbulent mixing, but among these reactions some can be faster; here, a priority rule to access
oxygen is established (the more eager for oxygen the specy, the faster the reaction).
The first reaction is a partial dehydrogenation of the light volatile CHx1 to form the species caracteristic
of heavy volatile CHx2 : in fs1, all of CHx1 (issued from the low temperature pyrolisis reaction) is
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 91/402

converted, and the CHx2 (issued from the high temperature pyrolisis reaction) is incremented.
x1 x2 x1 x2
CHx1 + O2 CHx2 + H2 O.
4 2

O2

CHx2

CHx1

CO H2S

0 fs4 fs1
fs3 fs2 1 F1+F2

Figure II.9.7: Condensed Fuels after hydrocarbons conversion.

The oxygen and the hydrocarbon vapor have linear concentrations in f (1 + 2) on [0, 1]. As long as the
stoechiometry of the reaction is known, a simple equation allows to determine fs2 the stoechiometric
point for the second reaction (where both oxygen and hydrocarbon vanish). The second reaction is the
conversion of some hydrocarbon vapor to carbon monixide and water vapor (not plotted in an optimistic
attempt to lighten the sketch).

2 + x2 x
CHx2 + O2 CO + H2 O.
4 2

Then the rich area cant undergo any reaction (no oxygen available) if the PDF(f) is not zero before
Fs2, then some CHx is unburnt.
Some H2 S can be converted to SO2 , the carbon monoxide existing between fs2 and 1 is protected
from oxidation (the two first reactions have destroyed the free oxygen). Like previously, oxygen and
hydrogen sulphide have concentrations linear in f on [0, f s2] as long as the stoechiometry of the
reaction is known, a simple equation allows to determine f s3 the stoechiometric point for the third
reaction (where both oxygen and hydrogen sulphide vanish).
3
H2 S + O2 SO2 + H2 O.
2

If the final conversion of carbon monoxide to carbon dioxide is assumed fast (with respect to variance
dissipation) a last reaction is taken in account:
1
CO + O2 CO2 .
2
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 92/402

O2

CO CHx2

CHx1

H2S

0 fs4 fs1
fs3 fs2 1 F1+F2

Figure II.9.8: Condensed Fuels after hydrocarbons oxidation.

O2

CO CHx2

CHx1

SO2
H2S

0 fs4 fs1
fs3 fs2 1 F1+F2

Figure II.9.9: Condensed fuels after H2S oxidation.


Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 93/402

O2

CO2 CO CHx2

CHx1

SO2
H2S

0 fs4 fs1
fs3 fs2 1 F1+F2

Figure II.9.10: Condensed Fuels after final oxidation of CO.

Comparisons of the PDF rectangle hedges [fdeb , ffin ] and remarkable composition points [0, fs4 , fs3 ,
fs2 , fs1 , 1] allows a simple integration: 1) Diracs peak intensity are used to weight composition at
boundaries, 2) the piece linear part is integrated with analytical formulae on each band:

1. rich range, here existing species with the higher calorific value:
CHx (in fuel case) or CHx2 (in coal case): [max(fdeb , fs1 ); min(fend , 1)]
2. upper-middle range CHx1 conversion: [max(fdeb , fs2 ); min(fend , fs1 )]
3. middle range H2 S conversion: [max(fdeb , fs3 ); min(fend , fs2 )]
4. working range, carbon monoxide consumption frees enthalpy : [max(fdeb , fs4 ); min(fend , fs3 )]
5. poor range, only products and oxidisers: [min(fdeb , fs4 ); min(fend , fs4 )]

For each band (eg. [fsi , fsj ]) concentrations can be written :

f fsi
Ye = Ye (fsi ) + . (Ye (fsj ) Ye (fsi )) .
fsj fsi
Integration on the band [b1 , b2] (obviously b1 fsi and b2 fsj ) gives the increment:
 
Ye (fsi ). fsj Ye (fsj ). fsi Ye (fsj ) Ye (fsi ) b1 + b2
Ye := Ye + hrec (b2 b1). + . ,
fsj fsi fsj fsi 2
where hrec is the height of the PDFs rectangle.

9.4.3 Specification of pyrolysis


Coal is currently known by its proximate and ultimate analysis. Ultimate analysis of char can be
known or assumed pure carbone. The point is to determine the amount of volatile matter and their
composition; the following assumptions are every time done:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 94/402

1. sulphur is released as hydrogen sulphide (H2 S),


2. nitrogen is released both in HCN and N H3 , with a ratio which is an users prescription

Three ways are available:

1. The volatile matter content determined during the proximate analysis is supposed to be rep-
resentative of Y1 selectivity in volatile of the first reaction (Kobayashi description involves two
parallel reactions, the first has a low activation energy and produces ligth volatile matter, the
second one has a high activation energy and produces heavy volatile matter). Oxygen is released
as carbon monoxide. No water steam (linked water) among volatile matter. So the formulae for
the mean hydrocarbon is determined as x1 in CHx1 . The heavy, unsaturated, volatile issued
from the second reaction are caracterised by x2 as an half of x1; with the same assumption for
oxygen, Y2 can be computed. User has to check for x1 and x2 likelihood (between 1 and 4).

2. When the proximate analysis is not known, x1 is assumed to be equal to four (methane is a fairly
good model for light volatiles) and x2 is assumed to be equal to 2 (ethylene and other species
with double bound are good models for unsaturated species), then selectivites Y1 and Y2 can be
deduced . . . and checked (under one).
3. Large amount of oxygen appears in the ultimate analysis of biomass and low rank coal (lignite
or peat) then linked or bounded water is released during pyrolisis (a chemical mechanism taking
place at higher temperature than the physical drying which releases the free water). In this
case, an extra parameter have to be determined (number of water molecules released during
pyrolisis), so the user may stipulate both x (in the formulae for hydrocarbon CHx , as previously
4 and 2 respectively) and Y (the selectivity in volatile matter, the proximate analysis set Y1 and
Y2 is assumed from empirical criterion, e.g. (1 + Y1 )/2).

Detail of computation: From ultimate analysis of coal (or heavy fuel oil) and char (if ultimate
analysis of char is lacking, the pure carbon assumption is welcome), global formulae for the monomer
(refering to one carbon, so ch...cs and kh...ks are easy to compute) can be deducted. Then, the reaction
(pyrolisis and / or evaporation) transforming the original fuel in a mixture of gaseous ones and residual
char can be summarized as:

CHch Oco Ncn Scs a.CHx + b.CO + c.H2 O + d.H2 S + e.HCN + f.N H3
+(1 a b e).CHkh Oko Nkn Sks .

The stoechiometric coefficient for char monomer beeing deducted from Carbon conservation, five equa-
tion can be written: four for the conservation of elements (H, O, N , S) and one defines the gas
selectivity.

Hydrogen budget ch = a.x + 2.c + 2.d + e + 3.f + (1 a b e).kh,


Oxygen budget co = b + c + (1 a b e).ko,
Nitrogen budget cn = e + f + (1 a b e).kn,
Sulphur budget cs = d + (1 a b e).ks,
mass ratio of gases or selectivity
a.(12 + x) + b.28 + c.18 + d.34 + e.27 + f.17 = Y.(12 + ch + 16.co + 14.cn + 32.cs).

But, eight unknown are involved (a, b, c, d, e, f , x, Y ), so three extra conditions are needed to solve
the linear system (if ax is considered as an auxiliary unknown instead of x):

1. User assumes the repartition between nitrogenated species by fixing reference numbers ei and fi.
The equation ei.f fi .e = 0 can be added to the system.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 95/402

2. if the proximate analysis can be used to determine the ratio of gases issued from an high rank
coal or fuel, Y is know and c (number of water molecules issued from decomposition) can be
assumed nil. Equations Y = Yi and c = 0 are added.
3. without relevant information about the selectivity, assumption have to be done on x (is the
released hydrocarbon saturated or not?), and c can be again assumed nil. Equations a.xi ax = 0
and c = 0 are added.
4. oxygenated fuels (biomass, lignin) contains bounded water to be released during pyrolisis, so
proximate analysis (for Y ) and assumption about the kind of hydrocarbon (for x) are needed.
Equations a.xi ax = 0 and Y = Yi are added.

Then a 8 times 8 linear system is defined and can be solved by regular algorithm.

9.4.4 Specification of granulometry


User has to choose the initial diameter of different classes and the sharing out of the inlet flow. The
distribution is often known by some diameters (quantile or sieves) from which parameters of an assumed
Rossin-Ramler law can be fitted (least squares). Then choosing the number of classes and flow partition
allows computation of the initial diameter of each class. Obviously, the finest particles or droplets are
responsible for the ignition and stability of the flamme and the biggest ones are responsible for unburnt
carbon in ash. So two common descritions are ten classes, each of them with a tenth of the flow, or
five classes with (0.1 , 0.2 , 0.4 , 0.2 , 0.1) of the flow. The second way is nearly two times cheaper (in
computer time) but includes the same extreme diameters.
By definition of the Rossin-Ramler law as used in granulometry, the mass fraction associated with
particles finer than a diameter obeys:
di n
 
P (di ) = 1 exp ,
Dm
where, surprinsgly, n is not an integer (but a real) and Dm is the median diameter. When only
two data are available (pass through two sieves, extreme deciles or quartiles) the determination of
Rossin-Ramler law parameters is direct:
d1 n
 
P (d1 ) = 1 exp , (II.9.30)
Dm
d2 n
 
P (d2 ) = 1 exp . (II.9.31)
Dm
The logarithm forms of (Eqs. II.9.30-II.9.31) are the following expressions:
 n
d1
= log(1 P1 ), (II.9.32)
Dm
 n
d2
= log(1 P2 ). (II.9.33)
Dm
The logarithm forms of (Eqs. II.9.32-II.9.33) are:

n. [ log(d1 ) log(Dm ) ] = log[ log(1 P1 ) ], (II.9.34)


n. [ log(d2 ) log(Dm ) ] = log[ log(1 P2 ) ]. (II.9.35)

Using the expressions (Eqs. II.9.34-II.9.35) we obtain:


 
log(1 P1 )
log
log(1 P2 )
n =   (II.9.36)
d1
log
d2
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 96/402

and Dm is easily deduced.


When more data are available, the second logarithm relation gives a cloud of couple (log(di ) , log[
log(1 Pi ) ] ) among which a linear fit is looked for (n, n. log(Dm )):

n. log(di ) [ n. log(Dm ) ] = log[ log(1 Pi ) ], (II.9.37)


a.xi + b = yi .

Least square formulae are then used ... after a data transformation (two logarithm) relevant for the
distance.
XN N
X N
X
N xi .yi xi . yi
i=1 i=1 i=1
a= !2 , (II.9.38)
N
X N
X
N x2i xi
i=1 i=1

where N is the number of data.


N
X N
X N
X
N log[di ]. log[ log(1 Pi ) ] log(di ). log[ log(1 Pi ) ]
i=1 i=1 i=1
n = !2 ,
N
X N
X
N log(di )2 log(di )
i=1 i=1
N
X N
X N
X N
X
yi . x2i xi . xi .yi
i=1 i=1 i=1 i=1
b = !2 ,
N
X N
X
N x2i xi
i=1 i=1
N
X N
X N
X N
X
log[ log(1 Pi ) ]. log(di )2 log(di ). log(di ). log[ log(1 Pi ) ]
i=1 i=1 i=1 i=1
n. log(Dm ) = !2 .
N
X N
X
N log(di )2 log(di )
i=1 i=1

After this laborious identification of parameters (done using Excel), the determination of the mean
diameter of each mass class is obtained from the definition of the rossin-Ramler law:

di = Dm [ log(1 Pi )]( n ) .
1
(II.9.39)

As an example, if the user chooses the (recommended) sharing out [0.1, 0.2, 0.4, 0.2, 0.1], the corre-
sponding diameter are deduced from the mean cumulated mass as:

0.1
d1 = Dm [ log(0.95) ]( n ) ,
1
1 = 0.1 ; 1 = 0.1 ; 1 M CM1 = 1 = 0.95
2
0.1 + 0.3
d2 = Dm [ log(0.80) ]( n ) ,
1
2 = 0.2 ; 2 = 0.3 ; 1 M CM2 = 1 = 0.80
2
0.3 + 0.7
d3 = Dm [ log(0.50) ]( n ) ,
1
3 = 0.4 ; 3 = 0.7 ; 1 M CM3 = 1 = 0.50
2
0.7 + 0.9
d4 = Dm [ log(0.20) ]( n ) ,
1
4 = 0.2 ; 4 = 0.9 ; 1 M CM4 = 1 = 0.20
2
0.9 + 1.0
d5 = Dm [ log(0.05) ]( n ) .
1
5 = 0.1 ; 5 = 1.0 ; 1 M CM5 = 1 = 0.05
2
With such a symetrical mass distribution, the diameter of the central class is the median diameter of
the Rossin-Ramler (i.e. half of the mass is contained in more tiny particles).
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 97/402

9.4.5 Special attention paid to variance


With the gaz phase combustion model, everything is quite simple: two variables are relevant, the mean
and the variance of the mixture fraction. With the two phase combustion model, a lot of mixture
fractions are defined and the pdf model is constructed for the sum of the two mixture fractions related
with volatiles. So the source term related with the square of the gradient of the mean cant be computed
as for regular variance (the gradcel subroutine is called for the sum).
In Code Saturne homogeneous two phase flow, only one velocity is defined, and all variables refer to
the bulk (sum of gaseous and condensed phase), but the pdf has to be defined only in the gas phase.
So phasic mean and variance have to be defined, with the special difficulties of variables undefined in
the condensed phase (fi is a mixture fraction in gas on mixture: kg coming from i/kg of mixture):

f
fe = X1 .f + X2 .0 f = , (II.9.40)
1 X2
fe2
fe2 = X1 . f 2 + f 002 + X2 .0 f 2 + f 002 =

, (II.9.41)
1 X2
!2
fe2 f
f 002 = , (II.9.42)
1 X2 1 X2
!2
(f)2 + fe002 f
f 002 = , (II.9.43)
1 X2 1 X2
fe002 X2 .(f)2
f 002 = , (II.9.44)
1 X2 (1 X2 )2
X2 2
fe002 .(f )
X1
f 002 = . (II.9.45)
X1
Only this phasic variance (the part of the variance in the gas phase) is able to dissipate: so, the second
part of the source term for variance has to be modified.
Last but not least, mass flux crossing the interface (pyrolisis fluxes) are made of pure volatile matter
and mixes with a gas at any value of mixture fraction mean. So the interfacial flux constitutes a source
term for the mean and for the variance, following Escaich [Esc11], the closure would be:
   
S.f
002 = . fcl f . 2.f fcl f , (II.9.46)

in which, is the mass flux, f is the value of the mixture fraction in the flux (1 for pyrolisis or
fuel evaporation), fcl is the value of the mixture fraction in the boundary layer ... to be closed by
a relevant assumption: from laminar or turbulent diffusion (to do in coal variance source term or
fuel variance source term, not available for regular users).
With an assumption of laminar diffusion around each particle able to transport the mass flux:
 

fcl = 1 (1 f) exp .
2Dd

When mass flux is huge, the diffusion cant stay regular around each inclusion: if the variance is
maximal (intermittency assumption), the boundary layer cant be no more distinguished from the
mean, if the variance vanish, the boundary layer is quiet and made of outing gases:
00
fe 2
fcl = f + (f f ) .
f.(1 f)

This special assumption allows a term source for variance easy to implicit in order to avoid overshoot
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 98/402

(the variance have a maximal value related to the mean):


" #2
 2 e00 2
f
Se0 02 = . f f 1 .
f (1 f)

9.4.6 Nitrogen oxides (N Ox)


Nitrogen oxides are a key pollutant, an accurate prediction is difficult but the relative effect of modi-
fication (of fuel, of stagging, and so on) is a reachable goal. Hereafter, the two main ways of nitrogen
oxides formation are supposed to be thermal N Ox (reaction between molecular nitrogen and radical
oxygen activated at the higher temperature) and fuel NOx (resulting from the oxidation of nitrogen
originating from fuel) are described and taken in account in the Code Saturne model for diphasic
combustion. The third way, resulting of reaction between the molecular nitrogen and hydrocarbon
radicals is assumed negligible in diphasic combustion; its contribution is worthy of attention only for
gas combustion (especially in dry low N Ox combustor for gas turbine).

Thermal N Ox

In the Zeldovich mechanism, the rate of the key reaction, between molecular nitrogen and radical
oxygen, has a simple expression thanks to an assumption of equilibrium applied on oxygen dissociation,
leading to:

N2 + O2 2 N O,
 
66 900 1/2
W 1N O = 3.4 1012 . exp . [N2 ] . [O2 ] .
RT

This production term has to be evaluated in each fluid particle because it is not only non linear
(with respect to mixture fraction) but submitted to segregation: the hottest particles are near the
stoechiometric point ... where oxygen is exhausted (and vice versa). As a consequence, simplest
approximations, neglecting covariances, are not satisfaying:
  h i h i
E 1/2
f1N O 6= k0 . exp
W . N
e2 . O
e2 .

RT
Taking in account only the mean temperature, the contribution of hotest fuilds particles disappears
and nitrogen oxide formation is under estimated.
The source term for thermal NOx has to be integrated following the example of others turbulents
variables (like species mass fractions). In the turbulent oxydation model, mass fraction of species are
known linear piecewise functions, the oxygen fraction is positive only between the mean local oxidizer
and fs3 the stoechiometric point for the last reaction (H2 S conversion), the post conversion of carbon
monoxide to carbon dioxide is assumed to result from a relaxation to the thermodynamical equilibrium
computed with mean values. The stoechiometric point corresponding to this last reaction is no more
necessary to the turbulent computation but for temperature evaluation: as, by now, the mean local
oxidiser includes some carbon monoxide (originating from heterogeneous reactions involving char), it
cant be no more supposed unreactive, assuming a linear profile for oxygen, and carbon monoxide,
between the local mean oxidiser and the point where hydrocarbon oxidation is finished, the mass
fraction in the local mean oxidizer are auxilliary unknowns the value of which is determinated by
equalizing the transported value for the carbon monoxide (which involves the effect of relaxation to
equilibrium) and its integrated value (taking in account the local pdf).
Assuming the entalpy piecewise linear with the enthalpy in f s4 considered as an auxilliairy unknown,
which can be determined by equalizing the integrated enthalpy and the transported one (the tranport
equation of which includes radiation losses), then the temperature piecewiselinear with respect to
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 99/402

h(adiab ) CHx
CO
Effect of
O2 h radiation
losses
relaxation to
COCO2 equilibrium

0 fs4 fs3 1

Figure II.9.11: Mass fractions of reactive species, turbulent reaction then kinetical relaxation, enthalpy
with radiation losses.

the mixture fraction, the numerical integration of the source term is now available, using a regular
trapezium method with 200 points (between the pdfs rectangle begining and the minimum of f s3 and
pdfs rectangle end).

Fuel NOx
The nitrogen included in the organic part of the fuel (can be a significant part of some biomass, like
agricultural residues, oil cake and so on) evolves to HCN . This reducing form of nitrogen can be
oxydised either by oxygen or by nitrogen oxide:

5 1
HCN + O2 NO + H2 O + CO,
4 2  
12 30 000 b
W 2N O = 3 10 exp . [HCN ] . [O2 ] ,
RT

with:




1 if [O2 ] < 0.0025,

0.018 [O2 ]

b= if 0.0025 < [O2 ] < 0.018,


0.018 0.0025


0 if 0.018 < [O2 ] .

In the last case, N O is reduced to nitrogen: the fuel nitrogen contributes to destroy even thermal NO.
1 1
HCN + N O + O2 N2 + H2 O + CO,
4 2  
10 33 500
W 3N O = 1.2 10 . exp . [HCN ] . [N O] .
RT
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 100/402

9.4.7 Conservation Equations for two phase flow combustion


The bulk, made of gases and particles, is assumed to be modeled with only one pressure and velocity.
The slipping velocitiy between particles and gases is supposed negligible compared to this mean velocity,
that is to say that the velocity of the continuous phase (gas phase) u1 and the velocities of the particle
classes u2, i are equal to the bulk velocity um . Scalars for the bulk are:

Bulk density
m = 1 1 + 2 2 . (II.9.47)

Bulk velocity
Nclasses
X
1 1 u1 + 2, i 2 u2, i
i=1
um = . (II.9.48)
m

Bulk enthalpy
Nclasses
X
1 1 .H1 + 2, i 2 .H2, i
i=1
Hm = . (II.9.49)
m

Bulk pressure
Pm = P1 . (II.9.50)

Mass fractions of gaseous medium (Y1 ) and of particles are defined by:
1 1
Y1 = ,
m
Nclasses
X
2, i 2
i=1
Y2 = .
m

So budget equations for the bulk can be written as following: (II.9.51-II.9.53):


m + div (m um ) = 0, (II.9.51)
t  
D 2 2
(m um ) + div (um m um ) = div T um + uTm qm 1 Pm + m g,
(II.9.52)
t 3

(m Hm ) + div (m um Hm ) = div (T Hm ) + Sm,R , (II.9.53)
t
T
where the tubulent dynamic viscosity of the bulk is T = m Dm .
With the (velocity) homogeneity assumption, mainly budget equation for bulk caracteristic are perti-
nent. So transport equation for the scalar k , where k is the phase, can be written:


(m Yk k ) + div (m um Yk k ) = div (T (Yk k )) + Sk + k . (II.9.54)
t
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 101/402

Bulk enthalpy: Hm
Budget equation for the specific enthalpy of the mixture (gas + particles) admits only one source term
for radiative effects Sm,r :
Sm,r = S1,r + S2,r , (II.9.55)
with contributions of each phase liable to be described by different models (e.g. wide band for gases,
black body for particles).

Particles enthalpy: Y2 H2
Enthalpy of droplets (J in particles/kg bulk) is the product of solid phase mass fraction (kg liq/kg
bulk) by the specific enthalpy of solid (kg solid/kg bulk). So the budget equation for liquid enthalpy
has six source terms :
0
2 + S2,r evap HH2 O, vap (T2 ) devol1 HMV1 (T2 ) devol2 HMV2 (T2 )
 
MO MCO
+ het HO2 (T1 ) HCO (T2 ) ,
MC MC

with
0
2 : heat flux between phases,
S2,r : radiative source term for droplets,
evap HH2 O, vap (T2 ) the vapor flux leaves at particle temperature (Hvap includes latent heat),
dvol1 HMV1 (T2 ) the light volatile matter flux leaves at particle temperature (Hvap includes
latent heat),
dvol2 HMV2 (T2 ) the heavy volatile matter flux leaves at particle temperature (Hvap includes
latent heat),
het (...) heterogenous combustion induces reciprocal mass flux: oxygen arriving at gas tempera-
ture and carbon monoxide leaving at char particle one.

Dispersed phase mass fraction: Y2

In budget equation for the mass fraction of the dispersed phase (first droplets, then char particles, at
last ashes) the source terms are interfacial mass fluxes (first evaporation, then net flux for heterogeneous
combustion):

evap het gas, H2 O gas, CO2 . (II.9.56)


The fuel is described by only one amount (for each diameter class) under a percentile of the initial
mass (or diameter), the droplet is supposed to become a char particle. Under a more little diameter
the particle is supposed to become an ash particle (inert).

pyrol1 pyrol2 het gas, H2 O gas, CO2 . (II.9.57)


The coal or biomass particles are described by three mass component: water (free: available for drying),
reactive coal (available for pyrolisis), char (available for heterogeneous oxidation and gasification). The
mass of ash is computed with respect to the number of particles, initial size and initial amount of ashes.
The sum of these four component is the amount of each class (initial diameter and kind of coal).
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 102/402

Number of particles: Np
No source term in the budget equation for number of droplets or solid particles: a droplet became a
particle (eventually a tiny flying ash) but never vanish (all particles have to get out).

Mean of the passive scalar for light volatile: F1


This scalar represents the amount of matter released by the first (low activation energy) pyrolisis
reaction. It is a mass fraction of gaseous matter (in hydrocarbon form or carbon oxide one). So the
source term in its budget is only the pyrolisis mass flux:

pyrol . (II.9.58)

Mean of the passive scalar for heavy volatile: F2


This scalar represents the amount of matter which has leaved the droplet as fuel vapour or the particle
by the second (high activation energy reaction), whatever it happens after. Its a mass fraction of
gaseous matter (in hydrocarbon form or carbon oxide ones). So the source term in its budget is only
evaporation or pyrolisis mass flux:
pyrol1 or evap . (II.9.59)

Mean of the passive scalar for oxidizers: F3 to F5


Budget equation for the three different oxidizers taken in account dont have any source term.

Mean of the passive scalar for steam from drying: F6


Budget equation for the water steam issued from drying of coal or biomass has one source term:

dry . (II.9.60)

Mean of the passive scalar for carbon from char oxidation: F7

Budget equation for F7 hase for source term the mass flux due to heterogeneous combustion (mass
flux of carbon monoxide minus oxygene mass flux). As for F1 , oxidation in the gaseous phase does not
modifiy this passive scalar:

het . (II.9.61)

Mean of the passive scalar for gasification by the carbon dioxide: F8

Budget equation for F8 has for source term the mass flux due to heterogeneous combustion (mass flux
of carbon monoxide minus oxygene mass flux). As for F1 , oxidation in the gaseous phase does not
modifiy this passive scalar:

gas, CO2 . (II.9.62)

Mean of the passive scalar for gasification by steam: F9

Budget equation for F9 have for one source term the mass flux due to heterogeneous combustion (mass
flux of carbon monoxide minus oxygene mass flux). As for F1 , oxidation in the gaseous phase does not
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 103/402

modifiy this passive scalar:

gas, H2 O . (II.9.63)

Droplets enthalpy: Y2 H2
Enthalpy of droplets (J in droplets/kg bulk) is the product of liquid phase mass fraction (kg liq/kg
bulk) by the specific enthalpy of liquid (kg liq/kg bulk). So the budget equation for liquid enthalpy
has four source terms:
 
0 MO M
2 + S2,r evap Hvap (T2 ) + het HO2 (T1 ) CO HCO (T2 ) (II.9.64)
MC MC

with
0
2 : heat flux between phases
S2,r : radiative source term for droplets
evap Hvap (T2 ) the vapor flux leaves at droplet temperature (Hvap includes latent heat)

het (...) heterogenous combustion induces reciprocal mass flux: oxygen arriving at gas temper-
ature and carbone monoxide leaving at char particle one.

Dispersed phase mass fraction: Y2


In budget equation for the mass fraction of the dispersed phase (first droplets, then char particles, at
last ashes) the source terms are interfacial mass fluxes (first evaporation, then net flux for heterogeneous
combustion):

evap het . (II.9.65)


Chapter 10

Groundwater flows
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 105/402

10.1 Introduction
The Hydrogeology module of Code Saturne is a numerical model for water flow and solute transport in
continuous porous media, based on the Darcy law for flow calculation, and on the classical convection-
diffusion equation for transport. It allows to simulate steady or unsteady flows, saturated or not,
with scalar or tensorial permeabilities, and transport with dispersion, sorption and radioactive decay.
Any law, even unlinear, is acceptable for dependances between moisture content, permeability and
hydraulic head.
For the solving of the flow, the Richards equation is used, derived from the Darcy law and the con-
servation of mass. In the general case, this equation is non-linear and must be solved by a Newton
scheme.
From this flow, the transport equation is solved, taking into account convection and diffusion, both
slightly modified due to the specificities of underground transport.
Physical concepts and equations developed in this module are detailed hereafter.

10.2 Groundwater flows


10.2.1 Continuity Equation
The expression of the mass conservation for the water contained in a volume of the subsurface,
delimited by a surface boundary , can be written:
Z Z Z

d + u dS = Qs d (II.10.1)
t
with:

is the moisture content (also called saturation) [L3 .L3 ];


is the density of water [M.L3 ];
u is the water velocity [L.T 1 ];
Qs is a volumetric source term [L3 .T 1 ].

By assuming a constant density of water and using Gauss theorem, the equation simplifies to the
following local expression:

+ div q = Qs (II.10.2)
t
As seen in section 10.3, the moisture content can be determined from the pressure head.

10.2.2 Darcy Law


The momentum conservation equation in a continuous porous medium is expressed through Darcy law,
an empirical relationship which shows the proportionality between the velocity of the water u and the
gradient of the soil water potential. This means that motion of water in a porous medium is due to
both the gradient of water pressure and gravity. The following equation describes the pressure head
h, which is equivalent to the water pressure but expressed in a length unit [L]:
p
h= + A, (II.10.3)
g
with A a constant such that h = 0 at the atmospheric pressure, as a convention. We also introduce
the hydraulic head H:
H = h + z. (II.10.4)
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 106/402

Darcy law was initially established for mono-dimensional flows in saturated isotropic conditions. It
binds darcian velocity q, which is the product of the real flow velocity u and the moisture content of the
medium, to the gradient of hydraulic head. To represent anisotropic conditions and multidimensional
flows, it has to be extended to a tensorial relationship:

q = u = KH = K(h + z) (II.10.5)

where K can be scalar or tensoriel. It is called hydraulic conductivity. By abuse of langage, we also call
it permeability, but in a rigorous sense the hydraulic conductivity is deduced from the permeability of
the soil and the properties of the water. It varies in unsaturated conditions, and depends on the nature
of the soil and the pressure head h (see section 10.3). Notice that the constant A has no importance
in the Darcy equation, neither in the following of the development.

10.2.3 Richards equation


Richards equation is obtained by substitution of the velocity expression given in equation (II.10.5)
directly into the continuity equation II.10.2:

(h)
= div (K(h)H) + Qs (II.10.6)
t

10.3 Soil-water relationships


To close Richards equation, two extra relationships have to be given to link the hydraulic conductivity
and the moisture content to the pressure head. The relationship between the moisture content and the
pressure head is usually derived from the soil water retention curve, which is determined experimentally.
The Hydrogeology module permits to define any model of that kind. In the following we denote s
the porosity of the soil and r the residual moisture content, which is fraction of water that cannot be
removed from the soil.
In saturated conditions, we have = s everywhere, thus only depends on the nature of the soil. As
for the permeability, it usually does not depend on the pressure head in this case, and is also constant
for a given soil.
In unsaturated conditions, the laws used to analytically derive soil hydraulic properties are usually
highly non-linear. The Richards equation is thus a non-linear second order partial differential equation
in unsaturated conditions. The method chosen to solve it involves an iterative process used to linearise
the equation as described in section 10.4. Let us give the example of the Van Genuchten model with
Mualem condition, wich is the most commonly used:
n m
(
r [1 + |h| ] if h < 0
Se = = (II.10.7)
s r 1 if h 0

with n and m two constant parameters.


  m 2
1/m
K0 SeL 1 1 Se if h < 0

K= (II.10.8)
K
0 if h 0

with K0 a constant not depending on the moisture content. Notice that if h > 0, then we have a
saturated soil. That is because we chose, as a convention (and as explained in section 10.2.2), to define
the pressure head such that it vanishes at the atmospheric pressure. When the soil is saturated, the
permeability is equal to K0 , depending only on the soil.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 107/402

10.4 Solving of the Richards equation


In the general case, the laws connecting the hydraulic properties are non-linear. We will have to
implement an iterative process for solving the Richards equation. First, we define the soil capacity C:

C(h) = , (II.10.9)
h
which can be derived from the soil law linking and h. A classical way to solve Richards equation
(II.10.6) is to first transform it with the approximation:

h
' C(h) , (II.10.10)
t t
so that it becomes:
h
' div (K(h) (h + z)) + Qs ,
C(h) (II.10.11)
t
this last formulation being called the h-based formulation. The equation (II.10.11) can be written
(recalling that H = h + z):

H
C(H z) ' div (K(H z)(H)) + Qs , (II.10.12)
t
and then discretized in time:
H n+1 H n
C(H n z) ' div K(H n+1 z)(H n+1 ) + Qs .

(II.10.13)
t
The complete implicitation of the right hand term is made for ensuring stability. The explicitation of
the capacity C is chosen after testing different options and noticing that implicitation does not improve
the results. We will now linearize the equation (II.10.13) and define sub-iterations to solve it. Suppose
that we seek unknown variable H n+1 at the sub-iteration k + 1 from its value at sub-iteration k. We
write:
H n+1, k+1
Hn
C(H n z) ' div K(H n+1, k
z) (H n+1, k+1

) + Qs . (II.10.14)
t
The equation (II.10.14), whose unknown is H n+1,k+1 , is a transport equation without convection,
which can be solved by the usual routines of Code Saturne.
But the approximation (II.10.10) does not ensure a rigorous conservation of mass after discretization,
because we do not have:
hn+1 hn (hn+1 ) (hn )
C(hn ) = .
t t
Anyway, it is still possible to define the exact residual:

hn+1 hn (hn+1 ) (hn )


R(hn , hn+1 ) = C(hn ) (II.10.15)
t t
and to mix it into the discretized and linearized formulation (II.10.14) at the sub-iteration k, to obtain:

H n+1, k+1
Hn
C(H n z) '
t
div K(H n+1, k
z)(H n+1, k+1
) + Qs + R(H n z, H n+1, k

z). (II.10.16)

As equation (II.10.14), this can be solved by the usual routines of Code Saturne. Then the sub-
iterations, if they converge, lead to the exact solution of:

(hn+1 ) (hn )  D


= div K(hn+1 )(H n+1 ) + Qs , (II.10.17)
t
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 108/402

where exponent D represents the spatial discretization of gradient - divergent operator in Code Saturne.
This discrete operator is rigorously conservative, thus the global volume of water:
Z
d,
D

where D denotes the entire domain, is conserved in a discrete sense (provided that there is no physical
loss at the boundaries).

10.4.1 Finite Volume method in Code Saturne for the operator-diffusive


terms
In Code Saturne, the integral on a cell of the term div (KY ) is discretized this way:
Z X
div (KY ) d ' Kf f Y S f , (II.10.18)
f Fi

where Fi is the set of the faces of cell i. For each face f , Kf is the face diffusivity (calculated from
the diffusivities at centers of the adjacent cells, with an harmonic or arithmetic mean), f Y is the
gradient of Y at the face center, and S f is a vector normal to the face, whose size is the surface of the
face, directed towards the outside of the cell . There are two ways of calculating the term f Y S f :
a simple one (i.e. without reconstruction) and an accuracy one (i.e. with reconstruction). In the
general case, two adjacent cells of Code Saturne can be represented like in the picture below, where two
cells i and j are separated by a face denoted fij : The variables are known at centers of the cells, i.e.
at points I and J. But to get a rigorous estimation of the normal gradient at the center of the face
fij , we need values at points I 0 and J 0 :
YJ 0 YI 0
fij Y S ij = . (II.10.19)
I 0J 0
The face gradient without reconstruction is calculated by the approximation:
YJ YI
fij Y S ij = . (II.10.20)
I 0J 0
The less the vector IJ is orthogonal to the face fij , the more this approximation is wrong. But it has
the advantage to be easy and quick to deduce from the variables at cell centers, with a linear relation,
and to depend only on the variables of the adjacent cells. The face gradient with reconstruction is
calculated following the relation (II.10.19), thanks to the relations:

YI 0 = YI + YI II 0 . (II.10.21)

YJ 0 = YJ + YJ JJ 0 . (II.10.22)
Thus, the calculation of the face gradient with reconstruction requires a calculation of the gradients
of Y at cell centers, which can be done by several methods. Depending on the choosen method, the
relation between the values of Y at cell centers and the gradient at cell centers can be nonlinear and
require a large stencil of cells. We will see in section 10.4.2 how the laplacian is solved in Code Saturne,
in order to get the solution with the accurate definition of the face gradients but to keep the simple
definition for matrix inversions.

10.4.2 Solving of the linear sub-iteration in Code Saturne


The sub-iteration (II.10.16) can be rewritten:

fs H div (H ) = QH , (II.10.23)

where:
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 109/402

H = H n+1, k+1
H n+1, k
is the unknown;
C(H n z)
fs = t , not depending on the unknown;
= K(H n+1, k z) is the diffusion coefficient, tensorial if the permeability is tensorial. It does
not depend on the unknown;

QH is the second member, not depending on the unknown.

We have:

QH = Qs + R(H n z, H n+1, k
z) div K(H n+1, k
z) (H n+1, k ) .

(II.10.24)

Now, let us denote En the following operator, that applies on any discrete field x:
D
En (x) = fs x [div (x)] , (II.10.25)

where exponent D represents the spatial discretization of gradient - divergent operator in Code Saturne.
This operator is linear but, when using the reconstruction of the non-orthogonalities, it is difficult to
invert (see section 10.4.1). Thus, we also define EMn , that is the equivalent of En but without taking
into account the reconstruction of non-orthogonalities. Now, we write the discretisation of the equation
(II.10.23) in the form:
En (x) = QH , (II.10.26)
where x is the unknown. In order to solve it, we define the sequence (xm )mN that is calculated
following these iterations:

EMn (xm+1 ) = En (xm ) + QH ;

xm+1 = xm + xm+1 ;
x0 = initial guess.

With that method, we only invert the simple matrix EMn . If the iterations converge, we get the
solution of (II.10.26) with an arbitrary precision, and with a precise definition of the discrete diffu-
sive operator. This is the standard way of dealing with the diffusion problem in Code Saturne. See
documentation on routine codits, for example, for further details.

10.4.3 Determination of the velocity field


Theoretically, the darcy velocity field q of the flow just has to be calculated from the pressure head
field, thanks to the Darcy relation (II.10.5). This can be done with the routine of Code Saturne that
calculates the gradient of a variable at cell centers from the values of this variable at cell centers.
However, this simple way of getting the velocity field is only used for posttreatment purpose, and not
used in the transport equation, for the reasons given below.

In Code Saturne, the integral on a cell of the convection term div Y q , where q is a velocity field
and Y a transported variable, is discretized this way:
Z X

div Y q d ' Yf q f S f , (II.10.27)
f Fi

where Fi is the set of faces for cell i. For each face f , Yf is the value of Y at the center of face Fi
(calculated from the values of Y at centers of the adjacent cells, with an arithmetic mean), q f is the
velocity at face center, and S f is a vector normal to the face, whose size is the surface of the face,
directed towards the outside of the cell . Thus the term q f S f is the mass flux at face center.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 110/402

These mass fluxes at face centers could be deducted from the velocity values at cell centers, but
this method would not ensure the exact coherence of these mass fluxes with the continuity equation
(II.10.2). To ensure this coherence, let us write the discrete contnuity equation:
n+1 n  D
+ div q = Qs , (II.10.28)
t
where exponent D corresponds to the discrete operator for convection, described above. Mixing the
discrete Richards equation (II.10.17) and the discrete continuity equation (II.10.28), we want to have:
D  D
div K(hn+1 )(H n+1 )

= div q . (II.10.29)
Exponent D still represents discretisation of operators. Taking into account equation (II.10.18) and
equation (II.10.27), this leads for each face f of the domain to:
K(hn+1 )f f H n+1 S f = q f S f . (II.10.30)

This gives the good value for q f S f , available from the solving of Richards equation.

So, for the purpose of discrete coherence between flow and transport equations (which is important
for the precision of the computation and coherence of the results), we deduct the mass fluxes used in
the transport equation from the normal gradients of the pressure head H calculated in the solving of
Richards equation, instead of deducting them from the velocity values at cell centers.

10.4.4 Convergence criterion


Two choices are available for the convergence criterion of the loop over sub-iterations k (from section
10.4). The first possibility is to continue the loop until two successive pressure head fields are close
enough, i.e.
khn+1, k+1 hn+1, k kL2 ,
where the value of  is given by the user. The second possibility is to impose such a condition on the
velocity field of the flow, i.e.
kun+1,
x
k+1
un+1,
x
k L2
k + kun+1,
y
k+1
un+1,
y
k L2
k + kun+1,
z
k+1
un+1,
z
k L2
k ,
where we denoted ux , uy and uz the components of u over the three spatial directions. This last
choice imposes to calculate the velocity field at the end of each sub-iteration. Both of these options
are available in the module.

10.4.5 Cases without gravity


If we dont want to take into account the gravity, then the Darcy law writes:
u = Kh, (II.10.31)
and the Richards equation becomes:
(h)
= div (K(h) (h)) + Qs , (II.10.32)
t
which is solved exactly the same way, except that the solved variable is h instead of H. The user of the
module must be careful to adapt the initial conditions, boundary conditions and soil-laws accordingly.

10.5 Groundwater Transferts


10.5.1 Introduction
The transport of a contaminant in variably saturated porous media is treated by the Hydrogeology
module, based on the transport solver already present in Code Saturne, with few specific developments.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 111/402

10.5.2 Advection/dispersion/diffusion/decay equation


We assume hereafter that the contaminant only exists in the liquid phase and is potentially sorbed
on the solid matrix. We also assume that the transport phenomena in the liquid phase are advection,
kinematic dispersion and molecular diffusion. The classical transport equation in variably saturated
flow is:
(Rc) c q c
= (Dij ) i + Qs cr Rc (II.10.33)
t xj xi xi
where:

R is the delay factor, representing sorption phenomena [-];


is the moisture content [L3 .L3 ];
c is the contaminant concentration in the liquid phase [M.L3 ];
q refers to the darcian velocity, which is a result of the solving of the Richards equation (see
section 10.4.3) [L.T 1 ];
is a first-order decay coefficient [M.L3 .T 1 ];
Qs refers to the volumetric flow source/sink, from the Richards equation (II.10.6) [M 3 .T 1 ];
cr is the source/sink concentration [M.L3 ];
Dij is the dispersion tensor. It contains both the kinematic dispersion and the molecular diffusion
[L2 .T 1 ].

We note the following differences with the standard formulation of the transport equation in Code Saturne:

the presence of the delay factor R and the moisture content in the unsteady term;
the tensorial diffusivity Dij .

The delay factor R is given by:


kd
R=1+ (II.10.34)

is the moisture content [L3 .L3 ];


is the bulk density [M.L3 ]
Kd is the contaminant distribution coefficient [L3 .M 1 ]

10.5.3 Kinematic dispersion


Kinematic dispersion results from the existence of a very complex and unknown velocity field which
is not taken into account for advection (the average Darcy velocity is considered instead). It results
in a kinematic dispersion tensor denoted Dk , whose main directions of anisotropy are the direction of
the flow and two directions orthogonal to the flow. This tensor can be inferred from two parameters
named longitudinal and transversal dispersion coefficients (m.s-1), denoted l and t , and from the
amplitude of the velocity darcy field. In an orthonormal frame such that the first direction is the
direction of the flow, this kinematic dispersion tensor writes:

l 0 0


Dk = | q |
0 t 0 (II.10.35)


0 0 t
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 112/402

Physically, The coefficients l and t are representative of the size of the biggest heterogeneities on
the solute path. Their determination is empirical.

10.5.4 Molecular diffusion


Molecular diffusion is due to Brownian motion of solute molecules that tends to reduce the differences
of concentration in different points of a continuous medium. It is already taken into account in the
standard transport equation of Code Saturne. In porous media, molecular diffusion occurs in the whole
fluid phase but not in the solid medium. Hence, the diffusion coefficient is, in the general case,
proportional to the moisture content . It is denoted dm .

10.5.5 Dispersion tensor


Finally, the dispersion tensor Dij is the cumulation of the kimematic dispersion tensor Dk and the
molecular diffusion scalar. In a frame independant of the flow, it can be written:
qi qj
Dij = t | q | ij + (l t ) + dm ij , (II.10.36)
|q|

where:

ij refers to the Kronecker symbol [];


l is the longitudinal dispersivity [L];
t is the transversal dispersivity [L];
dm is the water molecular diffusion [L2 .T 1 ];
q i refers to the darcian velocity in the direction i [L.T 1 ];
| q | is the norm of the darcian velocity [].

Finally, the tensor is symetric (i.e. Dij = Dji ) and can be expressed as:

q2 q2 q2
Dxx = l |q|x + t |q|y + t |q|z + dm ;

q2 q2 q2
Dyy = t |q|x + l |q|y + t |q|z + dm ;

q2 q2 q2
Dyy = t |q|x + t |q|y + l |q|z + dm ;
q q
x y
Dxy = (l t ) |q| ;
q q
Dxz = (l t ) |q| ;
x z

q q
y z
Dyz = (l t ) |q| .

10.5.6 Specificities of the groundwater transport equation in rela-


tion to the standard transport equation
The general method developed in Code Saturne for the treatment of the transport equation is kept;
just a few changes in the definition of the general matrix to invert and of the right hand side have been
done, in order to take into account the presence of the moisture content and delay in the unsteady
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 113/402

term, and to give to the user the opportunity to define a dispersion tensor. More specifically, as values
at iterations n and n + 1 of moisture content and delay are available for the transport calculation at
iteration n, we can discretize the unsteady term this way:

(Rc) Rn+1 n+1 cn+1 Rn n cn


' , (II.10.37)
t t
which ensures global discrete mass conservation of the tracer.
Chapter 11

Magneto-Hydro Dynamics

See A.
Chapter 12

Lagrangian particle tracking

See A.
Chapter 13

Cavitation modelling
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 117/402

13.1 System equations


The cavitation model is based on an homogeneous mixture model. In this model, the physical prop-
erties, the density and the dynamic viscosity , of the mixture depends on a resolved void fraction
and constant reference properties l , l for the liquid phase and v , v for the gas phase, following
the relations:
= v + (1 )l , (II.13.1)
= v + (1 )l . (II.13.2)
In this model, it is assumed that the mixture dynamic is ruled by the classical incompressible Navier
Stokes equations:

+ div (u) = 0, (II.13.3)
t

(u) + div (u u) = P + div . (II.13.4)
t
Eq. (II.13.4) corresponds to the momentum equation in Eq. (I.2.11) where the volume source terms
have been removed for brevity and 0 for the mass source term.
Using (II.13.1), the mass equation can be splitted into:
(v )
+ div (v u) = V , (II.13.5)
t
((1 )l )
+ div ((1 )l u) = V , (II.13.6)
t
with V representing the vaporization (resp. condensation) source (resp. sink) term, appearing with
an opposite sign in the liquid part of the density budget.
Using the fact that the reference densities v and l are constant, Eqs. (II.13.5) and (II.13.6) can be
easilly written in the form:
V
+ div (u) = , (II.13.7)
t v
 
1 1
div (u) = V . (II.13.8)
v l
It is seen that the mass equation of the mixture Eq. (II.13.1) has been splitted into two equations: one
simple convection equation which can be used to solve the void fraction and one equation structurally
similar to the one solved at the correction step of the predictior-corrector solver of Code Saturne (see
Appendix O). The global resolution scheme of the cavitation module is thus the following:

1. Prediction of the velocity using Eq. (II.13.4) (see Appendix N).


2. Correction of the velocity using Eq. (II.13.8) (see Appendix O).
3. Resolution of the void fraction using Eq. (II.13.7).
4. Update physcal properties of the mixture using Eqs. (II.13.1) and (II.13.2).

13.2 Vaporization source term


In the cavitation module of Code Saturne, the V source term is modeled using the Merkle model:
v (, P ) = m+ + m ,
with:
Cprod l min (P PV , 0) Cdest v max (P PV , 0)
m+ = , m = , (II.13.9)
0.5l u2 t 0.5l u2 t
and Cprod = 1000, Cdest = 50 empirical constants, t = l /u a reference time scale and PV the
reference saturation pressure. l , u and PV may be provided by the user.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 118/402

13.3 Time stepping


At each time step n, the global resolution scheme follows successively the steps 1 to 4 described above
(13.1). In this resolution scheme, the physical properties are updated at the end of the time step n.

Prediction step The procedure is almost identical to the classical one described at Appendix N.
Only the discretization of the time derivative at the l.h.s of Eq. (II.13.4) is modified in order to take into
account that the mixture density is updated at the end of the time step. In the cavitation algorithm,
the time derivative at time step n + 1 is discretized by:

en+1 n1 un
n u
(u) ' ,
t tn

en+1 the predicted velocity at time step n + 1.


with u

Correction step With the Merkle model described above (13.2), the correction step equation of
the cavitation model writes:
 n 
t
div P = div (e
u) V (, P ).

In this equation, the pressure in the cavitation source term is taken implicit while the void fraction is
explicit:  n   
t 1 1
div (P )n+1 = div (e un+1 ) V (n , P n+1 ) .
v l

Void fraction resolution The time discretization of Eq. (II.13.8) is:

n+1 n 1
+ div (n+ un+ ) = V (n , P n+1 ). (II.13.10)
tn v
In this equation, the cavitation source term is discretized with the time scheme as the one used
at the correction step in order to ensure the exact mass conservation (it is recalled that the void
faction transport equation and correction step are two part of the mixture mass conservation equation,
Eq. (II.13.3).
Part III

Appendices
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 120/402

Calling tree
Each sub-section of this document is associated with an important subroutine. The full list of the
subroutines described here is the following: bilsc2 clptur clsyvt codits condli covofi gradmc
gradrc inimas itrmas matrix navstv predvv resopv turbke turrij viscfa visort visecv.
The table 1 presents their sequence within a time step. This calling tree is only partial. In particular,
it does not account for the number of calls to each subroutine. Also, for the sake of clarity, no reference
has been made to the subroutines dedicated to the gradient calculation (gradmc, gradrc), which are
called very often. For the same reason, the calls to bilsc2 (advection fluxes) and matrix (matrix
calculation) which are made from within codits (treatment of an advection equation with source
terms) have not been reported.
The sub-sections where important information can be found are indicated below:

Calculation of gradients
gradrc
gradmc
Least square method
gradmc
Convective schemes
bilsc2
Wall-laws (for velocity and temperature)
clptur
condli
System solve (incremental method)
codits
Calculation of the values at the faces (not exhaustive)
viscfa
visort

Finally, for the reader wishing to become more familiar with the methods implemented in Code Saturne,
it is recommended to begin with the study of the advection equation for a scalar (covofi) which is
solved iteratively using an incremental method (codits). It will then be useful to look at navstv
which briefly presents the solution of the system made up of the mass and momentum equations.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 121/402

Calculation of the physical properties


Boundary Conditions
condli
clptur turbulent conditions at the wall
clsyvt symmetry conditions for the vectors and the tensors
Navier-Stokes solution
navstv
Velocity prediction
predvv
visecv momentum source terms related to the
transposed gradient of the velocity
viscfa calculation of the viscosity at the faces
codits iterative solution of the system using an incremental method
Pressure correction
resopv
viscfa calculation of the time step at the faces...
visort ...according to the selected options
matrix calculation of the Poisson equation matrix
inimas initialisation of the mass flow rate
itrmas update of the mass flow rate
Velocity correction
standard method
k model
turbke
viscfa preliminary steps before...
bilsc2 ...source terms coupling
viscfa calculation of the viscosity at the faces
codits iterative solution of the systems using an incremental method
Reynolds stress model
turrij
visort calculation of the viscosity at the faces
codits iterative solution of the systems using an incremental method
Equations for the scalars
covofi
viscfa calculation of the viscosity at the faces
codits iterative solution of the systems using an incremental method

Table 1: Partial and simplified calling tree associated with the successive stages within a time step.
Part IV

Base module
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 123/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 124/402

A- bilsc2 routine

Function
In this subroutine, called by codits and turbke, the contributions to the explicit budget of the
reconstructed (on non-orthogonal meshes and if the user chooses to) convective and diffusive terms of
the right-hand side of a convection/diffusion equation for a scalar a are computed. These terms write
1
:

B (( u)n , a) = div ( (u)n a) + div ( a) (IV.A.1)


| {z } | {z }
convective part diffusive part

with , u, and a the variables at time tn .

Discretization
Convective Part
Using the notations adopted in the subroutine navstv, the explicit budget corresponding to the in-
tegration over a cell i of the convective part div ( ( u)n a) of B can be written as a sum of the
numerical fluxes F ij calculated at the faces of the internal cells, and the numerical fluxes F bik calcu-
lated at the boundary faces of the computational domain . Lets take N eigh (i) the set of the centres
of the neighbouring cells of i and b (i) the set of the centres of the boundary faces of i (if they
exist). Thus we can write
Z X X
div ((u)n a) d = F ij ((u)n , a) + F bik ((u)n , a)
i jN eigh(i) kb (i)

with :
F ij ((u)n , a) = (u)nij . S ij a f,ij
 
(IV.A.2)

F bik ((u)n , a) = (u)nbik . S bik af bik


 
(IV.A.3)
where a f,ij and af bik represent the values of a at the internal and boundary faces of i , respectively.

Before presenting the different convection schemes available in Code Saturne, we define:

F J0
ij = defined at the internal faces only and
I 0J 0
uK 0 = uK + (grad u)K . KK 0 at the first order in space, for K = I or J

The value of the convective flux F ij depends on the numerical scheme. Three different types of
convection schemes are available in this subroutine:
1 They appear on the right-hand side of the incremental system for cell I of the momentum prediction step:

EM(uk+1 , I) = E(un+1/2,k , I) (see navstv for more details)


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 125/402

a 1st order upwind scheme:


upstream
F ij ((u)n , a) = F ij ((u)n , a)

aI si (u)nij . S ij > 0


o`
u: a f,ij =
aJ si (u)nij . S ij < 0

a centered scheme:

F ij ((u)n , a) = F ijcentered ((u)n , a)

with : a f,ij = ij aI 0 + (1 ij )aJ 0

a Second Order Linear Upwind scheme (SOLU):

F ij ((u)n , a) = F ijSOLU ((u)n , a)



a + IF . (a) si (u)n . S > 0

I I ij ij
with : a f,ij =
aJ + JF . (a) J si (u)nij . S ij < 0

The value of F bik is calculated as :

if (u)nbik . S bik > 0



aI
af bik =
a bik if (u)nbik . S bik < 0

a bik is the boundary value directly computed from the prescribed boundary conditions.

Remark 1

When a centered scheme is used, we actually write (to ensure first order discretization in space for a)

1
a f,ij = ij aI + (1 ij )aJ + [(a)I + (a)J ] . OF
2
1
A factor is used for numerical stability reasons.
2

Remark 2
A slope test (which may introduce non-linearities in the convection operator) allows to switch from
the centered or SOLU scheme to the first order upwind scheme (without blending). Additionally, in
standard mode a f,ij is computed as a weighted average between the upstream value and the centered
value (blending), according to users choice (variable BLENCV in the subroutine usini1).

Diffusive Part
Similarly, the diffusive part writes :
Z X X
div ( a) d = D ij ( , a) + D bik (, a)
i jN eigh(i) kb (i)

1 Extrapolation of the upwind value at the faces centre.


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 126/402

with:
a J0 a I0
D ij ( , a) = ij S ij (IV.A.4)
I 0J 0
and :
a bik a I 0
D bik ( , a) = bik S bik (IV.A.5)
I 0F
using the same notations as before, and with S ij and S bik being the norms of vectors S ij , and S bik
respectively.

Implementation
In the following, the reader is reminded of the role of the variables used in the different tests:
IRCFLP, from array IRCFLU ; indicates for the considered variables wether or not the convective and
diffusive fluxes are reconstructed
= 0 : no reconstruction
= 1 : reconstruction
ICONVP, from array ICONV ; indicates if the considered variables is convected or not.
= 0 : no convection
= 1 : convection
IDIFFP, from array IDIFF ; indicates if the diffusion of the considered variables is taken into account
or not.
= 0 : no diffusion
= 1 : diffusion
IUPWIN indicates locally, in bilsc2 (to avoid unnecessary calculations) whether a pure upwind
scheme is chosen or not for the considered variables to be convected.
= 0 : no pure upwind
= 1 : pure upwind is used
ISCHCP, from array ISCHCV ; indicates which type of second order convection scheme is used on
orthogonal meshes for the considered variable to convect (only useful if BLENCP > 0 ).
= 0 : we use the SOLU scheme (Second Order Linear Upwind )
= 1 : we use a centered scheme
In both cases the blending coefficient BLENCP needs to be given in usini1.
BLENCP, from array BLENCV ; indicates the percentage of centered or SOLU convection scheme that
one wants to use. This weighting coefficient is between 0 and 1.
ISSTPP, from array ISSTPC ; indicates if one wants to remove the slope test that switches the
convection scheme from second order to upwind if the test is positive.
= 0 : a slope test is systematically used
= 1 : no slope test

Computation of the gradient G c,i of variable a


The computation of the gradient of variable a is necessary for the computation of the explicit budget.
grdcel is called everytime this gradient is needed, and it is stored in the array (DPDX, DPDY, DPDZ).
The computation of the gradient is necessary in the following situations: if the convection is
activated with a non pure upwind scheme (ICONVP 6= 0 and IUPWIN = 0) and,
if we want to reconstruct the fluxes (IRCFLP = 1),
or if we want to use the SOLU scheme (ISCHCP = 0),
or if we use the slope test (ISSTPP = 0),
or :
if there is diffusion and we want to reconstruct the fluxes (IDIFFP 6= 0 and IRCFLP = 1).

In all other cases, the array (DPDX, DPDY, DPDZ) is set to zero.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 127/402

Computation of the upwind gradient G amont


c,i of variable a
G amont
c,i refers to the upwind gradient of variable a, for cell i . It is stored in the array (DPDXA, DPDYA, DPDZA).
We also define the scalars a amont
ij and a amont
bik as:

def
|i | G upwind a upwind a upwind
P P
c,i = ij S ij + bik S bik (IV.A.6)
jN eigh(i) kb (i)

After initializing it to zero, G amont


c,i is only computed when the user wishes to compute a convec-
tion term with a centered or SOLU method, and a slope test.
For each cell i , the face values aIF (variable PIF) and aJF (variable PJF), are computed as:

aIF = aI + IF . (a) I
aJF = aJ + JF . (a) J

Depending on the sign snij of the mass flux (u)nij . S ij , we give aIF or aJF the value a upwind
ij of the
P upwind
expression a ij S ij .
jN eigh(i)
aI + IF . (a) I si snij = 1

a upwind =
ij aJ + JF . (a) J si snij = 1

The boundary terms are computed in a classic manner as follows (keeping the same notations as in
the other subroutines):

a upwind
P P
bik S bik = (INC A b,ik + B b,ik aI 0 ) S bik
kb (i) kb (i) 
INC A b,ik + B b,ik aI + B b,ik II 0 . G c,i S bik
P 
=
kb (i)

(A b,ik , B b,ik )kb (i) are stored in the arrays (COEFAP, COEFBP). The vector II 0 is stored in the array
(DIIPBX, DIIPBY, DIIPBZ). The surfaces (S bik )kb (i) are stored in the array SURFBO .

Summation of the numerical convective and diffusive fluxes


The contributions to the explicit budget [div ( (u)n a) + div ( a)] are computed and added to the
right-hand side array SMBR, which has already been initialized before the call to BILSC2 (with the
explicit source terms for instance, etc.).
The variable FLUX gathers the convective and diffusive parts of the numerical fluxes. It is computed
in a classic manner, first on the internal faces, and then on the boundary faces. The indices i and j
are represented by II and JJ, respectively.
In order to take into account (when necessary) the sign snij of the mass flux (u)nij . S ij , the following
equations are used :
For any real b, we have :

b = b+ + b with b+ = max (b, 0), b = min (b, 0)




| b| = b+ b



1
b+ = [ b + | b| ]
2
1


b

= [ b |b | ]
2
In this subroutine, b represents the mass flux FLUMAS(IFAC) on an internal face IFAC (FLUMAB(IFAC)
for a boundary face IFAC) ; b+ is stored in FLUI and b in FLUJ.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 128/402

 for an internal face ij (IFAC)

We calculate :
 
X
n
X X a J0 a I0
(u)nij . S ij a f,ij ij
 
F ij ((u) , a) D ij ( , a) = S ij
jN eigh(i) jN eigh(i) jN eigh(i)
I 0J 0

The above sum corresponds to the numerical operation:

FLUX = ICONVP . [ FLUI . PIF + FLUJ . PJF ]


(IV.A.7)
+ IDIFFP . VISCF(IFAC) . [ PIP PJP ]

The above equation does not depend on the chosen convective scheme, since the latter only affects
the quantities PIF (face value of a used when b is positive) and PJF (face value of a used when b is
S ij
negative). PIP represents aI 0 , PJP aJ 0 and VISCF(IFAC) ij 0 0 .
IJ
The treatment of diffusive part is identical (either with or without reconstruction). Consequently, only
the numerical scheme relative to the convection differs.

 for a boundary face ik (IFAC)

We compute the terms :


X X X  a b a I0

F bik ((u)n , a) (u)nbik . S bik af bik bik ik 0

D bik (, a) = S bik
kb (i) kb (i) k (i)
IF
b

with:
aI 0 = aI + II 0 . G c,i
a b1ik = INC A b,ik + B b,ik aI 0
a bik = INC Adif f dif f
b,ik + B b,ik aI
0

 
The coefficients (A b,ik , B b,ik )kb (i) resp.(Adif f dif f
b,ik , B b,ik )kb (i) represent the boundary conditions
associated with a (resp. the diffusive fluxes 2 of a).
The above sum corresponds to the numerical operation:

FLUX = ICONVP . [ FLUI . PVAR(II) + FLUJ . PFAC ]


(IV.A.8)
+ IDIFFP . VISCB(IFAC) . [ PIP PFACD ]

S bik
where PFAC represents a b1ik , PIP aI 0 , PFACD a bik and VISCB(IFAC) bik .
I 0F
This treatment is common to all schemes, because boundary values only depend on boundary condi-
tions, and because a very simplified expression of F bik is used (upwind) 3 .

We still have to compute, when the convection option is activated (ICONVP = 1), the values of variables
PIF and PJF, for any internal face IFAC between cell i and j .

Calculation of the flux in pure upwind IUPWIN = 1


In this case, there is no reconstruction since only the values PVAR(II) and PVAR(JJ) at the cell centres
are needed.
PIF = PVAR(II)
(IV.A.9)
PJF = PVAR(JJ)
The variable INFAC counts the number of calculations in pure upwind, in order to be printed in the
listing file. In order to obtain the global numerical flux FLUX (convective + diffusive) associated, the
following operations are performed :
2 see clptur for more details. The difference is actually only effective when the k  model is used, and for the velocity

only.
3 Actually, a is aI if (u)nb . S bik > 0, a b1ik otherwise.
f b ik
ik
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 129/402

calculation of vectors II and JJ,


calculation of the face gradient (DPXF, DPYF, DPZF) with the half-sum of the cell gradients G c,i et
G c,j ,
calculation of the reconstructed (if necessary) values aI 0 and aJ 0 (variables PIP and PJP, respectively)
given by :
1
aK 0 = aK + IRCFLP . KK 0 . ( G c,i + G c,j ) K = I et J (IV.A.10)
2
calculation of the quantities FLUI and FLUJ,
calculation of the flux FLUX using (IV.A.7).
The computation of the sum in SMBR is straight-forward, following (IV.A.1) 4 .

Calculation of the flux with a centered or SOLU scheme (IUPWIN = 0)

The two available second order schemes on orthogonal meshes are the centered scheme and the SOLU
scheme.
In both cases, the following operations are performed:
calculation of the vector II, the array (DIIPFX, DIIPFY, DIIPFZ) and the vector JJ, the array
(DJJPFX, DJJPFY, DJJPFZ)
calculation of the face gradient (DPXF, DPYF, DPZF) haff-sum of the cell gradients G c,i and G c,j ,
calculation of the possibly reconstructed (if IRCFLP = 1) values aI 0 and aJ 0 (variables PIP and PJP,
respectively) given by :
1
aK 0 = aK + IRCFLP . KK 0 . ( G c,i + G c,j ) K = I and J (IV.A.11)
2
calculation of FLUI and FLUJ.

 without slope test (ISSTPP = 1)

F with a centered scheme (ISCHCP = 1)

The values of the variables PIF and PJF are equal, and calculated using the weighting coefficient ij
as follows:
PIF = ij . PI 0 + (1 ij ) . PJ 0
(IV.A.12)
PJF = PIF
F with a SOLU scheme (ISCHCP = 0)

After calculating the vectors IF and JF , the values of the variables PIF and PJF are computed
as follows:
PIF = PI + IF . G c,i
(IV.A.13)
PJF = PJ + JF . G c,j
PIF and PJF are systematically reconstructed in order to avoid using pure upwind, i.e. this formulae
is applied even when the user chooses not to reconstruct (IRCFLP = 0).

 with slope test (ISSTPP = 0)

The procedure is quite similar to the one described in the previous paragraph. There is, in addi-
tion to hte previous procedure, a slope test that makes under certain conditions the scheme switch
locally (but systematically) from the chosen centered or SOLU scheme to a pure upwind scheme.

calculation of the slope test  


Equation (IV.A.6) writes on an internal cell i , with snij = sgn (u)nij . S ij :
4 taking into account the negative sign of B .
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 130/402

|i | G upwind a upwind
P
c,i = ij S ij
jN eigh(i)  
1 n 1
+ ( snij 1 ) aJF
P
= ( sij + 1 ) aIF S ij
jN eigh(i)  2 2
P 1 n
= ( sij + 1 ) ( aI + IF . (a) I )
jN eigh(i) 2
1
( snij 1 ) ( aI + JF . (a) J ) S ij

+
2
On a cell i with neighbours (j )jN eigh(i) , the classic slope test consists in locating where a variable
a is non-monotonic by studying the sign of the scalar product of the cell gradients of G c,i and G c,j . If
this product is negative, we switch to an upwind scheme, if it is positive, we use a centered or SOLU
scheme.
Another technique which also ensures the monotonicity of the solution is to apply this criterion to the
upwind gradients G amont
c,k or to their normal projection on face ( G amont
c,k . S kl ).
We then study the sign of the product G amont
c,i . G amont
c,j or of the product ( G amont
c,i . S ij ) . ( G amont
c,j . S ij ) .
amont amont
The slope test implemented is based on the first quantity, G c,i . G c,j (the second one was aban-
donned because it was found to be less general). The choice of a slope test based on G amont c,i . G amont
c,j
comes from the following line of argument in one-dimension 5 :
Lets take p a second order in x polynomial function. Its value at points I 1, I, I + 1 of coordinates
xI1 , xI and xI+1 are pI1 , pI , and pI+1 , respectively. To simplify, we suppose that I is the origin O
( xI = 0 ), and that the grid spacing h is constant, which results in xI+1 = xI1 = h. Additionally,
we suppose that the velocity is orientated from point I towards point I + 1, i.e. snij = 1. Therefore we
consider the points I 1, I and I + 1 for the face ij which is located between I and I + 1.
The sign of the product p0 (xI1 ) . p0 (xI+1 ) inidicates the monotonicity of function p. If this product it
positive, the function is monotonic and we use a centered or a SOLU scheme, otherwise, we switch to
an upwind scheme. By identifying the polynomial coefficients using the equations p (xI1 ) = pI1 ,
p (xI ) = pI , p (xI+1 ) = pI+1 , we obtain :
 
0 pI+1 pI1 pI pI1 pI+1 pI
p (xI1 ) = + +
2h h h
  (IV.A.14)
0 p I+1 p I1 pI pI1 p I+1 pI
p (xI+1 ) = +
2h h h
or after simplification :  
0 pI+1 pI
p (xI1 ) = G c,i + G amont

c,i
h
  (IV.A.15)
0 amont pI+1 pI
p (xI+1 ) = G c,i G c,i
h
We know that :
pI+1 pI
representes the upwind derivative at point I + 1, directly accessible by the values of p in
h
the neighbouring cells of face ij,
pI+1 pI1
represents the centered derivative (in finite volume) at point I, namely G c,i ,
2h
pI pI1
represents the value of the upwind derivative (in finite volume) at point I, namely G amont
c,i .
h 0 0
The slope test relative to p (xI1 ) . p (xI+1 ) reduces to studying the sign of T P 1d :
   
pI+1 pI pI+1 pI
T P 1d = G c,i + [ G amontc,i ] . G c,i [ G amont
c,i ]
h h (IV.A.16)
2 amont pI+1 p I 2
= |G c,i | ( G c,i )
h
5 Information on the second derivative would permit to study more finely the behaviour and the strong variations of
a.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 131/402

Using a similar line of argument, a possible extension to higher dimensions consists in replacing the
values G c,k and G amont
c,k by ( G c,k . S kl ) eand ( G amont
c,k . S kl ) respectively. After simplifications, this
+
leads us to the formulae T P 3d :
aJ aI
T P+ 2 amont
3d = (G c,i . S ij ) (G c,i . S ij S ij )2 (IV.A.17)
I 0J 0
for (u)nij . S ij > 0.
Similarly, we can deduce a T P n
3d associated with (u) ij . S ij < 0, defined by :

aJ aI
T P 2 amont
3d = (G c,j . S ij ) (G c,j . S ij S ij )2 (IV.A.18)
I 0J 0

We introduce the variables TESTI, TESTJ and TESTIJ computed as:


TESTI = G amont
c,i . S ij
TESTJ = G amont
c,j . S ij (IV.A.19)
TESTIJ = G amont
c,i . G amont
c,j

The quantity TESQCK corresponding to T P 3d , is computed dynamically, depending on the sign of the
mass flux snij .
consequently :

 if (u)nij . S ij > 0 and


aJ aI
if (G c,i . S ij )2 (G amont
c,i . S ij S ij )2 < 0 or (G amont
c,i . G amont
c,j ) < 0,
| {z I 0J 0 }
TESQCK

or :
if (u)nij . S ij < 0 and
aJ aI
if (G c,j . S ij )2 (G amont
c,j . S ij S ij )2 < 0 or (G amont
c,i . G amont
c,j ) < 0,
| {z I 0J 0 }
TESQCK

then we switch to a pure upwind scheme:


PIF = PVAR(II)
(IV.A.20)
PJF = PVAR(JJ)
and INFAC is incremented.

 otherwise :
the centered or the SOLU scheme values values are used as before :

F with a centered scheme (ISCHCP = 1)

The values of the variables PIF and PJF are equal and calculated using the weighting coef-
ficient ij :
PIF = ij . PI 0 + (1 ij ) . PJ 0
(IV.A.21)
PJF = PIF
F with a SOLU scheme (ISCHCP = 0)

After calculating the vectors IF and JF , the values of the variables PIF and PJF are
computed as follows:
PIF = PI + IF . G c,i
(IV.A.22)
PJF = PJ + JF . G c,j
PIF and PJF are systematically reconstructed in order to avoid using pure upwind, i.e. this
formulae is applied even when the user chooses not to reconstruct (IRCFLP = 0).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 132/402

Wether the slope test is activated or not, when the centered or the SOLU schemes are activated, a
blending coefficient (BLENCP) between 0 and 1, provided by the user, enables to blend, if desired, the
chosen scheme and the pure upwind scheme following the formulae:
(centre ou SOLU )
PIF = BLENCPP IF + (1 BLENCP) PII
(centre ou SOLU ) (IV.A.23)
PJF = BLENCPP JF + (1 BLENCP) PJJ

calculation of FLUI and FLUJ,


calculation of the flux FLUX using equation (IV.A.7).
The computation of the sum in SMBR is straight-forward, following (IV.A.1)6
Remark

For more information on the convection schemes and the slope test in Code Saturne (version 1.1), the
reader is referred to EDF internal report EDF HI-83/04/020 (F. Archambeau, 2004).

6 taking into account the negative sign of B .


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 133/402

Points to treat

Convection scheme
Upwind scheme
As all first-order schemes, it is robust, but introduces severe numerical diffusion.
Centered or SOLU scheme
This type of schemes can generate numerical oscillations, that can cause the calculation to blow up.
It can also lead to physical scalars taking unphysical values.
Considering these limitations, other schemes are currently being tested and implemented in order to
improve the quality of the schemes available to the users.

Diffusion scheme

The formulae :
a J0 a I0
D ij ( , a) = ij S ij (IV.A.24)
I 0J 0
1
is second-order accurate only for ij = . A possible correction may be to write :
2
a J0 a I0 1
G f,ij . S ij = (a) ij = 0 0
. S ij + ( ij ) [(a)I 0 (a)J 0 ] . S ij (IV.A.25)
IJ 2
with a gradient limiter and a computation of ij which does not alter the order of accuracy.

Implementation

In order to improve the CPU time, an effort on loops can be done. More particularly, there is a test
IF inside of a loop on variable IFAC that needs to be checked.

Calculation of the gradient used during the reconstruction of the diffusive fluxes
1
Why do we use ( G c,i + G c,j ) instead of G c,k , for k = i or for k = j in the reconstructed values
2
aI 0 or aJ 0 of (IV.A.10) and (IV.A.11)?
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 134/402

11
00
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00 F
11 I
i Sb 00
11
00
11
J 00
11
F 00
11
I 00
11
J 00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.A.1: Definition of the geometric entities for internal (left) and a boundary faces (right).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 135/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 136/402

B- clptur routine

Function
This subroutine is dedicated to the calculation of the wall boundary conditions. The notations intro-
duced in CONDLI for the general boundary conditions will be used.
The wall boundary conditions refer to all the boundary conditions for the velocity, the turbulent
variables (k, , Rij ), the temperature when it has a prescribed value at the wall (or the enthalpy
and more generally the VarScalaires1 to treat at the wall by using a similarity law for the associated
boundary layer). For the VarScalaire in particular, when the boundary conditions at the wall are of
Neumann type (homogeneous or not), they are treated in condli and dont present them here. In
particular, the boundary conditions of the VarScalaires are not treated here because their treatment
at the wall is of homogeneous Neumann type.
We present the calculation of the pair of coefficients Ab and Bb which are used during the computation
of certain discretized terms of the equations to solve, and which allow in particular to determine a
value associated with the boundary faces fb,int (at a point located at the centre of the boundary face,
the barycentre of its vertices) using the formulae fb,int = Ab + Bb fI 0 (fI 0 is the value of the variable
at point I 0 , the projection of the centre of the boundary cell onto the line normal to the boundary face
and passing through its centre : see figure IV.B.1).

Bord du domaine de calcul


Sb
Domaine de calcul 11111111
00000000
00000000
11111111
00000000
11111111
00000000
11111111
I
00000000
11111111 n normale sortante
00000000
11111111
I F 00000000
11111111
00000000
11111111
de norme 1
00000000
11111111
y
f
00000000
11111111
00000000
11111111
fI b,int 00000000
11111111
fb,ext fimp,ext
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
Coefficients dechange
h himp,ext
int
h
b

Figure IV.B.1: Boundary cell.

Discretisation

Notations
1 As in condli the VarScalaire are any solution of a convection-diffusion equation apart from the velocity, the pressure

and the turbulent variables k, and Rij . More specifically, the name VarScalaire can refer to the temperature, the
enthalpy or a passive scalar.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 137/402

The velocity of the wall is noted v p . We assume it is projected onto the plane tangent to the wall (if
it is not, then the code projects it).
The velocity of the fluid is noted u. Index I, I 0 or F denotes the point at which the velocity is
estimated. The component tangent to the wall writes u . The fluid velocity in the coordinate system
attached to the wall (relative velocity) writes ur = u v p .
= ( , n
The orthonormal coordinate system attached to the wall writes R , b).

n
= n is the unit vector orthogonal to the wall and directed towards the interior of the com-
putational domain.
1
= [ur 0 (urI 0 . n
)] is the unit vector parallel to the projection of the relative
kurI 0 (urI 0 . n )k I
velocity at I 0 , urI 0 , in the plane tangent to the wall (i.e. orthogonal to n ) : see figure IV.B.1.
b is the unit vector which completes the positively oriented coordinate system.

The dimensionless limit distance which separates the viscous sublayer from the logarithmic region
+
writes ylim . Its value is 1/ (with = 0, 42) in general (to ensure the continuity of the velocity
gradient) and 10.88 in LES (to ensure the continuity of the velocity).
In the case of the two velocity scale model,

- uk is the friction velocity at the wall obtained from the turbulent kinetic energy. We write u
ur,I 0
the friction velocity at the wall calculated from the equation = f (yk+ ).
u
uk I 0 F
- yk+ represents a dimensionless wall distance, yk+ = ( is the molecular kinematic viscosity

taken at the centre I of the boundary cell). The function f gives the ideal shape of the velocity
1
profile. It is piecewisely approximated by the logarithmic law f (z) = f1 (z) = ln(z) + 5, 2 for

+
z > ylim and by the linear law f (z) = f2 (z) = z otherwise.
- The two velocity scale uk and u are simple to compute but their computation requires the
knowledge of the turbulent kinetic energy kI at the centre of cell adjoint to the boundary face
(with the Rij model, we use half the trace of the Reynolds stress tensor).
- The two velocity scale model is the default model in Code Saturne. It often permits, and in
particular in cases with heat transfer, to reduce the effects of certain flaws associated to the k
model.

Later on, we will use u and uk for the boundary conditions of the velocity and scalars (in particular
the temperature).

Two velocity scale model


1 1

uk = C4 kI2 r
u 0

,I = 1 ln(y + ) + 5, 2 for y + > y +




k k lim
u (IV.B.1)

u is solution of ur,I 0
= yk+ for yk+ 6 ylim
+


u


0

uk I F


with C = 0, 09 yk+ = and = 0, 42



In the case of the one velocity scale model,
ur,I 0
we write u the only friction velocity at the wall solution of the equation = f (y + ). y + represents
u
u I 0 F
a dimensionless wall distance y + = ( is the molecular kinematic viscosity taken at the centre I

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 138/402

of the boundary cell). The function f gives the ideal shape of the velocity profile, as in the case of the
two velocity scale model. One can note that this friction velocity, calculated using a more complicated
approach (Newton method), can however be obtained without making any reference to the turbulent
variables (k, , Rij ). For convenience in the case of the one velocity scale model, we write uk = u .
Later on, we will use u and uk for the boundary conditions of the velocity and scalars (in particular
the temperature).

Mod`ele `
a une
echelle de vitesse
uk = u

r
u 0
,I = 1 ln(y + ) + 5, 2


+
pour y + > ylim


u


u solution de (IV.B.2)
ur,I 0 +
= y+ +
pour y 6 ylim



u 0
u IF


avec y + =

et = 0, 42

Remark : Hereafter, we provide three exemples based on the two velocity scale model.

In this way, one can implement a specific wall function :


u,I 0
= g(y + )
u
by simply imposing u = u,I 0 /g(y + ).
It is also possible to use a rough-wall wall function such as :
u,I 0 1 y

= ln( ) + 8, 5
u

where  is the height  of the roughness elements at the wall : one just has to impose u =
1 y
u,I 0 / ln( ) + 8, 5 , y being deduced from y + , available as an argument, by the equation


y = y+ .
uk
Even a more general correlation could be used of Colebrook type :
" !#
2, 51
u = udeb / 4 2log10 + +
2 2DH 3, 7 DH

+
where DH is the hydraulic diameter made dimensionless using uk , , udeb the mean streamwise

velocity and the relative roughness.
DH

Boundary conditions for the velocity in k

We first consider the boundary conditions used in the case of calculation using the k model. Indeed
these cases are the most complex and general.
The boundary conditions are necessary to prescribe at the boundary the correct tangential stress
= I u uk in the momentum equation2 (I is the density at the centre of cell I). The term which
requires boundary conditions is the one containing the velocity derivative in the normal direction to
the wall3 : (I + t,I )grad u n. It appears on the right-hand side of the usual momentum equation (see
bilsc2 and predvv).
2 Proposition de modification des conditions aux limites de paroi turbulente pour le Solveur Commun dans le cadre

du mod` ele k standard, rapport EDF HI-81/00/019/A, 2000, M. Boucker, J.-D. Mattei.
3 The transpose gradient term is treated in visecv and thus will not be considered here.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 139/402

In the case where the k model tends to surestimate the production of turbulent kinetic energy, the
length scale of the model, Lk , can become significantly larger than the maximum theoretical length
scale of the turbulent boundary layer eddies Ltheo . We write :
3
k2
Lk = C (IV.B.3)
L 0

theo = I F

In the case where Lk > Ltheo , we thus have t,I > lm t with t,I the turbulent viscosity of the
k model at point I and lm t = I Ltheo uk the turbulent viscosity of the mixing length model.
Additionally, the tangential stress can write by making the turbulent viscosity appear :
u
= I u uk = I I 0 F u k (IV.B.4)
I 0 F | {z }
lm
t

The viscosity scale introduced in the stress thus contradicts the one deduced from the neighbouring
turbulence calculated by the model. Consequently we prefer to write the stress, by using the velocity
scale of the k model when it is lower than the limit Ltheo :
u
= max(lm
t , t,I ) (IV.B.5)
I 0F

One can then use this value to calculate the diffusive flux which depends upon it in the Navier-Stokes
equations :
(I + t,I )grad u n = . (IV.B.6)

But the velocity gradient (face gradient) is computed in the code as :

(I + t,I )
(I + t,I )grad u n = (uF uI 0 ) (IV.B.7)
I 0F

Using (IV.B.6) and (IV.B.7) we obtain the value of uF to be prescribed, referred to as uF,f lux (con-
servation of the momentum flux) :

I 0F
uF,f lux = uI 0
I + t,I (IV.B.8)

u
= uI 0 max(lm
t , t,I )
(I + t,I )

In reality, an extra approximation is made. It consists in imposing a zero normal velocity at the wall
and in using equation (IV.B.8) projected on the plane parallel to the wall :

u
 
uF,f lux = u,I 0 max(lm
t , t,I ) (IV.B.9)
(I + t,I )

+
Moreover, if the value obtained for y + is lower than ylim a no-slip condition is applied. Finally, one
can also make the wall velocity appear in the final expression :

Flux boundary conditions of the velocity (k )


+

uF,f lux = v p if y + 6 ylim
(IV.B.10)
u
 
uF,f lux = v p + ur,I 0 max(lm
t , t,I ) otherwise
(I + t,I )
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 140/402

A first pair of coefficients Af lux and Bf lux can then be deduced (for each component of the velocity
separately) and it is used only to compute the tangential stress dependent term (see bilsc2) :
Coefficients associated with the flux boundary conditions of the velocity (k )
+
+
A f lux = v p  if y 6 ylim


u
Af lux = v p + ur,I 0 max(lm
t , t,I ) otherwise

(I + t,I )
B f lux = 0

(IV.B.11)
We saw above how to impose a boundary condition to compute directly the stress term. Further
analysis is necessary to calculate correctly the velocity gradients. We want to find a boundary face
value which permits to obtain, with the chosen expression for the gradient, the value the turbulent
production as close as possible to its theoretical value (determined by using the logarithmic law), in
order to evaluate the normal derivative the tangential velocity. Thus, we define (at point I) :
u uk (u )2
Ptheo = I u uk k kI = I (IV.B.12)
n I 0F

Morevoer, the dominant term of the production computed in cell I is, in classical situations (y is the
coordinate on the axis whose direction vector is n
),
 2
u
Pcalc = t,I (IV.B.13)
y I

The normal gradient of the tangential velocity (cell gradient) is calculated in the code using finite
volume, and its expression on regular orthogonal meshes is (see the notations on figure IV.B.2) :
 2  2
u,G u,F u,I + u,J 2u,F
Pcalc = t,I = t,I (IV.B.14)
2d 4d
We then assume that u,J can be obtained from u,I and from the normal gradient of u calculated in
G from the logarithmic law :
 
u

u
u,J = u,I +IJ . (y u )G +O(IJ 2 ) u,I +IJ . y ln(y + ) + 5, 2 = u,I +2d (IV.B.15)
G 2d
and thus we obtain :

!2
u,I + u,I + 2d u2d 2u,F
Pcalc = t,I
4d
!2 !2 (IV.B.16)
u
2u,I + 2 2 2u,F u,I + u2 u,F
= t,I = t,I
4d 2d

We then use (IV.B.12) and (IV.B.16) to impose that the calculated production is equal to the theoretical
production. The preceeding formulae are extended with no precaution to non-orthogonal meshes (the
velocity at I is then simply computed at I 0 ). The following expression for u,F is then obtained :
s !
u I uk I 0 F 1
u,F,grad = u,I 0 2 (IV.B.17)
t,I 2

Additionally, we force the gradient to remain as stiff as the one given by the normal derivative of the
theoretical velocity profile (logarithmic) at I 0 :
u u
y u = y ( ln(y + ) + 5, 2) = , thus :
I 0F
s !
u I uk I 0 F 1
u,F,grad = u,I 0 max 1, 2 (IV.B.18)
t,I 2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 141/402

Bord du domaine de calcul

Domaine de calcul 11
00
00
11
00
11
00
11 n
00
11
00normalede sortante
11
00
11
norme 1
J G I M F 00
11
00
11
y d/2 d/2 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
d d d
00
11
00
11
Figure IV.B.2: Cellule de bord - Maillage orthogonal.

Finally, we clip the velocity at the wall with a minimum value calculated assuming that we are in the
logarithmic layer :
" s !#!

I uk I 0 F
 
1 + u 1
u,F,grad = max u ln(ylim ) + 5, 2 , u,I 0 max 1, 2 (IV.B.19)
t,I 2

+
The normal derivative at the wall is prescribed to zero. If the y + value at the wall is lower than ylim ,a
no-slip condition is prescribed. Finally, one can also make explicit the velocity of the wall in the final
expression :

Gradient boundary conditions of the velocity(k )


+
if y + 6 ylim


uF,grad = v p
uF,grad = v p +

( " s !#!)
u I uk I 0 F
 
1 + r 1
max u ln(ylim ) + 5, 2 , u,I 0 max 1, 2 otherwise



t,I 2
(IV.B.20)
A second pair of coefficients Agrad and Bgrad can then be deduced (for each velocity component
separately). It is used when the velocity gradient is necessary (except for the terms depending on the
tangential shear, those being treated in bilsc2 using Af lux and Bf lux ) :

Coefficients associated to the gradient boundary conditions of


the velocity(k )
+
if y + 6 ylim


A
grad = v p


Agrad = v p +

( " s !#!)
u I uk I 0 F
 
1 + r 1
max u ln(ylim ) + 5, 2 , u,I 0 max 1, 2 otherwise






t,I 2
B grad = 0

(IV.B.21)

Boundary conditions of the velocity in Rij

The boundary conditions of the velocity with the Rij model are more simple, since there are only
of one type. Keeping the same notations as above, we want the tangential velocity gradient (calculated
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 142/402

at I, and to be used to evaluate the turbulent production) to be consistent with the logarithmic law
giving the ideal tangential velocity profile. The theoretical gradient is :

u
 
u
Gtheo = = (IV.B.22)
y I0 I 0F

The normal gradient of the tangential velocity (cell gradient) is calculated in the code using finite
volumes, and its expression in the case of regular orthogonal meshes is (see notations in figure IV.B.2) :
u,G u,F u,I + u,J 2u,F
Gcalc = = (IV.B.23)
2d 4d
We then assume that u,J can be obtained from u,I and from the normal gradient of u calculated in
u
G from the logarithmic law (see equation (IV.B.15)) u,J = u,I + 2d and we thus obtain :
2d
u u u
u,I + u,I + 2d 2u,F 2u,I + 2 2u,F u,I + u,F
Gcalc = 2d = 2 = 2 (IV.B.24)
4d 4d 2d
We then use the equations (IV.B.22) and (IV.B.24) to derive an expression for u,F (the preceeding
formulae are extended with no precaution to the case non-orthogonal meshes, the velocity at I being
simply computed at I 0 ) :
3u
u,F = u,I 0 (IV.B.25)
2
The normal derivative at the wall is prescribed to zero. If the value obtained for y + at the wall is
+
lower than ylim , a no-slip condition is prescribed. Finally, one can also make explicit the velocity of
the wall in the final expression :

Boundary conditions of the velocity (Rij )


+

u
F = v
p if y + 6 ylim

 (IV.B.26)
3u
uF = ur,I 0 + v p otherwise
2

Un couple de coefficients A et B sen deduit (pour chaque composante de vitesse separement) :

Coefficients es aux conditions aux limites sur la vitesse (Rij )


associ
+

A = v
p si y + 6 ylim


3u (IV.B.27)
A = ur,I 0 + v p sinon

2
B=0

A pair of coefficients Agrad and Bgrad can be deduced from the above equation (for each velocity
component separately).

Boundary conditions of the velocity in laminar

When no turbulence model is activated, we implicitly use a one velocity scale model (there is no
turbulent variables to compute uk ), and the same conditions 4 as in Rij are used : the model
degenerates automatically.

4 In other words; the boundary conditions are given by (IV.B.26) and (IV.B.27).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 143/402

Boundary conditions for k and (standard k model)

We impose k with a Dirichlet condition using the friction velocity uk (see equation (IV.B.1)) :

u2k
k= 1 (IV.B.28)
C2

We want to impose the normal derivative of from of the following theoretical law (see the notations
in figure IV.B.2) : 
u3k /( y)
Gtheo, = (IV.B.29)
y

We use point M to impose a boundary condition with a higher order of accuracy in space. Indeed,
using the simple expression F = I + dy I + O(d2 ) leads to first order accuracy. A second order
accuracy can be reached using the following Taylor series expansion:
2

M = I d y I + d y2 I + O(d3 )

2 82 (IV.B.30)
M = F + d y F + d 2 F + O(d3 )

y
2 8
By substracting these twxo expression, we obtain
d
F = I (y I + y F ) + O(d3 ) (IV.B.31)
2
Additionally, we have
= y M + dy2 M + O(d2 )

y I
(IV.B.32)
y F = y M dy2 M + O(d2 )
The sum of these last two expressions gives y I +y F = 2y M +O(d2 ) and, using equation (IV.B.31),
we finally obtain a second order approximation for F :

F = I dy M + O(d3 ) (IV.B.33)

The theoretical value (see equation IV.B.29) is then used in order to evaluate y M and thus the value
to prescribe at the boundary is obtained (d = I 0 F ) :

u3k
F = I + d (IV.B.34)
(d/2)2

This expression is extended to non-orthogonal mesh without any precautions (which is bound to
deteriorate the spatial accuracy ot the method).
+
Additionally, the velocity uk is set to zero for y + 6 ylim . Consequently, the value of k and the flux of
are both zero.
Finally we have :

Boundary conditions for k and


u2k

kF = 12


C (IV.B.35)
F = I 0 + I 0 F

u3k
0
(I F/2)2
+ +
with uk = 0 if y 6 ylim
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 144/402

and the associated pair of coefficients

Coefficients associated to the boundary conditions of k et


u2k

Ak = 12 and Bk = 0


C (IV.B.36)
A = I 0 F
u3k

0
and B = 1
(I F/2)2
+
with uk = 0 if y + 6 ylim

Boundary conditions for Rij and (standard Rij model)

The boundary conditions for the Reynolds stresses in the coordinate system attached to the wall write
refers to the local coordinate system) :
(R
= n R
n R n n = n R
bb = 0 n = u uk
et R b = R
et R n b = 0 (IV.B.37)

+
Additionally, if the value obtained for y + is lower than ylim , all Reynolds stresses are set to zero (we
assume that the turbulent stresses are negligible compared to the viscous stresses).
Although it is done systematically in the code, expressing the above boundary conditions in the
computation coordinate system is relatively complex (rotation of a tensor): the reader is referred
to the documentation of clsyvt where more details are provided. In what follows, the boundary
conditions will only be presented in the local coordinate system.
Thus we want to impose the boundary values :

Boundary conditions of Rij


+
if y + 6 ylim R ,F = 0

=R
,F (IV.B.38)
,F = R
R ,I 0 with {, n , b} (without summation)
otherwise n = u uk and R b = R
n b = 0
R

For the dissipation, the boundary condition applied is identical to the one applied with the k
model :
Boundary conditions of (Rij )
u3k

F = I 0 + I 0 F (IV.B.39)

0
(I F/2)2
+
with uk = 0 if y + 6 ylim

These boundary conditions can be imposed explicitly (by default, ICLPTR=0) or (semi-)implicitly (
ICLPTR=1). The standard option (explicit) leads to the following values5 of the coefficients A and
B:
5 Itcan be noticed that the value of is not reconstructed at I 0 . We thus wish to improve the stability since
1
has a very steep gradient at the wall ( ), and thus only weak recontruction errors at I 0 could lead to important
y
deterioration of the results. However, it would be necessary to check if stability is altered with the gradient reconstruction
of gradrc.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 145/402

Coefficients associated to the explicit boundary conditions of Rij et


+
If y + 6 ylim

:



A
R = AR = 0 and BR = BR = 0

Otherwise :



AR = (R )I and BR = 0 with {, n
, b} (without summation)



AR n = u uk and BR n = 0
AR b = AR n b = 0 and BR b = BR nb =0







And for all cases :
u3k


A = I + I 0 F


and B = 0
(I 0 F/2)2
+ +
with uk = 0 if y 6 ylim
(IV.B.40)
The semi-implicit option leads to the following values for the coefficients A and B. They differ from
the preceeding ones, only as regards as the diagonal Reynolds stresses and dissipation. In the general
case, impliciting of some components of the tensor in the local coordinate system leads to partially
impliciting all the components in the global computation coordinate system :

Coefficients associated to the semi-implicit boundary conditions of


sur les variables Rij et
+ +
If y 6 y lim :



AR = AR = 0 and BR = BR = 0

Sinon:



AR = 0 and BR = 1 with {, n
, b} (without summation)



AR n = u uk and BR n = 0
AR b = AR n b = 0 and BR b = BR nb =0







And for all cases :
u3k


A = I 0 F



0
and B = 1
(I F/2)2
+
with uk = 0 if y + 6 ylim
(IV.B.41)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 146/402

Boundary conditions of the VarScalaires

Only the boundary conditions when a boundary value is imposed (at the wall or away from the wall
with a possible external exchange coefficient) are treated here. The reader is referred to the notations
in figure IV.B.1 and to the general presentation provided in condli (in what follows only the most
essential part of the presentation is repeated).
The conservation of the normal flux at the boundary for variable f writes :


himp,ext (fimp,ext fb,ext ) (Dirichlet condition)
|
{z }
real imposed
hint (fb,int fI 0 ) = hb (fb,ext fI 0 ) =
| {z } | {z } imp,ext (Neumann condition)
int b

| {z }
real imposed

(IV.B.42)
The above two equation are rearranged in order to obtain the value of the numerical flux fb,int = fF
to impose at the wall boundary face, according to the values of fimp,ext and himp,ext set by the user,
and to the value of hb set by the similarity laws detailed hereafter. The coefficients A and B can then
be readily derived, and are presented here.

Boundary conditions of the VarScalaires


himp,ext hint + himp,ext (hr 1) hint
fb,int = fimp,ext + fI 0 with hr = (IV.B.43)
hint + hr himp,ext hint + hr himp,ext hb
| {z } | {z }
A B
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 147/402

Similarity principle : calculation of hb .


The only remaining unknown in expression (IV.B.43) is the value of hb , since hint has a numerical

value which is coherent with the face gradient computation options detailed in condli (hint = 0 ).
IF
The value of hb must relate the flux to the values fI 0 and fb,ext by taking into account the boundary
layer (the profile of f is not always linear) :

b = hb (fb,ext fI 0 ) (IV.B.44)

The following considerations are presented using the general notations. In particular, the Prandtl-
C
Schmidt number writes = . When the considered scalar f is the temperature, we have (see

condli)

C = Cp (specific heat capacity),


= (molecular conductivity),
Cp
= = P r (Prandtl number),

t = P rt (turbulent Prandtl number),
 
Cp t T
= + (flux in W m2 ).
t y

The reference Convection Heat Transfer, Vedat S. Arpaci and Poul S. Larsen, Prentice-Hall, Inc was
used.
The flux at the wall writes for the scalar f (the flux is positive if it enters the fluid domain, as shown
by the orientation of the y axis) :
   
t f t f
= +C = C + (IV.B.45)
t y C t y

t
Similarly for the temperature, with a = and at = , we have :
Cp t
T
= Cp (a + at ) (IV.B.46)
y

In order to make f dimensionless, we introduce f defined using the flux at the boundary b :
b
f = (IV.B.47)
C uk
For the temperature, we thus have :
b
T = (IV.B.48)
Cp uk

We then divide both sides of equation (IV.B.45) by b . For the left-hand side, we simplify using the
conservation of the flux (and thus the fact that = b ). For the right-hand side, we replace b by its
value C uk f . With the notations :
t y uk f fb,ext
= t = y+ = f+ = (IV.B.49)
f
we have :
f +
 
1 1 t
1= + (IV.B.50)
t y +
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 148/402

One can remark at this stage that with the notations used in the preceeding, hb can be expressed as
a function of fI+0 :
b C uk
hb = = (IV.B.51)
fb,ext fI 0 fI+0

In order to compute hb , we integrate equation (IV.B.50) to obtain fI+0 . The only difficulty then consists
1 1 t
in prescribing a variation law K = + .
t
In the fully developed turbulent region (far enough from the wall, for y + > y2+ ), a mixing length
hypothesis models the variations of t :
U
t = l 2 | | = y u (IV.B.52)
y

Additionally, the molecular diffusion of f (or the conduction when f represents the temperature) is
1 1 t
negligible compared to its turbulent diffusion : therefore we neglect compared to . Finally we
t
6
have :
y+
K= (IV.B.53)
t

On the contrary, in the near-wall region (for y + < y1+ ) the turbulent contribution becomes negligible
1 t 1
compared to the molecular contribution and we thus neglect compared to .
t
It would be possible to restrict ourselves to these two regions, but Arpaci and Larsen suggest the
model can be improved by introducing an intermediate region (y1+ 6 y + < y2+ ) in which the following
hypothesis is made :
t
= a1 (y + )3 (IV.B.54)

where a1 is a constant whose value is obtained from experimental correlations :
t
a1 = (IV.B.55)
1000

Thus the following model is used for K (see a sketch in figure B) :


1


if y + < y1+


a1 (y + )3

1
K= + if y1+ 6 y + < y2+ (IV.B.56)
t
y+



if y2+ 6 y +
t

The values of y1+ and y2+ are obtained by calculating the intersection points of the variations laws used
for K.
The existence of an intermediate region depends upon the values of . Lets first consider the case
where cannot be neglected compared to 1. In practise we consider > 0, 1 (this is the common
case when scalar f represents the air or the water temperature in normal temperature and pressure
1 a1 (y + )3
conditions). It is assumed that can be neglected compared to in the intermediate region.
t
We thus obtain :  1 r
+ 1000 3 + 1000
y1 = y2 = (IV.B.57)
t
6 We make the approximation that the definitions of y + from u and uk are equivalent.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 149/402

14

12 1/Pr
0.42 y+/Prt
a1 (y+)**3/Prt
10

8 y+
2
K

2 y+
1

0
0 10 20 30
y+

Figure IV.B.3: (a + at )/ as a function of y + obtained for = 1 and t = 1.

The dimensionless equation (IV.B.50) is integrated under the same hypothesis and we obtain the law
of f + :
if y + < y1+
+
f = y+
t


if y1+ 6 y + < y2+
+
f = a2 (IV.B.58)
2 a1 (y + )2
f + = t ln(y + ) + a3 if y + 6 y +


2

where a2 and a3 are integration constants, which have been chosen to obtain a continuous profile of
f+ :   
2 2 t 1000
a2 = 15 3 a3 = 15 3 1 + ln (IV.B.59)
2 t

Lets now study the case where is much smaller than 1. In practise it is assumed that 6 0, 1 (this is
for instance the case for liquid metals whose thermal conductivity is very large, and who have Prandtl
number of values of the order of 0.01). The intermediate region then disappears and the coordinate
of the interface between the law used in the near-wall region and the one used away from the wall is
given by :
t
y0+ = (IV.B.60)

The dimensionless equation (IV.B.50) is then integrated under the same hypothesis, and the law of f +
is obtained :
if y + 6 y0+
+
f = y+  
t y+ (IV.B.61)
f+ = ln + y0+ if y0+ < y +
y0+
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 150/402

To summarize, the computation of hb


b C uk
hb = = (IV.B.62)
fb,ext fI 0 fI+0

is performed by calculating fI+0 from y + = yI+0 using the following laws.


If 6 0, 1, a two-layer model is used :

if y + 6 y0+
+
f = y+  
t y+ (IV.B.63)
f+ = ln + y0+ if y0+ < y +
y0+

with
t
y0+ = (IV.B.64)

If > 0, 1, a three-layer model is used :

if y + < y1+
+
f = y+
t


if y1+ 6 y + < y2+
+
f = a2 + 2 (IV.B.65)
2 a 1 (y )
f + = t ln(y + ) + a3

if y2+ 6y +


with   13 r
1000 1000
y1+ = y2+ = (IV.B.66)
t
and   
2 2 t 1000
a2 = 15 3 a3 = 15 3 1 + ln (IV.B.67)
2 t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 151/402

Points to treat
The use of HFLUI/CPP when ISCSTH is 2 (case with radiation) needs to be checked (CPP is actually 1
in this case).
The boundary conditions of the velocity are based on derivations focusing on only one term of the
tangential stress (I + t,I )(grad u) n without taking into account the tranpose gradient.
In order to establish the boundary conditions of the velocity in k based on the constraint , a
projection onto the plane tangent to the wall and an arbitrary zero normal velocity are introduced.
The hypothesis made in order to establish formulae for the different types of boundary conditions
(dissipation, velocities) are based on the assumption that the mesh is orthogonal at the wall. This
assumption is extended without any caution to the case of non-orthogonal meshes.
The one velocity scale (cs wall functions.c) wall function requires solving an equation using a
Newton algorithm. The computational cost of the latter is low. One can also used a 1/7 power law
(Werner et Wengle) which yields results which are as accurate as the logarithmic law in the logarithmic
region, and which permits analytical resolutions (chosen option in LES mode). Be careful however,
since with this law, the intersection with the linear law is slightly different, which thus requires some
1
adaptations (intersection around 11.81 instead of 10.88 for the law adopted here U + = 8, 3 (y + ) 7 ).
The values of all the physical properties are taken at the cell centres, without any reconstruction.
Without modifying this approach, it would be useful to keep this in mind.
For the thermal law with very small Prandtl numbers compared to 1, Arpaci and Larsen suggest
y0+ ' 5/P r (with proof from experimental data) rather than P rt /(P r ) (current value, computed
as the analytical intersection of the linear and logarithmic laws considered). One should address this
question.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 152/402

C- clptrg routine

Fonction
Ce sous-programme est dedie au calcul des conditions aux limites en paroi rugueuse. On utilise le
formalisme introduit dans CONDLI pour les conditions aux limites generales.
Par conditions aux limites en paroi, on entend ici lensemble des conditions aux limites pour la vitesse,
les grandeurs turbulentes (k, ), la temperature lorsquelle a une valeur de paroi imposee (ou lenthalpie
et plus generalement les VarScalaires1 `a traiter en paroi en prenant en compte une loi de similitude pour
la couche limite associee). Pour les VarScalaires, en particulier, lorsque les conditions aux limites de
paroi sont du type Neumann (homog`ene ou non), elles sont traitees dans condli et on ne sy interesse
donc pas ici. En particulier, les conditions aux limites des VarScalaires representant la variance de
fluctuations dautres VarScalaires ne sont pas traitees ici car leur traitement en paroi est de type
Neumann homog`ene.
On indique comment sont calcules les couples de coefficients Ab et Bb qui sont utilises pour le calcul
de certains termes discrets des equations `a resoudre et qui permettent en particulier de determiner une
valeur associee aux faces de bord fb,int (en un point localise au centre de la face de bord, barycentre
de ses sommets) par la relation fb,int = Ab + Bb fI 0 (fI 0 est la valeur de la variable au point I 0 , projete
du centre de la cellule jouxtant le bord sur la droite normale `a la face de bord et passant par son
centre : voir la figure IV.C.1).

Bord du domaine de calcul


Sb
Domaine de calcul 11111111
00000000
00000000
11111111
00000000
11111111
00000000
11111111
I
00000000
11111111 n normale sortante
00000000
11111111
I F 00000000
11111111
00000000
11111111
de norme 1
00000000
11111111
y 00000000
11111111
fI f
b,int
00000000
11111111
00000000
11111111
fb,ext fimp,ext
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
Coefficients dechange
h himp,ext
int
h
b

Figure IV.C.1: Cellule de bord.


Discretisation

Notations
1 Comme dans condli, on d esignera ici par VarScalaire toute variable solution dune
equation de convection-diffusion
autre que la vitesse, la pression et les grandeurs turbulentes k, . La d
enomination VarScalaire pourra en particulier se
rapporter a
` la temp erature, `
a lenthalpie ou `
a un scalaire passif.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 153/402

La vitesse de la paroi est notee v p . On la suppose projetee dans le plan tangent `a la paroi (si elle ne
lest pas, le code la projette).
La vitesse du fluide est notee u. Lindice I, I 0 ou F designe le point auquel elle est estimee. La
composante tangentielle par rapport ` a la paroi est notee u . La vitesse du fluide dans le rep`ere lie `
a
la paroi (vitesse relative) est notee ur = u v p .

Le rep`ere orthonorme lie ` = ( , n


a la paroi est note R , b).

= n est le vecteur norme orthogonal `a la paroi et dirige vers linterieur du domaine de calcul.
n
1
= [ur 0 (urI 0 . n
)] est le vecteur norme porte par la projection de la vitesse
kurI 0
(urI 0 . n )k I
relative en I 0 , urI 0 , dans le plan tangent `a la paroi (i.e. orthogonal `a n ) : voir la figure IV.C.1.
b est le vecteur norme completant le rep`ere direct.

Dans le cas du mod`


ele `
a deux
echelles de vitesse, on note :

- uk la vitesse de frottement en paroi obtenue `a partir de lenergie turbulente.


ur,I 0
- u la vitesse de frottement en paroi determinee `a partir de la relation = f (zp ).
u
- zp represente une distance `a la paroi (cest `a dire la distance depuis le bord du domaine de calcul),
soit zp = I 0 F (voir la figure IV.C.1). La fonction f traduit la forme ideale du profil de vitesse.
Dans latmosph`ere, cette fonction est donnee par une loi de type logarithmique faisant intervenir
la rugosite dynamique de la paroi z0 :
 
1 zp + z0
f (zp ) = ln
z0
- Les deux echelles de vitesse uk et u sont simples `a calculer mais leur obtention necessite la
connaissance de lenergie turbulente kI au centre de la maille jouxtant la face de bord.
- Le mod`ele `a deux echelles est le mod`ele par defaut dans Code Saturne. Il permet souvent, et en
particulier dans les cas avec transfert thermique, de diminuer les effets de certains defaut lies au
mod`ele k (exemple classique du jet impactant).

On se sert plus bas de u et uk pour les conditions aux limites portant sur la vitesse et les scalaires
(temperature en particulier).

Mod`
ele ` a deux echelles de vitesse
1 1
uk = C kI
4 2

ur,I 0

1



u solution de = ln(zk ) (IV.C.1)
u
I 0 F + z0 zp + z0
zk = =





z0 z0
avec C = 0, 09 et = 0, 42

Dans le cas du mod` ele `


a une echelle de vitesse, on note u lunique vitesse de frottement en paroi
ur,I 0
solution de lequation = f (zp ). La grandeur zp represente une distance `a la paroi, soit zp = I 0 F .
u
La fonction f traduit la forme ideale du profil de vitesse comme pour le mod`ele `a deux echelles de
vitesses. On peut noter que cette vitesse de frottement, dun calcul plus delicat (point fixe), sobtient
cependant sans faire reference aux variables turbulentes (k, ). Par commodite, on posera dans le cas
a une echelle uk = u .
du mod`ele `
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 154/402

On se sert plus bas de u et uk pour les conditions aux limites portant sur la vitesse et les scalaires
(temperature en particulier).

Mod`
ele ` a une echelle de vitesse

u
k = u
r
u solution de u,I 0 = 1 ln(z )



k (IV.C.2)
0
u
I F + z0 zp + z0
zk =
=
z z

0 0


avec C = 0, 09 et = 0, 42

Conditions aux limites pour la vitesse en k

On consid`ere tout dabord les conditions utilisees dans le cas dun calcul realise avec le mod`ele k .
Ce sont en effet les plus complexes et les plus generales.
Les conditions aux limites sont necessaires pour imposer au bord la contrainte tangentielle = I u uk
adequate dans lequation de quantite de mouvement2 (I est la masse volumique au centre de la cellule
I). Le terme qui necessite des conditions aux limites est celui qui contient la derivee de la vitesse dans
la direction normale `a la paroi, soit3 : (I + t,I )grad u n. Il apparat au second membre de lequation
de quantite de mouvement usuelle (voir bilsc2 et predvv).
u le mod`ele k a tendance `a surestimer la production de lenergie turbulente, lechelle de
Dans le cas o`
longueur du mod`ele, Lk , peut devenir significativement plus grande que lechelle theorique maximale
des tourbillons de la couche limite turbulente Ltheo . On note :
3
k2
Lk = C (IV.C.3)
L 0
th
eo = (I F + z0 ) = (zp + z0 )

Dans le cas o`u Lk > Ltheo , on a donc t,I > lm t avec t,I la viscosite turbulente du mod`ele k
au point I et lm
t = I Ltheo uk la viscosite turbulente du mod`ele de longueur de melange. En outre, la
contrainte tangentielle peut secrire en faisant apparatre la viscosite turbulente, soit :
u
= I u uk = I (I 0 F + z0 ) uk (IV.C.4)
(I 0 F+ z0 ) | {z }
lm
t

Lechelle de viscosite introduite dans la contrainte est alors en contradiction avec celle deduite de la
turbulence calculee alentour par le mod`ele. On pref`ere d`es lors ecrire, en utilisant lechelle de longueur
du k chaque fois quelle est inferieure `a la limite Ltheo :
u
= max(lm
t , t,I ) (IV.C.5)
(I 0 F + z0 )

On peut alors utiliser cette valeur pour le calcul du flux diffusif qui en depend dans lequation de
Navier-Stokes :
(I + t,I )grad u n = (IV.C.6)

Or, le gradient de vitesse (gradient `


a la face de bord) est calcule dans le code sous la forme suivante :

(I + t,I )
(I + t,I )grad u n = (uF uI 0 ) (IV.C.7)
I 0F
2 Proposition de modification des conditions aux limites de paroi turbulente pour le Solveur Commun dans le cadre

du mod` ele k standard, rapport EDF HI-81/00/019/A, 2000, M. Boucker, J.-D. Mattei.
3 Le terme en gradient transpose est trait
e dans visecv et ne sera pas consid
er
e ici.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 155/402

Du rapprochement de (IV.C.6) et de (IV.C.7) on tire alors la valeur de uF `a imposer, soit uF,f lux (re-
spect du flux de quantite de mouvement) :

I 0F
uF,f lux = uI 0
I + t,I (IV.C.8)
u I 0F
= uI 0 max(lm
t , t,I ) 0

(I + t,I ) (I F + z0 )

En realite, une approximation supplementaire est realisee, qui consiste `a imposer la vitesse normale
nulle `
a la paroi et `
a utiliser lequation (IV.C.8) projetee sur le plan tangent `a la paroi, soit :
u I 0F
 
uF,f lux = u,I 0 max(lm
t , t,I ) (IV.C.9)
(I + t,I ) (I 0 F + z0 )

Enfin, on peut egalement faire apparatre la vitesse de la paroi dans lexpression finale :
Conditions aux limites sur la vitesse de type flux (k )
u I 0F
 
r lm (IV.C.10)
uF,f lux = v p + u,I 0 max(t , t,I ) 0
(I + t,I ) (I F + z0 )

Un premier couple de coefficients Af lux et Bf lux sen deduit (pour chaque composante de vitesse
separement) et il nest utilise que pour le calcul du terme dependant de la contrainte tangentielle (voir
bilsc2) :
Coefficients associ
 es aux conditions aux limites sur la vitesse de type flux(k )
0

u I F
Af lux = v p + ur,I 0 max(lm
t , t,I )

(I + t,I ) (I 0 F + z0 )
B f lux = 0

(IV.C.11)
On a vu ci-dessus comment imposer une condition `a la limite permettant de calculer correctement le
terme en contrainte. Une analyse supplementaire est necessaire pour le calcul des gradients de vitesse.
On cherche ` a trouver une valeur en face de bord qui permette dobtenir, avec la formulation adoptee
pour le gradient, la valeur de la production turbulente la plus proche possible de la valeur theorique,
elle-meme determinee en utilisant la loi logarithmique, pour evaluer la derivee normale de la vitesse
tangentielle. Ainsi, on definit (au point I) :
u uk (u )2
Ptheo = I u uk k kI = I (IV.C.12)
n (I 0 F + z0 )

Par ailleurs, le terme preponderant de la production calculee dans la cellule I est, pour les situations
classiques (z est lordonnee sur laxe de vecteur directeur n ),
 2
u
Pcalc = t,I (IV.C.13)
z I

Or, le gradient normal de la vitesse tangentielle (gradient cellule) est calcule dans le code en volumes
finis et son expression dans le cas dun maillage orthogonal et regulier est la suivante (voir les notations
sur la figure IV.C.2) :
 2  2
u,G u,F u,I + u,J 2u,F
Pcalc = t,I = t,I (IV.C.14)
2d 4d
On suppose alors que u,J peut etre obtenu `a partir de u,I et du gradient normal de u evalue en G
a partir de la loi logarithmique, soit :
`
 
u

2 u
u,J = u,I +IJ . (z u )G +O(IJ ) u,I +IJ . z ln(z) = u,I +2d (IV.C.15)
G (2d + z0 )
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 156/402

Bord du domaine de calcul

Domaine de calcul 11
00
00
11
00
11
00
11 n
00
11
00normalede sortante
11
00
11
norme 1
J G I M F 00
11
00
11
y d/2 d/2 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
d d d
00
11
00
11
Figure IV.C.2: Cellule de bord - Maillage orthogonal.

et lon obtient alors :


2
u

2u,I + 2d 2u,F
(2d + z0 )
Pcalc = t,I
4d

2 (IV.C.16)
u

u
,I + d u ,F
(2d + z0 )
= t,I
2d

On rapproche alors les equations (IV.C.12) et (IV.C.16) pour imposer que la production calculee soit
egale `
a la la production theorique. On etend sans precaution les formules precedentes aux maillages non
orthogonaux (la vitesse en I est alors simplement prise en I 0 ). On obtient alors lexpression suivante
pour u,F :
u
 r 
I uk 1
u,F,grad = u,I 0 2d (IV.C.17)
t,I (I 0 F + z0 ) 2 + z0 /I 0 F

On impose dautre part que le gradient reste au moins aussi raide que celui donne par la derivee
normale du profil de vitesse theorique (logarithmique) en I 0 :
u u
z u = z ( ln(z)) = 0
, soit donc :
(I F + z0 )

u
 
I uk 1
r
u,F,grad = u,I 0 max 1, 2d (IV.C.18)
t,I (I 0 F + z0 ) 2 + z0 /I 0 F

La vitesse normale ` a la paroi est imposee nulle. De plus, si la vitesse tangentielle en I 0 est nulle (de
a une limite numerique arbitraire de 1012 ) une condition dadherence est
valeur absolue inferieure `
appliquee. Enfin, on peut egalement faire apparatre la vitesse de la paroi dans lexpression finale :

Conditions aux limites sur la vitesse de type gradient(k )


1012
si ur,I 0 < 

uF,grad = v p

 (IV.C.19)
u I uk 1
r
r
uF,grad = v p + u,I 0 max 1, 2d
t,I (I 0 F + z0 ) 2 + z0 /I 0 F
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 157/402

Un second couple de coefficients Agrad et Bgrad sen deduit (pour chaque composante de vitesse
separement) et est utilise chaque fois que le gradient de la vitesse est necessaire (hormis pour les
termes dependant de la contrainte tangentielle, traites dans bilsc2 au moyen des coefficients Af lux et
Bf lux ) :

Coefficients associ es aux conditions aux limites sur la vitesse


de type gradient(k )
si ur,I 0 <1012

A = v
grad p
(IV.C.20)

u

I uk 1
r
r
Agrad = v p + u,I 0 max 1, 2d

t,I (I 0 F + z0 ) 2 + z0 /I 0 F
B grad = 0

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 158/402

Conditions aux limites pour les variables k et (mod`


ele k standard)

On impose sur k une condition de Dirichlet tiree de la vitesse de frottement uk (se reporter `
a
lequation (IV.C.1)), soit :
u2
k = k1 (IV.C.21)
C2

On cherche ` a imposer la derivee normale de `a partir de la loi theorique suivante (voir les notations
sur la figure IV.C.2) :
u3k
 

Gtheo, = (IV.C.22)
z (z + z0 )

On utilise le point M pour imposer une condition `a la limite avec un ordre plus eleve en espace. En
effet, la simple utilisation de la relation F = I + dz I + O(d2 ) conduit `a une precision dordre 1. En
utilisant les developpements limites suivants, on peut obtenir une precision `a lordre 2 :
2

M = I d z I + d z2 I + O(d3 )

2 82 (IV.C.23)
M = F + d z F + d 2 F + O(d3 )

z
2 8
Par difference, ces relations conduisent `a
d
F = I (z I + z F ) + O(d3 ) (IV.C.24)
2
De plus, on a
= z M + dz2 M + O(d2 )

z I
(IV.C.25)
z F = z M dz2 M + O(d2 )
La somme de ces deux derni`eres relations permet detablir z I +z F = 2z M +O(d2 ) et, en reportant
dans (IV.C.24), on obtient alors une expression de F `a lordre 2, comme souhaite :
F = I dz M + O(d3 ) (IV.C.26)
On utilise alors la valeur theorique (IV.C.22) pour evaluer z M et on obtient alors la valeur `a imposer
au bord (d = I 0 F ) :
u3k
F = I + d (IV.C.27)
(d/2 + z0 )2

Cette relation est etendue au cas de maillages non orthogonaux sans precaution (ce qui doit degrader
lordre en espace).
On a finalement :

Conditions aux limites sur les variables k et


u2

kF = k1

(IV.C.28)

C2
F = I 0 + I 0 F

u3k
(I 0 F/2 + z0 )2
et les coefficients associes
Coefficients associ es aux conditions aux limites sur les variables k et
2
u

Ak = k1
et Bk = 0
(IV.C.29)

C2
A = I 0F
u3k
et B = 1
(I 0 F/2 + z0 )2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 159/402

Conditions aux limites pour les VarScalaires

On ne traite ici que les conditions se presentant sous la forme dune valeur imposee (`a la paroi ou en
retrait de celle-ci avec un coefficient dechange externe eventuel). On se reporte aux notations de la
figure IV.C.1 et ` a la presentation generale disponible dans condli dont on ne reprend que la partie
essentielle ci-dessous.
La conservation du flux normal au bord pour la variable f secrit sous la forme :


himp,ext (fimp,ext fb,ext ) (condition de Dirichlet)
|
{z }
reel impos
e
hint (fb,int fI 0 ) = hb (fb,ext fI 0 ) =
| {z } | {z } imp,ext (condition de Neumann)
int b

| {z }
reel impos
e

(IV.C.30)
On rearrange ces deux equations afin dobtenir la valeur numerique fb,int = fF `a imposer en face de
paroi, etant donnees les valeurs de fimp,ext et de himp,ext fixees par lutilisateur et la valeur hb dictee
par les lois de similitude qui seront detaillees plus bas. On precise les coefficients A et B qui sen
deduisent naturellement.

Conditions aux limites sur les VarScalaires


himp,ext hint + himp,ext (hr 1) hint
fb,int = fimp,ext + fI 0 avec hr = (IV.C.31)
hint + hr himp,ext hint + hr himp,ext hb
| {z } | {z }
A B
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 160/402

Principe de similitude : calcul de hb .


Dans lexpression (IV.C.31), seule reste `a determiner la valeur de hb , celle de hint etant une valeur
numerique coherente avec le mode de calcul des gradients aux faces et precisee dans condli (hint =

). La valeur de hb doit permettre de relier le flux `a lecart entre les valeurs fI 0 et fb,ext en prenant
I 0F
en compte la couche limite (le profil de f nest pas toujours lineaire) :

b = hb (fb,ext fI 0 ) (IV.C.32)

Les considerations suivantes sont presentees en adoptant des notations generales. En particulier, le
C
nombre de Prandtl-Schmidt est note = . Lorsque le scalaire f considere est la temperature, on

a (voir condli) :

C = Cp (chaleur massique),
= (conductivite moleculaire),
Cp
= = P r (nombre de Prandtl),

t = P rt (nombre de Prandtl turbulent),
 
Cp t T
= + (flux en W m2 ).
t z

On sest appuye sur la reference The atmospheric boundary layer, J. R. Garratt, Cambridge Uni-
versity Press.
Le flux en paroi secrit, pour le scalaire f (le flux est positif sil est entrant dans le domaine fluide,
comme lindique lorientation de laxe z) :
   
t f t f
= +C = C + (IV.C.33)
t z C t z

t
Pour la temperature, avec a = et at = , on a donc, de mani`ere equivalente :
Cp t

T
= Cp (a + at ) (IV.C.34)
z

On introduit f afin dadimensionner f , en utilisant la valeur du flux au bord b :


b
f = (IV.C.35)
C uk
Pour la temperature, on a donc :
b
T = (IV.C.36)
Cp uk

On rappelle que dans le cas du mod`ele `a deux echelles de vitesse, uk est la vitesse de frottement en
paroi obtenue ` a partir de lenergie cinetique moyenne du mouvement turbulent4 . Dans le cas du mod`ele
a une echelle de vitesse, on pose uk = u avec u la vitesse de frottement en paroi determinee `a partir
`
de la loi logarithmique.
1 1
4u = C4 kI2
k
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 161/402

On divise alors les membres de lequation (IV.C.33) par b . Pour le membre de gauche, on simplifie
en utilisant le fait que le flux se conserve et donc que = b . Pour le membre de droite, on remplace
b par sa valeur C uk f . Avec les notations :
t f fb,ext
= t = f+ = (IV.C.37)
f
on a :
f + 1
 
t
1= + (IV.C.38)
t z uk

a present quavec les notations precedentes, hb sexprime en fonction de fI+0 :


Remarquons d`es `

b C uk
hb = = (IV.C.39)
fb,ext fI 0 fI+0

Pour determiner hb , on int`egre alors lequation (IV.C.38) afin de disposer de fI+0 . Lunique difficulte
t
a prescrire une loi de variation de K = +
consiste alors `
t
Dans la zone turbulente pleinement developpee, une hypoth`ese de longueur de melange permet de
modeliser les variations de t :
U
t = l2 | | = u (z + z0 ) (IV.C.40)
z
De plus, les effets de diffusion de f (ou effets conductifs lorsque f represente la temperature) sont
t
negligeables devant les effets turbulents : on neglige alors devant . On a donc finalement :
t
uk
K= (z + z0 ) (IV.C.41)
t

On int`egre lequation adimensionnelle (IV.C.38) sous la meme hypoth`ese et on obtient alors la loi
donnant f + :  
+ t z + z0
f = ln (IV.C.42)
zoT
o`
u zoT est la longueur de rugosit
 ethermique. Son ordre de grandeur compare `a la rugosite dynamique
z0
est donne par la relation ln 2 (reference J. R. Garratt).
zoT
Pour resumer, le calcul de hb est realise en determinant :
 0 
+ t I F + z0
fI 0 = ln (IV.C.43)
zoT
b C uk
hb = = (IV.C.44)
fb,ext fI 0 fI+0
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 162/402

D- clsyvt routine

Function
The aim of this subroutine is to fill the arrays of boundary conditions (COEFA and COEFB) of the
velocity and of the Reynolds stress tensor, for the symmetry boundary faces. These conditions are
express relatively naturally in the local coordinate system of the boundary face. The function of clsyvt
is then to transform these natural boundary conditions (expressed in the local coordinate sytem) in
the general coordinate sytem, and then to possibly partly implicit them.
It should be noted that the part of the subroutine clptur (for the wall boundary conditions) relative
to the writing in the local coordinate system and to the rotation is totally identical.

Discretisation
Figure IV.D.1 presents the notations used at the face. The local coordinate system is defined from the
normal at the face and the velocity at I 0 :
1
t= u 0 is the first vector of the local coordinate system.
|uI 0 , | I ,
n = n is the second vector of the local coordinate system.
b=tn = n t is the third vector of the local coordinate system.

I
t
1111111
0000000
0000000
1111111 u
0000000
1111111
0000000
1111111 I
0000000
1111111
0000000
1111111
ez 0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
F
0000000
1111111
n0000000
1111111
0000000
1111111 ~
0000000
1111111
0000000
1111111
n = n
ey ex 0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
0000000
1111111
b=t n~
0000000
1111111
0000000
1111111
0000000
1111111

Figure IV.D.1: Definition of the vectors forming the local coordinate system.

Here, n is the normalized normal vector to the boundary face in the sense of Code Saturne (i.e. directed
towards the outside of the computational domain) and uI 0 , is the projection of the velocity at I 0 in
the plane of the face : uI 0 , = uI 0 (uI 0 .n)n.
If uI 0 , = 0, the direction of t in the plane normal to n is irrelevant. thus it is defined as : t =
1 1
q (nz ey ny ez ) where t = p (nz ex nx ez ) along the non-zero components of n
2 2 n 2 + n2
ny + nz x z

(components in the global coordinate system (ex , ey , ez )).


For sake of clarity, the following notations will be used :
The general coordinate system will write R = (ex , ey , ez ).
The local coordinate system will write R = (t, n, b) = (t, n
, b).
The matrices of the components of a vector u in the coordinate systems R and R will write U and

U, respectively.
The matrices of the components of a tensor R (2nd order) in the coordinate systems R and R will
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 163/402

respectively.
write R and R,

P refers to the (orthogonal) matrix transforming R into R.

tx nx bx
P = ty ny by (IV.D.1)
tz nz bz

(P being orthogonal, P1 = t P).


In particular, we have for any vector u and for any second order tensor R :
(
U = P.U
(IV.D.2)
R = P . R . tP

Treatment of the velocity


In the local coordinate system, the boundary conditions for u naturally write :

uF,t = uI 0 ,t
uF,n = 0 (IV.D.3)
uF,b = uI 0 ,b

or
1 0 0 1 0 0
UF = P . U = P. 0 0 0 .U 0 = P . 0 0 0 . tP . U 0 (IV.D.4)
F I I
0 0 1 0 0 1

1 0 0
Lets take A = P . 0 0 0 . tP (matrix in the coordinate system R of the projector orthog-
0 0 1
onal to the face).
The boundary conditions for u thus write :

UF = A . UI 0 (IV.D.5)

Since the matrix P is orthogonal, it can be shown that

2x

1n nx n
y
nx n
z
A = y 1 n
nx n 2y
ny n
z (IV.D.6)
z
nx n ny n
z 1n 2z

The boundary conditions can then be partially implicited:


(n+1) (n+1) (n) (n)
uF,x =1n 2 u 0 y uI 0 ,y n
nx n xn
z uI 0 ,z (IV.D.7)
| {z x} I ,x | {z }
COEFB COEFA

The other components have a similar treatment. Since only the coordinates of n are useful, we do not
need (for u) to define explicitly the vectors t and b.

Treatment of the Reynolds stress tensor


We saw that we have the following relation:
. tP
R = P.R (IV.D.8)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 164/402

The boundary conditions we want to write are relations of the type:


X
RF,ij = ijkl RI 0 ,kl (IV.D.9)
k,l

We are then naturally brought to introduce the column matrices of the components of R in the different
coordinate systems.
We write
S = t [R11 , R12 , R13 , R21 , R22 , R23 , R31 , R32 , R33 ] (IV.D.10)
and
= t [R
S 11 , R
12 , R
13 , R
21 , R
22 , R
23 , R
31 , R
32 , R
33 ] (IV.D.11)

Two functions q and r from {1, 2, 3, 4, 5, 6, 7, 8, 9} to {1, 2, 3} are defined. Their values are given in the
following table :

i 1 2 3 4 5 6 7 8 9
q(i) 1 1 1 2 2 2 3 3 3
r(i) 1 2 3 1 2 3 1 2 3

i 7 (q(i), r(i)) is then a bijection from {1, 2, 3, 4, 5, 6, 7, 8, 9} to {1, 2, 3}2 , and we have :

Rij = S3(i1)+j
(IV.D.12)
Si = Rq(i)r(i)

Using equation IV.D.8, we thus have :


X
SF,i = RF,q(i)r(i) = F,mn Pr(i)n
Pq(i)m R
(m,n){1,2,3}2
9
X
= F,q(j)r(j) Pr(i)r(j)
Pq(i)q(j) R (dapr`es la bijectivite de (q, r))
j=1
9
X
= F,j
Pq(i)q(j) Pr(i)r(j) S (IV.D.13)
j=1

Or

SF = A . S avec Aij = Pq(i)q(j) Pr(i)r(j) (IV.D.14)
F

It can be shown that A is an orthogonal matrix (see Annexe A).


In the local coordinate system, the boundary conditions of R write naturally1 .

F,11 = R
I 0 ,11 F,21 = 0 F,31 = B R I 0 ,31

R R R

R =0 F,22 = R
R I 0 ,22
RF,32 = 0 (IV.D.15)
F,12 I 0 ,13 F,33 = R
I 0 ,33
RF,13 = B R RF,23 = 0 R
1 cf. Davroux A., Archambeau F., Le Rij dans Code Saturne (version ), HI-83/00/030/A
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 165/402

or 1 0 0
.. ..
0
0 . .

.. .. .. ..
. . B . .
.. ..

.. ..
. . 0 . .
. ..
= B.S
0 .. ..

SF I avec B =
.. . 1 . .

(IV.D.16)
. .. .. ..
. . .
. 0 .


. .. .. ..
..

. B . .

.. ..
. . 0 0
0 0 1

For the symmetry faces which are treated by clsyvt, the coefficient B is 1. However a similar treatment
is applied in clptur for the wall faces, and in this B is zero. This parameter has to be specified when
clca66 is called (see D).
Back in the global coordinate system, the following formulae is finally obtained :

SF = C . SI 0 avec C = A . B . t A (IV.D.17)

It can be shown that the components of the matrix C are :

9
X
Cij = Pq(i)q(k) Pr(i)r(k) Pq(j)q(k) Pr(j)r(k) (k1 + Bk3 + k5 + Bk7 + k9 ) (IV.D.18)
k=1

To conclude, it can be noted that, due to the symmetries of the tensor R, the matrix S. Thus only the
0 will be used:
simplified matrices S0 and S

S0 = t [R11 , R22 , R33 , R12 , R13 , R23 ] (IV.D.19)

0 = t [R
S 11 , R
22 , R
33 , R
12 , R
13 , R
23 ] (IV.D.20)

By gathering different lines of matrix C, equation IV.D.17 is transformed into the final equation :

S0F = D . S0I 0 (IV.D.21)

The computation of the matrix D is performed in the subroutine clca66. The methodology is described
in annexe B.
From D, the coefficients of the boundary conditions can be partially implicited (ICLSYR = 1) or totally
explicited (ICLSYR = 0).
Partial implicitation
(n+1) (n+1) (n)
X
S0F,i = Dii S0I 0 ,i + Dij S0I 0 ,j (IV.D.22)
|{z}
COEFB j6=i
| {z }
COEFA

Total explicitation
(n+1) (n)
X
S0F,i = Dij S0I 0 ,j (COEFB = 0) (IV.D.23)
j
| {z }
COEFA
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 166/402

Implementation

Beginning of the loop

Beginnning of the loop on all the boundary faces IFAC with symmetry conditions. A face is considered
as a symmetry face if ICODCL(IFAC,IU) is 4. The tests in vericl are designed for ICODCL to be equal
to 4 for IU if and only if it is equal to 4 for the other components of the velocity and for the components
of R (if necessary)
.
The value 0 is given to ISYMPA, which identifies the face as a wall or symmetry face (a face where the
mass flux will be set to zero as explained in inimas).

Calculation of the basis vectors


The normal vector n is stored in (RNX,RNY,RNZ).
uI 0 is calculated in CONDLI, passed via COEFU, and stored in (UPX,UPY,UPZ).

Case with Rij


With the Rij model (ITURB=30 or 31), the vectors t and b must be calculated explicitly (we use
P, not simply A). They are stored in (TX,TY,TZ) and (T2X,T2Y,T2Z), respectively.
The transform matrix P is then calculated and stored in the array ELOGLO.
The subroutine clca66 is then called to calculate the reduced matrix D. It is stored in ALPHA. clca66
is called with a parameter CLSYME which is 1, and which corresponds to the parameter of equation
IV.D.15.

Filling the arrays COEFA and COEFB


The arrays COEFA and COEFB are filled following directly equations IV.D.7, IV.D.22 and IV.D.23.
RIJIPB(IFAC,.) corresponds to the vector S0I 0 , computed in condli, and passed as an argument to
clsyvt.

Filling the arrays COEFAF and COEFBF


If they are defined, the arrays COEFAF and COEFBF are filled. They contain the same values as COEFA
and COEFB, respectively.

Annexe A

Proof of the orthogonality of matrix A

All the notations used in paragraphe 2 are kept. We have :


9
X
(t A . A)ij = Aki Akj
k=1
9
X
= Pq(k)q(i) Pr(k)r(i) Pq(k)q(j) Pr(k)r(j) (IV.D.24)
k=1
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 167/402

When k varies from 1 to 3, q(k) remains equal to 1 and r(k) varies from 1 to 3. We thus have :
3
X 3
X
Pq(k)q(i) Pr(k)r(i) Pq(k)q(j) Pr(k)r(j) = P1q(i) P1q(j) Pr(k)r(i) Pr(k)r(j)
k=1 k=1
3
X
= P1q(i) P1q(j) Pkr(i) Pkr(j) (IV.D.25)
k=1
= P1q(i) P1q(j) r(i)r(j) (by orthogonality of P)

Likewise for k varying from 4 to 6 or from 7 to 9, q(k) being 2 or 3, respectively, we obtain :


9
X
(t A . A)ij = Pq(k)q(i) Pr(k)r(i) Pq(k)q(j) Pr(k)r(j)
k=1
3
X
= Pkq(i) Pkq(j) r(i)r(j) (IV.D.26)
k=1
= q(i)q(j) r(i)r(j)
= ij (by the bijectivity of (q, r))

Thus t A . A = Id. Similarly, it can be shown that A . t A = Id. Thus A is an orthogonal matrix.

Annexe B

Calculation of the matrix D

The relation between the matrices of dimension 9 1 of the components of R in the coordinate system
R at F and at I 0 (matrices SF and SI 0 ) :

SF = C . SI 0 (IV.D.27)

with
9
X
Cij = Pq(i)q(k) Pr(i)r(k) Pq(j)q(k) Pr(j)r(k) (k1 + k3 + k5 + k7 + k9 ) (IV.D.28)
k=1

To transform S into the matrix 6 1 S0 , the function s from {1, 2, 3, 4, 5, 6, 7, 8, 9} to {1, 2, 3, 4, 5, 6} is


defined. It takes the following values :

i 1 2 3 4 5 6 7 8 9
s(i) 1 4 5 4 2 6 5 6 3

By construction, we have Si = S0s(i) for all i between 1 and 9.


To compute Dij , we can choose a value of m to satisfy s(m) = i and sum all the Cmn to have s(n) = j.
The choice of m is irrelevent. We can also compute the sum over all m so that s(m) = i and then
divide by the number of such values of m. We will use this method.
We define N (i) the number of integers between 1 and 9 so that s(m) = i. According to the preceeding,
we thus have
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 168/402

1 X
Dij = Cmn
N (i) s(m)=i
s(n)=j

1 X
= Pq(m)q(k) Pr(m)r(k) Pq(n)q(k) Pr(n)r(k) (k1 + k3 + k5 + k7 + k9
(IV.D.29)
)
N (i) s(m)=i
s(n)=j
16k69

First case : i 6 3 and j 6 3


In this case, we have N (i) = N (j) = 1. Additionally, if s(m) = i and s(n) = j, then q(m) = r(m) = i
and q(n) = r(n) = j. Thus
9
X
Dij = Piq(k) Pir(k) Pjq(k) Pjr(k) (k1 + k3 + k5 + k7 + k9 ) (IV.D.30)
k=1

When k belongs to {1, 5, 9}, q(k) = r(k) belongs to {1, 2, 3}. And for k = 3 or k = 7, q(k) = 1 and
r(k) = 3, or the inverse (and for k even the the sum of Kronecker symbol is zero). Finally we have :
3
X
Dij = P2ik P2jk + 2Pj1 Pi3 Pi1 Pj3 (IV.D.31)
k=1

Second case : i 6 3 and j > 4


Again we have N (i) = 1, and if s(m) = i then q(m) = r(m) = i.
On the contrary, we have N (j) = 2, the two possibilities being m1 and m2 .

- if j = 4, then m1 = 2 and m2 = 4, q(m1 ) = r(m2 ) = 1 and r(m1 ) = q(m2 ) = 2. We then have


m = 1 and n = 2.
- if j = 5, then m1 = 3 and m2 = 7, q(m1 ) = r(m2 ) = 1 and r(m1 ) = q(m2 ) = 3. We then have
m = 1 and n = 3.
- if j = 6, then m1 = 6 and m2 = 8, q(m1 ) = r(m2 ) = 2 and r(m1 ) = q(m2 ) = 3. We then have
m = 2 and n = 3.

And we have :
9
X  
Dij = Piq(k) Pir(k) Pmq(k) Pnr(k) + Pnq(k) Pmr(k) (k1 + k3 + k5 + k7 + k9 ) (IV.D.32)
k=1

But when k is in {1, 5, 9}, q(k) = r(k) is in {1, 2, 3}. Thus :


3
X 9
X
P2ik Pmk Pnk +
 
Dij = 2 Piq(k) Pir(k) Pmq(k) Pnr(k) + Pnq(k) Pmr(k) (k3 + k7 ) (IV.D.33)
k=1 k=1

And for k = 3 or k = 7, q(k) = 1 and r(k) = 3, or the opposite. We finally have :


" 3 #
X
2
Dij = 2 Pik Pmk Pnk + Pi1 Pi3 (Pm1 Pn3 + Pn1 Pm3 ) (IV.D.34)
k=1
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 169/402

with (m, n) = (1, 2) if j = 4, (m, n) = (1, 3) if j = 5 and (m, n) = (2, 3) if j = 6.

Third case : i > 4 and j 6 3


By symmetry of C, we obtain a result which is the symmetric of the second case, except that N (i) is
now 2. Thus :
X3
Dij = P2jk Pmk Pnk + Pj1 Pj3 (Pm1 Pn3 + Pn1 Pm3 ) (IV.D.35)
k=1

with (m, n) = (1, 2) if i = 4, (m, n) = (1, 3) if i = 5 and (m, n) = (2, 3) if i = 6.

Fourth case : i > 4 and j > 4


Then N (i) = N (j) = 2.
We have (m, n) = (1, 2) if i = 4, (m, n) = (1, 3) if i = 5 and (m, n) = (2, 3) if i = 6. Likewise we define
m0 and n0 as a function of j. We then obtain :
9
1X  
Dij = Pmq(k) Pnr(k) + Pnq(k) Pmr(k) Pm0 q(k) Pn0 r(k) + Pn0 q(k) Pm0 r(k)
2
k=1
(k1 + k3 + k5 + k7 + k9 )
" 3
#
1 X
= 4Pmk Pnk Pm0 k Pn0 k + 2 (Pm1 Pn3 + Pn1 Pm3 ) (Pm0 1 Pn0 3 + Pn0 1 Pm0 3 )(IV.D.36)
2
k=1

and finally :
3
X
Dij = 2 Pmk Pnk Pm0 k Pn0 k + (Pm1 Pn3 + Pn1 Pm3 ) (Pm0 1 Pn0 3 + Pn0 1 Pm0 3 ) (IV.D.37)
k=1

with (m, n) = (1, 2) if i = 4, (m, n) = (1, 3) if i = 5 and (m, n) = (2, 3) if i = 6


and (m0 , n0 ) = (1, 2) if j = 4, (m0 , n0 ) = (1, 3) if j = 5 and (m0 , n0 ) = (2, 3) if j = 6.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 170/402

E- codits routine

Fonction
Ce sous-programme, appele entre autre par predvv, turbke, covofi, resrij, reseps, ..., resout les
equations de convection-diffusion dun scalaire a avec termes sources du type :

fsimp (an+1 an ) + div ((u) an+1 ) div ( tot an+1 )


| {z } | {z }
convection implicite diffusion implicite
(IV.E.1)
= fsexp (1 ) div ((u) an ) +(1 ) div ( tot an )
| {z } | {z }
convection explicite diffusion explicite

o`u u, fsexp et fsimp designent respectivement le flux de masse, les termes sources explicites et les termes
linearises en an+1 . a est un scalaire defini sur toutes les cellules1 . Par souci de clarte on suppose, en
labsence dindication, les proprietes physiques (viscosite totale tot ,...) et le flux de masse (u)
pris respectivement aux instants n + et n + F , o` u et F dependent des schemas en temps
specifiquement utilises pour ces grandeurs2 .
Lecriture des termes de convection et diffusion en maillage non orthogonal engendre des difficultes
(termes de reconstruction et test de pente) qui sont contournees en utilisant une methode iterative
dont la limite, si elle existe, est la solution de lequation precedente.


Discretisation
Afin dexpliquer la procedure utilisee pour traiter les difficultes dues aux termes de reconstruction et
de test de pente dans les termes de convection-diffusion, on note, de facon analogue `a ce qui est defini
dans navstv mais sans discretisation spatiale associee, En loperateur :

En (a) = fsimp a + div ((u) a) div ( tot a)


(IV.E.2)
fsexp fsimp an + (1 ) div ((u) an ) (1 ) div ( tot an )

Lequation (IV.E.1) secrit donc :


En (an+1 ) = 0 (IV.E.3)
La quantite En (an+1 ) comprend donc :
fsimp an+1 , contribution des termes differentiels dordre 0 lineaire en an+1 ,
div ((u) an+1 ) div ( tot an+1 ), termes de convection-diffusion implicites complets
(termes non reconstruits + termes de reconstruction) lineaires3 en an+1 ,
fsexp fsimp an et (1) div ((u) an )(1) div ( tot an ) lensemble des termes explicites
(y compris la partie explicite provenant du schema en temps applique `a la convection diffusion).

De meme, on introduit un operateur EMn approche de En , lineaire et simplement inversible, tel que
son expression contient :
la prise en compte des termes lineaires en a,
1 a, sous forme discr`
ete en espace, correspond a ` un vecteur dimensionn e `
a NCELET de composante aI , I d
ecrivant
lensemble des cellules.
2 cf. introd
3 Lors de la discr
etisation en espace, le caract`
ere lin
eaire de ces termes pourra cependant
etre perdu, notamment ` a
cause du test de pente.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 171/402

la convection integree par un schema decentre amont (upwind) du premier ordre en espace,
les flux diffusifs non reconstruits.

EMn (a) = fsimp a + [div ((u) a)]amont [div ( tot a)]N Rec (IV.E.4)
Cet operateur permet donc de contourner la difficulte induite par la presence deventuelles non linearites
introduites par lactivation du test de pente lors du schema convectif, et par le remplissage important
de la structure de la matrice decoulant de la presence des gradients propres `a la reconstruction.
On a la relation4 , pour toute cellule I de centre I :
Z
EMdisc (a, I) = EMn (a) d
i

On cherche `
a resoudre :

0 = En (an+1 ) = EMn (an+1 ) + En (an+1 ) EMn (an+1 ) (IV.E.5)

Soit :
EMn (an+1 ) = EMn (an+1 ) En (an+1 ) (IV.E.6)
On va pour cela utiliser un algorithme de type point fixe en definissant la suite (an+1, k )kN 5 :
 n+1, 0
a = an
n+1, k+1
a = an+1, k + an+1, k+1

u an+1, k+1 est solution de :


o`

EMn (an+1, k + an+1, k+1 ) = EMn (an+1, k ) En (an+1, k ) (IV.E.7)

Soit encore, par linearite de EMn :

EMn (an+1, k+1 ) = En (an+1, k ) (IV.E.8)

Cette suite, couplee avec le choix de loperateur En , permet donc de lever la difficulte induite par
la presence de la convection (discretisee `a laide de schemas numeriques qui peuvent introduire des
non linearites) et les termes de reconstruction. Le schema reellement choisi par lutilisateur pour la
convection (donc eventuellement non lineaire si le test de pente est active) ainsi que les termes de re-
construction vont etre pris ` a literation k et traites au second membre via le sous-programme bilsc2,
alors que les termes non reconstruits sont pris `a literation k + 1 et representent donc les inconnues du
syst`eme lineaire resolu par codits6 .

On suppose de plus que cette suite (an+1, k )k converge vers la solution an+1 de lequation (IV.E.2),
i.e. lim an+1, k = 0, ceci pour tout n donne.
k
(IV.E.8) correspond ` a lequation resolue par codits. La matrice EM n , matrice associee `a EMn est
a inverser, les termes non lineaires sont mis au second membre mais sous forme explicite (indice k de
`
an+1, k ) et ne posent donc plus de probl`eme.

Remarque 1
La viscosite tot prise dans EMn et dans En depend du mod`ele de turbulence utilise. Ainsi on a
tot = laminaire + turbulent dans EMn et dans En sauf lorsque lon utilise un mod`ele Rij , auquel
cas on a tot = laminaire .
4 On pourra se reporter au sous-programme matrix pour plus de d a EMdisc , op
etails relativement ` erateur discret
agissant sur un scalaire a.
5 Dans le cas ou le point fixe en vitesse-pression est utilis
e (NTERUP> 1) an+1,0 est initialis
e par la derni`
ere valeur
obtenue de an+1 .
6 cf. le sous-programme navstv.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 172/402

Le choix de EMn etant a priori arbitraire (EMn doit etre lineaire et la suite (an+1, k )kN doit con-
verger pour tout n donne), une option des mod`eles Rij (IRIJNU = 1) consiste `a forcer ntot dans
lexpression de EMn ` a la valeur nlaminaire +nturbulent lors de lappel `a codits dans le sous-programme
navstv, pour letape de prediction de la vitesse. Ceci na pas de sens physique (seul nlaminaire etant
cense intervenir), mais cela peut dans certains cas avoir un effet stabilisateur, sans que cela modifie
pour autant les valeurs de la limite de la suite (an+1, k )k .

Remarque 2
Quand codits est utilise pour le couplage instationnaire renforce vitesse-pression (IPUCOU=1), on
fait une seule iteration k en initialisant la suite (an+1, k )kN `a zero. Les conditions de type Dirichlet
sont annulees (on a INC = 0) et le second membre est egal `a |i |. Ce qui permet dobtenir une
approximation de type diagonal de EM n necessaire lors de letape de correction de la vitesse7 .

Mise en uvre
Lalgorithme de ce sous-programme est le suivant :
- determination des proprietes de la matrice EM n (symetrique si pas de convection, non symetrique
sinon)
- choix automatique de la methode de resolution pour linverser si lutilisateur ne la pas specifie pour la
variable traitee. La methode de Jacobi est utilisee par defaut pour toute variable scalaire a convectee.
Les methodes disponibles sont la methode du gradient conjugue, celle de Jacobi, et le bi-gradient con-
jugue stabilise (BICGStab) pour les matrices non symetriques. Un preconditionnement diagonal est
possible et utilise par defaut pour tous ces solveurs excepte Jacobi.
- prise en compte de la periodicite (translation ou rotation dun scalaire, vecteur ou tenseur),
- construction de la matrice EM n correspondant `a loperateur lineaire EMn par appel au sous-
programme matrix8 . Les termes implicites correspondant `a la partie diagonale de la matrice et donc
aux contributions differentielles dordre 0 lineaires en an+1 ,(i.e fsimp ), sont stockes dans le tableau
ROVSDT (realise en amont du sous-programme appelant codits).
- creation de la hierarchie de maillage si on utilise le multigrille (IMGRP > 0).
- appel `a bilsc2 pour une eventuelle prise en compte de la convection-diffusion explicite lorsque 6= 0.
- boucle sur le nombre diterations de 1 `a NSWRSM (appele NSWRSP dans codits). Les iterations sont
representees par k appele ISWEEP dans le code et definissent les indices de la suite (an+1, k )k et de
(an+1, k )k .
Le second membre est scinde en deux parties :
n+1, k1
 un terme, affine en a , facile `a mettre `a jour dans le cadre de la resolution par increment,
et qui secrit :

fsimp an+1, k1 an+1,0 + fsexp (1 ) div ((u) an+1,0 ) div ( tot an+1,0 )
  

 les termes issus de la convection/diffusion (avec reconstruction) calculee par bilsc2.

div (u) an+1, k1 div tot an+1, k1


  

La boucle en k est alors la suivante :

Calcul du second membre, hors contribution des termes de convection-diffusion explicite SMBINI;
le second membre complet correspondant `a En (an+1, k1 ) est, quant `a lui, stocke dans le tableau
7 cf.
le sous-programme resopv.
8 On rappelle que dans matrix, la convection est trait
ee, quelque soit le choix de lutilisateur, avec un sch
ema d
ecentr
e
amont dordre 1 en espace et quil ny a pas de reconstruction pour la diffusion. Le choix de lutilisateur quant au
sch
ema num erique pour la convection intervient uniquement lors de lint egration des termes de convection de En , au
second membre de (IV.E.8) dans le sous-programme bilsc2.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 173/402

SMBRP, initialise par SMBINI et complete par les termes reconstruits de convection-diffusion par
appel au sous-programme bilsc2.
` literation k, SMBINI note SMBINI k vaut :
A

SMBINI k = fsexp (1 ) [ div ((u) an ) div ( tot an ) ] fsimp ( an+1, k1 an )

Avant de boucler sur k, un premier appel au sous-programme bilsc2 avec THETAP = 1


permet de prendre en compte la partie explicite des termes de convection-diffusion provenant du
schema en temps.

SMBRP 0 = fsexp (1 ) [ div ((u) an ) div ( tot an ) ]

Avant de boucler sur k, le second membre SMBRP 0 est stocke dans le tableau SMBINI 0 et sert
pour linitialisation du reste du calcul.

SMBINI 0 = SMBRP 0

pour k = 1,

SMBINI 1 = fsexp (1 ) [div ((u) an ) div ( tot an ) ] fsimp( an+1, 0 an )


= fsexp (1 ) div ((u) an+1, 0 ) div ( tot an+1, 0 ) fsimp an+1, 0

On a donc :
SMBINI 1 = SMBINI 0 ROVSDT ( PVAR PVARA)
et SMBRP 1 est complete par un second appel au sous-programme bilsc2 avec THETAP = , de
mani`ere `
a ajouter dans le second membre la partie de la convection-diffusion implicite.

SMBRP 1 = SMBINI 1 div ((u) an+1, 0 ) div ( tot an+1, 0 )


 

= fsexp (1 ) [ div ((u) an ) div ( totan ) ] fsimp (an+1, 0 an )


div ((u) an+1, 0 ) div ( tot an+1, 0 )

pour k = 2,
de facon analogue, on obtient :

SMBINI 2 = fsexp (1 ) [ div ((u) an ) div ( tot an ) ] fsimp ( an+1, 1 an )

Soit :
SMBINI 2 = SMBINI 1 ROVSDT DPVAR 1
lappel au sous-programme bilsc2, etant systematiquement fait par la suite avec THETAP = ,
on obtient de meme :

SMBRP 2 = SMBINI 2 div (u) an+1, 1 div tot an+1, 1


  

o`
u
an+1, 1 = PVAR 1 = PVAR 0 + DPVAR 1 = an+1, 0 + an+1, 1
pour literation k + 1,
Le tableau SMBINI k+1 initialise le second membre complet SMBRP k+1 auquel vont etre rajoutees
les contributions convectives et diffusives via le sous-programme bilsc2.
on a la formule :
SMBINI k+1 = SMBINI k ROVSDT DPVAR k
Puis suit le calcul et lajout des termes de convection-diffusion reconstruits de En (an+1, k ), par
appel au sous-programme bilsc2. On rappelle que la convection est prise en compte `a cette
etape par le schema numerique choisi par lutilisateur (schema decentre amont du premier ordre
en espace, schema centre du second ordre en espace, schema decentre amont du second ordre
S.O.L.U. ou une ponderation (blending) des schemas dits du second ordre (centre ou S.O.L.U.)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 174/402

avec le schema amont du premier ordre, utilisation eventuelle dun test de pente).
Cette contribution (convection-diffusion) est alors ajoutee dans le second membre SMBRP k+1
(initialise par SMBINI k+1 ).
SMBRP k+1 = SMBINI k+1 div (u) an+1, k div tot an+1, k
  

= fsexp (1 ) [ div ((u) an ) div ( tot an ) ] fsimp (an+1, k an )


div ((u) an+1,k ) div ( tot an+1,k )

Resolution du syst`eme lineaire en an+1, k+1 correspondant `a lequation (IV.E.8) par inversion
de la matrice EM n , en appelant le sous programme invers. On calcule an+1, k+1 grace ` a la
formule :
an+1, k+1 = an+1, k + an+1, k+1
Soit :
PVAR k+1 = PVAR k + DPVAR k+1

Traitement de la periodicite et du parallelisme.


Test de convergence :
Il porte sur la quantite ||SMBRP k+1 || < ||EM n (an ) + SMBRP 1 ||, o`
u || . || represente la norme
euclidienne. Si le test est verifie, la convergence est atteinte et on sort de la boucle sur les
iterations. La solution recherchee est a n+1 = an+1, k+1 .
Sinon, on continue diterer dans la limite des iterations imposees par NSWRSM dans usini1.
En continu ce test de convergence secrit aussi :
||SMBRP k+1 || < ||fsexp div ((u) an ) + div ( tot an )
+[div ((u) an )]amont + [div ( tot an )]N Rec ||
Si bien que sur maillage orthogonal avec schema de convection upwind et en labsence de terme
source, la suite converge en theorie en une unique iteration puisque par construction :
||SMBRP 2 || = 0 < ||fsexp ||

Fin de la boucle.

Points a` traiter

Approximation EMn de lop erateur En


Dautres approches visant soit ` a modifier la definition de lapproximee, prise en compte du schema
centre sans reconstruction par exemple, soit `a abandonner cette voie seraient `a etudier.

Test de convergence
La quantite definissant le test de convergence est egalement `a revoir, eventuellement `a simplifier.

Prise en compte de Tsimp


Lors de la resolution de lequation par codits, le tableau ROVSDT a deux fonctions : il sert `a calculer
la diagonale de la matrice (par appel de matrix) et il sert `a mettre `a jour le second membre `a chaque
u Tsimp est positif, on ne lint`egre pas
sous-iteration de la resolution en increments. Or, dans le cas o`
dans ROVSDT, afin de ne pas affaiblir la diagonale de la matrice. De ce fait, on ne lutilise pas pour
mettre ` a jour le second membre, alors que ce serait tout `a fait possible. Au final, on obtient donc
un terme source traite totalement en explicite (Tsexp + Tsimp an ), alors que la resolution en increments
nous permettrait justement de limpliciter quasiment totalement (Tsexp + Tsimp an+1,kf in 1 , o` u kf in est
la derni`ere sous-iteration effectuee).
Pour ce faire, il faudrait definir deux tableaux ROVSDT dans codits.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 175/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 176/402

F- condli routine

Function
Boundary conditions are required in at least three principal cases :

calculation of the convection terms (first order derivative in space) at the boundary : the cal-
culation uses a flux at the boundary and requires the value of the convected variable at the
boundary when the latter is entering the domain in the sens of the characteristic curves of the
system (in the sens of the velocity, in the case of the single equation of a simple scalar : sufficient
interpretation in the current framework of Code Saturne1 ) ;
calculation of the diffusion terms (second order derivative in space) : a method to determine the
value of the first order spatial derivatives at the boundary is then required (more exactly, the
terms that depend upon it are required, such as the stresses of the thermal fluxes at the wall) :
calculation of the cell gradients : the variable at the boundary faces are required (more generally,
the discrete terms of the equations which depend upon the gradient inside boundary cells are
required, such as the transpose gradient terms in the Navier-Stokes equations).

These considerations only concern the computational variables (velocity, pressure, Reynolds tensor,
scalars solution of a convection-diffussion equation). For these variables 2 , the user has to define the
boundary conditions at every boundary face (usclim).
The subroutine condli transforms the data provided by the user (in usclim) into an internal format
of representation of the boundary conditions. Verifications of the completeness and coherence are also
performed (in vericl). More particularly, the smooth-wall boundary conditions (clptur), the rough-
wall boundary conditions (clptrg) and the symmetry boundary conditions for the velocities and the
Reynolds stress tensor (clsyvt) are treated in dedicated subroutines.
The subroutine condli provides as an output pairs of coefficients Ab and Bb for each variable f and for
each boudary face. These are used for the calculation of the discrete terms in the equations to be solved.
More specifically, these coefficients are used to calculate a value at the boundary faces fb,int (localised
at the centre of the boundary face, barycentre of its vertices) by the relation fb,int = Ab + Bb fI 0 , where
fI 0 is the value of the variable at point I 0 . I 0 is the projection onto the centre of the cell adjoin to the
boundary on the line normal to the boundary face and passing by its centre (see figure IV.F.1).

Discretisation

Notation
On designera dans la suite par VarScalaire toute variable

- autre que la vitesse, la pression, les grandeurs turbulentes k, , Rij , , f et ,

- solution dune equation de convection-diffusion.


1 except with the compressible module, see. cfxtcl
2 The other variables (the physical properties for instance) have a different treatment which will not be detailed here
(for instance, for the density, the user defines directly the values at the boundary. This information is then stored ; one
is referred to usphyv or phyvar for more information).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 177/402

Bord du domaine de calcul


Sb
Domaine de calcul 11111111
00000000
00000000
11111111
00000000
11111111
00000000
11111111
I
00000000
11111111 n normale sortante
00000000
11111111
00000000
11111111 de norme 1
I F 00000000
11111111
00000000
11111111
y
f
00000000
11111111
00000000
11111111
fI b,int 00000000
11111111
fb,ext fimp,ext
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
Coefficients dechange
h himp,ext
int
h
b

Figure IV.F.1: Boundary cell.

La denomination VarScalaire pourra en particulier designer la temperature, un scalaire passif, une frac-
tion massique ou (sauf mention contraire explicite) la variance des fluctuations dune autre VarScalaire.
Les variables detat deduites (masse volumique, viscosite...) ne seront pas designees par VarScalaire.

Repr
esentation des conditions aux limites standard dans usclim

Des conditions aux limites standardisees peuvent etre fournies par lutilisateur dans usclim. Il est pour
cela necessaire daffecter un type aux faces de bord des cellules concernees3 . Les conditions prevues
par defaut sont les suivantes :

Entr ee : correspond `a une condition de Dirichlet sur toutes les variables transportees (vitesse,
variables turbulentes, VarScalaires...), et `a une condition de Neumann homog`ene (flux nul) sur
la pression.

Sortie :
- lorsque le flux de masse est effectivement dirige vers lexterieur du domaine, ce choix cor-
respond ` a une condition de Neumann homog`ene sur toutes les variables transportees et
2P
a
` = 0, pris en compte sous forme de Dirichlet pour la pression (n et ( i )i{1,2}
n i
designent respectivement le vecteur normal de la face de sortie consideree et deux vecteurs
normes, orthogonaux entre eux et dans le plan de la face de sortie). Cette condition est
appliquee de mani`ere explicite en utilisant le champ de pression et son gradient au pas de
temps precedent. En outre, la pression etant definie `a une constante pr`es, elle est recalee en
un point de sortie pour y conserver la valeur P0 (on evite ainsi toute derive vers des valeurs
a lecart maximal de pression sur le domaine)4 .
tr`es grandes relativement `
- lorsque le flux de masse est dirige vers linterieur du domaine, situation peu souhaitable a
priori5 , on impose une condition de Dirichlet homog`ene sur la vitesse (pas sur le flux de
masse), ` a defaut de connatre sa valeur en aval du domaine. La pression est traitee comme
3 Laffectationdun type se fait en renseignant le tableau ITYPFB.
4 Lorsquilny a pas de sortie, le spectre des valeurs propres de la matrice est decal
e dune valeur constante afin de
rendre le syst`
eme inversible : voir matrix.
5 Un message indique a` lutilisateur combien de faces de sortie voient un flux de masse entrer dans le domaine.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 178/402

dans le cas precedent o`


u le flux de masse est dirige vers lexterieur du domaine. Pour les
variables autres que la vitesse et la pression, deux cas se presentent :
- on peut imposer une condition de Dirichlet pour representer la valeur du scalaire intro-
duit dans le domaine par les faces de bord concernees.
- on peut imposer, comme lorsque le flux de masse est sortant, une condition de Neumann
homog`ene (ceci nest pas une situation souhaitable, puisque linformation portee sur les
faces de bord provient alors de laval de lecoulement local). Cest le cas par defaut si
lon ne donne pas de valeur pour le Dirichlet.
Paroi : on se reportera ` a clptur (ou `a clptrg pour les parois rugueuses) pour une description du
traitement des conditions aux limites de paroi (supposees impermeables au fluide). Bri`evement,
on peut dire ici quune approche par lois de paroi est utilisee afin dimposer la contrainte tan-
gentielle sur la vitesse. La paroi peut etre defilante6 . Les VarScalaires recoivent par defaut une
condition de Neumann homog`ene (flux nul). Si lon souhaite imposer une valeur en paroi pour
ces variables (par exemple, dans le cas dune paroi `a temperature imposee) une loi de similitude
est utilisee pour determiner le flux au bord en tenant compte de la couche limite. Dans le cas
des couplages avec SYRTHES, Code Saturne recoit une temperature de paroi et fournit un flux
thermique. La condition de pression standard est une condition de Neumann homog`ene7 .

Sym etrie : correspond `a des conditions de Neumann homog`enes pour les grandeurs scalaires
et `
a des conditions de symetrie classiques pour les vecteurs (vitesse) et les tenseurs (tensions de
Reynolds) : voir clsyvt.

6 On doit alors fournir les composantes de la vitesse de la paroi.


7 On pourra se reporter ` a gradrc pour la condition conduisant ` a lextrapolation de la pression au bord, condition
pilotable par lutilisation de la variable EXTRAP.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 179/402

Repr
esentation des conditions aux limites sp
ecifiques dans usclim

On a vu que laffectation ` a une face de bord dun type standard (entree, sortie, paroi, symetrie)
permettait dappliquer simplement ` a lensemble des variables un assortiment de conditions aux limites
coherentes entre elles pour les types usuels de fronti`ere physique.
Une solution consiste ` a definir dans usclim, pour chaque face de bord et chaque variable, des condi-
tions aux limites specifiques8 (celles-ci, comme les conditions standards, se ram`enent finalement `a des
conditions de type mixte).
Les deux approches ne sont pas necessairement incompatibles et peuvent meme se reveler complementaires.
En effet, les conditions aux limites standards peuvent etre surchargees par lutilisateur pour une ou
plusieurs variables donnees. Il convient cependant de sassurer que, dune facon ou dune autre, une
condition `a la limite a ete definie pour chaque face de bord et chaque variable.
Des conditions de compatibilite existent egalement entre les differentes variables (voir vericl):

- en entree, paroi, symetrie ou sortie libre, il est important que toutes les composantes de la vitesse
aient le meme type de condition ;
- lorsque la vitesse recoit une condition de sortie, il est important que la pression recoive une
condition de type Dirichlet. Pour plus de details, on se reportera au paragraphe relatif ` a la
condition de sortie pour la pression, page 183 ;

- lorsquune des variables de vitesse ou de turbulence recoit une condition de paroi, il doit en etre
de meme pour toutes ;
- lorsquune des composantes Rij recoit une condition de symetrie, il doit en etre de meme pour
toutes ;

- lorsquune VarScalaire recoit une condition de paroi, la vitesse doit avoir le meme type de con-
dition.

8 Les conditions aux limites sp


ecifiques sont cod
ees en renseignant directement les tableaux ICODCL et RCODCL pour
chaque face de bord et chaque variable : des exemples sont fournis dans usclim.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 180/402

Repr
esentation interne des conditions aux limites

Objectif
Les conditions fournies par lutilisateur sont retraduites sous forme de couples de coefficients Ab et
Bb pour chaque variable f et chaque face de bord. Ces coefficients sont utilises pour le calcul des
termes discrets intervenant dans les equations `a resoudre et permettent en particulier de determiner
une valeur de face de bord fb,int . Il est important dinsister d`es `a present sur le fait que cette valeur
est, de mani`ere generale, une simple valeur numerique qui ne refl`ete pas necessairement une realite
physique (en particulier aux parois, pour les grandeurs affectees par la couche limite turbulente). On
detaille ci-dessous le calcul de Ab , Bb et de fb,int .
Notations

- On consid`ere lequation (IV.F.1) portant sur le scalaire f , dans laquelle represente la masse
volumique, u la vitesse, la conductivite et S les termes sources additionnels. C est defini plus
bas.
f  
+ div(uf ) = div f + S (IV.F.1)
t C
- Le coefficient represente la somme des conductivites moleculaire et turbulente (selon les mod`eles
t
utilises), soit = m + t , avec, pour une modelisation de type viscosite turbulente, t = C ,
t
u t est le nombre de Prandtl turbulent9 .
o`
- Le coefficient Cp represente la chaleur specifique, dunite m2 s2 K 1 = J kg 1 K 1 .
- On note la conductivite thermique, dunite kg m s3 K 1 = W m1 K 1 .
- Il convient de preciser que C = 1 pour toutes les variables hormis pour la temperature, cas dans
m
lequel on a10 C = Cp . Dans le code, cest la valeur de que lutilisateur doit fournir (si
C
la propriete est constante, les valeurs sont affectees dans usini1 `a VISCL0 pour la vitesse et `a
VISLS0 pour les VarScalaires ; si la propriete est variable, ce sont des tableaux equivalents qui
doivent etre renseignes dans usphyv).
- Pour la variance des fluctuations dune VarScalaire, la conductivite et le coefficient C sont
herites de la VarScalaire associee.

Condition de type Dirichlet simple : lorsque la condition est une condition de Dirichlet simple,
on obtient naturellement (cas particulier de (IV.F.6)) :
fb,int = freel (IV.F.2)
| {z } | {z }
valeur de bord utilis
ee par le calcul valeur r
eelle impos
ee au bord

a la limite porte sur la donnee dun flux, il sagit dun flux diffusif11 .
Autres cas : lorsque la condition `
On a alors :
int = reel (IV.F.3)
| {z } | {z }
flux diffusif transmis au domaine interne flux diffusif r
eel impos
e au bord
9 Le nombre de Prandtl turbulent est sans dimension et, dans certains cas usuels, pris egal `
a 0, 7.
10 Plus exactement, on a C = Cp pour toutes les VarScalaires f que lon souhaite traiter comme la temp erature pour
les conditions aux limites. Ces VarScalaires sont rep erables par lutilisateur au moyen de lindicateur ISCSTH=1. Par
defaut cet indicateur est positionn e`
a la valeur 0 pour toutes les VarScalaires (qui sont alors trait ees comme des scalaires
passifs avec C = 1) hormis pour la variable thermique eventuelle (ISCALTi`eme VarScalaire), pour laquelle on a ISCSTH=1 :
on suppose par d efaut que la variable thermique est la temp erature et non lenthalpie. Si lon souhaite r esoudre en
enthalpie, il faut positionner ISCSTH ` a la valeur 2 pour la variable thermique. Pour le compressible, la variable thermique
est l
energie, identifi ee par ISCSTH=3. On se reportera ` a cfxtcl pour le traitement des conditions aux limites.
11 En effet, le flux total sortant du domaine est donn e par la somme du flux convectif (si la variable est effectivement
convect ee) et du flux diffusif. N eanmoins, pour les parois etanches et les sym etries, le flux de masse est nul et la condition
se reduit a
` une contrainte sur le flux diffusif. De plus, pour les sorties (flux de masse sortant), la condition ` a la limite ne
porte que sur le flux diffusif (souvent une condition de Neumann homog` ene), le flux convectif d ependant des conditions
amont (il na donc pas besoin de condition a ` la limite). Enfin, aux entr ees, cest le plus souvent une condition de Dirichlet
simple qui est appliqu ee et le flux diffusif sen deduit.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 181/402

Le flux diffusif reel impose peut etre donne

- directement (condition de Neumann), soit reel = imp,ext ou


- deduit implicitement de deux informations imposees : une valeur externe fimp,ext et un coefficient
dechange himp,ext (condition de Dirichlet generalisee).

Selon le type de condition (Dirichlet ou Neumann) et en prenant pour hypoth`ese la conservation du


flux dans la direction normale au bord, on peut alors ecrire (voir figure IV.F.1) :


himp,ext (fimp,ext fb,ext ) (condition de Dirichlet)
|
{z }
reel impos
e
hint (fb,int fI 0 ) = hb (fb,ext fI 0 ) =
| {z } | {z } imp,ext (condition de Neumann)
int b

| {z }
reel impos
e

(IV.F.4)
Le rapport entre le coefficient hb et le coefficient hint rend compte de limportance de la traversee de
la zone proche du bord et revet une importance particuli`ere dans le cas des parois le long desquelles
se developpe une couche limite (dont les proprietes sont alors prises en compte par hb : se reporter ` a
clptur). Dans le cadre plus simple considere ici, on se limitera au cas hb = hint et fb,ext = fb,int = fb .
La relation (IV.F.4) secrit alors :



himp,ext (fimp,ext fb ) (condition de Dirichlet)
|
{z }
r
eel impos
e
hint (fb fI 0 ) = (IV.F.5)
| {z } imp,ext (condition de Neumann)
int

| {z }
reel impos
e

En rearrangeant, on obtient la valeur de bord :


himp,ext hint


fimp,ext + fI 0 (condition de Dirichlet)
fb = h int + h imp,ext hint + himp,ext (IV.F.6)
1
imp,ext + fI 0 (condition de Neumann)


hint

Conclusion : on notera donc les conditions aux limites de mani`ere generale sous la forme :

f b = Ab + B b f I 0 (IV.F.7)

avec Ab et Bb definis selon le type des conditions :



himp,ext
Ab =

fimp,ext 1
hint + himp,ext Ab = imp,ext

Dirichlet hint Neumann hint (IV.F.8)
Bb =

Bb = 1
hint + himp,ext
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 182/402

Remarques

- La valeur fI 0 est calculee en utilisant le gradient cellule de f , soit : fI 0 = fI + II 0 fI .


- Il reste `
a preciser la valeur de hint . Il sagit dune valeur numerique, nayant a priori aucun
rapport avec un coefficient dechange physique, et dependante du mode de calcul du flux diffusif

dans la premi`ere maille de bord. Ainsi hint = 0 (lunite sen deduit naturellement).
IF
m
- On rappelle que dans le code, cest la valeur de que lutilisateur doit fournir. Si la propriete
C
est constante, les valeurs sont affectees dans usini1 `a VISCL0 pour la vitesse (viscosite dynamique
moleculaire en kg m1 s1 ) et a` VISLS0 pour les VarScalaires (par exemple, pour la temperature

et lenthalpie, en kg m1 s1 ). Si la propriete est variable en espace ou en temps, ce sont
Cp
des tableaux equivalents qui doivent etre renseignes dans usphyv. En outre, la variance des
m
fluctuations dune VarScalaire herite automatiquement la valeur de de la VarScalaire associee
C
(Code Saturne 1.1 et suivantes).
- On rappelle egalement, car ce peut etre source derreur, que dans le code, on a :

- pour la temperature m = et C = Cp

- pour lenthalpie m = et C = 1
Cp

Exemples de cas particuliers

- Dans le cas dune condition de Dirichlet, lutilisateur est donc conduit `a fournir deux donnees :
fimp,ext et himp,ext . Pour obtenir une condition de Dirichlet simple (sans coefficient dechange) il
suffit dimposer himp,ext = +. Cest le cas dutilisation le plus courant (en pratique, himp,ext =
1030 ).
- Dans le cas dune condition de Neumann, lutilisateur fournit une seule valeur imp,ext (nulle
pour les conditions de Neumann homog`enes).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 183/402

Condition de sortie pour la pression

On precise ici la condition de sortie appliquee `a la pression dans le cas des sorties standards. Il est
necessaire dimposer une condition de type Dirichlet (accompagnee dune condition de type Neumann
homog`ene sur les composantes de la vitesse). On la calcule `a partir des valeurs de la variable au pas
de temps precedent.

- En raisonnant sur une configuration simple (de type canal, avec une sortie plane, perpendiculaire
a lecoulement), on peut faire lhypoth`ese que la forme des profils de pression pris sur les surfaces
`
parall`eles `
a la sortie est inchangee aux alentours de celle-ci (hypoth`ese dun ecoulement etabli,
2P
loin de toute perturbation). Dans cette situation, on peut ecrire = 0 (n est le vecteur
n i
normal ` a la sortie, i represente une base du plan de sortie).
- Si, de plus, on peut supposer que le gradient de pression pris dans la direction perpendiculaire
aux faces de sortie est uniforme au voisinage de celle-ci, le profil `a imposer en sortie (valeurs pb )
se deduit du profil pris sur un plan amont (valeurs pamont ) en ajoutant simplement la constante
R = d (p).n (o` u d est la distance entre le plan amont et la sortie), soit pb = pamont + R (le fait
que R soit identique pour toutes les faces de sortie est important afin de pouvoir leliminer dans
lequation (IV.F.9) ci-dessous).
- Avec lhypoth`ese supplementaire que les points I 0 relatifs aux faces de sortie sont sur un plan
parall`ele `
a la sortie, on peut utiliser les valeurs en ces points (pI 0 ) pour valeurs amont soit
pamont = pI 0 = pI + II 0 .p.
- Par ailleurs, la pression etant definie `a une constante pr`es (ecoulement incompressible) on peut
fixer sa valeur arbitrairement en un point A (centre dune face de sortie choisie arbitrairement12 )
a p0 (valeur fixee par lutilisateur, egale `a P0 et nulle par defaut), et donc decaler le profil impose
`
en sortie en ajoutant :
R0 = p0 (pamont,A + R) = p0 (pI 0 ,A + R).
- On obtient donc finalement :
pb = p I 0 + R + R0
= pI 0 + R + p0 (pI 0 ,A + R)
= pI 0 + p0 pI 0 ,A (IV.F.9)
| {z }
valeur constante R1
= p I 0 + R1

On constate donc que la condition de pression en sortie est une condition de Dirichlet dont les valeurs
sont egales aux valeurs de la pression (prises au pas de temps precedent) sur le plan amont des points
I 0 et recalees pour obtenir P0 en un point de sortie arbitraire.

Points a` traiter

Repr esentation des conditions par une valeur de face


Bien que la methode utilisee permette une simplicite et une homogeneite de traitement de toutes les
conditions aux limites, elle est relativement restrictive au sens o`
u une seule valeur ne suffit pas toujours
pour representer les conditions `a appliquer lors du calcul de termes differents.
Ainsi, en k a-t-il ete necessaire, lors du calcul des conditions aux limites de paroi, de disposer
de deux couples (Ab , Bb ) afin de prendre en compte les conditions `a appliquer pour le calcul de la
contrainte tangentielle et celles `a utiliser lors du calcul du terme de production (et un troisi`eme jeu de
12 premi`
ere face de sortie rencontr
ee en parcourant les faces de bord dans lordre naturel induit par la num
erotation
interne au code
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 184/402

coefficients serait necessaire pour permettre le traitement des gradients intervenant dans les termes de
gradient transpose, dans visecv).
Peut-etre pourrait-il etre utile de mettre en place une methode permettant dutiliser (au moins en
certains points strategiques du code) directement des forces, des contraintes ou des flux, sans passer
necessairement par le calcul dune valeur de face.

Condition de sortie en pression


La condition de pression en sortie se traduit par pf = pI 0 + R1 et le profil obtenu correspond au profil
amont pris aux points I 0 et recale pour obtenir p0 en un point A arbitraire. Ce type de condition
est applique sans precautions, mais nest pas toujours justifie (une condition de Dirichlet basee sur
la valeur calculee directement aux faces de bord pourrait etre plus adaptee). Les hypoth`eses sont en
particulier mises en defaut dans les cas suivants :

- la sortie est proche dune zone o`


u lecoulement nest pas etabli en espace (ou varie en temps) ;
- la sortie nest pas une surface perpendiculaire `a lecoulement ;
- le gradient de pression dans la direction normale `a la sortie nest pas le meme pour toutes les
faces de sortie (dans le cas de sortie multiples, par exemple, le gradient nest probablement pas
le meme au travers de toutes les sorties) ;
- les points I 0 ne sont pas sur une surface parall`ele `a la sortie (cas des maillage irreguliers par
exemple).

Par ailleurs, en labsence de condition de sortie, il pourrait peut-etre se reveler utile de fixer une valeur
de reference sur une cellule donnee ou de ramener la moyenne de la pression `a une valeur de reference
(avec le decalage du spectre, on assure linversibilite de la matrice `a chaque pas de temps, mais il
faudrait verifier si la pression nest pas susceptible de deriver au cours du calcul).

Termes non pris en compte


Les conditions aux limites actuelles semblent causer des difficultes lors du traitement du terme de
gradient transpose de la vitesse dans lequation de Navier-Stokes (terme traite de mani`ere explicite en
temps). Il est possible de debrancher ce terme en positionnant le mot cle IVISSE `a 0. Sa valeur par
defaut est 1 (les termes en gradient transpose sont pris en compte).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 185/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 186/402

G- covofi routine

Fonction
Dans ce sous-programme, on resout :
F soit l
equation de convection-diffusion dun scalaire en presence de termes sources :

(a)
+ div ((u) a) div (Ka) = Tsimp a + Tsexp + ai (IV.G.1)
t | {z } | {z }
convection diffusion

Ici a represente la valeur instantanee du scalaire en approche laminaire ou, en approche RANS, sa
moyenne de Reynolds e a. Les deux approches etant exclusives et les equations obtenues similaires, on
utilisera le plus souvent aussi la notation a pour e
a.
F soit, dans le cas dune modelisation RANS, la variance de la fluctuation dun scalaire en presence de
termes sources1 :
g2 )
(a g2 ) div (K a
+ div (( u) a g2 ) = T imp a
g2 + T exp + a
g2
s s i
t | {z } | {z }
convection diffusion
t g2 (IV.G.2)
a)2
+2 (e a
t Rf k
| {z }
termes de production et de dissipation dus `
a la turbulence moyenne

g2 represente ici la moyenne du carre des fluctuations2 de a. K, , T imp et T exp representent respec-
a s s
tivement le coefficient de diffusion, la valeur du terme source de masse, les termes sources implicite
g2 . et sont respectivement la viscosite turbulente et le nombre de
et explicite du scalaire a ou a t t
Schmidt ou de Prandtl turbulent, est la dissipation de lenergie turbulente k et Rf definit le rapport
g2 (R est constant selon le mod`ele assez simple
constant entre les echelles dissipatives de k et de a f
adopte ici).
On ecrit les deux equations precedentes sous la forme commune suivante :

(f )
+ div (( u)f ) div (Kf ) = Tsimp f + Tsexp + fi + Tspd (IV.G.3)
t
g2 :
avec, pour f = a ou f = a

0 pour f = a,
Tspd = t g2 g2 (IV.G.4)
2 a)2
(e a pour f = a
t Rf k

(f )
Le terme est decompose de la sorte :
t
(f ) f
= +f (IV.G.5)
t t t
1 Davroux A. et Archambeau F. : Calcul de la variance des fluctuations dun scalaire dans le solveur commun.

Application `a lexp
erience du CEGB dite Jet in Pool, HE-41/99/043.
g2 , sous forme discr`
2 a et a ete en espace, correspondent donc en fait `a des vecteurs dimensionn
es a
` NCELET de com-
posantes a et ag2 respectivement, I d ecrivant lensemble des cellules.
I I
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 187/402

En utilisant lequation de conservation de la masse (cf. predvv), lequation precedente secrit finale-
ment :
f
+ div (( u) f ) div (K f ) = Tsimp f + Tsexp + (fi f ) + Tspd + f div ( u) (IV.G.6)
t


Discretisation
Pour integrer lequation (IV.G.6), une discretisation temporelle de type -schema est appliquee `
a la
variable resolue3 :
f n+ = f n+1 + (1 ) f n (IV.G.7)

Lequation (IV.G.6) est discretisee au temps n + en supposant les termes sources explicites pris au
temps n + S , et ceux implicites en n + . Par souci de clarte, on suppose, en labsence dindication,
que les proprietes physiques (K, ,...) et le flux de masse ( u) sont pris respectivement aux instants
n + et n + F , o` u et F dependent des schemas en temps specifiquement utilises pour ces
grandeurs4 .

f n+1 f n
+ div (( u) f n+ ) div ( K f n+ ) = Tsimp f n+ + Tsexp, n+S
t | {z } | {z } (IV.G.8)
convection diffusion
+( fi )n+S n f n+ + Tspd, n+S + f n+ div (u)
o`
u:
0
pour f = a,
Tspd, n+S =
n+S n (IV.G.9)

t g2 n+ g2
2
a)2
(e n
(a ) pour f = a
t Rf k
Le terme de production affecte dun indice n + S est un terme source explicite et il est donc traite
comme tel :
n+S
n n1

t
a)
(e 2
= (1 + S ) t (e an )2 S t (e an1 )2 (IV.G.10)
t t t

Lequation (IV.G.6) secrit :


f n+1 f n
+ div (( u) f n+1 ) div ( K f n+1 )
 timp 
Ts n + Tspd, imp + div ( u) f n+1 (IV.G.11)
= (1 ) Tsimp f n + Tsexp, n+S + ( fi )n+S (1 ) n f n + Tspd, exp Tspd, imp f n
+(1 ) f n div ( u) (1 ) div (( u) f n ) + (1 ) div ( K f n )
avec :
0 pour f = a,
Tspd, imp = n g2 (IV.G.12)
pour f = a
Rf k n

0
pour f = a,
pd, exp n+S n
Ts = (IV.G.13)

t g2 n g2
2
a)2
(e (a ) pour f = a
t Rf k n
On rappelle que, pour un scalaire f , le sous-programme codits resout une equation du type suivant
fsimp (f n+1 f n ) + div (( u) f n+1 ) div ( K f n+1 )
= fsexp (1 ) div (( u) f n ) + (1 ) div ( K f n ) (IV.G.14)
| {z }
convection diffusion explicite
3 Si = 1/2, ou quune extrapolation est utilis
ee, le pas de temps t est suppos
e uniforme en temps et en espace.
4 cf. introd
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 188/402

fsexp represente les termes sources discretises de mani`ere explicite en temps (hormis contributions de
la convection diffusion explicite provenant du -schema) et fsimp f n+1 represente les termes lineaires
en f n+1 dans lequation discretisee en temps.
On reecrit lequation (IV.G.11) sous la forme (IV.G.15) qui est ensuite resolue par codits.
 
Tsimp + n Tspd, imp div ( u) f n+1
| t {z }
fsimp
n+1
+ div ( (u) f ) div (K f n+1 ) = (IV.G.15)
Tsimp n
f + Tsexp, n+S+ (fi )n+S
n f n + Tspd, exp + f n div ( u)
| {z }
fsexp
(1 ) div ( (u) f ) + (1 ) div (K f n )
n

Mise en uvre
On distingue deux cas suivant le type de schema en temps choisi pour les termes sources :
Si les termes sources ne sont pas extrapoles, toutes les contributions du second membre vont directe-
ment dans le vecteur SMBRS.
Sinon, un vecteur supplementaire est necessaire afin de stocker les contributions du pas de temps
precedent (PROPCE). Dans ce cas :

- le vecteur PROPCE sert `a stocker les contributions explicites du second menbre au temps n 1
(pour lextrapolation en n + S ).
- le vecteur SMBRS est complete au fur et `a mesure.

Lalgorithme de ce sous-programme est le suivant :

mise `
a zero des vecteurs representants le second membre (SMBRS) et de la diagonale de la matrice
(ROVSDT).
calcul des termes sources du scalaire definis par lutilisateur en appelant le sous-programme
ustssc.

? Si les termes sources sont extrapoles, SMBRS recoit S fois la contribution au temps n 1 des
termes sources qui sont extrapoles (stockes dans PROPCE). La contribution des termes sources
utisateurs (au pas temps courant) est repartie entre PROPCE (pour la partie Tsexp qui est `a stocker
en vue de lextrapolation) et SMBRS (pour la partie explicite provenant de lutilisation du schema
pour Tsimp ). La contribution implicite est alors mise dans ROVSDT (apr`es multiplication par )
quel que soit son signe, afin de ne pas utiliser des discretisations temporelles differentes entre
deux pas de temps successifs, dans le cas par exemple o` u Tsimp change de signe5 .

? Sinon la contibution de Tsexp est directement mise dans SMBRS. Celle de Tsimp est ajoutee
a ROVSDT si elle est positive (de mani`ere `a conserver la dominance de la diagonale), ou explicitee
`
et mise dans le second membre sinon.

prise en compte des physiques particuli`eres : arc electrique, rayonnement, combustion gaz et
charbon pulverise. Seuls les vecteurs ROVSDT et SMBRS sont completes (schema dordre 1 sans
extrapolation).
5 cf. predvv
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 189/402

ajout des termes sources de masse en (fi f ) par appel au sous-programme catsma.

? Si les termes sources sont extrapoles, le terme explicite en fi est stocke dans PROPCE. Le
-schema est applique au terme implicite, puis les contributions implicite et explicite reparties
entre ROVSDT et SMBRS.

? Sinon, la partie implicte en f va dans ROVSDT, et tout le reste dans SMBRS.

calcul du terme daccumulation de masse en div (u) par appel `a divmas et ajout de sa contri-
bution dans SMBRS, et dans ROVSDT apr`es multiplication par 6 .
ajout du terme instationnaire `
a ROVSDT.
t g2
calcul des termes de production (2 a)2 ) et de dissipation (
(e a ) si on etudie la variance
t Rf k
des fluctuations dun scalaire avec un mod`ele de turbulence de type RANS. Ce calcul seffectue
en calculant prealablement le gradient du scalaire f par appel au sous-programme grdcel.

? Si les termes sources sont extrapoles, la production est mise dans PROPCE puis lenergie cinetique
k et la dissipation turbulentes sont calculees (XK et XE) en fonction du mod`ele de turbulence
g2
utilise. SMBRS recoit a au temps n et ROVSDT le coefficient dimplicitation apr`es
Rf k Rf k
multiplication par THETAP = .

? Sinon, la production va dans SMBRS, et la dissipation est repartie de la meme mani`ere que
precedemment avec THETAP = 1.

une fois la contribution de tous les termes sources calcules, le second membre est assemble, et le
vecteur PROPCE ajoute apr`es multiplication par 1 + S `a SMBRS, dans le cas o`
u les termes sources
sont extrapoles.
calcul du coefficient de diffusion K au centre des cellules, et des valeurs aux faces par appel au
sous-programme viscfa.
resolution de lequation compl`ete (avec les termes de convection diffusion) par un appel au sous-
programme codits avec fsexp = SMBRS et fsimp = ROVSDT.
ajustement (clipping) du scalaire ou de la fluctuation du scalaire en appelant le sous-programme
clpsca.
n
impression du bilan explicite dexpression ||En (f n ) ( f n+1 f n )|| , o`
u ||.|| designe la norme
t
euclidienne.

On resume dans les tableaux IV.G.16 et IV.G.17 les differentes contributions (hors convection-diffusion)
affectees `
a chacun des vecteurs PROPCE, SMBRS et ROVSDT suivant le schema en temps choisi pour les
termes sources. En labsence dindication, les proprietes physiques , , ... sont supposees prises en au
temps n + , et le flux de masse ( u) pris au temps n + F , les valeurs de F et de dependant du
type de schema selectionne specifiquement pour ces grandeurs7 .

6 cette op
eration est faite quel que soit le sch
ema en temps de facon `
a rester coh
erent avec ce qui est fait dans bilsc2
7 cf. introd
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 190/402

Avec extrapolation des termes sources :

n
ROVSDTn Tsimp div ( u) + n +
t Rf k n
n

PROPCEn Tsexp, n + n fin + 2 t (f n )2
t
n n
SMBRSn (1 + S ) PROPCEn S PROPCEn1 + Tsimp f n + div ( u) f n n f n f
Rf k n
(IV.G.16)

Sans extrapolation des termes sources :

n
ROVSDTn + M ax(Tsimp , 0) div ( u) + n +
t Rf k n
n
t (IV.G.17)
SMBRSn Tsexp + Tsimp f n + div ( u) f n + n ( fin f n ) n
f n + 2 (f n )2
Rf k t

Points a` traiter

Int
egration du terme de convection-diffusion
Dans ce sous-programme, les points litigieux sont dus `a lintegration du terme de convection-diffusion.
On renvoie donc le lecteur au sous-programme bilsc2 qui les explicite.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 191/402

Annexe 1 : Inversibilite de la matrice EM n


Dans cette section, on va etudier plus particuli`erement linversibilite de la matrice EM n , matrice du
syst`eme lineaire ` a EMn pour le cas dun schema en temps de type Euler implicite
a resoudre associee `
dordre un ( = 1). Pour toutes les notations, on se reportera `a la documentation sur le sous-programme
covofi. On va montrer que la demarche adoptee permet de sassurer que la matrice des syst`emes de
convection-diffusion dans les cas courants est toujours inversible.

Introduction
Pour montrer linversibilite, on va utiliser le fait que la dominance stricte de la diagonale limplique8 .
On cherche donc ` a determiner sous quelles conditions les matrices de convection diffusion sont ` a
diagonale strictement dominante.

On va montrer quen incluant dans la matrice le terme en div ( u) issu de , on peut etablir directe-
t
9
ment et exactement la propriete. Par contre, si ce terme nest pas pris en compte dans la matrice, il
est necessaire de faire intervenir le pendant discret de la relation :
Z
div ( u) d = 0 (IV.G.18)
i

Cette relation nest cependant verifiee au niveau discret qu`a la precision du solveur de pression pr`es
(et, en tous les cas, ne peut etre approchee au mieux qu`a la precision machine pr`es). Il parat donc
preferable de sen affranchir.

Avant dentrer dans les details de lanalyse, on rappelle quelques proprietes et definitions.
Soit C une matrice carree dordre N, delement generique Cij . On a par definition :
Definition : La matrice C est `
a diagonale strictement dominante ssi
j=N
X
i [1, N ], |Cii | > |Cij | (IV.G.19)
j=1, j6=i

On convient de dire que C est `


a diagonale simplement dominante ssi linegalite nest pas stricte,
soit :
j=N
X
i [1, N ], |Cii | > |Cij | (IV.G.20)
j=1, j6=i

Remarque : Si, sur chaque ligne, la somme des elements dune matrice est nulle, que les elements
extradiagonaux sont negatifs et que les elements diagonaux sont positifs, alors la matrice est `a diagonale
simplement dominante. Si la somme est strictement positive, la diagonale est strictement dominante.
On a limplication suivante :
Propriete : Si la matrice C est `
a diagonale strictement dominante, elle est inversible.

Cette propriete10 se demontre simplement si lon admet le theor`eme de Gerschgorin ci-dessous :


Theor`eme : Soit B une matrice carree dordre N dans C C, delement generique B ij , les valeurs
j=N
P
propres l de B sont, dans le plan complexe, telles que ||l Bii || C 6 ||Bij || C
j=1, j6=i

8 Ce faisant, on choisit cependant une condition forte et la demonstration nest probablement pas optimale.
9 Hormis dans le cas de conditions aux limites mixtes, quil conviendrait dexaminer plus en d etail.
10 Lascaux, P. et Theodor, R. : Analyse Num erique Matricielle Appliquee `
a lart de lIng
enieur, Tome 2, Ed. Masson.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 192/402

j=N
P
a elements reels, on ecrira ||l Bii || C 6
Si B est ` |Bij |
j=1, j6=i

Demontration de la propriete precedente :


Soit C `a diagonale strictement dominante `a elements reels. On montre quil est possible dinverser le
syst`eme CX = S dinconnue X, quel que soit le second membre S. Pour cela, on decompose C en
partie diagonale (D) et extradiagonale (E) soit :

C =DE

C etant `
a diagonale strictement dominante, tous ses elements diagonaux sont non nuls. D est donc
inversible (et les elements de linverse sont reels). On consid`ere alors la suite11 :

(X n )nN , avec X 0 = D1 S et DX n = S + EX n1
On peut ecrire :
k=n
X k
Xn = D1 E D1 S
k=0

Cette somme converge si le rayon spectral de B = D1 E est strictement inferieur `a 1. Or, la matrice
a diagonale strictement dominante. On a donc pour tout i N (`a partir de la relation (IV.G.19)
C est `
et en divisant par |Cii |) :
j=N
|Cii | X |Cij |
i [1, N ], >
|Cii | |Cii |
j=1, j6=i

ce qui secrit encore :


j=N j=N
|Dii | X |Eij | X
| D1 E ij |
 
i [1, N ], > =
|Dii | |Dii |
j=1, j6=i j=1, j6=i

ou bien :
j=N
X
i [1, N ], 1> |Bij |
j=1, j6=i

do`
u, avec le theor`eme de Gerschg
orin, une relation sur les valeurs propres l de B :
j=N
X
i [1, N ], ||l Bii || C 6 |Bij | < 1
j=1, j6=i

et comme Bii = 0 :
||l || C < 1
en particulier, la valeur propre dont la norme est la plus grande verifie egalement cette equation. Ceci
implique que le rayon spectral de B est strictement inferieur `a 1. La suite (X n )nN converge donc (et
la methode de Jacobi converge). Il existe donc une solution `a lequation CX = S. Cette solution est
unique12 et la matrice C est donc inversible.
11 On reconnat la methode de Jacobi
12 On peut le voir par labsurde. En effet, supposons quil existe deux solutions distinctes X1 et X2 ` a l
equation
CX = S. Alors Y = X2 X1 v erifie CY = 0, soit DY = EY , donc D1 EY = Y . Ceci signifie que Y (qui nest
pas nul, par hypoth` ese) est vecteur propre de D1 E avec = 1 pour valeur propre associee. Or, le rayon spectral de
D1 E est strictement inf etre une valeur propre de D1 E. En cons
` 1 et = 1 ne peut donc pas
erieur a equence, il ne
peut exister quune seule solution a ` lequation CX = S.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 193/402


Avec prise en compte des termes issus de dans EM n
t
Introduction
Pour montrer que la matrice EM n est inversible, on va montrer quelle est `a diagonale strictement
dominante. Pour cela, on va considerer successivement les contributions :
- des termes differentiels dordre 0 lineaires en f n+1,k+1 ,

- des termes issus de la prise en compte de ,
t
- des termes differentiels dordre 1 (convection),
- des termes differentiels dordre 2 (diffusion).
Pour chacune de ces contributions, on va examiner la dominance de la diagonale de loperateur lineaire
associe. Si, pour chaque contribution, la dominance de la diagonale est acquise, on pourra alors conclure
a la dominance de la diagonale pour la matrice (somme) compl`ete13 EM n et donc `a son inversibilite.
`


Contributions des termes differentiels
dordre 0 lineaires en f n+1,k+1
Lunique contribution est sur la diagonale : il faut donc verifier quelle est strictement positive.
Pour chaque ligne I, fsimp I (cf. (IV.G.15)) contient au minimum la quantite strictement positive14
nI |i |
. Les autres expressions, ( |i | (Tsimp )I , +|i | I , |i | (Tspd,imp ) I ), lorsquelles existent,
t
contribuent toutes positivement15 .
Loperateur lineaire associe `
a ces contributions verifie donc bien la dominance stricte de la diagonale
(propriete 1). Ce nest cependant pas vrai si on extrapole les termes source, `a cause de Tsimp . Il en
resulte une contrainte sur la valeur du pas de temps.


Contributions des termes differentiels dordre 1 et des termes issus de la prise

en compte de
t
Les termes consideres sont au nombre de deux dans (IV.G.11) :

- la contribution issue de la prise en compte de se retrouve dans fsimp I (equation IV.G.15),
t
- la contribution du terme de convection linearise.
Apr`es integration spatiale, la somme de ces deux termes discrets secrit :
1 X h i
( mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1 (IV.G.21)
2
jV ois(i)

1 X h i
+ ( mnbik + | mnbik | ) fIn+1,k+1 + ( mnbik |mnbik |) f bn+1,k+1 (IV.G.22)
2 ik
kb (i)

Pour chaque ligne I, on va chercher les proprietes de dominance de la diagonale en traitant separement
les faces internes (equation (IV.G.21)) et les faces de bord (equation (IV.G.22)).
la contribution des faces internes ij (facteur de fIn+1,k+1 ) `a la diagonale est positive ; la
contribution aux extradiagonales est negative (facteur de fJn+1,k+1 ) et la somme de ces contributions
13 Ce raisonnement nest pas optimal (la somme de valeurs absolues etant superieure `
a la valeur absolue de la somme),
mais permet dobtenir des conclusions dans le cas pr esent (condition suffisante).
14 Ceci permettra de conclure `
a la stricte dominance de la diagonale de la matrice somme compl` ete EM .
n
15 Le terme de dissipation 1 , spe cifique `
a l
e tude de la variance des fluctuations, est positif par d
efinition et ne
R k f
remet donc pas en cause la conclusion.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 194/402

est exactement nulle (equation (IV.G.21)). Si lon note CIJ les coefficients de la matrice issus de
J=N
P
la contribution de ces termes, on a donc |CII | > |CIJ | qui traduit la dominance simple
J=1, J6=I
(linegalite nest pas stricte) de la diagonale et r`egle la question des contributions des faces internes.
la contribution des faces de bord doit etre reecrite en utilisant lexpression des conditions aux
limites sur f pour preciser la valeur de f bik (on omet lexposant ( n + 1, k + 1) pour alleger les nota-
tions) :
- pour une condition de Dirichlet : f bik = 0,
- pour une condition de Neumann : f bik = fI ,
- pour une condition mixte (f bik = + fi ) : f bik = fI .

Pour la contribution des faces de bord, il faut alors considerer deux cas de figure possibles.

Le flux de masse au bord est positif ou nul ( mnbik = ( u)nbik . S bik > 0). Cette situation
correspond par exemple aux sorties standards (fluide sortant du domaine), aux symetries ou
aux parois etanches (flux de masse nul). Les contributions aux faces de bord sont alors toutes
nulles, quelles que soient les conditions aux limites portant sur la variable f . En consequence, la
diagonale issue de ces contribution est simplement dominante.
Le flux de masse au bord est strictement n egatif. Cette situation correspond `a une entree
de fluide dans le domaine. Les contributions considerees secrivent alors :
X h i
( mnbik ) fIn+1,k+1 + ( mnbik ) f bn+1,k+1
ik
(IV.G.23)
kb (i)

Il convient alors de distinguer plusieurs situations, selon le type de condition `a la limite portant
sur f :
F si la condition `
a la limite de f est de type Dirichlet, seule subsiste une contribution
positive ou nulle `
a la diagonale, qui assure donc la dominance simple :
X
( mnbik ) fIn+1,k+1 (IV.G.24)
kb (i)

F si la condition `
a la limite de f est de type Neumann, la somme des contributions dues
aux faces de bord est alors nulle, ce qui assure donc la dominance simple.
F si la condition `
a la limite de f est de type mixte, la contribution des faces de bord est
sur la diagonale et vaut :
1 X
(1 )( mnbik ) fIn+1,k+1 (IV.G.25)
2
kb (i)

On ne peut pas se prononcer quand `a la dominance de la diagonale, `a cause de la presence de


(1) (la valeur de est fixee par lutilisateur) et la demarche adoptee ici ne permet donc pas
de conclure. Il faut neanmoins noter que cette situation est rare dans les calculs standards. Elle
demande un complement danalyse et sera pour le moment exclue des considerations exposees
dans le present document.

On peut conclure, quand il ny a pas de condition `a la limite de type mixte, que la matrice associee
aux contributions des termes differentiels dordre 1 (convectifs) et `a la prise en compte des termes issus

de et est `
a diagonale simplement dominante.
t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 195/402


Contributions des termes differentiels dordre 2
On va considerer enfin les contributions des termes differentiels dordre 2 (issus du terme
div (K n f n+1,k+1 )). Pour ces termes, la contribution `a la diagonale est positive16 , negative aux
extradiagonales16 , compte tenu de :

div (K n f n+1,k+1 ) d
R
i
f n+1,k+1 fIn+1,k+1 X
n
f bn+1,k+1 fIn+1,k+1
K nij J
P
= . Sij K bik
ik
. Sbik
jV ois(i) I 0J 0 k (i)
I 0F
b

(IV.G.26)
Considerons deux cas :
- la cellule courante I na que des faces internes au domaine de calcul (pas de faces de bord).
La somme des contributions est nulle. On a donc dominance simple de la diagonale.
- la cellule courante I a des faces de bord. La somme des contributions diagonales et extra-
diagonales est positive quand on a une condition `a la limite de type Dirichlet ou de type Neumann
sur f . La diagonale est alors strictement dominante. Lorsquil y a des conditions `a la limite de
type mixte, il nest plus possible de conclure (situation ecartee precedemment).

On peut conclure, quand il ny a pas de condition `a la limite de type mixte, que la matrice associee
aux contributions des termes differentiels dordre 2 est au moins `a diagonale simplement dominante.

Conclusion
En travaillant sur des maillages non pathologiques (`a transmittivite positive, voir la note de bas de
page numero 16) et en nimposant pas de condition `a la limite de type mixte sur les variables, on
peut donc conclure que EM n est la somme de matrices `a diagonale simplement dominante et dune
matrice `
a diagonale strictement dominante (paragraphe G). Elle est donc `a diagonale strictement
dominante, et donc inversible (de plus, la methode iterative de Jacobi converge).


Sans prise en compte des termes issus de dans EM n
t
Introduction

Pour identifier les cas dans lesquels la matrice EM n est inversible, on va rechercher les conditions
qui assurent la dominance de la diagonale. Par rapport `a lanalyse presentee au paragraphe G, seules
diff`erent les considerations relatives aux contributions des termes differentiels dordre 1, puisquelles

sont traitees au paragraphe G avec les termes issus de la prise en compte de .
t


Contributions des termes differentiels dordre 1
La contribution du terme de convection est la seule `a prendre en compte. Elle secrit, dapr`es les
equations (IV.G.15) et la discretisation explicitee pour le sous-programme covofi :
1 X h i
( + mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1 (IV.G.27)
2
jV ois(i)
n
16 Ceci nest en fait pas toujours vrai. En effet, pour chaque face ij, la transmittivit e K0 0 Sij fait intervenir la
I J
mesure alg 0 0
ebrique du segment I J , o` 0 0
u I et J sont les projet es orthogonaux sur la normale `a la face du centre des
cellules voisines. Cette grandeur est une valeur alg
ebrique et peut th
eoriquement devenir n
egative sur certains maillages
pathologiques, contenant par exemple des mailles non convexes. On pourra se reporter au dernier point a ` traiter du
sous-programme matrix.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 196/402

1 X h i
( + mnbik + | mnbik | ) fIn+1,k+1 + ( mnbik |mnbik |) f bn+1,k+1 (IV.G.28)
2 ik
kb (i)

On constate que pour chaque ligne I, la contribution des faces internes (facteur de fIn+1,k+1 ) ` a la
n+1,k+1
diagonale est positive et quelle est negative aux extradiagonales (facteur de fJ ). Cependant,
contrairement au cas presente au paragraphe G, la somme de ces contributions nest pas nulle dans le
cas general. Pour obtenir un resultat quant `a la dominance de la diagonale, il faut faire intervenir la
version discr`ete de la propriete (IV.G.18) rappelee ci-dessous :
Z
div ( u) d = 0
i

Soit, sous forme discr`ete : X X


mnij + mnbik = 0 (IV.G.29)
jV ois(i) kb (i)

Il nest donc pas possible danalyser separement les contributions des faces internes et celles des faces
de bord (contrairement ` a la situation rencontree au paragraphe G). On se place ci-apr`es dans le cas
general dune cellule qui a des faces internes et des faces de bord (si elle na que des faces internes,
la demonstration est la meme, mais plus simple. On peut lecrire en considerant formellement que la
cellule a zero faces de bord, cest `a dire que b (i) est lensemble vide).

Il faut alors considerer deux cas de figure, selon la valeur du flux de masse aux faces de bord (eventuelles)
de la cellule :

Le flux de masse au bord est positif ou nul ( mnbik = ( u)nbik . S bik > 0). Cette situation
correspond `a des cellules qui ont des faces de bord de sortie standard (fluide sortant du domaine),
de symetrie ou de paroi etanche (flux de masse nul). Les contributions secrivent alors :
1 X h i X
( + mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1 + mnbik fIn+1,k+1
2
jV ois(i) kb (i)
(IV.G.30)
Dans ce cas, la somme des contributions `a la diagonale est positive, les contributions aux extradi-
agonales sont negatives et, avec la relation (IV.G.29), on verifie que la somme des contributions
diagonales et extradiagonales est nulle. On a donc dominance simple de la diagonale.
Le flux de masse au bord est strictement n egatif. Cette situation correspond `a des cellules
qui ont des faces de bord dentree standard (entree de fluide dans le domaine). Les contributions
considerees secrivent alors :
1 X h i X
( + mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1 + mnbik f bn+1,k+1
2 ik
jV ois(i) kb (i)
(IV.G.31)
Il convient alors de distinguer plusieurs situations, selon le type de condition `a la limite portant
sur f (on omet lexposant ( n + 1, k + 1) pour alleger les notations) :
- pour une condition de Dirichlet : f bik = 0,
- pour une condition de Neumann : f bik = fI ,
- pour une condition mixte (f bik = + fI ) : f bik = fI .
Selon le cas on se trouve dans une des situations suivantes :
F si la condition `a la limite de f est de type Dirichlet, la contribution des faces de
bord est nulle dans la matrice. La contribution des faces internes `a la diagonale est positive, la
mnij ,
P
contribution aux extradiagonales negative et la somme de ces contributions vaut
jV ois(i)
soit avec la relation (IV.G.29) :
X X
mnij = mnbik
jV ois(i) kb (i)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 197/402

Elle est strictement positive et la diagonale est donc strictement dominante.


F si la condition `a la
Plimiten de fn+1,k+1
est de type Neumann, la contribution des faces de
bord se reduit au terme : m bik fI . La somme des contributions `a la diagonale est
kb (i)
alors SCi :
1 X X
SCi = ( + mnij + | mnij | ) + mnbik
2
jV ois(i) kb (i)

En utilisant deux fois la relation (IV.G.29), on obtient donc pour la diagonale :



1 X X 1 X
SCi = | mnij | + mnbik = ( | mnij | mnij )
2 2
jV ois(i) kb (i) jV ois(i)

Cette grandeur est positive et egale `a loppose de la somme des termes extradiagonaux qui sont
tous negatifs. La diagonale est donc simplement dominante.
F si la condition `
a la limite de f est de type mixte, la somme des contributions dues aux
faces de bord est :
X
mnbik fIn+1,k+1 (IV.G.32)
kb (i)

On ne peut donc pas conclure quant au signe de cette contribution, le facteur etant choisi
librement par lutilisateur. Cette situation a ete ecartee dans le paragraphe G.

On peut donc conclure, quand il ny a pas de condition `a la limite de type mixte, que la matrice
associee aux contributions des termes differentiels dordre 1 (convectifs) est `a diagonale simplement
dominante, ` a condition que la relation (IV.G.29) soit verifiee exactement.

Conclusion
En travaillant sur des maillages non pathologiques (`a transmittivite positive, voir la note de bas de
page numero 16) et en nimposant pas de condition `a la limite de type mixte sur les variables, on peut
donc conclure que EM n est ` a diagonale strictement dominante, donc inversible (et la methode
iterative de Jacobi converge) ` a condition que la relation (IV.G.29) soit verifiee exactement. Ce nest
generalement pas le cas (la precision du solveur de pression et la precision machine sont finies). Meme
n |i |
si la contribution diagonale en I peut suffire `a assurer la dominance, on a cependant souhaite,
t

dans Code Saturne, saffranchir du probl`eme potentiel en prenant en compte les termes issus de
t
dans la matrice.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 198/402

Annexe 2 : Remarques a` propos du respect du principe du


maximum discret
Introduction
Les considerations exposees ici sont relatives au fait que, en continu, une variable qui nest que convectee
par un champ de debit ` a divergence nulle doit rester dans les bornes minimales et maximales definies
par les conditions initiales et par les conditions aux limites en espace. Ainsi, les valeurs dun scalaire
passif initialement nul dont les conditions aux limites sont des conditions de Neumann homog`ene et
des conditions de Dirichlet de valeur 1 devront necessairement rester comprises dans lintervalle [0 ; 1].
Cest ce que lon entend ici par principe du maximum.
Soient u un champ de vitesse fige et connu et t un reel positif. On consid`ere le probl`eme mod`ele P de
convection des variables scalaires et f , defini par :



+ div ( u) = 0
t (IV.G.33)
(f )

+ div (( u) f ) = 0
t
avec une condition initiale f 0 donnee ainsi que des conditions aux limites associees sur f de type
Dirichlet ou Neumann.
Dans Code Saturne, la deuxi`eme equation de P est reecrite en continu, en utilisant la premi`ere, sous la
forme :
f
f div ( u) + div (( u) f ) = 0 (IV.G.34)
t
et discretisee temporellement comme suit :

f n+1 f n
n f n+1 div ( u)n + div (( u)n f n+1 ) = 0 (IV.G.35)
t
Dans un premier temps, on va etudier la discretisation spatiale associee `a (IV.G.35), qui correspond

donc `a la prise en compte de la contribution de dans lequation en continu (et se traduit par la
t
n imp
presence de div (( u) ) dans lexpression de fs I ), puis dans un deuxi`eme temps, la discretisation
spatiale de lexpression ;

f n+1 f n
n + div (( u)n f n+1 ) = 0 (IV.G.36)
t
qui correspond `
a un probl`eme de convection pure classique.
On etudiera ensuite un exemple simplifie (monodimensionnel `a masse volumique constante).
Les considerations presentes meriteraient detre approfondies.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 199/402

eral
Cas gen
f n+1 f n

Discretisation spatiale de n f n+1 div ( u)n + div (( u)n f n+1 ) = 0
t
En integrant sur une cellule i ` a laide de la formulation volumes finis habituelle, on obtient :

f n+1 f n
Z
[n f n+1 div ( u)n + div (( u)n f n+1 )] d

i
t
| i | X X
= nI ( ( u)nij . S ij + ( u)nbik . S bik ) fIn+1
t (IV.G.37)
jV ois(i) kb (i)
P n n+1 P n n+1
+ ( u)ij . S ij ff ij + ( u) bik . S bik ff b ik
jV ois(i) kb (i)
|i | n
nI f
t I
u ffn+1
o` n+1
ij et ff b ik sont les valeurs de f aux faces internes et de bord issues du choix du sch
ema convectif.
En reprenant les notations precedentes, en imposant un schema decentre amont au premier membre
n+1,k+1
(i.e. en exprimant f ij et f bn+1,k+1
ik
) et en raisonnant en increments (cf. sous-programme
navstv), on aboutit `
a:

|i |
nI f n+1,k
tX I h
1 i
+ ( mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1
2
jV ois(i)
1 X h i
+ ( mnbik + | mnbik | ) fIn+1,k+1 + ( mnbik |mnbik |) f bn+1,k+1
2 ik
kb (i)
|i | (IV.G.38)
= n ( fIn+1,k fIn )
" t #
n+1,k
( u)nij . S ij f ij ( u)nbik . S bik f bn+1,k
P P
+ ik
jV ois(i) kb (i) !
( u)nij . S ij + ( u)nbik . S bik fIn+1,k
P P

jV ois(i) kb (i)

avec :
fIn+1,0 = fIn

(IV.G.39)
fIn+1,k+1 = fIn+1,k+1 fIn+1,k , k N
et (f n+1,k )kN suite convergeant vers f n+1 , n entier donne, solution de (IV.G.35) .
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 200/402

f n+1 f n

Discretisation spatiale de n + div (( u)n f n+1 ) = 0
t
En procedant de facon analogue et en adoptant les memes hypoth`eses, on obtient :
|i |
n f n+1,k+1
tX I h
1 i
+ ( + mnij + | mnij | ) fIn+1,k+1 + ( mnij | mnij |) fJn+1,k+1
2
jV ois(i)
1 X h i
+ ( + mnbik + | mnbik | ) fIn+1,k+1 + ( mnbik |mnbik |) f bn+1,k+1 (IV.G.40)
2 ik
kb (i)
|i |
= n ( fIn+1,k fIn )
" t #
( u)nij . S ij ffn+1,k u)nbik ffn+1,k
P P
ij + ( . S bik bik
jV ois(i) kb (i)

u ffn+1
(o` n+1
ij et ff b ik sont les valeurs de f aux faces internes et de bord issues du choix du sch
ema
convectif)
avec :
fIn+1,0 = fIn

(IV.G.41)
fIn+1,k+1 = fIn+1,k+1 fIn+1,k , k N
et (f n+1,k )kN suite convergeant vers f n+1 , n entier donne, solution de (IV.G.36) .

Exemple pour le principe du maximum


On va maintenant se placer en monodimensionnel, sur un maillage regulier forme de trois cellules de
pas h constant (figure IV.G.1) et etudier le comportement du premier membre pour les deux types
dexpressions, entre le pas de temps n t et le pas de temps (n + 1) t, avec, comme condition initiale
f10 = f20 = f30 = 0 et comme conditions aux limites, une de type Dirichlet et lautre de type Neumann
homog`ene :
f b1 = 1
f (IV.G.42)
=0
x b2

On supposera de plus que :


F le sch
ema convectif utilise est le schema upwind
F la masse volumique est constante
n n n n
F ( u)
b1 > 0, ( u) 12 > 0 , ( u) 23 > 0 , ( u) b2 > 0 et S b1 < 0.
Sb
1
(u)b
1

i=1
1
(u)

S
12
12

i=2
2
(u)

S 23
23

i=3
3
(u)b

Sb
2
2
x

Figure IV.G.1: Definition du domaine de calcul unidimensionnel considere.

On sinteresse ` a linfluence sur le respect du principe du maximum discret de la precision avec laquelle
est verifiee sous forme discr`ete la relation :
Z
i [1, N ], div ( u) d = 0
i
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 201/402

soit, ici :
( u)nb1 . S b1 = ( u)n12 . S 12 = ( u)n23 . S 23 = ( u)nb2 . S b2 (IV.G.43)


Prise en compte de la contribution de dans la matrice
t
Le syst`eme `
a resoudre est alors, en omettant pour simplifier lexposant ( n + 1, k + 1) :
|1 |
1n f1 ( u)nb1 . S b1 f1 = ( u)nb1 . S b1 f b1
t
|2 |
2n f2 + ( u)n12 . S 12 f2 ( u)n12 . S 12 f1 = 0 (IV.G.44)
t
|3 |
3n f3 + ( u)n23 . S 23 f3 ( u)n23 . S 23 f2 = 0
t
ce qui donne :
( u)nb1 . S b1

f1 = f b1


|1 |


1n ( u)nb1 . S b1




t
( u)n12 . S 12



f2 = + f1 (IV.G.45)
|2 |
2n + ( u)n12 . S 12
t n




( u) 23 . S 23

f3 = + f2
| 3|


3n + ( u)n23 . S 23


t
do`
u:
f1 < 1
f2 < 1 (IV.G.46)
f3 < 1

On obtient donc bien une solution qui verifie le principe du maximum discret, meme pour des grands
pas de temps t, et ce, quelle que soit la precision avec Zlaquelle est verifiee, `a letape de correction, la
forme discr`ete (IV.G.43) de la conservation de la masse div ( u) d = 0 dont on ne sest pas servi
i
ici.


Sans la contribution de dans la matrice
t
On obtient de meme :
|1 |
1n f1 + ( u)n12 . S 12 f1 = ( u)nb1 . S b1 f b1
t
|2 |
2n f2 + ( u)n23 . S 23 f2 ( u)n12 . S 12 f1 = 0 (IV.G.47)
t
|3 |
3n f3 ( u)n23 . S 23 f2 + ( u)nb2 . S b2 f3 = 0
t

soit :

( u)nb1 . S b1

f1 = f b1


|1 |


1n + ( u)n12 . S 12




t
( u)n12 . S 12



f2 = f1 (IV.G.48)
|2 |
2n + ( u)n23 . S 23
t n




( u) 23 . S 23

f3 = f2
|3 |


3n + ( u)nb2 . S b2


t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 202/402

Ici, on constate que le respect du principe du maximum discret :



f1 6 1
f2 6 1 (IV.G.49)
f3 6 1

est equivalent `
a la condition :

|1 |

( u)nb1 . S b1
6 1n + ( u)n12 . S 12

t
|2 |

( u)n12 . S 12 6 2n + ( u)n23 . S 23 (IV.G.50)
t
|3 |


( u)n23 . S 23 6 3n + ( u)nb2 . S b2


t
Contrairement ` a la situation du paragraphe G, on ne peut obtenir ici un resultat quen faisant intervenir
legalite (IV.G.43), forme discr`ete de la conservation de la masse. On obtient bien alors, `a partir du
syst`eme precedent :
f1 < 1
f2 < 1 (IV.G.51)
f3 < 1

a la cellule 1 et que lon suppose ( u)n12 . S 12 = ( u)nb1 . S b1 ( u)n12 . S 12 (o`


Si lon sinteresse ` u
est la precision locale relative pour lequation de conservation de la masse discr`ete), on constate que
lon obtient f1 > fb1 = 1 (valeur non admissible) d`es lors que :

1 ( u)n12 . S 12 t
<
1 |1 |

( u)n12 . S 12 t
cest-`
a-dire d`es que le nombre de CFL local exc`ede linverse de la precision relative
1 |1 |
locale .

Conclusion

Prendre en compte la contribution de dans la matrice permet un meilleur respect du principe du
t Z
maximum discret, lorsque la precision de div ( u) d = 0 nest pas exactement verifiee.
i
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 203/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 204/402

H- gradmc routine

Fonction
Le but de ce sous-programme est de calculer, au centre des cellules, le gradient dune fonction scalaire,
egalement connue au centre des cellules. Pour obtenir la valeur de toutes les composantes du gradi-
ent, une methode de minimisation par moindres carres est mise en uvre : elle utilise lestimation
dune composante du gradient aux faces, obtenue `a partir des valeurs de la fonction au centre des
cellules voisines. Cette methode est activee lorsque lindicateur IMRGRA vaut 1 et on lutilise alors
pour le calcul des gradients de toutes les grandeurs. Elle est beaucoup plus rapide que la methode
utilisee par defaut (IMRGRA=0), mais presente linconvenient detre moins robuste sur des maillages
non orthogonaux, le gradient produit etant moins regulier.


Discretisation
11
00
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11 F I
i Sb 00
11
00
11
J 00
11
F 00
11
I J 00
11
00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.H.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).

On se reportera aux notations de la figure IV.H.1. On cherche `a calculer Gc,i , gradient au centre de
la cellule i de la fonction scalaire P . Soit Gf,ij . dij une estimation `a la face ij (dont les voisins sont
les cellules i et j) du gradient projete dans la direction du vecteur dij (`a preciser). De meme, on note
a la face de bord ik (k i`eme face de bord appuyee sur la cellule i) du gradient
Gf b,ik . db,ik une estimation `
projete dans la direction du vecteur db,ik (`a preciser). Lideal serait de pouvoir trouver un vecteur Gc,i
tel que, pour toute face interne ij (j V ois(i)) et toute face de bord ik (k b (i)), on ait :

Gc,i . dij = Gf,ij . dij
(IV.H.1)
Gc,i . db,ik = Gf,b,ik . db,ik

Comme il est generalement impossible dobtenir legalite, on cherche `a minimiser la fonctionnelle Fi


suivante :
1 X  2 1 X  2
Fi (Gc,i , Gc,i ) = Gc,i . dij Gf,ij . dij + Gc,i . db,ik Gf,b,ik . db,ik (IV.H.2)
2 2
jV ois(i) kb (i)

Pour ce faire, on annule la derivee de Fi (Gc,i , Gc,i ) par rapport `a chacune des trois composantes
(Gc,i,x , Gc,i,y , Gc,i,z ) du vecteur inconnu Gc,i et lon resout le syst`eme qui en resulte.
Pour pouvoir inverser le syst`eme localement et donc `a faible co ut, on cherche `a eviter les dependances
de Gf,ij . dij et de Gf,b,ik . db,ik au gradient Gc,j (gradient pris dans les cellules voisines). Un choix
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 205/402

particulier du vecteur d permet datteindre ce but :

IJ (I 0 F )l
dij = et db,ik = 0 = nb,ik (IV.H.3)
||IJ|| ||I F ||

Ainsi, pour les faces internes, le vecteur d est le vecteur norme joignant le centre des cellules voisines.
La quantite Gf,ij . dij est reliee directement aux valeurs de la variable P prises au centre des cellules,
sans faire intervenir de gradient :
Pj Pi
Gf,ij . dij = (IV.H.4)
||IJ||

Pour les faces de bord, il est possible dopter pour un choix plus naturel sans pour autant faire intervenir
le gradient des cellules voisines : on utilise pour d le vecteur norme orthogonal `a la face, dirige vers
lexterieur (le gradient le mieux connu, en particulier au bord, etant le gradient normal aux faces). On
a alors :
Pb,ik Pi0
Gf,b,ik . db,ik = (IV.H.5)
||I 0 F ||

On utilise alors les relations (IV.H.6) au bord (Aik et Bik permettent de representer les conditions aux
limites imposees, Pb,ik en est issue et represente la valeur `a la face de bord) :

= Pi + II 0 .Gc,i

Pi 0
(IV.H.6)
Pb,ik = Aik + Bik Pi0 = Aik + Bik (Pi + II 0 .Gc,i )

On obtient finalement :
1
Aik + (Bik 1) (Pi + II 0 .Gc,i )
 
Gf,b,ik . db,ik = (IV.H.7)
||I 0 F ||

Lequation (IV.H.7), qui fait intervenir Gc,i , doit etre utilisee pour modifier lexpression (IV.H.2) de
la fonctionnelle avant de prendre sa differentielle. Ainsi :
1 X  2
Fi (Gc,i , Gc,i ) = Gc,i . dij Gf,ij . dij +
2
jV ois(i)
 2 (IV.H.8)
1 X Bik 1 0 1
Gc,i . (db,ik II ) (A ik + (B ik 1) P i )
2 ||I 0 F || ||I 0 F ||
kb (i)

On annule alors la derivee de Fi (Gc,i , Gc,i ) par rapport `a chacune des trois composantes (Gc,i,x , Gc,i,y , Gc,i,z )
du vecteur inconnu Gc,i . On obtient, pour chaque cellule i, le syst`eme 3 3 local (IV.H.9) :

Ci,x x Ci,x y Ci,x z Gc,i,x Ti,x
Ci,y x Ci,y y Ci,y z Gc,i,y = Ti,y (IV.H.9)
Ci,z x Ci,z y Ci,z z Gc,i,z Ti,z
| {z } | {z } | {z }
C Gc,i Ti
i

avec


X X  Bik 1 0
 
Bik 1 0

C = (dij )l (dij )m + db,ik II db,ik II

i,l m

||I 0 F || ||I 0 F ||


jV ois(i) kb (i) l m
 
X X 1 Bik 1 0
T = (Gf,ij . dij )(dij )l + (A + (B 1) P ) d II

i,l ik ik i
b,ik
||I 0 F || ||I 0 F ||


jV ois(i) kb (i) l

(IV.H.10)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 206/402

On obtient finalement :
X 1 X  1 Bik 0
 
1 Bik 0

Ci,l m = (IJ) l (IJ)m + n b,ik + II n b,ik + II
||IJ||2 ||I 0 F || l ||I 0 F || m
jV ois(i) kb (i)  
X (IJ)l X 1 Bik 1 0
Ti,l = (Pj Pi ) + (Aik + (Bik 1) Pi ) nb,ik II
||IJ||2 ||I 0 F || ||I 0 F || l
jV ois(i) kb (i)
(IV.H.11)

Mise en uvre
La variable dont il faut calculer le gradient est contenue dans le tableau PVAR. Les conditions aux limites
associees sont disponibles au travers des tableaux COEFAP et COEFBP qui representent respectivement
les grandeurs A et B utilisees ci-dessus. Les trois composantes du gradient seront contenues, en sortie
du sous-programme, dans les tableaux DPDX, DPDY et DPDZ.

Calcul de la matrice
Les NCEL matrices C i (matrices 33) sont stockees dans le tableau COCG, (de dimension NCELET33).
Ce dernier est initialise `
a zero, puis son remplissage est realise dans des boucles sur les faces internes
et les faces de bord. Les matrices C i etant symetriques, ces boucles ne servent qu`a remplir la partie
triangulaire superieure, le reste etant complete `a la fin par symetrie.
Pour eviter de realiser plusieurs fois les memes calculs geometriques, on conserve, en sortie de sous-
programme, dans le tableau COCG, linverse des NCEL matrices C i . De plus, pour les NCELBR cellules
qui ont au moins une face de bord, on conserve dans tableau COCGB, de dimension NCELBR 3 3,
la contribution aux matrices C i des termes purement geometriques. On precise ces points ci-dessous.
Notons donc d`es ` a present quil ne faut pas utiliser les tableaux COCG et COCGB par ailleurs comme
tableaux de travail.
Cellule ne poss edant pas de face de bord
Lorsque, pour une cellule, aucune des faces nest une face de bord du domaine, lexpression de la matrice
C i ne fait intervenir que des grandeurs geometriques et elle reste inchangee tant que le maillage nest pas
deforme. Son inverse nest donc calcule quune seule fois, au premier appel de GRADMC avec ICCOCG=1
(lindicateur INICOC, local ` a GRADMC, est positionne `a 0 d`es lors que ces calculs geometriques ont ete
realises une fois). Le tableau COCG est ensuite reutilise lors des appels ulterieurs au sous-programme
GRADMC.
Cellule poss edant au moins une face de bord
Lorsque lensemble des faces dune cellule contient au moins une face de bord du domaine, un terme
contributeur aux matrices C i est specifique `a la variable dont on cherche `a calculer le gradient, au
travers du coefficient Bik issu des conditions aux limites. Il sagit de :

X  1 Bik 0
 
1 Bik 0

nb,ik + II nb,ik + II (IV.H.12)
||I 0 F || l ||I 0 F || m
kb (i)

Au premier appel realise avec ICCOCG=1, on calcule la contribution des faces internes et on les stocke
dans le tableau COCGB, qui sera disponible lors des appels ulterieurs. En effet, la contribution des faces
internes est de nature purement geometrique et reste donc inchangee tant que le maillage ne subit pas
de deformation. Elle secrit : X 1
(IJ)l (IJ)m
||IJ||2
jV ois(i)

` tous les appels realises avec ICCOCG=1, les termes qui dependent des faces de bord (IV.H.12) sont
A
ensuite calcules et on additionne cette contribution et COCGB qui contient celle des faces internes :
on obtient ainsi les matrices C i dans le tableau COCG. Leur inverse se calcule independamment pour
chaque cellule et on le conserve dans COCG qui sera disponible lors des appels ulterieurs.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 207/402

Lorsque GRADMC a ete appele une fois avec ICCOCG=1, des calculs peuvent etre evites en positionnant
lindicateur ICCOCG `
a 0 (si ICCOCG est positionne `a 1, tous les calculs relatifs aux cellules ayant au
moins une face de bord sont refaits).

- Si GRADMC est utilise pour calculer le gradient de la meme variable (ou, plus generalement, dune
variable dont les conditions aux limites conduisent aux memes valeurs du coefficient Bik ), les
matrices C i sont inchangees et leur inverse est disponible dans COCG (on positionne ICCOCG ` a0
pour eviter de refaire les calculs).
- Dans le cas contraire, les termes relatifs aux faces de bord (IV.H.12) sont recalcules et on ad-
ditionne cette contribution et COCGB qui fournit celle des faces internes : on obtient ainsi les
matrices C i dans COCG. Il reste alors `a inverser ces matrices.

Remarque :
Pour sauvegarder les contributions geometriques dans COCGB, on a recours a une boucle portant sur les
NCELBR cellules dont au moins une face est une face de bord du domaine. Le numero de ces cellules est
donne par IEL = ICELBR(II) (II variant de 1 `a NCELBR). Les operations realisees dans cette boucle
sont du type COCGB(II,1,1) = COCG(IEL,1,1). La structure (injective) de ICELBR permet de forcer
la vectorisation de la boucle.

Inversion de la matrice
On calcule les coefficients de la comatrice, puis linverse. Pour des questions de vectorisation, la boucle
sur les NCEL elements est remplacee par une serie de boucles en vectorisation forcee sur des blocs de
NBLOC=1024 elements. Le reliquat (NCEL E(NCEL/1024) 1024) est traite apr`es les boucles. La
matrice inverse est ensuite stockee dans COCG (toujours en utilisant sa propriete de symetrie).

Calcul du second membre et r esolution


Le second membre est stocke dans BX, BY et BZ. Le gradient obtenu par resolution des syst`emes locaux
est stocke dans DPDX, DPDY et DPDZ.

Remarque : gradient sans reconstruction


(non consistant sur maillage non orthogonal)
Dans le cas o`
u lutilisateur souhaite ne pas reconstruire le gradient (i.e. ne pas inclure les termes de
non orthogonalite au calcul du gradient), une methode specifique est mise en uvre, qui na pas de
rapport avec la methode de moindres carres presentee ci-dessus.
Le volume de la cellule i est note i . Pij (resp. Pb,ik ) represente la valeur estimee de la variable P `
a
la face interne ij (resp. `
a la face de bord ik) de vecteur normal associe S ij (resp. S b,ik ). Le gradient
est simplement calcule en utilisant la formule suivante :

1 X X
Gc,i = = Pij S ij + Pb,ik S b,ik (IV.H.13)
i
jV ois(i) kb (i)

F J0
Les valeurs aux faces sont obtenues simplement comme suit (avec ij = ):
I 0J 0

Pij = ij Pi + (1 ij )Pj
(IV.H.14)
Pb,ik = Aik + Bik Pi

Points a` traiter

Vectorisation forc ee
Il est peut-etre possible de saffranchir du decoupage en boucles de 1024 si les compilateurs sont
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 208/402

capables deffectuer la vectorisation sans cette aide. On note cependant que ce decoupage en boucles
de 1024 na pas de co ut CPU supplementaire, et que le co ut memoire associe est negligeable. Le seul
inconvenient reside dans la relative complexite de lecriture.

Choix du vecteur d
IJ
Le choix dij = ||IJ|| permet de calculer simplement une composante du gradient `a la face en ne faisant
0 0
intervenir que les valeurs de la variable au centre des cellules voisines. Le choix dij = ||II 0 JJ 0 || serait
egalement possible, et peut-etre meilleur, mais conduirait naturellement `a faire intervenir, pour le
calcul de la composante du gradient normale aux faces, les valeurs de la variable aux points I 0 et J 0 , et
donc les valeurs du gradient dans les cellules voisines. Il en resulterait donc un syst`eme couple, auquel
un algorithme iteratif (voir GRADRC) pourrait etre applique. Laspect temps calcul, atout majeur de la
methode actuelle, sen ressentirait sans doute.

Am elioration de la m ethode
Cette methode rencontre des difficultes dans le cas de maillages assez non orthogonaux (cas de la
voiture maille en tetra`edres par exemple). Une voie damelioration possible est dutiliser un support
etendu (le support est lensemble des cellules utilisees pour calculer le gradient en une cellule donnee).
Un exemple est fourni sur la figure IV.H.2 ci-dessous : si la cellule I est la cellule courante, on choisit
pour support les cellules de centre J telles que la droite (IJ) soit la plus orthogonale possible `a une
face de la cellule I.

1
0
0
1

I
1
0
0
1 Support actuel
1
0
0
1 1
0
0
1 Support etendu

Cellule courante : I

Figure IV.H.2: Differents supports pour le calcul du gradient.


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 209/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 210/402

I- gradrc routine

Fonction
Le but de ce sous-programme est de calculer, au centre des cellules, le gradient dune fonction scalaire,
egalement connue au centre des cellules. Pour obtenir la valeur du gradient, une methode iterative de re-
construction pour les maillages non orthogonaux est mise en uvre : elle fait appel `a un developpement
limite dordre 1 en espace sur la variable, obtenu `a partir de la valeur de la fonction et de son gradient
au centre de la cellule. Cette methode, choisie comme option par defaut, correspond `a IMRGRA = 0 et
est utilisee pour le calcul des gradients de toutes les grandeurs. Cette technique est plus robuste mais
beaucoup plus lente que la methode par moindres carres correspondant `a IMRGRA = 1.


Discretisation
M
ethode g
en
erale
11
00
00
11
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00 F
11 I
i Sb 00
11
00
11
J 00
11
F 00
11
00
11
I J 00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.I.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).

On se reportera aux notations de la figure IV.I.1, qui correspondent `a celles employees dans le sous-
programme gradmc. On cherche ` a calculer G c,i , gradient au centre de la cellule i de la fonction scalaire
P . Le volume de la cellule i est note i . Soit G f,ij la valeur du gradient `a la face ij dont les voisins
sont les cellules i et j. Pij (resp. Pb,ik ) represente la valeur estimee de la variable P `a la face interne
ij (resp. `a la face de bord ik, k i`eme face de bord appuyee sur la cellule i) de vecteur normal associe
S ij (resp. S b ik ).
Par definition :

G c,i = (P ) I
G f,ij = (P ) f,ij
On a :
G f,ij = (P ) Oij = (P ) Fij (`a lordre 1 en P )
Afin de prendre en compte les non orthogonalites eventuelles du maillage, on calcule le gradient G c,i
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 211/402

en effectuant un developpement limite dordre 1 en espace. On obtient alors :


Z
def X X
|i | (P ) I = P d = P ij S ij + P bik S bik
i jV ois(i) kb (i)
P P
= [POij + O ij F ij . (P ) Oij ] S ij + (INC A b,ik + B b,ik PI 0 ) S bik
jV ois(i) kb (i) (IV.I.1)
P P h i
= [ ( ij PI + (1 ij ) PJ ) ] S ij + O ij F ij . (P ) f,ij S ij
jV ois(i) jV ois(i)
P
+ (INC A b,ik + B b,ik PI 0 ) S bik
kb (i)

La variable INC permet daffecter correctement les conditions aux limites des quantites dont on veut
prendre le gradient. En effet,
INC = 1 correspond ` a un calcul de gradient de variable totale et donc `a des conditions aux limites
standards,
INC = 0 correspond ` a un calcul de variable en increment et donc `a des conditions aux limites
associees homog`enes.

En faisant une approximation sur P dordre 1 en espace `a nouveau :


1
(
(P ) f,ij = [(P ) I + (P ) J ]
2
PI 0 = PI + II 0 . (P ) I

do`
u:

 
X 1 
|i | G c,i = ( ij PI + (1 ij ) PJ ) + O ij F ij . G c,i + G c,j S ij
2
jV ois(i)
X 
INC A b,ik + B b,ik PI + B b,ik II 0 . G c,i S bik

+
kb (i)

F J0
en notant ij = .
I 0J 0
On regroupe a
` gauche les termes en G c,i et on obtient :
X 1 X
|i | G c,i (O ij F ij . G c,i )S ij B b,ik (II 0 . G c,i ) S bik =
2
jV ois(i) kb (i)
X X 1
[( ij PI + (1 ij ) PJ )] S ij + (O ij F ij . G c,j )S ij
2
jV ois(i) jV ois(i)
X
+ (INC A b,ik + B b,ik PI ) S bik (IV.I.2)
kb (i)

ce qui donne pour la direction (, = x, y ou z) :



X 1 X X X
|i | G c,i, (O ij F ij ), G c,i, S ij, B b,ik (II 0 ), G c,i, S bik , =
2
jV ois(i) kb (i)

X X 1 X
[( ij PI + (1 ij ) PJ )] S ij, + (O ij F ij ), G c,j, S ij,
2
jV ois(i) jV ois(i)
X
+ (INC A b,ik + B b,ik PI ) S bik , (IV.I.3)
kb (i)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 212/402

Cas sans reconstruction des non orthogonalit


es
Lorsque le maillage est orthogonal ou lorsquon ne veut pas reconstruire, seules les contributions dordre
0 au centre des cellules interviennent dans le calcul du gradient (II 0 = 0, OF = 0) :
Z
def X X
|i | G c,i = P d = P ij S ij + P b,ik S bik
i jV ois(i) kb (i)
P P
= [ ( ij PI + (1 ij ) PJ ) ] S ij + (INC A b,ik + B b,ik PI ) S bik
jV ois(i) kb (i)

do`
u:

1 X X
G c,i = . [ ij PI + (1 ij ) PJ ) ] S ij + (INC A b,ik + B b,ik PI ) S bik (IV.I.4)
|i |
jV ois(i) kb (i)

Remarque
Le gradient non reconstruit GNc,iRec se calcule donc tr`es facilement et directement via lequation (IV.I.4).
Il nest cependant pas consistant sur maillage non orthogonal.

Reconstruction
M
ethode de r
esolution
Afin de pouvoir resoudre le syst`eme (IV.I.2), on va impliciter les termes en G c,i , expliciter ceux en
G c,j et raisonner de facon iterative en introduisant une suite dincrements ( G ki )kN definie par :

G 0i = GNc,iRec

(IV.I.5)
G k+1
i = Gk+1 k
c,i G c,i

et de syst`eme associe, dans la direction :


X 1 X X X
|i | G k+1
c,i,
(O ij F ij ), G k+1 S ij,
c,i, B b,ik (II 0 ), G k+1
c,i,
S bik ,
2
jV ois(i) kb (i)

X X 1 X
= [( ij PI + (1 ij ) PJ )] S ij, + (O ij F ij ), G kc,j, S ij,
2
jV ois(i) jV ois(i)
X
+ (INC A b,ik + B b,ik PI ) S bik , (IV.I.6)
kb (i)

ou, comme :
Gk+1 k k+1
c,i = G c,i + G i
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 213/402


X 1 X X X
|i | G k+1
i,
(O ij F ij ), G k+1
c,i,
S ij, B b,ik (II 0 ), G k+1
c,i,
S bik ,
2
jV ois(i) kb (i)
X
k
= |i | G c,i, + [( ij PI + (1 ij ) PJ )] S ij,
jV ois(i)

(O ij F ij ), 1 (G kc,i, + G kc,j, ) S ij,
X X
+
2
jV ois(i)

X X
+ (INC A b,ik + B b,ik (PI + (II 0 ), G kc,i, )) S bik , (IV.I.7)
kb (i)

Lequation (IV.I.7) conduit ` a un syst`eme matriciel local par rapport `a chacune des trois composantes
( G k+1
i,x , G k+1
i,y , G k+1
i,z ) du vecteur inconnu G k+1
i . On obtient donc, pour chaque cellule i, le syst`eme
3 3 suivant :
G k+1
k+1
Ci,x x Ci,x y Ci,x z i,x Ri,x
Ci,y x Ci,y y Ci,y z G k+1i,y
= k+1
Ri,y (IV.I.8)
Ci,z x Ci,z y Ci,z z k+1 k+1
G i,z Ri,z
| {z }| {z } | {z }
C
i G k+1
i Rik+1

avec, (, = x, y ou z) :

1 X
X

Ci, = |i | (O ij F ij ), S ij, B b,ik (II 0 ), S bik ,
2



jV ois(i) kb (i)

1 X X
B b,ik (II 0 ), S bik ,

Ci, = (O ij F ij ), S ij, pour 6=


2





jV ois(i) kb (i)
R k+1

= |i | G kc,i, +
P
[( ij PI + (1 ij ) PJ )] S ij,
i,
jV ois(i) ! (IV.I.9)

1
(O ij F ij ), (G kc,i, + G kc,j, ) S ij,
P P
+


2




jV ois(i)


X X
(INC A b,ik + B b,ik PI + (II 0 ), G kc,i, ) S bik ,

+





kb (i)

Linversion de la matrice C i permet de calculer ( G k+1 i ) et donc (G k+1


i ). Les iterations sarretent
k+1
lorsque la norme euclidienne du second membre R i tend vers zero (i.e. lorsque la norme euclidienne
de ( G ki ) tend vers zero) ou lorsque le nombre diterations en k fixe maximal est atteint.

Remarque 3
Pour les conditions aux limites en pression, un traitement particulier est mis en uvre, surtout utile
dans les cas o` u un gradient de pression (hydrostatique ou autre) necessite une attention specifique
aux bords, o` u une condition `
a la limite de type Neumann homog`ene est generalement inadaptee. Soit
PF b ik la valeur de la pression `
a la face associee, que lon veut calculer.
On note que :
0 0 P
I F b ik . (P )I = I F b ik . G c,i = I 0F b ik .
n F b
ik
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 214/402

avec les conventions precedentes.

Sur maillage orthogonal On se place dans le cas dun maillage orthogonal , i.e. pour toute cellule
I , I et son projete I 0 sont identiques. Soit M b ik le milieu du segment IF b ik .
On peut ecrire les egalites suivantes :
2

P 2 1 P
PF b ik = PM b ik + M b ik F b ik . + M F
b ik b ik . + O(h3 )
n M b 2 n2 M b
ik ik
2

P 2 1 P
PI = PM b ik + M b ik I . + M b ik I . + O(h3 )
n M b 2 n2 M b
ik ik

avec M b ik I = M b ik F b ik .
On obtient donc :
P
PF b ik PI = IF b ik . + O(h3 ) (IV.I.10)
n M b
ik

Gr
ace `
a la formule des accroissements finis :
" #
P 1 P P
= + + O(h2 ) (IV.I.11)
n M b 2 n I n F b
ik ik

On sinteresse aux cas suivants :

condition `
a la limite de type Dirichlet
PF b ik = PIM P OSE , aucun traitement particulier

condition `
a la limite de type Neumann homog`ene standard
On veut imposer :
P
= 0 + O(h) (IV.I.12)
n F b
ik

On a :
P P
= + O(h)
n I n F b
ik

et comme :
P
PF b ik = PI + IF b ik . + O(h2 ) (IV.I.13)
n I
on en deduit :
P
PF b ik = PI + IF b ik . + O(h2 ) (IV.I.14)
n F b
ik

soit :
PF b ik = PI + O(h2 ) (IV.I.15)
On obtient donc une approximation dordre 1.
condition ` a la limite de type Neumann homog`ene amelioree
Des egalites (IV.I.10, IV.I.11), on tire :

1 P
PF b ik = PI + IF b ik . + O(h3 )
2 n I
On obtient donc une approximation dordre 2.
P P
condition ` a la limite de type extrapolation du gradient =
n F b n I
ik
Des deux egalites (IV.I.10, IV.I.11), on deduit :

P
PF b ik = PI + IF b ik . + O(h3 ) (IV.I.16)
n I
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 215/402

On obtient donc egalement une approximation dordre 2.

Sur maillage non orthogonal Dans ce cas, on peut seulement ecrire :


1 0
PF b ik = PI 0 + I F b ik . [ (P )I 0 + (P )F b ik ] + O(h3 ) (IV.I.17)
2
condition `
a la limite de type Dirichlet
PF b ik = PIM P OSE , toujours aucun traitement particulier

condition `
a la limite de type Neumann homog`ene standard
On veut :
P
= 0 + O(h) (IV.I.18)
n F b
ik

ce qui entrane :
I 0 F b ik . (P )F b ik = O(h2 ) (IV.I.19)
On peut ecrire :
(P )I 0 = (P )F b ik + O(h)
do`
u:
PF b ik = PI 0 + O(h2 ) (IV.I.20)
On obtient donc une approximation dordre 1.

condition `a la limite de type Neumann homog`ene amelioree


Le gradient nest connu quau centre des cellules I et non aux points I 0 .

(P )I 0 = (P )I + O(h)

do`
u:
1 0
PF b ik I F b ik . [ (P )I 0 + (P )F b ik ] + O(h3 )
= PI 0 +
2 (IV.I.21)
1
= PI 0 + I 0 F b ik . [ (P )I + (P )F b ik ] + O(h2 )
2
Compte-tenu de la condition imposee et de lequation (IV.I.19), seule la contribution en I reste.
1 0
PF b ik = PI 0 + I F b ik . (P )I + O(h2 ) (IV.I.22)
2
On obtient donc une approximation dordre 1.
P P
condition `
a la limite de type extrapolation du gradient =
n F b n I
ik
En tenant compte de cette egalite, lexpression de PF b ik devient :

PF b ik = PI 0 + I 0 F b ik . (P )I + O(h2 ) (IV.I.23)

On obtient egalement une approximation dordre 1.

Conclusion
On peut recapituler toutes ces situations via la formule :

PF b ik = PI 0 + EXTRAP (I 0 F b ik . (P )I )

avec EXTRAP valant 0, 0.5 ou 1.


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 216/402


P
Il ne faut en aucun cas utiliser EXTRAP avec des conditions de type Neumann non homog`enes =
n F
g bord , g bord donn
ee non nulle ou de type Robin (mixtes) plus generalement
P
aPF b ik + b = g bord , le recours `a EXTRAP nayant plus aucun sens.
n F b ik

Mise en uvre
La variable dont il faut calculer le gradient est contenue dans le tableau PVAR. Les conditions aux
limites associees sont disponibles au travers des tableaux COEFAP et COEFBP qui representent respec-
tivement les grandeurs A et B utilisees ci-dessus. Les trois composantes du gradient sont contenues,
en sortie du sous-programme, dans les tableaux DPDX, DPDY et DPDZ.

Initialisations
Le tableau (BX, BY, BZ) du second membre R i est initialise `a zero.
Le calcul du gradient cellule non reconstruit GNc,iRec est realise et stocke dans les tableaux DPDX, DPDY
et DPDZ. Si aucune reconstruction nest `a faire, on a fini.

Reconstruction
Sinon, on cherche ` a resoudre le syst`eme (IV.I.7) en increments de gradient G k+1
i . Le gradient non
reconstruit constitue alors une premi`ere estimation du gradient `a calculer par increments.
On effectue les operations suivantes :

Phase pr
eliminaire
Calcul de la matrice, hors boucle en k
Les NCEL matrices C i (matrices non symetriques 33) sont stockees dans le tableau COCG, (de dimension
NCELET 3 3). Ce dernier est initialise `a zero, puis son remplissage est realise dans des boucles sur les
faces internes et les faces de bord. Pour eviter de realiser plusieurs fois les memes calculs geometriques,
on conserve, en sortie de sous-programme, dans le tableau COCG, linverse des NCEL matrices C i .
Cellule ne poss edant pas de face de bord
Lorsque, pour une cellule, aucune des faces nest une face de bord du domaine, lexpression de la
matrice C i ne fait intervenir que des grandeurs geometriques. Son inverse peut etre donc calcule une
seule fois, stocke dans COCG et reutilise si lon rappelle gradrc sequentiellement et si on est sur un
maillage fixe (indicateur ICCOCG positionne `a 0).
Cellule poss edant au moins une face de bord
Lorsque lensemble des faces dune cellule contient au moins une face de bord du domaine, un terme
contributeur aux matrices C i est specifique `a la variable dont on cherche `a calculer le gradient, au
travers du coefficient B b,ik issu des conditions aux limites. Il sagit de :

X
B b,ik (II 0 ) S bik ,
kb (i)

Si, lors de lappel precedent1 `


a gradrc, les conditions aux limites relatives `a la variable P traitee
conduisaient `a des valeurs identiques de B b,ik , les matrices C i sont donc inchangees et linverse est
encore disponible dans COCG. Pour eviter de refaire les calculs associes, lindicateur ICCOCG, passe en
argument, est alors positionne `a 0.
1 donc, `
a partir du second appel au moins
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 217/402

Si, au contraire, les valeurs de B b,ik sont differentes de celles de lappel precedent, il est alors indis-
pensable de recalculer le terme et lindicateur ICCOCG doit etre positionne `a 1.

Toutefois compte-tenu du co ut total de linversion de ces matrices relativement au co


ut global du
sous-programme, cette demarche de stockage et donc deconomie de temps C.P.U. est un peu super-
flue et risque dengendrer des erreurs (indicateur ICCOCG positionne `a 0 au lieu de 1) beaucoup plus
penalisantes que leventuel gain escompte.

Inversion de la matrice
On calcule les coefficients de la comatrice, puis linverse. Pour des questions de vectorisation, la boucle
sur les NCEL elements est remplacee par une serie de boucles en vectorisation forcee sur des blocs de
NBLOC=1024 elements. Le reliquat (NCEL E(NCEL/1024) 1024) est traite apr`es les boucles. La
matrice inverse est ensuite stockee dans COCG.

erative k, k N
Phase it

On suppose G ki connu et donc Gkc,i pour k donne et sur toute cellule i et on veut calculer G k+1
i
et Gk+1
c,i .

Calcul du second membre R k+1 i et resolution


Le calcul proprement dit du second membre R k+1 i correspondant au syst`eme (IV.I.9) est effectue et
stocke dans le tableau (BX, BY, BZ). Il est initialise, `a chaque pas k, par la valeur du gradient Gkc,i
multiplie par le volume de la cellule |i |, avec G0c,i = GNc,irec . Lincrement ( G k+1
i ) de gradient est
obtenu par C i 1 R k+1
i et ajout
e dans les tableaux DPDX, DPDY et DPDZ pour obtenir G k+1
c,i .

En ce qui concerne les conditions aux limites en pression, elles sont traitees comme suit dans Code Saturne:

= PI + II 0 .Gc,i

PI 0
= INC A b,ik + B b,ik PI 0 = INC A b,ik + B b,ik (PI + II 0 . G c,i )

P
b,ik
Pb ,ik = PI + IF ij . G c,i
1


Pf, b ik = B b,ik (EXTRAP Pb1 ,ik + (1 EXTRAP) Pb,ik ) + (1 B b,ik )Pb,ik

ce qui correspond `
a:

 lorsquon veut imposer des conditions de Dirichlet (A b,ik = PF b ik , B b,ik = 0),

PF b ik = PIM P OSE (IV.I.24)

pour toute valeur de EXTRAP.

 lorsquon veut imposer des conditions de flux (A b,ik = 0, B b,ik = 1) (condition de type

Neumann)
PF b ik = EXTRAP (PI + (IF b ik . (P )I ) + (1 EXTRAP)PI 0 (IV.I.25)
seules trois valeurs de EXTRAP sont licites.

avec un maillage non orthogonal

Lordre obtenu est egal `


a 1 dans tous les cas.

EXTRAP =0 Neumann homog`ene PF b ik = PI 0 + O(h2 )


1 1
EXTRAP = Neumann homog`ene ameliore PF b ik = PI 0 + I 0 F b ik . (P )I + O(h2 )
2 2
EXTRAP =1 extrapolation du gradient PF b ik = PI 0 + I 0 F b ik . (P )I + O(h2 )
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 218/402

avec un maillage orthogonal

On peut atteindre lordre deux.

EXTRAP =0 Neumann homog`ene PF b ik = PI 0 + O(h2 )


on est `
a lordre 1
1 1
EXTRAP = Neumann homog`ene ameliore PF b ik = PI + IF b ik . (P )I + O(h3 )
2 2
on est `
a lordre 2
EXTRAP =1 extrapolation du gradient PF b ik = PI + IF b ik . (P )I + O(h3 )
on est `
a lordre 2

Test de convergence de la m ethode it erative de r


esolution
On calcule la norme euclidienne RESIDU du second membre (BX, BY, BZ).
On arrete les iterations sur k si le test de convergence pour cette norme ou le nombre de sweeps
maximal NSWRGP est atteint. La valeur par defaut de NSWRGP est fixee `a 100, ce qui permet un calcul
suffisamment precis pour lordre despace considere.
Sinon, on continue diterer sur k.

Points a` traiter

Vectorisation forc ee
Il est peut-etre possible de saffranchir du decoupage en boucles de 1024 si les compilateurs sont
capables deffectuer la vectorisation sans cette aide. On note cependant que ce decoupage en boucles
de 1024 na pas de co ut CPU supplementaire, et que le co ut memoire associe est negligeable. Le seul
inconvenient reside dans la relative complexite de lecriture.

Traitement des conditions aux limites de pression


1
Actuellement, lordre deux decrit dans le cas EXTRAP = relativement aux conditions aux limites de
2
pression nexiste pas dans Code Saturne en non orthogonal. Mais en a-t-on vraiment besoin ?

Methode it erative de r esolution


La methode iterative de resolution adoptee dans ce sous-programme marche, i.e. converge, mais
ne rentre dans aucun cadre theorique precis. Des reflexions sur le sujet pourraient eventuellement
permettre dexhiber certaines proprietes des matrices considerees, cerner les limites dapplication ou
expliquer certains comportements.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 219/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 220/402

J- inimas routine

Fonction
Le but de ce sous-programme est principalement de calculer le flux de masse aux faces. Il prend
une variable vectorielle associee au centre des cellules (generalement la vitesse), la projette aux faces
en la multipliant par la masse volumique, et la multiplie scalairement par le vecteur surface. Plus
generalement, inimas est aussi appele comme premi`ere etape du calcul dune divergence (terme en
div (R) en Rij , filtre Rhie & Chow, ...).


Discretisation
La figure IV.J.1 rappelle les diverses definitions geometriques pour les faces internes et les faces de
F J0
bord. On notera = 0 0 (defini aux faces internes uniquement).
IJ
11
00
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00 F
11 I
i Sb 00
11
00
11
J 00
11
F 00
11
I J 00
11
00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.J.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).

Faces internes
On ne connat pas la masse volumique `a la face, cette derni`ere doit donc aussi etre interpolee. On
utilise la discretisation suivante :

(u)F = (I uI ) + (1 )(J uJ ) + grad(u)O .OF (IV.J.1)


La partie en (I uI ) + (1 )(J uJ ) correspondant en fait `a (u)O . Le gradient en O est calcule
1  1
par interpolation : grad(u)O = grad(u)I + grad(u)J . La valeur sest imposee de mani`ere
2 2
heuristique au fil des tests comme apportant plus de stabilite `a lalgorithme global quune interpolation
faisant intervenir . Lerreur commise sur u est en O(h2 ).

Faces de bord
Le traitement des faces de bord est necessaire pour y calculer le flux de masse, bien s ur, mais aussi
pour obtenir des conditions aux limites pour le calcul du grad(u) utilise pour les faces internes.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 221/402

Pour les faces de bord, on connat la valeur de F , qui est stockee dans la variable ROMB. De plus, les
conditions aux limites pour u sont donnees par des coefficients A et B tels que :

uk,F = Ak + Bk uk,I 0 = Ak + Bk (uk,I + (uk )I .II 0 ) (IV.J.2)

(k {1, 2, 3} est la composante de la vitesse, lerreur est en O(Bk h))


On a donc `
a lordre 1 :
(uk )F = F [Ak + Bk (uk,I + (uk )I .II 0 )] (IV.J.3)

Mais pour utiliser cette formule, il faudrait calculer grad(u) (trois appels `a GRDCEL), alors quon a dej`
a
calcule grad(u) pour les faces internes. Le surcout en temps serait alors important. On reecrit donc :

(uk )F = F Ak + F Bk uk,I 0 (IV.J.4)


F
= F Ak + B k (uk )I 0 (IV.J.5)
I 0
F F
= F Ak + B k (uk )I + Bk (uk )I .II 0 (IV.J.6)
I 0 I 0

Pour calculer les gradients de u, il faudrait donc en theorie utiliser les coefficients de conditions aux
limites equivalents :
Ak = F Ak
B k = Bk F
I 0
F
Ceci parat delicat, `
a cause du terme en , et en particulier `a lerreur que lon peut commettre sur
I 0
I 0 si la reconstruction des gradients est imparfaite (sur des maillages fortement non orthogonaux par
exemple). On reecrit donc lequation (IV.J.6) sous la forme suivante :
I F F
(uk )F = F Ak + Bk uk,I + Bk (uk )I .II 0 (IV.J.7)
I 0 I 0

Pour le calcul du flux de masse au bord, on va faire deux approximations. Pour le deuxi`eme terme,
on va supposer I 0 I (ce qui conduit `a une erreur en O(Bk h) sur u si I 0 6= I ). Pour le troisi`eme
terme, on va supposer I 0 F . Cette derni`ere approximation est plus forte, mais elle nintervient
que dans la reconstruction des non-orthogonalites ; lerreur finale reste donc faible (erreur en O(Bk h2 )
sur u si I 0 6= F ). Et au final, le flux de masse au bord est calcule par :
3
X
m
F = [F Ak + Bk F uk,I + Bk (uk )I .II 0 ] Sk (IV.J.8)
k=1

Pour le calcul des gradients, on repart de lequation (IV.J.5), sur laquelle on fait lhypoth`ese que
I 0 F . Encore une fois, cette hypoth`ese peut etre assez forte, mais les gradients obtenus ne sont
utilises que pour des reconstructions de non-orthogonalites ; lerreur finale reste donc l`a encore assez
faible. Au final, les gradients sont calcules `a partir de la formule suivante :

(uk )F = F Ak + Bk (uk )I 0 (IV.J.9)

ce qui revient `
a utiliser les conditions aux limites suivantes pour u:
Ak = F Ak
B k = Bk

Remarque

Dans la plupart des cas, les approximations effectuees nengendrent aucune erreur. En effet :
- dans le cas dune entree on a generalement Bk = 0, avec un flux de masse impose par la condition `
a
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 222/402

la limite.
- dans le cas dune sortie, on a generalement flux nul sur les scalaires donc sur , soit F = I 0 = I .
- dans le cas dune paroi, on a generalement Bk = 0 et le flux de masse est impose nul.
- dans le cas dune symetrie, on a generalement F = I 0 = I et le flux de masse est impose nul.
Pour sentir un effet de ces approximations, il faudrait par exemple une paroi glissante (Bk 6= 0) avec
un gradient de temperature (F 6= I ).

Mise en uvre
La vitesse est passee par les arguments UX, UY et UZ. Les conditions aux limites de la vitesse sont
COEFAX, COEFBX, ... Le flux de masse resultat est stocke dans les variables FLUMAS (faces internes) et
FLUMAB (faces de bord). QDMX, QDMY et QDMZ sont des variables de travail qui serviront `a stocker u, et
COEFQA servira `
a stocker les A.

Initialisation
eventuelle du flux de masse
Si INIT vaut 1, le flux de masse est remis `a zero. Sinon, le sous-programme rajoute aux variables
FLUMAS et FLUMAB existantes le flux de masse calcule.

Remplissage des tableaux de travail


u est stocke dans QDM, et A dans COEFQA.

Cas sans reconstruction


On calcule alors directement
X3
FLUMAS = [(I uk,I ) + (1 )(J uk,J )] Sk
k=1
et
3
X
FLUMAB = [F Ak + Bk F uk,I ] Sk
k=1

Cas avec reconstruction


On rep`ete trois fois de suite les operations suivantes, pour k = 1, 2 et 3 :
- Appel de GRDCEL pour le calcul de (uk ).
- Mise `
a jour du fluxde masse 
1
FLUMAS = FLUMAS + (I uk,I ) + (1 )(J uk,J ) + [(uk )I + (uk )J ] .OF Sk
2
et
FLUMAB = FLUMAB + [F Ak + Bk F uk,I + Bk (uk )I .II 0 ] Sk

Annulation du flux de masse au bord


Quand le sous-programme a ete appele avec la valeur IFLMB0=1 (cest-`a-dire quand il est reellement
appele pour calculer un flux de masse, et pas pour calculer le terme en div (R) par exemple), le flux de
masse au bord FLUMAB est force ` a 0, pour les faces de paroi et de symetrie (identifiees par ISYMPA=0).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 223/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 224/402

K- itrmas/itrgrp routine

Fonction
Le but du sous-programme itrmas est de calculer un gradient de pression facette. Il est utilise dans
la phase de correction de pression (deuxi`eme phase de navstv) o` u le flux de masse est mis `a jour `
a
laide de termes en t ij (f P ) ij .S ij et en t bik (f P ) bik . S bik .
Le sous-programme itrgrp calcule un gradient facette de pression et en prend la divergence, cest-
`-dire calcule le terme :
a
X X
t ij (f P ) ij .S ij t bik (f P ) bik . S bik
jV ois(i) kb (i)

En pratique itrgrp correspond ` a la combinaison de itrmas et de divmas, mais permet par son traite-
ment en un seul bloc deviter la definition de tableaux de travail de taille NFAC et NFABOR.


Discretisation
La figure IV.K.1 rappelle les diverses definitions geometriques pour les faces internes et les faces de
bord.
11
00
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00 F
11 I
i Sb 00
11
00
11
J 00
11
F 00
11
I J 00
11
00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.K.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).


Calcul sans reconstruction des non orthogonalites
Pour les faces internes, on ecrit simplement :
t ij S ij
t ij (f P ) ij . S ij = (PI PJ ) (IV.K.1)
I 0J 0

Pour les faces de bord, on ecrit :


t bik S bik
tbik (f P ) bik . S bik = ((1 Bb,ik )PI INC Ab,ik ) (IV.K.2)
I 0F

Les pas de temps aux faces t ij et t bik sont calcules par interpolation par les sous-programmes
viscfa (cas isotrope, IPUCOU=0) ou visort (cas anisotrope, IPUCOU=1).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 225/402


Calcul avec reconstruction des non orthogonalites
Plusieurs discretisations peuvent etre proposees pour le traitement des non orthogonalites. Celle
retenue dans le code est issue des premiers tests realises sur le prototype, et fait intervenir non seulement
le pas de temps interpole `
a la face, mais aussi les pas de temps dans chaque cellule. Il serait sans doute
bon de revenir sur cette ecriture et evaluer dautres solutions. La forme utilisee pour les faces internes
est :

t ij S ij
t ij (f P ) ij . S ij = (PI PJ )
I 0J 0
1 S ij
+ (II 0 JJ 0 ). [tI (P )I + tJ (P )J ] 0 0 (IV.K.3)
2 IJ

Pour les faces de bord, on ecrit :


t bik S bik 
(1 Bb,ik )(PI + II 0 .(P )I ) INC Ab,ik

t bik (f P ) bik . S bik = 0
(IV.K.4)
IF

Mise en uvre
Les principaux arguments passes ` a itrmas et itrgrp sont la variable traitee PVAR (la pression), ses
conditions aux limites, le pas de temps projete aux faces1 (VISCF et VISCB), le pas de temps au
centre des cellules, eventuellement anisotrope (VISELX, VISELY, VISELZ). itrmas retourne les tableaux
FLUMAS et FLUMAB (flux de masse aux faces) mis `a jour. itrgrp retourne directement la divergence du
flux de masse mis ` a jour, dans le tableau DIVERG.

Initialisation
Si INIT vaut 1, les variables FLUMAS et FLUMAB ou DIVERG sont mises `a zero.

Cas sans reconstruction


La prise en compte ou non des non orthogonalites est determinee par lindicateur NSWRGR de la variable
traitee (nombre de sweeps de reconstruction des non orthogonalites dans le calcul des gradients), passe
par la variable NSWRGP. Une valeur inferieure ou egale `a 1 enclenche le traitement sans reconstruction.
Des boucles sur les faces internes et les faces de bord utilisent directement les formules (IV.K.1) et
(IV.K.2) pour remplir les tableaux FLUMAS et FLUMAB (itrmas) ou des variables de travail FLUMAS et
FLUMAB qui servent ` a mettre `
a jour le tableau DIVERG (itrgrp).

` noter que les tableaux VISCF et VISCB contiennent respectivement t ij S ij et t bik S bik .
A
I 0J 0 I 0F

Cas avec reconstruction


Apr`es un appel `
a GRDCEL pour calculer le gradient cellule de pression, on remplit les tableaux FLUMAS
et FLUMAB ou DIVERG l`a encore par une application directe des formules (IV.K.3) et (IV.K.4).

Points a` traiter
Il est un peu redondant de passer en argument `a la fois le pas de temps projete aux faces et le pas
de temps au centre des cellules. Il faudrait sassurer de la reelle necessite de cela, ou alors etudier des
formulations plus simples de la partie reconstruction.

1 Plus pr
ecis
ement, le pas de temps projet
e aux faces, multipli e par I 0 J 0 ou I 0 F , cf. viscfa
e par la surface et divis
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 226/402

L- matrix routine

Fonction
Le but de ce sous-programme, appele par codits et covofi, est de construire la matrice de convec-
tion/diffusion, incluant les contributions adequates des termes sources, intervenant dans le membre
de gauche dequations discretisees telles que celle de la quantite de mouvement, dune equation de
convection diffusion dun scalaire ou de mod`ele de turbulence.
Le type dequation consideree est, pour la variable scalaire a :
 
a a
+ div ( (u) a) =0
t x x

La matrice ne sapplique quaux termes non reconstruits, les autres etant pris en compte au second
membre et traites dans le sous-programme bilsc2. La partie convective, lorsquelle existe, est issue
du schema upwind pur, quelque soit le type de schema convectif choisi par lutilisateur. En effet, cest,
a lheure actuelle, la seule facon dobtenir un operateur lineaire `a diagonale dominante.
`

a EMscal , operateur agissant sur un scalaire a (inspire de celui vectoriel


La matrice est donc associee `
EM defini dans navstv) dexpression actuelle, pour tout cellule i de centre I :

EMscal (a, I) = fsimp


P aI amont
((u)n , a) + F bamont ((u)n , a)
P
+ F ij ik
jV ois(i) kb (i)
DN Rec
DN Rec
P P
ij (, a) bik (, a)
jV ois(i) kb (i)

avec :
|i |
fsimp le coefficient issu du terme instationnaire , sil y a lieu, et de limplicitation de certains
t

termes sources (contribution decoulant de la prise en compte de la variation de la masse volumique
t
au cours du temps, diagonale du tenseur de pertes de charges par exemple...): cette initialisation est
en fait effectuee en amont de ce sous-programme,
F ijamont le flux numerique convectif scalaire decentre amont calcule `a la face interne ij de la cellule
i ,
F bamont
ik
le flux numerique convectif scalaire decentre amont associe calcule `a la face de bord ik de la
cellule i jouxtant le bord du domaine ,
N Rec
D ij le flux numerique diffusif scalaire non reconstruit associe calcule `a la face interne ij de la
cellule i ,
D bNikRec le flux numerique diffusif scalaire non reconstruit associe calcule `a la face de bord ik de la
cellule i jouxtant le bord du domaine ,
V ois(i) represente toujours lensemble des cellules voisines de i et b (i) lensemble des faces de bord
de i .
Du fait de la resolution en increments, a est un increment et ses conditions aux limites associees sont
donc de type Dirichlet homog`ene ou de type Neumann homog`ene.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 227/402

11
00
00
11
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11 F I
i Sb 00
11
00
11
J 00
11
F 00
11
00
11
I J 00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11 i
00
11

Figure IV.L.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).


Discretisation
Loperateur EMscal secrit, pour tout I centre de cellule :

EMscal (a, I) = fsimp


P aI   P  
+ (u)nij . S ij a f,ij + (u)nbik . S bik af bik
jV ois(i) k (i) (IV.L.1)
P aJ aI X b ab aI
ij 0 0
S ij bik ik 0 S bik
jV ois(i) IJ k (i)
IF
b

o`u a f,ij = a I ou a J selon le signe de (u)nij .S ij (schema convectif upwind systematique), et avec I 0 J 0 ,
mesure algebrique, orientee comme la normale sortante `a la face, i.e. allant de I vers J pour la cellule
I
i de centre I. On la notera I 0 J 0 lorsquon aura besoin dexpliciter clairement lorientation.
af bik = aI ou a bik selon le signe de (u)nbik . S bik (schema upwind systematique) et a bik valeur au
bord est donnee directement par les conditions aux limites (valeur non reconstruite). I 0 F , mesure
algebrique, orientee relativement ` a la normale sortante `a la face, i.e. allant de I vers lexterieur du
domaine.
En general, sauf cas pathologiques, les mesures algebriques I 0 J 0 et I 0 F sont positives et correspondent
aux distances I 0 J 0 et I 0 F . On se reportera au paragraphe Points `a traiter pour plus de details.
Soit EM scal la matrice associee ; sa taille est a priori de NCELNCEL, mais compte-tenu de la nature de
la structure de donnees, seuls deux tableaux DA(NCEL) contenant les valeurs diagonales et XA(NFAC,*)
les contributions des termes extra-diagonaux sont necessaires, avec NCEL nombre de cellules du maillage
considere et NFAC nombre de faces internes associe.
Du fait des simplifications effectuees sur la matrice (non reconstruction des termes), les composantes
extradiagonales de la ligne I ne sont differentes de zero que pour les indices J des cellules voisines de I.
On peut donc stocker toutes les contributions non nulles de la matrice dans deux tableaux DA(NCEL)
et XA(NFAC,2) :
DA(I) est le coefficient de la colonne I dans la ligne I,
si IFAC est une face qui separe les cellules i et j , orientee de I vers J, alors :
XA(IFAC,1) est le coefficient de la colonne J dans la ligne I et XA(IFAC,2) est le coefficient de la
colonne I dans la ligne J. Lorsque la matrice est symetrique, i.e. lorsquil ny a pas de convection
(ICONVP = 0) et que seule la diffusion est `a prendre en compte, alors XA(IFAC,1) = XA(IFAC,2) et on
reduit XA `a XA(NFAC,1).

Soit mnij ( mnbik ) la valeur de (u)nij .S ij (respectivement (u)nbik . S bik ).


Alors :
imp
 contribution volumique : fs aI

 contribution dune face purement interne ij

Lexpression
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 228/402

X X
+ F ijamont ((u)n , a) DN
ij
Rec
( , a)
jV ois(i) jV ois(i)

secrit :
 
P  n
 aJ aI
(u) ij . S ij a f,ij ij S ij
jV ois(i)  I 0J 0  (IV.L.2)
P 1 n n 1 n n P aJ aI
= ( m ij + | m ij | ) aI + ( m ij | m ij |) aJ ij S ij
jV ois(i) 2 2 jV ois(i) I 0J 0
I
Ici, I 0 J 0 = I 0 J 0 .

 contribution dune face de bord ik

De meme :
F bamont ((u)n , a) DN Rec
P P
ik bik (, a)
kb (i)  kb (i) 
a b aI
(u)nbik . S bik af bik bik ik 0
P  
= S bik (IV.L.3)
kb (i)  IF 
1 1 a b aI
( mnbik + | mnbik | ) aI + ( mnbik |mnbik |) a bik
P P
= bik ik 0 S bik
kb (i) 2 2 kb (i) IF
avec :
a bik = INC A b,ik + B b,ik aI = B b,ik aI
a netant associee qu`
a des conditions aux limites de type Dirichlet homog`ene ou de type Neumann
homog`ene.

Mise en uvre
Initialisations
Lindicateur de symetrie ISYM de la matrice consideree est affecte comme suit :
ISYM = 1 , si la matrice est symetrique ; on travaille en diffusion pure , ICONVP = 0 et IDIFFP
= 1,
ISYM = 2 , si la matrice est non symetrique ; on travaille soit en convection pure ( ICONVP = 1,
IDIFFP = 0 ), soit en convection/diffusion ( ICONVP = 1, IDIFFP = 1 ).
Les termes diagonaux de la matrice sont stockes dans le tableau DA(NCEL). Ceux extra-diagonaux le
sont dans XA(NFAC,1) si la matrice est symetrique, dans XA(NFAC,2) sinon.
Le tableau DA est initialise `a zero pour un calcul avec ISTATP = 0 (en fait, ceci ne concerne que les
calculs relatifs `
a la pression). Sinon, on lui affecte la valeur ROVSDT comprenant la partie instationnaire,
la contribution du terme continu en a div (u)n et la partie diagonale des termes sources implicites.
Le tableau XA(NFAC,*) est initialise ` a zero.

Calcul des termes extradiagonaux stock


es dans XA
Ils ne se calculent que pour des faces purement internes IFAC, les faces de bord ne contribuant qu`
a la
diagonale.


matrice non symetrique
( presence de convection )

Pour chaque face interne IFAC, les contributions extradiagonales relatives au terme aI et `a son voisin
associe aJ sont calculees dans XA(IFAC,1) et XA(IFAC,2) respectivement (pour une face orientee de I
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 229/402

vers J).
On a les relations suivantes :

XA(IFAC,1) = ICONVP FLUI IDIFFP VISCF(IFAC)


(IV.L.4)
XA(IFAC,2) = ICONVP FLUJ IDIFFP VISCF(IFAC)
1 S ij
a mnij , FLUI `a
avec FLUMAS(IFAC) correspondant ` ( mnij | mnij | ), VISCF(IFAC) `a ij 0 0 .
2 IJ
XA(IFAC,1) represente le facteur de aJ dans la derni`ere expression de (IV.L.2).

1
FLUJ correspond ` a ( mnij + | mnij | ). En effet, XA(IFAC,2) est le facteur de aI dans lexpression
2
equivalente de la derni`ere ligne de (IV.L.2), mais ecrite en J.
Ce qui donne :
X 1 1
 X aI aJ
( mnji + | mnji | ) aJ + ( mnji | mnji |) aI ji S ji (IV.L.5)
iV ois(j)
2 2
iV ois(j)
J 0I 0

1 S ji
Le terme recherche est donc : ( mnji | mnji | ) ji 0 0 .
2 JI
Or :
mnji = mnij (S ji = S ij et (u)nji = (u)nij ), avec J 0 I 0 mesure algebrique, orientee relativement
J
a la face, i.e. allant de J vers I. On la note J 0 I 0 .
` la normale sortante `
a
On a la relation :
J I
J 0I 0 = I 0J 0 = ( I 0J 0) (IV.L.6)
do`
u la deuxi`eme egalite dans (IV.L.4).


matrice symetrique ( diffusion pure )

Pour chaque face interne IFAC, la contribution extradiagonale relative au terme aI est calculee dans
XA(IFAC,1) par la relation suivante :

XA(IFAC,1) = IDIFFP VISCF(IFAC) (IV.L.7)


S ij
avec VISCF(IFAC) `
a ij .
I 0J 0

Calcul des termes diagonaux stock


es dans DA

matrice non symetrique
( presence de convection )
Pour chaque face interne ij (IFAC) separant les cellules i de centre I et j de centre J, DA(II) est
la quantite en facteur de aI dans la derni`ere expression de (IV.L.2), soit :
1 S ij
( mnij + | mnij | ) + ij 0 0 (IV.L.8)
2 IJ
De meme, pour DA(JJ), on a :
1 S ij
( mnij + | mnij | ) + ji 0 0 (IV.L.9)
2 IJ
dapr`es lexpression de (IV.L.5) et legalite (IV.L.6).
Limplantation dans Code Saturne associee est la suivante :
pour toute face IFAC delements voisins II = IFACEL(1,IFAC) et JJ = IFACEL(2,IFAC),
on ajoute ` a DA(II) la contribution croisee XA(IFAC,2) (cf. (IV.L.8)) et `a DA(JJ) la contribution
XA(IFAC,1) (cf. (IV.L.9)).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 230/402

Prise en compte des conditions aux limites


Elles interviennent juste dans le tableau DA, compte-tenu de leur ecriture et definition. Elles se calculent
via la derni`ere expression de (IV.L.3). Pour chaque face IFAC, de lelement de centre I, jouxtant le
bord, on sinteresse ` a:
 
1 1 a b aI
( mnbik + | mnbik | ) aI + ( mnbik |mnbik |) a bik
P P
bik ik 0 S bik (IV.L.10)
kb (i) 2 2 kb (i) IF
avec :
a bik = B b,ik aI
soit :
  !
1 1 1 B b,ik
( mnbik + | mnbik | ) + ( mnbik |mnbik |)B b,ik +
P P
bik S bik aI
kb (i) 2 2 kb (i) I 0F
(IV.L.11)
ce qui, pour le terme sur lequel porte la somme, se traduit par :
ICONVP (FLUJ + FLUI COEFBP(IFAC) + IDIFFP VISCB(IFAC) ( 1 COEFBP(IFAC))
1
avec, mnbik represente par FLUMAB(IFAC) , ( mnbik + | mnbik | ) par - FLUJ ,
2
1 Sb
( mnbik |mnbik |)B b,ik par FLUI , B b,ik par COEFBP(IFAC), bik 0 ik par VISCB(IFAC).
2 IF

D
ecalage du spectre
Lorsquil nexiste aucune condition `
a la limite de type Dirichlet et que ISTATP = 0 (cest-`a-dire pour
la pression uniquement), on deplace le spectre de la matrice EM scal de EPSI (i.e. on multiplie chaque
terme diagonal par (1 + EPSI) ) afin de la rendre inversible. EPSI est fixe en dur dans matrix `a 107 .

Points a` traiter

Initialisation
|i |
Le tableau XA est initialise ` a zero lorsquon veut annuler la contribution du terme en , i.e.
t
ISTATP = 0 . Ce qui ne permet donc pas la prise en compte effective des parties diagonales des termes
sources `a impliciter, decidee par lutilisateur. Actuellement, ceci ne sert que pour la variable pression
et reste donc a priori correct, mais cette demarche est `a corriger dans labsolu.

Nettoyage

La contribution ICONVP FLUI, dans le calcul du terme XA(IFAC,1) lorsque la matrice est symetrique
est inutile, car ICONVP = 0.

Prise en compte du type de sch


ema de convection dans EM scal

Actuellement, les contributions des flux convectifs non reconstruits sont traitees par schema decentre
amont, quelque soit le schema choisi par lutilisateur. Ceci peut etre handicapant. Par exemple, meme
sur maillage orthogonal, on est oblige de faire plusieurs sweeps pour obtenir une vitesse predite cor-
recte. Un schema centre sans test de pente peut etre implante facilement, mais cette ecriture pourrait,
dans letat actuel des connaissances, entraner des instabilites numeriques. Il serait souhaitable davoir
dautres schemas tout aussi robustes, mais plus adaptes `a certaines configurations.

Maillage localement pathologique


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 231/402

Il peut arriver, notamment au bord, que les mesures algebriques, I 0 J 0 ou I 0 F soient negatives (en cas
de maillages non convexes par exemple). Ceci peut engendrer des probl`emes plus ou moins graves :
perte de lexistence et lunicite de la solution (loperateur associe nayant plus les bonnes proprietes de
regularite ou de coercivite), degradation de la matrice (perte de la positivite) et donc resolution par
solveur lineaire associe non approprie (gradient conjugue par exemple).
Une impression permettant de signaler et de localiser le probl`eme serait souhaitable.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 232/402

M- navstv routine
Consideration is given to solving the non-stationary, pressure-based, single-phase, three-dimensional
Navier-Stokes system of equations for incompressible or weakly compressible flows based on first-order
implicit Euler or second-order Crank-Nicolson time discretization with collocated finite volume spatial
discretization.

Function
This subroutine is used to calculate, at a given time step, the velocity and pressure variables of the
problem following an approach that proceeds in two steps based on a decomposition of operators
(fractional step method).
The variables are assumed to be known at the instant tn and a determination of their new values is
sought at the instant1 tn+1 . Therefore, the associated time step is tn = tn+1 tn . To begin with,
the velocity prediction step is performed by solving the momentum balance equation with an explicit
pressure. This is followed by the pressure correction (or velocity projection) step allowing to obtain a
null divergence velocity field.
The continuous equations are thus:

(u) + div (u u) = div + T S K u + u uin ,
 
t (IV.M.1)


+ div (u) = ,
t
with the density field, u the velocity field, [ T S K u ] the other source terms (K is a positive diagonal
tensor by definition), the stress tensor, the tensor of viscous stresses, the dynamic viscosity
(molecular and possibly turbulent), the volume viscosity (usually null and therefore neglected in the
code and hereafter in this document, apart from the compressible module), D the deformation rate
tensor2 , the mass source term and uin is the velocity of the injection.

= P Id,
= 2D + ( 23 )tr(D)Id, (IV.M.2)
D = 12 u + uT .

Recalling the definition of the notations employed3 :



  ai

a ij = ,
xj



  ij
div () i = ,
xj




[a b] = ai bj ,
ij

and thus:
(ai bj )
[div (a b)]i =
xj

Remark M.1 When accounting for variable density, the continuity equation is written:

+ div ( u) =
t
1 The pressure is assumed known at instant tn1+ and its new value sought at tn+ , with = 1 or 1/2 depending

on the considered time-stepping scheme.


2 Not to be confused, despite an identical notation D, with the diffusive fluxes D
ij and D bik described later in this
subroutine.
3 Using the Einstein summation convention.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 233/402

This equation is not taken into account in the projection step (we continue to resolve only div ( u) = )

whereas the term does appear during the velocity prediction step in the subroutine predvv. If this
t
term plays a significant role, the Code Saturne compressible algorithm (which solves the full equation)
is probably better adapted.

Discretization
We define beforehand:
F J0
ij = defined at the internal faces only and
I 0J 0
uK 0 = uK + (grad u)K . KK 0 at first order in space, for K = I or J

Sij

00
11
11
00
00
11
00
11
00
11
i 00
11
00
11
00
11
J 00
11
00
11
I
F 00
11
00
11
J Sb 00
11
00
11
F I
00
11
O 00
11
00
11
j 00
11
00
11
00
11
00
11 I
00
11
00
11
I 00
11
00
11
00
11
00
11
00
11 i

(a) Internal face. (b) Boundary face.

Figure IV.M.1: Schema of the geometric entities defined for internal and boundary faces.

Fractional step method


Introduction
One of the methods used to numerically solve the Navier-Stokes equations consists of decomposing
the corresponding operators into a set of simpler operators (which can then be treated by efficient
algorithms) via the division of a single time step into a number of intermediate sub-steps. In this case,
two sub-steps are used: the first takes up the convective, diffusive and source terms of the momentum
equation and constitutes the velocity prediction step, the second treats the continuity equation and is
designated as the pressure correction or velocity projection step.

Velocity prediction step


The discretization in time is achieved by applying a -scheme at time n + to the resolved variable,
following the approach used for the transport equation of a scalar4 .
The velocity at time n + 1 not being available until after the projection step, a predicted velocity at
time n + 1 is used herein to interpolate:

en+ = u
u en+1 + (1 ) un (IV.M.3)
4 cf. covofi
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 234/402

With5 : 
=1 For a first-order implicit Euler scheme,
(IV.M.4)
= 1/2 For a second-order Crank-Nicolson scheme.

en+1 is then obtained by:


The predicted velocity field u

Partial linearization of the convection operator giving rise to a decoupling of the velocity com-
ponents.
Explicitation of the pressure.
Explicitation or extrapolation of the physical quantities (i.e , , Cp ...) and the mass flux.
Explicitation or extrapolation of the explicit source terms (for example, the contributions of the
transpose gradient, secondary viscosity, extra diagonal elements of the head losses, injected mass
uin , ...) at time n + S .
The implicit source terms that are linear with respect to the velocity (implicit user-specified
source terms, diagonal of the head losses Kd u, sources of mass u, etc...) are assumed to be
evaluated at time n + and are tied to the tensor K 6 .

For clarification, unless otherwise specified, the physical properties = , ... and the mass flux (u)
are assumed to be evaluated respectively at the instants n + and n + F , with and F being
dependent on the specific time-stepping schemes employed for these quantities7 .
After rewriting the non-stationary terms based on the mass conservation relation, we solve the following
system:
!
en+1 un
u  
en+ (u) = div n+ + T S n+S K n un+ + u en+ div (u), (IV.M.5)

+ div u
t

with:
T 2
un+ P n1+ Id + ( u)n+S
n+ = e ( div u)n+S Id . (IV.M.6)
| {z 3 }
explicit source terms

Pressure correction step (or projection of velocities)


The predicted velocity has a priori non-zero divergence. The second step corrects the pressure by
imposing the nullity of the stationary constraint for the velocity computed at time instant tn+1 . We
then solve:
(u)n+1 (e u)n+1
= P n+ , (IV.M.7)
tn+1
div (u) = ,

where the pressure increment P n+ is defined as:

P n+ = P n+ P n1+ . (IV.M.8)

Remark M.2 The and quantities remain constant over the course of both steps. If there has been
any variation in the interval, their values will be modified at the start of the next time step, after the
scalars (temperature, mass fraction,...) have been updated.
5 In the = 1/2 case, the time step t is assumed to be constant in time and uniform in space.
6 As the velocity components are decoupled, in practice only the linear terms relative to the resolved component are
factorised; the other terms are treated as explicit terms. A more detailed explanation can be found in predvv.
7 cf. introd
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 235/402

Spatial discretization
Following the classical approach, the time-discretized equations are then integrated over the control
volumes i (or cells).

Velocity prediction step


Second member
If we do not take account of the -scheme convection and diffusion terms, the explicit volume source
terms of the equation (IV.M.5) for the system concerning the quantity (eun+1 un ) are expressed as:
 
T 2
P n1+ + div ( u )n+S (div u)n+S Id + T S n+S K n un + un div (u).
3
To integrate these terms over a cell i , we multiply their local value at the cell centre by the volume
of the cell.

Convection
After decomposition of ue based on the relation (IV.M.3), spatial integration of the convective parts
of the velocity field div u en+1 (u) and (1 ) div (un (u)) yields a sum of the numerical
fluxes F ij calculated at the faces of the internal cells and F bik calculated at the boundary faces of
the domain . Taking N eigh(i) as the set of the centres of the neighbouring cells of i and b (i) the
set of the centres of the boundary faces of i , we obtain:
Z X X
div (u (u)) d = F ij ((u), u) + F bik ((u), u),
i jN eigh(i) kb (i)

with:  
F ij ((u), u) = (u) ij . S ij u f,ij . (IV.M.9)

 
F bik ((u), u) = (u) bik . S bik uf b . (IV.M.10)
ik

The value of the flux F ij depends on the numerical scheme selected. Three different schemes are
available in Code Saturne:

i/ a first-order upwind scheme:


F ij ((u), u) = F upwind
ij ((u), u)
where:
ufij = ui if (u)fij S ij > 0
(IV.M.11)
ufij = uj if (u)fij S ij < 0,

ii/ a second-order centred scheme:


F ij ((u), u) = F centred
ij ((u), u)
with:

ufij = ij uI 0 + (1 ij )uJ 0 and uK 0 = uK + (u)K KK 0 for K = I or J (IV.M.12)

iii/ a Second-Order Linear Upwind scheme (SOLU):


F ij ((u), u) = F ijSOLU ((u), u)
with:
u f,ij = ui + (u)I IF if (u)fij S ij > 0,
(IV.M.13)
uj + (u)j JF if (u) ij .S ij < 0.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 236/402

The value of F bik is calculated as:

uf b = u I if (u) bik . S bik > 0


ik (IV.M.14)
= u bik if (u) bik . S bik < 0

with the boundary value u bik obtained from the prescribed boundary conditions.

Remark M.3 When a centred scheme is used, for the simple reason of numerical stability we actually
write:

1 
ufij = ij ui + (1 ij )uj + (u)i + (u)j OF
2
to preserve the order in space.

Remark M.4 A slope test (which may introduce nonlinearities in the convection operator) allows
switching between a second-order scheme and the first-order upwind scheme. Moreover, with standard
efij derived from a barycentric mean between
models, we use at all points a value of the velocity field u
the upwind value and the second-order value (blending, specified by the user).

Diffusion
en+1 ) and (1 ) div (grad un ) are written:
Likewise, the diffusive components div ( grad u
Z X X
div (u)d = Dij (, u) + Dib (, u)
i jN eigh(i) kb (i)

with:
uJ 0 uI 0
Dij (, u) = fij Sij (IV.M.15)
I 0J 0
and:
ufb uI 0
Dib (, u) = fbSib (IV.M.16)
I 0F
keeping the same notations employed beforehand and with the value ufb at the boundary provided
directly by the specified boundary conditions.
The face value of the viscosity fij is calculated from the cell centre values using a specified function
f:
fij = f (i , j )
this function being either an arithmetic mean:
1
f (i , j ) = (i + j ) (IV.M.17)
2
or a geometric mean:
i j
f (i , j ) = (IV.M.18)
ij i + (1 ij )j
and the viscosity value fb at the boundary face is given by the equality:
fb = i (IV.M.19)
We also introduce here, for later use, the following additional notations:
uJ uI
DN
ij
Rec
(, u) = ij Sij (IV.M.20)
I 0J 0
uf uI
DN
ib
Rec
(, u) = fb b 0 Sib (IV.M.21)
IF
which correspond to the non-reconstructed values at the internal and boundary faces, respectively.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 237/402

Solution
As the system (IV.M.5) may contain nonlinearities owing to use of the slope test or may give rise
via the (cell) gradient reconstruction to a nearly-full matrix when non orthogonalities are present, we
solve the system using the iterative sequence (eun+1,k )kN defined by:

en+1,0
= un

u
n+1,k+1
u
e en+1,k + e
= u uk+1 (IV.M.22)
uk+1 , i) = E(e
EM(e un+1,k , i)

uk+1 )kN .
which also defines the sequence (e
The two operators E and EM have the respective expressions:
i
E(e
u, i) = J (eu, i) + (1 ) J (un , i) + |I | u uni )
(e
h i t i
+ |i | (T S)n+
i
S
(P )n1+
i
 
P T n+S 2 n+S
+ ( u ) (div u) Id S ij
jN eigh(i) 3 fij
| {z } (IV.M.23)
0 0
 average or linear interpolation between Iand J
T 2
( u )n+S (div u)n+S Id
P
+ S ib
kb (i) 3 fb
| {z }
obtained from the boundary conditions

with:
J (v, i) = |i |[K n div (u) ]i v i !
P P
+ F ij ((u), v) + F ib ((u), v)
jN eigh(i) kb (i) !
P P
Dij (, v) + Dib (, v)
jN eigh(i) kb (i)

 
i
EM(u, i) = |i | + [K n div (u) ]i ui
t !
F ijupwind ((u), u) F ibupwind ((u), u)
P P
+ +
jN eigh(i) kb (i) !
DN Rec
DN Rec
P P
ij (, u) + ib (, u)
jN eigh(i) kb (i)

un+1,k )kN converges towards u


Furthermore, we assume that the sequence (e en+1 .

Remark M.5 The boundary conditions associated with the operators E and EM of the system (IV.M.23)
are those relating to the velocity field u. They are either homogeneous Dirichlet- or homogeneous
Neumann-type conditions on u, this being dependent on whether the same type of condition, in this
case a Dirichlet and a Neumann-type condition has been used for the velocity u. They are mixed if a
symmetry condition applies to a face that is skewed with respect to the reference frame axes.

P
Remark M.6 The first two summations of the type ( ), i.e. comprising the F ib ((u), u) and
kb (i)
Dib (, u) terms, use the velocity boundary conditions.
The volume term:  
X T n+S 2 n+S
( u ) (div u) Id S ij
3 ij
jN eigh(i) | {z }
average or linear interpolation between I 0 and J 0
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 238/402

The associated boundary term:


X  T 2

( grad u )n+S (div u)n+S Id S ib
3 fb
kb (i) | {z }
from the boundary conditions

is treated in a specific way. In effect, the contribution of the first term (transposed gradient) is cancelled
out for a cell i adjoining the boundary, no proper boundary condition being attributed to it at this
time.

Remark M.7 The operator EM approaches E (there is no reconstruction of terms and the convective
term is systematically treated using an upwind scheme). This can introduce non-negligible numerical
un+1,k )kN has not converged.
diffusion if the sequence (e

Pressure correction step

Applying the divergence of the first equation of the system (IV.M.7), we obtain:

div (u)n+1 (e u)n+1 = div (t P n+ )


 
(IV.M.24)

By applying the stationary constraint div (u)n+1 = , this becomes:

div (t P n+ ) = div ((e


u)n+1 ) (IV.M.25)

where:
div (t P n+ ) = div ((e
u)n+1 )

n+1 n+1 (IV.M.26)
(u) = (e
u) t P n+
and:
t
en+1
un+1 = u P n+ (IV.M.27)

Integrating over a cell gives the discrete equation:


Z X X
div (t P n+ ) d = Dij (t, P n+ ) + Dib (t, P n+ ) (IV.M.28)
i jN eigh(i) kb (i)

and: Z h i
X X h i
u)n+1 d =
div (e u)n+1
(e fij S ij + u)n+1
(e fb S ib (IV.M.29)
i jN eigh(i) kb (i)

The formalism introduced previously for the integration of the diffusion term in the prediction step is
also adopted here: the boundary conditions on the pressure gradient P are either of the homogeneous
Dirichlet or homogeneous Neumann type and correspond to the type of condition imposed on the
pressure P , i.e. a Dirichlet or Neumann-type condition respectively.

Computation of the second member


h of the equation
i relating to the i pressure increment.
P n+1 P h n+1
Discretization of the sum u)fij S ij +
(e u)fb S ib presents a particularity.
(e
jN eigh(i) kb (i)
Init
The following choice denoted [ ] , for example, yields unsatisfactory results for a cell not touching
the boundary with the discretization and numerical scheme here used, particularly for the following
equation (IV.M.27):
h iInit 
u)n+1 u)n+1 u)n+1 u)n+1

(e fij . S ij = (e fij . S ij = ij (e I0 + (1 ij )(e J0 S ij (IV.M.30)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 239/402

As for the numerical flux calculation in the centred scheme, we legitimately use the following approx-
imation:
(eu)n+1
fij en+1
= ij i ui + (1 ij )j uen+1
j
1 n+1
(IV.M.31)
u)n+1 )j OF
 
+ ((e u) )i + (grad (e
2
which does not, in itself, pose a problem.
h iInit
n
On the other hand, (e u)n+1
fij contains the term Gcell,f ij
, effectively inherited from the prediction
step, whose value is:

G n1+ n1+
cel,fij = ij PI 0 + (1 ij ) PJn1+
0

However, on a regular orthogonal Cartesian mesh, with a velocity field uen+1 = 0 and a pressure field
PIn1+ = (1)I , we obtain G n1+
cel,fij = 0 and hence the pressure gradient P
n+
= 0. In this case,
the initial pressure anomaly can evidently never be corrected.
Init
To fix this, we modify the [ ] u)n+1
expression of (e ij u)n+1
and (e fb by substituting the corrected
Corr
value [ ] :
Corr
u)n+1 u)n+1

(e fij . S ij = (e S ij
 ij Init  (IV.M.32)
n+1
= (e u) (tP n1+ ) fij S ij + (Dij (t, P n1+ ))

with, for the inlet, symmetry (if any) or wall boundary conditions:
h iCorr
u)n+1
(e fb S ib = (e
u )n+1
fb S ib = fb un+1
fb S ib

and for the outflow boundary conditions:


h iCorr
u)n+1
(e fb S ib u)n+1
= (e S ib
h fb i 
n+1
= fb ufb (tP n1+ )I 0 S ib + (Dib (t, P n1+ ))

is the Arakawa coefficient. When it has a value of 1 (default value), it is the weighting factor in the
Rhie & Chow filter.

Remark M.8 This approach can be generalized to other source terms of the same type, for example
those in the Rij model.

Solution
To solve the equation (IV.M.28), which can lead, via reconstruction of the cell gradient, to a nearly-
full matrix when non-orthogonalities are present, we construct a sequence (P n+1,k )kN defined by:

P n+,0 = 0
P n+,k+1 = P n+,k + Crelax (P )n+,k+1 (IV.M.33)
FM((P )n+,k+1 , i) = F(P n+,k , i)

which also defines the sequence ((P )n+,k+1 )kN .


The operators F and FM are expressed by:
h Corr i
u)n+1
P 
F(P, i) = Dij (t, P ) (e ij
jN eigh(i)
 h iCorr  (IV.M.34)
Dib (tn , P ) (e u)n+1
P
+ fb +
kb (i)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 240/402

and:
P  N Rec
 P  N Rec

FM((P ), i) = Dij (t, (P )) + Dib (t, (P )) (IV.M.35)
jN eigh(i) kb (i)

respectively.
Crelax is a given coefficient of relaxation set to 1 by default. We assume that the sequence (P n+,k )kN
converges to P n+ .
The mass flux is updated at each iteration step, using (P ). At convergence, the updated mass flux
equation is:
h iCorr
(u)n+1
ij u)n+1
S ij = (e fij S ij Dij (tn , P n+ ) (IV.M.36)
and we compute the new velocity field at the centre of the cells thanks to the equality:
t
en+1
un+1 = u P n+ (IV.M.37)

Remark M.9 A specific treatment is implemented in order to ensure the conservation of mass express-
ing the mass budget for the fluxes computed at the cell faces is always verified to strictly and perfectly
uphold at the end of the correction step, whether or not the sequence (P n+,k+1 )kN has reached con-
vergence. The term P n+,kend +1 , which is in effect the last term evaluated in the sequence, is given
by:

FM((P )n+,kend +1 , i) = F(P n+,kend , i) (IV.M.38)


Instead of updating the mass flux in the classical way, we compute it as follows:
Corr
(u)n+1 u)n+1 S ij Dij (t, P n+,kend ) Dij
N Rec
(t, (P )n+,kend +1 )

ij S ij = (e ij

and:
h iCorr
(u)n+1
ib u)n+1
S ib = (e fb S ib Dib (t, P n+,kend ) Dib
N Rec
(t, (P )n+,kend +1 )

enabling to arrive at the formulation:


(u)n+1 (u)n+1
P P
fij S ij + fb S ib
jN eigh(i) kb (i)
h iCorr P h iCorr
u)n+1 u)n+1
P
= (e fij S ij + (e fb S ib
jN eigh(i) kb (i)
Dij (t, P n+,kend ) Dib (t, P n+,kend )
P P

jN eigh(i) kb (i)
N Rec
(t, (P )n+,kend +1 ) N Rec
(t, (P )n+,kend +1 )
P P
Dij Dib
jN eigh(i) kb (i)

corresponding to:
X X
(u)n+1
fij S ij + (u)n+1
fb S ib = F(P n+,kend , i) + FM((P )n+,kend +1 , i) +
jN eigh(i) kb (i)

and thus: Z
div (u)n+1 d =
i

Implementation
Refer to the following appendices relating to the subroutines Predvv (prediction of velocities) and
Resopv (pressure correction).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 241/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 242/402

N- predvv routine

Function
This subroutine implements the prediction step for the velocity field u. This consists of solving the
momentum equation by treating the pressure explicitly. Once the pressure correction step has been
performed in the subroutine resopv, the velocity-pressure solution is obtained using the mass conser-
vation law:

+ div (u) = , (IV.N.1)
t
where is the mass source term1 .
The Reynolds-averaged momentum conservation equation obtained by applying the fundamental the-
orem of dynamics is:
(u)
+ div (u u) = div () + S div ( R) (IV.N.2)
t
where:
= pId + (IV.N.3)
with the following linear relationship for the Newtonian flows:
= 2 D + tr(D) Id
1 (IV.N.4)
D = (grad u + t grad u)
2

represents the stress tensor, the viscous stress tensor, the dynamic viscosity (molecular and
potentially turbulent),D the rate of deformation tensor2 , R the Reynolds which appears when applying
the average operator to the simultaneous equation, S the source terms.
is the second coefficient of viscosity. It is related to the volume viscosity via the expression
2
= (IV.N.5)
3
When the Stokes hypothesis holds, the volume viscosity is zero, in other words 3 + 2 = 0. This
hypothesis is implicit in the code and in the rest of this, except in the compressible module.

The equation for the conservation of momentum is finally written as:


u
= div (u u) + div ( grad u)
t | {z } | {z }
convection diffusion
t 2
+ div ( grad u) ( div u) div (R) (p) + ( 0 ) g + u div ( u)
| {z } | 3 {z }
transpose of the velocity gradient term secondary viscosity
+ (u i u) K pdc u + T exp
s + Tsimp u
| {z } | {z } | {z }
mass source term other source terms
head loss
(IV.N.6)
with p denoting the difference in pressure relative to the reference hydrostatic pressure (the real
hydrostatic pressure being calculated with the density and not with 0 ):

p = p 0 g X (IV.N.7)
1 In kg.m3 .s1
2 Not to be confused, despite the same notation D, with the diffusive fluxes described in the subroutine navstv
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 243/402

(X being the vector of components x, y and z).


t , K pdc , u i represent respectively the turbulent dynamic viscosity, the tensor related to head losses
and the value of the variable associated with the mass source.
The divergence of the Reynolds stress tensor is expressed by:


0 in laminar,

2 2
(t div u) + div (t (grad u + t grad u)) ( k) for turbulent





3 3
viscosity,
div ( R) = (IV.N.8)


div ( R) for second-order
models,




2


(t div u) + div (t (grad u + t grad u))

in LES
3
The mass source term involves terms corresponding to the local velocity field u as well as a velocity
field u i associated with the mass injected (or extracted). When < 0, we remove mass from the
system thereby obtaining u i = u. The mass term is zero (i.e. (u i u) = 0). When > 0, a non-zero
mass term if u i 6= u. All terms appearing in the conservation of momentum equation, apart from the
convection and diffusion terms, are computed in this subroutine and transmitted to the subroutine
codits which solves the full equation (convection-diffusion with source terms).

Discretization
The convective term in div (u u) introduces a nonlinearity and coupling of the components of the
velocity u in the equation (IV.N.6). The three velocity components are linearized and decoupled during
discretization of the momentum equation in this prediction step.
For instance, taking:
ue = un + u (IV.N.9)
The exact contribution of the convective term to take into account in the prediction step would be:

div (e e) = div (un un ) + div (u un ) + div (un u) +


u u div (u u)
| {z } | {z }
linear coupling term nonlinear coupling term
(IV.N.10)
The last two terms of the expression (IV.N.10) are a priori neglected so as to obtain a velocity system
that is decoupled and thereby avoid the inversion of a potentially very large matrix. These two terms
can nevertheless be taken into account in an approximate manner by explicit extrapolation of the
mass flux in n + F (for the linear coupling term arising from the convection of un by u) and by
applying a fixed-point subiteration over the subroutine navstv (for the nonlinear term) implemented
by specifying NTERUP > 1.
The equation (IV.N.6) is discretized at the time level n + using a -scheme and the tensor of velocity
head losses decomposed into the sum of its diagonal K d and extra diagonal K e terms (such that
K pdc = K d + K e ).
The pressure is assumed to be known at the point in time n 1 + (pressure/velocity time lag) and
the gradient evidently calculated at this instant.
The secondary viscosity and the gradient transpose source terms, those coming from the turbulence
model3 , K e u, (0 )g as well as T sexp and u i are evaluated explicitly at time n or else extrapolated
according to the time scheme selected for the physical properties and the source terms.
The source terms u div ( u), u, Tsimp u and K d u are implicit and calculated at instant n + .
The diffusion term div ( tot grad u) is implicitized: the velocity is taken at the instant n + and the
viscosity either explicitized or extrapolated.
Lastly, the convection term in div ( u (u) ) is treated implicitly: the resolved velocity component
is taken at n + and the mass flux determined explicitly or extrapolated at n + F .
3 with the exception of div (t (grad u))
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 244/402

For clarification, unless explicitly stated otherwise the physical properties (, tot , ...) and the mass
flux (u) are to be evaluated respectively at time steps n + and n + F , with and F dependent
upon the specific time schemes selected for these quantities4 .
The time-discrete form of the momentum equation (IV.N.6) then reads:

en+1 un
u
en+ (u) ) div ( tot grad u
+ div ( u en+ ) =
t
pn1+ + div ( u) u en+ + ( u i )n+S n u en+
n n+ n+S exp n+S imp n+
(IV.N.11)
K d ue ( K e u) + (T s ) + Ts u
e
t n+S 2 n+S
+[div ( tot grad u)] [ ( tot div u)] + ( 0 )g (turb)n+S
3
where, for simplification, the following definitions have been set:
(
+ t for turbulent viscosity or LES models,
tot = (IV.N.12)
for second order models or in laminar regimes

and:
2

n n
3 ( k ) for turbulent viscosity models,


n
turb = div (n Rn ) for second order models, (IV.N.13)


0 in laminar or LES

en+ is interpolated from the predicted


By analogy with the -scheme equation for a scalar variable, u
n+1 5
velocity u
e in the following manner :

en+ = u
u en+1 + (1 ) un (IV.N.14)

With: 
=1 For a first-order implicit Euler scheme.
(IV.N.15)
= 1/2 For a second-order Crank-Nicolson scheme.

Using the above interpolation function, (IV.N.11) is then rewritten in the following form:

 
en+1 un )
div ( u) + n + K nd Tsimp ( u
| t {z }
fsimp
n+1
+ div (eu en+1 ) =
(u)) div ( tot grad u
(1 ) div (u (u)) + (1 ) div ( tot grad un )
n (IV.N.16)
pn1+ + div ( u) un + ( n u i )n+S n un


( K e u )n+S K nd un + (T sexp ) n+S + Tsimp un

fsexp
2
+[div ( tot t grad u )]n+S [ ( tot div u )]n+S + ( 0 )g (turb)n+S


3

from which the equation solved by the subroutine codits is obtained:

un+1 un ) + div (e
fsimp (e un+1 (u)) div ( tot grad u
en+1 ) =
(IV.N.17)
(1 ) div (un (u)) + (1 ) div ( tot grad un ) + f exp
s

The spatial discretization scheme is elaborated further in the section relating to the subroutine codits.

4 cf. introd
5 if = 1/2, or a time extrapolation is used, second-order is only obtained provided the time step t is constant and
spatially uniform.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 245/402

Remarks:
imp
 In the standard case without extrapolation, the term Ts is only added to the coefficient fsimp
if it is positive so as not to weaken the diagonal dominance of the matrix to invert.
imp
 If, on the other hand, an extrapolation is used, Ts is added to fsimp whatever its sign. In effect,
the intuitive idea which consists of taking:
(
(T sexp + Tsimp u) n+S if Tsimp > 0
exp n+S imp n+ (IV.N.18)
(T s ) + Ts u if not

leads to inconsistency (loss of coherence) in the numerical treatment of the problem should Tsimp
changes sign between two time steps.
 The diagonal part K
d
of the head loss tensor term is used in fsimp . Strictly speaking, only the
positive contributions should in fact be retained (as pointed out in the associated user subroutine
uskpdc). The approach currently in use requires improvement.
n
 The term div ( u) is not problematic for the diagonal dominance of the matrix as it is
exactly counterbalanced by the convection term (cf. covofi).

Implementation
The conservation of momentum equation is solved in a decoupled manner. The integration of the
different terms has therefore been carried out in order to treat separately the equations obtained for
each component of the velocity.
For each of these components, the second member fsexp of the system (IV.N.16), the implicit terms of
the system (with the exception of the convection-diffusion terms) and the term representing the total
viscosity at the internal6 and boundary faces is calculated in the subroutine predvv. These terms are
then transmitted to the subroutine codits which constructs and then solves the resulting complete
system of equations, with the convection-diffusion terms, for each component of the velocity.

The normalized residual for convergence of the solution of the system for the pressure correction
(resopv) is calculated in predvv. It is defined as the norm of magnitude

en+1 + tP n1+ )
div ( u

integrated over each cell IEL of the mesh (iel ) or, symbolically, as the square root of the sum over
the mesh cells of the quantity

en+1 + t P n1+ ) ] d.
R
XNORMP(IEL)= [div ( u
iel

It represents the second member of the equation system that would be solved for the pressure if the
pressure gradient were not taken into account in the velocity prediction step. Note that, if the second
member of the pressure increment equation were to be used directly, a normalized residual tending
to zero would be obtained for a stationary calculation that had been run to convergence. This result
would be penalizing and of little use for the computations.
At the start of predvv, u en+1 is not yet available and it is not possible therefore to calculate the
total normalized residual. On the other hand, calculating the total residual at the end of predvv is
undesirable as this would require monopolising a working array to store the pressure gradient for the
duration of the subroutine predvv. The calculation of the normalized residual is therefore carried out
in two stages.
div ( t P n1+ ) d is calculated at the beginning of predvv and the comple-
R
The quantity
iel
en+1 )d added at the end of predvv.
R
ment div ( u
iel

6 value SURFN
required for the integration of the diffusion term in codits, ( tot )ij
DIST
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 246/402

The pressure gradient at the cells is thus first computed at instant n 1 + by a call to grdcel. The
subroutine inimas is then used to evaluate t S P n1+ n at the faces (of surface S and normal n).
On entry into inimas, the working array TRAV contains t P n1+ ; when exiting this subroutine,
the VISCF and VISCB arrays contain the value of t S P n1+ n at the internal and boundary faces
respectively.
div ( t P n1+ )d at the cells from the contents of VISCF
R
We then use divmas takes the value of
iel
and VISCB and places it into the array XNORMP.
n d of the mass source term is added to XNORMP.
R
Lastly, the contribution
iel

div ( t P n1+ )d,


R
For u
e+tP , we apply the velocity boundary conditions. For the computation of
iel
the boundary conditions for the pressure gradient (or more precisely for t P n1+
) are therefore
the homogenized boundary conditions of the velocity. The pressure gradient (or rather t P n1+ )
is consequently assumed to be zero normal to the walls and the inlets and to remain constant in the
direction normal to symmetries and to the outlets.
In addition, to save computation time when passing through inimas, the face values on non-orthogonal
meshes are evaluated merely to first-order accuracy in space (no reconstruction: NSWRP=1). Local
accuracy is moreover of no particular interest as the aim here is simply to determine a normalized
global residual.
The computation of the residual will be completed at the end of predvv.

Partial calculation of the normalized residual for the pressure step

During this first step, we use the array XNORMP(NCELET) to compute the quantity

div (t P n1+ )

integrated over each cell IEL of the mesh (iel ), which is expressed as:
Z
XNORMP(IEL) = div ( t P n1+ ) d
iel

This operation is carried out by successively implementing inimas (calculation at the faces in VISCF
and VISCB of t P n1+ using the contents of the working array TRAV= t P
n1+
together with
homogeneous velocity boundary conditions and without reconstruction) followed by divmas (compu-
tation in XNORMP of the integral over the cells). With a simple loop, we then add the mass source term
contribution . This calculation is completed at the end of predvv.

Partial calculation of the term f sexp

To represent the second member corresponding to each component of the velocity, we use the arrays
TRAV(IEL,DIR), TRAVA(IEL,DIR) and PROPCE, with IEL being the number of the cell and DIR the di-
rection (x, y, z). Four cases need to be considered depending on whether or not the source terms
are extrapolated at n + S and whether or not a fixed-point iteration is implemented on the velocity-
pressure system (NTERUP> 1).
If the source terms are extrapolated and we iterate over navstv

- TRAV receives the source terms which are recomputed during each iteration over navstv but are
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 247/402

not extrapolated (P n1+ and ( 0 )g 7 ).

- TRAVA receives the source terms whose values do not change during the course of the iterations
over navstv nor are they extrapolated (Tsimp un , K d un , n un , ...).

- PROPCE receives the source terms that have to be extrapolated.

When there is no iteration over navstv, TRAVA has no use and its contents are directly stored in TRAV.

If there is no source term extrapolation, PROPCE serves no purpose and its contents are directly
stored in TRAVA (or in TRAV if TRAVA is also of no use).
Therefore, when there is neither source term extrapolation nor iteration over navstv, all the source
terms go directly into TRAV.

We already have a pressure gradient on the cells at the instant in time n 1 + . The gravity
term is then added to the vector TRAV which already contains pressure gradient. This means we
have, for example, for the direction x:
p
TRAV(IEL, 1) = |IEL |(( )IEL + ((IEL) 0 )gx ) (IV.N.19)
x

If source term extrapolation is used, at the first iteration over navstv, the vector TRAV (or
TRAVA) receives S times the contribution at time n 1 of the source terms to be extrapolated8
(stored in PROPCE). PROPCE is then reinitialised to zero so as to be able to receive afterwards the
contribution at the current time step of the extrapolated source terms.

The value of the term corresponding to the turbulence model is only calculated during the first
iteration over navstv then added to TRAVA, TRAV or PROPCE depending on whether the source
terms are extrapolated, and/or whether we iterate over navstv.

 Turbulent viscosity models:


2 2
If IGRHOK = 1, then we calculate k (and not, as should be the case, (k)) by way of
3 3
simplification (cf. paragraph N). The gradient of the turbulent kinetic energy k is computed on
the cell by the subroutine grdcel.
If IGRHOK = 0, this term is expected to be implicitly taken into account in the pressure.
 Second order models:

Computation of the term div (R) is implemented in two steps. A call is first made to the
subroutine divrij, which projects the vector R.eDIR onto the cell faces along the direction DIR,
following which we then call the subroutine divmas to compute the divergence.

2
The secondary viscosity ( tot div u) and transposed gradient div ( tot t grad u) terms, when
3
these taken into account (i.e. IVISSE (IPHAS) = 1, where IPHAS is the number of the phase
treated) are computed by the subroutine visecv. They are only calculated at the first iteration
over navstv. During this step, the array TRAV serves as a working array when the subroutine
7 In reality, the value of ( )g doesnt change, however this is a computation and it avoids the need for additional
0
treatment of this term.
8 Because (T exp )n+S = (1 + ) (T exp )n (T exp )n1
s S s S s
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 248/402

visecv is being called. It reverts to its normal value at the end of the call during which its
contents are stored temporarily in the vectors W7 to W9.

The terms corresponding to the velocity head losses (K pdc u), if there are any ( NCEPDP > 0 ),
are calculated by the subroutine tspdcv at the first iteration over navstv. They are decomposed
into two parts:
 The first part, corresponding to the contribution of the diagonal terms ( K u), is not
d
extrapolated.
 The second, which corresponds to the extra diagonal terms ( K u), may or may not be
e
extrapolated.
During this step, the array TRAV is used as a working array while the call is being made to the
subroutine tspdcv. It reverts to its normal value at the end of this call, its contents having been
meanwhile stored in the vectors W7 to W9.

SURFN
Calculation of the viscosity term at the faces ( tot )ij
DIST
The calculation of the total viscosity term at the faces is performed by the subroutine viscfa and the
solutions stored in the arrays VISCF and VISCB for the internal and boundary faces respectively.
During integration of the convection-diffusion terms in the subroutine codits, the non-reconstructed
terms, integrated in the matrix EM , are singled out from the full set of terms (unreconstructed +
reconstruction gradients) associated to the operator E (nonlinear)9 . Likewise, we differentiate between
the total viscosity at the faces used in E, arrays VISCF and VISCB, and the total viscosity at the faces
employed in EM , arrays VISCFI and VISCBI.
For turbulent viscosity models and in LES, these two arrays are identical and contain t + . For
second order models, they normally contain however, for the simple reason of numerical stability, we
can choose to put t + in the matrix (i.e. in EM ) while keeping in the second member (i.e. in
E). Because the solution is obtained by increments, this manipulation doesnt change the result. This
option is activated by the indicator IRIJNU = 1
When there is no diffusion of the velocity ( IDIFF(IUIPH) < 1), the terms VISCF and VISCB are set to
zero.

Calculation of the whole second member, of fsimp and solving of the equation
The evolution equations for the components of the momentum are solved in a coupled manner. Con-
sequently, we use a single array, ROVSDT, to represent the diagonal of the matrix obtained for each of
the velocity components.
For each of these components:

During the first iteration over the subroutine navstv, the implicit and explicit parts of the user-
prescribed source terms are computed by a call to the subroutine ustsns.
imp
 The implicit part (Ts ) is saved in the vector XIMPA for subsequent iterations if the fixed-point
method is used on the velocity-pressure system, with the contribution resulting from the same
implicit terms (Tsimp un ) being added either to TRAVA or to TRAV.
exp
 The explicit part (Ts ) is added to TRAVA, TRAV or PROPCE depending on whether the source
terms are extrapolated or not, and whether we iterate over navstv.

The mass accumulation term (div (u)) is calculated by calling the subroutine divmas with the
mass flux as argument. During the first iteration of the subroutine navstv, the term correspond-
ing to the explicit contribution of the mass accumulation (un div (u)) is added to TRAVA or
to TRAV. The vector ROVSDT is initialized by div (u) (to remain coherent with the approach
9 Ensuring coherence with the definition of the operators EM and E employed in navstv
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 249/402

implemented in the subroutine bilsc2) after which the contribution of the non-stationary term

( ) is added to the latter.
t

The vector ROVSDT is next completed with the contribution of the user-defined implicit source
terms (stored in XIMPA) and with that of the head loss term ( K d ) should NCEPDP > 0.
 When there is no source term extrapolation, the implicit part of the user source terms is only

added to ROVSDT if it is negative so as not to weaken the diagonal of the system.


 When the source terms are extrapolated however, it is taken into account whatever its sign

may be.

The implicit and explicit mass source terms, if any ( NCESMP > 0 ), are computed at the first
iteration by the subroutine catsma over navstv. ui is added to TRAV, TRAVA or PROPCE for
potential extrapolation. un is added to TRAV or TRAVA and to ROVSDT.

The second member is then assembled taking account of all of the contributions stored in the
arrays PROPCE, TRAVA and TRAV.
 If the source terms are extrapolated, then the second member reads:

SMBR = (1 S ) PROPCE + TRAVA + TRAV

 If not, we directly obtain:


SMBR = TRAVA + TRAV

If a specific physics (lagrangian, electric arc, ...) is taken into account, its contribution is directly
added to SMBR.

The solution of the linear system is computed by the subroutine codits, taking as argument
ROVSDT and SMBR.

When strengthened transient velocity-pressure coupling ( IPUCOU = 1 ) (only available with a


first-order scheme, where there is neither source term extrapolation nor iteration over navstv)
is implemented, codits solves the following equation:

EM DIR . (RHO n )1 . T DIR = . 1 (IV.N.20)

with RHOn the diagonal tensor of element nIEL , the diagonal tensor of element |IEL | and 1
denoting the vector whose components are all equal to one.
Inversion of the system by codits yields (RHO n )1 . T DIR , which is subsequently multiplied by
RHO n to obtain T DIR . This process is repeated for each component DIR of the velocity. T DIR
is therefore a diagonal matrix approximation of RHO n . EM 1 DIR
, with EM DIR representing the
implicit part of the solution to the discrete momentum equation (i.e. ROVSDT + contribution of
the convection-diffusion terms accounted for in the subroutine matrix). T DIR is also involved in
the correction step (cf. subroutine resopv).

This terminates the loop over the velocity components.

Final calculation of the normalized residual for the pressure step

As mentioned beforehand, the computation of the normalized residual for the pressure step of resopv
can now be completed.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 250/402

div ( t P n1+ ) d to which we now add


R R
The XNORMP array already contains n+1 )d.
div ( u]
iel iel

div ( t P n1+ )d.


R
To do so, we follow the same procedure used previously to compute the integral
iel
en+1 n
A call to inimas enables to obtain S u e at the faces calculated from the of uen+1 known at the
cells (array RTP). The boundary conditions employed in inimas are naturally those of the velocity. As
beforehand, evaluation of the face values is only up to first-order in space on non-orthogonal meshes
(no reconstruction : NSWRP=1) in order to save computation time R when passing through inimas. The
subroutine divmas is then used to compute the divergence en+1 )d at the cells, which is
div ( u
iel
then added directly to XNORMP.
Lastly, the normalized residual is determined and then stored in RNORMP(IIPHAS) by a call to prodsc
(which computes the sum of the squares of the values at the faces contained in XNORMP and then takes
the square root of the result).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 251/402

The different contributions (excluding convection-diffusion) assigned to each of the vectors TRAV, TRAVA,
PROPCE and ROVSDT at iteration n are summarized in tables (IV.N.21), (IV.N.22), (IV.N.23) and
(IV.N.24). We differentiate two cases for each of the time-stepping schemes applied to the source
terms, depending on whether or not a fixed-point algorithm is used to solve the velocity-pressure
system (iteration over navstv for NTERUP> 1). Unless otherwise specified, the physical properties
(,,etc...) are assumed to be evaluated at the time level n + , and the mass flux ( u) at n + F ,
where and F are dependent on the specific time-stepping schemes selected for these quantities (cf.
introd).

The terms appearing in these tables are written as they have been implemented in the code, this
being the source of some differences in relation to the form adopted in equation (IV.N.16).

In order to simplify the problem, we pose:


(
+ t for turbulent viscosity models and in LES,
tot =
for second-order models and in laminar regime

With extrapolation of source terms


2 n

n
3 ( k ) for turbulent viscosity models,


turbn = div (n Rn ) for second-order models,


0 in laminar or LES computations.

NTERUP = 1 : SMBRn = (1 S ) PROPCEn + TRAVn



ROVSDTn div ( u) + n + K nd Tsimp
t
PROPCEn T sexp, n n K ne un + n uni
2 (u)
turbn + div (ntot t grad un ) + (ntot div n ) (IV.N.21)
3
TRAVn pn1+ + ( 0 )g
S PROPCEn1 K nd un
+Tsimp un + div ( u) un n un

NTERUP > 1 (sub-iteration k) : SMBRn = (1 S ) PROPCEn + TRAVAn + TRAVn



ROVSDTn div ( u) + n + K nd Tsimp
t
PROPCEn T sexp, n n K ne un + n uni
2 (u)
turbn + div (ntot t grad un ) + (ntot div n ) (IV.N.22)
3
TRAVAn S PROPCEn1 K nd un + Tsimp un + div ( u) un n un
TRAVn (pn+ )(k1) + ( 0 )g

Without source term extrapolation

2

n
3 ( k ) for turbulent viscosity models,


turbn = div ( Rn ) for second-order models,


0 in laminaire or LES computations.

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 252/402

NTERUP = 1 : SMBRn = TRAVn


ROVSDTn div ( u) + n + K nd + M ax( Tsimp , 0)
t
TRAVn pn1+ + ( 0 )g
+T sexp K ne un + n uni (IV.N.23)
2 (u)
turbn + div ( tot t grad un ) + ( tot div )
3
K nd un + Tsimp un + div ( u) un n un

NTERUP > 1 (sub-iteration k) : SMBRn = TRAVAn + TRAVn



ROVSDTn div ( u) + n + K nd + M ax( Tsimp , 0)
t
TRAVAn T sexp K ne un + n uni
2 (u)
turbn + div ( tot t grad un ) + ( tot div ) (IV.N.24)
3
n n imp n n n n
K d u + Ts u + div ( u) u u
n n+ (k1)
TRAV (p ) + ( 0 )g

Points to treat

Evaluation of the term (k) for turbulent viscosity models


When modelling turbulent viscosity, we compute k instead of (k). This approximation was im-
plemented from the outset because the k boundary conditions are not directly accessible, in contrast
to those of k.

Account taken of the diagonal of K pdc


The user subroutine uskpdc, currently contains an explicit warning regarding this issue, however it is
written in as a comment. If the user doesnt take sufficient care, the diagonal part K d of the velocity
head loss tensor K pdc can be systematically taken into account in the computation of the coefficient
coefficient fsimp , whether its contribution K d is positive or not. A positivity test to check the positive
definiteness of the elements of K d should be implemented to ensure these are correctly taken into
account (contribution genuinely increasing the diagonal dominance of the global matrix).

Expression of EM
With incremental solving, it is not absolutely necessary for convergence that the value of the viscosity
appearing in the expression of the operator E be the same as that taken into account in the incremental
system matrix, EM . In Rij , for example, the total viscosity used in EM contains the molecular
viscosity but can also contain the turbulent viscosity if the option IRIJNU = 1 is selected, whereas
only the former is included in the operator E. This addition of the turbulent viscosity, which is not at
all relevant to the Rij model, has been inherited from practices implemented in ESTET and N3S-
EF to improve numerical stability (incremental smoothing). However, it may have other, potentially
less desirable effects. Moreover, it has not been demonstrated to date that this practice is of absolute
necessity in the use of Code Saturne. An in-depth study would therefore be of some interest.

Normalized residual relating to the pressure step


We could check the normalized residual computation and in particular the use of the velocity boundary
conditions.

Calculation of the head losses


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 253/402

When the source terms are extrapolated in time, we now obtain:

(K e u)n+S + K nd un+

It would also be possible to envisage using:

(K e u)n+S + K n+
d
S
un+
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 254/402

O- resopv routine

Function
The velocity projection (or pressure correction) step is effected in this subroutine, called from navstv.
The equation of motion (prediction) is solved in predvv with a fully explicit treatment of the pressure
term. The resulting velocity field does not satisfy the continuity equation. Two correction algorithms
are proposed:

1. The algorithm that we will call weak velocity-pressure coupling. This algorithm is implemented
extensively in industrial source codes. It only couples the velocity and the pressure through the
mass term (it is the algorithm proposed by default). It consists of a SIMPLEC -type algorithm,
similar to SIMPLE although the latter accounts for the simplified diagonals of the convection,
diffusion and implicit source terms in addition to the mass term.
2. The strengthened velocity-pressure coupling algorithm (option IPUCOU = 1). This algorithm
couples the velocity and pressure through all of the terms (convection, diffusion and implicit
source terms) of the equation of motion, though it is still approximate. In practice, the advantage
of this algorithm is that it allows large time steps without entirely decoupling the velocity and
the pressure.

Taking p as the pressure increment (i.e. pn+1 = pn + p) and u e the velocity field resulting from the
prediction step, from a continuous point of view the projection step essentially comes down to solving
a Poisson equation for the pressure:

div ( T n p) = div ( u
e) (IV.O.1)

and then correcting the velocity:

1 n
un+1 = un T p (IV.O.2)

T n is a second-order tensor whose components are homogeneous over a time step.

Discretization
The velocity description step is described in predvv. An operator notation is adopted here to provide a
simplified explanation of the code-based algorithms. The discrete equation of motion at an intermediate
point in time of solution is written, in each direction of space ( {1, 2, 3})in the form:

M n Rn (V
f V n ) + A n V
f = G P n + S n + I V
s,
f (IV.O.3)

? M n , is a diagonal matrix, of dimension NCEL NCEL, containing the ratio of the volume of a cell
|i |
to the local time step ( M n (i, i) = ), tn,I represents the time step at time level n in the
tn,I
(spatial) direction at the cell i ,
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 255/402

? Rn , is the diagonal matrix of dimension NCELNCEL, that contains the density (which is separated
out from the mass matrix during this step so that a projection can be made of the value of u).
By definition, Rn (i, i) = nI , which means that the appearance of a vacuum (or null space) is
naturally excluded and the matrix will therefore always be invertible,
f , of dimension NCEL, is an array in which the th component of the predicted velocity field u
? V e
is stored,
? V n , of dimension NCEL, is an array storing the th component of the velocity un at the previous
instant of time n,

? A n denotes the convection/diffusion operator (it is not necessarily linear owing to the possible
use of slope tests in the convection scheme and may be dependent on V ),
? G is the linear, cell gradient operator1 in the direction (it is therefore applied on the vectors
of dimension NCEL),
? P n , of dimension NCEL, is an array used to store the pressure pn computed at each cell during
the previous time step,

? S n is the array of dimension NCEL that contains all of the explicit source terms (see predvv for
more detail),
? I s, is the diagonal tensor related to the implicit source terms of the velocity components.

The correction step consists of imposing the continuity constraint for the mass conservation:

div ( u ) = (IV.O.4)

where is an eventual mass source term.


Let W be the array of dimension 3 NCEL that contains all of the momentum components (V denotes
V n , V n+1 or Ve ). n
V1
W = R n V = n V 2
n V 3

Let D be the divergence operator. The continuity equation (IV.O.4) is rewritten in compact form as:

DW =

contains the values of at the cell centroids.


Rearranging the discrete equation (IV.O.3), we write for all {1, 2, 3} :
1 1
(M n + A n (Rn ) I s, (Rn ) ) Rn V
f = G P n + S n + M Rn V n (IV.O.5)

By grouping and posing the following definitions:


1 1
B = M n + A n (Rn ) I s, (Rn )

B1 0 0
0 B2 0
B=
0 0 B3
1 strictly speaking, this operator would no longer be truly linear if a gradient constraint option were to have been

activated by the user


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 256/402


G1
G = G2

G3

S1 n + M 1 Rn V1 n

Sn = S2 n + M 2 Rn V2 n
S3 n + M 3 Rn V3 n

we can thus write the simplified equation as:


f = G P n +Sn
BW (IV.O.6)

With the fractional step method, ??? is decomposed into a sequence of two steps:

1. solution of the equation (IV.O.3) (this equation yields equation(IV.O.6)), namely:

M n Rn (V
f V n ) + A n V
f I f = G P n + S n
V
s,
(IV.O.7)

2. subtraction2 of the solved velocity prediction equation (IV.O.7) from the equation of motion
evaluated at the subsequent time level (n + 1):

M n Rn (V n+1 V
f ) + A n (V n+1 V
f ) I
s,
(V n+1 V
f ) = G (P n+1 P n ) (IV.O.8)

Reverting to compact notation, Equation (IV.O.8) gives:

B (W n+1 W
f ) = G (P n+1 P n ) (IV.O.9)

with:
W n+1 = Rn V n+1

The continuity constraint has yet to be enforced:

D W n+1 =

By combining the equations of continuity and motion and postulating that P = P n+1 P n , the
following Poisson-type equation is derived:

D B 1 G P = D W
f (IV.O.10)

We still need to invert the system (IV.O.10) in order to determine p (and thus p n+1 ) and correct
the projected velocity field so as to obtain u n+1 . The velocity correction is handled in navstv, by
incrementing the velocity by the calculated magnitude of the gradient of the pressure increment p.
The problem initially arises with the calculation of B 1 . It has already been judged too expensive
computationally to calculate the inverse de B. The solutions computed by the weak velocity-pressure
coupling and the strengthened velocity-pressure coupling algorithms correspond to an approxima-
tion of this operator.
In the case of the weak velocity-pressure coupling algorithm, we assume B 1
= M 1

(we could also
include the diagonal terms of the convection, diffusion and implicit source terms).
With strengthened velocity-pressure coupling, we invert the system3 B T = and we define the
equality B 1

= diag(T ). This step takes place in the subroutine predvv.
2 We neglect any variation in the explicit source terms S n which are still those estimated at n.
3 = (|1 |, ..., |NCEL |, |1 |, ..., |NCEL |, |1 |, ..., |NCEL |).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 257/402

The use of operators when writing out the equations presents a major inconvenience when used in
conjunction with collocated discretization. More specifically, the operator4 D B 1 G can lead to odd-
even decoupling of the nodes on a regular Cartesian mesh5 . To avoid this problem, we use the operator
L (already present in the collocated finite volume formulation of the operator div ( )) defined in each
cell6 i of centre I by7 :

[ T nij (p) f ij ] . S ij + [ T nb (p) f b ik ] . S b ik


P P
(L P )I = (IV.O.11)
ik
jN eigh(i) kb (i)

T n is a diagonal tensor of order 2 containing the time steps in the three spatial directions with S ij
and S b ik the surface vector respectively of the purely internal face and of the boundary face ik. The
gradient (p) f present in equation (IV.O.11) is a facet8 gradient.
From a continuous perspective, we can write9 :
Z
n+1
(L P )I = div ( T n pn+1 ) d
i

The operator L does not pose a problem of odd/even decoupling on regular Cartesian meshes.
tIn

0 0
n
With the weak velocity-pressure coupling algorithm: T I = 0 tIn 0
0 0 t n
n I
T 11, I 0 0
and with the strengthened velocity-pressure coupling algorithm: T nI = 0 n
T 22, I 0
n
0 0 T 33, I
The pressure system matrix is not easy to compute when strengthened velocity-pressure coupling is
being used, this being due to the term:

[ T nij (p) f ij ] . S ij

for an internal face ij and the term:

[ T nb (p) f b ik ] . S b ik
ik

for a boundary face.


The difficulty lies with the viscosity, which changes according to the spatial direction. As the tensor
T n is effectively anisotropic, the pressure gradients for each direction must consequently be computed
as a function of the normal gradient.
Without reference, for the moment, to the nature of the gradient , we define for every scalar a:

n a

T11
x
n
n a
G a = T a = T22
e
y
n a

T33
z
4 We emphasize again that the operator G is the cell gradients operator applied to the explicit pressure during
velocity prediction.
5 If u is the value of a variable at the cell centres on a 1D Cartesian mesh, the Laplacian of u calculated by this
i
ui2 + 2ui ui+2
operator in i is written: , where h is the space step. This is where the decoupling of the cells originates.
4h2
6 Recalling that N eigh(i) is the set of cell centres of the neighbouring cells of and (i) the set of centres of the
i b
boundary faces, if any, of i .
7 If u is the value of a variable at the cell centres on a 1D Cartesian mesh, the Laplacian of u calculated by the latter
i
ui1 + 2ui ui+1
operator in i reads: , with h the spatial step.
4h2
pJ pI
8 On orthogonal mesh, (p)
f ij . S ij = S ij . I (resp. J) et I 0 (resp. J 0 ) are in effect superimposed.
IJ
9 In the weak velocity-pressure coupling algorithm case, T en = t n .
I I
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 258/402

We can also define:

def 
h i
. S ij = T n (a) ij . S ij

(G
e a) cell
ij

where a is the standard cell gradient of a.

and likewise for the facet gradient (a) f of a:


def 
h i
. S ij = T n ((a)) f ij . S ij

(G
e a) f
ij

We need to calculate G e (p) . S at the face.


This is relatively simple with a cell gradient as all the components of the latter perfectly calculable.
The difficulty lies, on the contrary, with a facet gradient because the only exploitable options is the
(p) (p) (p)
decomposition of the face normal gradient10 . We need the quantities , and both
x y z
explicitly and separately, which makes it difficult to use the normal pressure increment gradient.
We therefore make an approximation of the gradient of the pressure increment by assuming it to be
equal to its normal component11 , which is:

((p)) f (((p)) f . n) n (IV.O.12)

where n denotes the outer unit normal vector. We then obtain:


e (p) (((p)) f . n) (T n n)
G
n
This enables reducing the computations to those of a scalar time step Teij , given by:
n
Teij = (T nij n) . n (IV.O.13)

In which case:
[ T nij (p) f ij ] . S ij (T nij n) . S ij ((p)f ij . n)
= (T nij n) . n ((p)f ij . n) S ij (IV.O.14)
= Ten ((p) . n) S ij
ij f ij

or on the other hand:


n n
Teij ((p)f ij . n) S ij = Teij (p)f ij . S ij
 
n 0 0 1 S ij (IV.O.15)
= T ij PJ PI + ( JJ II ) ( P I + P J ) 0 0
e
2 IJ
This is used during reconstruction of the gradients in the second member of the final system of equations
to solve, by calling the subroutines itrmas and itrgrp.
The approximation (Teij n
= (T nij n) . n) is not in fact used. This is because the directional gradient of
the pressure increment is computed using the subroutine grdcel, allowing us to take the liberty of
using the tensor T to correct the term [ T nij (p) f ij ] . S ij .
In practice, the latter is discretized, for an internal face ij, by12 :
JJ 0 II 0 1
 
n n PJ P I n n
[ T ij (p) f ij ] . S ij = T ij
e + ( T I P I + T J P J ) S ij (IV.O.16)
I 0J 0 I 0J 0 2
10 According p J0 p I0
to the formula S ij .
11 i.e.
I0J 0
no account is taken of the tangential component (((p)) f . ). , denoting the tangential unit vector.
12 The factor 1 appearing in the discretization (IV.O.16) is introduced for reasons of numerical stability. Although
2
the use of weighting coefficients on the faces would in effect yield a more accurate numerical solution, it would probably
also be less stable.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 259/402

rather than by (IV.O.15). We use the same approach for the boundary terms.
n
The expression Teij ((p)f ij . S ij ) will nevertheless be seen subsequently.
The last issue relating to the inversion of the system (IV.O.10) concerns the tensor term D W f . This
term tends, via the cell pressure gradients present in the equation of motion, to decouple the odd and
even-numbered cells on a Cartesian grid. To avoid this problem, we apply a variant of the Rhie &
Chow filter which enables to dissipate (or smooth) the pressure field contribution in the equation of
motion. Expressed in discretized form, this yields:

[ n u e (pn )) cell ] f . S Arak n


(pn ) f ij . S ij
P P
(D W
f )I = e + Arak (G ij ij Teij
jN eigh(i) jN eigh(i)
[ n u e (pn )) cell ] f P en
T b ik (pn ) fb ik . S b ik
P
+ e + Arak (G b ik
. S b ik Arak
kb (i) kb (i)
P P
= me ij + me b ik
jN eigh(i) kb (i)
(IV.O.17)
where m e ij and me b ik denote respectively the mass flux at the purely internal face and the boundary
face ik) modified by the Rhie & Chow filter.
(pn )f ij represents a facet gradient while [ n u e (pn )) cell ] f denotes a face value interpo-
e + Arak (G ij
lated from the estimated cell values (the pressure gradient in this term is a cell-based gradient). This
clarification also applies to the boundary terms.
For historical reasons, Arak is known as the Arakawa coefficient dArakawa in Code Saturne. It is
denoted ARAK.
It should be reiterated that, for the Rhie & Chow filter, the tensor T n is used in the volumetric term
G
e whereas the approximation (IV.O.13) is applied when computing the facet gradient.

In accordance with equations (IV.O.10) and (IV.O.11), we finally solve the Poisson equation under the
form:
X X X X
n
Teij ((p)) f ij . S ij + Tebnik ((p)) fb ik . S b ik = me ij + e b ik I
m
jN eigh(i) kb (i) jN eigh(i) kb (i)
(IV.O.18)
To take account of the non-orthogonal elements, we use an incremental method to solve the linear
equation system, including the reconstructed terms in the second member. If (p) denotes the incre-
ment of the increment (the increment of the variable p to compute) and k the fixed-point iteration
index, we solve exactly :

n ((p))I
k+1
((p))Jk+1 X ((p))Ik+1 ((p)) k+1
bik
P
Teij S ij + ebn
T S b ik
jN eigh(i) I 0J 0 kb (i)
ik
I 0F
P P
= me ij + m
e b ik
jN eigh(i) kb (i)
n
((p)k ) f ij . S ij Tebnik ((p)k ) fb ik . S b ik I
P P
Teij
jN eigh(i) kb (i)
m kij + m kb ik I
P P
=
jN eigh(i) kb (i)
(IV.O.19)
with:
((p))0

=0
(IV.O.20)
((p))k+1 = (p)k+1 (p)k k N
The facet gradients, denoted ((p)k ) f ij and ((p)k ) fb ik , will be reconstructed.

Implementation
We present hereafter the algorithm as it is written in resopv.
T n designates an array of dimension 3 containing the local time steps in each direction (for use with
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 260/402

strengthened velocity-pressure coupling). We keep the same notation for the weak velocity-pressure
coupling algorithm although in this case the time steps are equal in the three spatial directions.

Computation of the matrix of the equation system to be solved

calculation of the diffusion coefficient at the cell faces for use in the Laplacian of pressure (the
diffusion coefficient uses the calculation time step or that of the strengthened velocity-pressure
coupling algorithm). One of two cases will apply, depending on the algorithm selected by the
user for the velocity-pressure coupling:

1. Call to viscfa with a total viscosity equal to the time step tnI for the weak velocity-
pressure coupling algorithm (IPUCOU = 0),
2. Call to visort with a diagonal total viscosity for the strengthened velocity-pressure cou-
n
pling algorithm (IPUCOU = 1). It is at this level that Teij is calculated. The equivalent
time steps calculated in the subroutine predvv beforehand are stored in the array TPUCOU.

Call to matrix for construction of the pressure diffusion matrix (without the reconstruction
terms which cannot be taken into account if we wish to preserve a sparse matrix structure) using
the previously calculated viscosity and the array COEFB of pressure boundary conditions pn (we
impose a homogeneous Neumann condition on p for a Neumann condition on p and vice versa.

Calculation of the normalized residual RNORMP


Since version 1.1.0.s, this step is accomplished within the subroutine predvv and the normalized
residual transmitted via the variable RNORMP(IPHAS).
At this level of Code Saturne the array TRAV contains the second member obtained from predvv without
the user source terms. The computational procedure for the calculation of RNORMP is enumerated below:

tnI (I 0 )tnI
eI
1. TRAV(I) = u TRAV(I) + g,
I |i | I
2. Call to inimas to compute the mass flux of the vector TRAV (we calculated at each face ij TRAV ij . S ij ,
where S is the surface vector ). We set the total number of sweeps (or iterations) to 1 (NSWRP =
1), which means that there is no reconstruction of the gradients during this run through inimas
(to save computation time). The boundary condition arrays passed into inimas contain those of
the velocity un .
3. Call to divmas to compute the divergence at each cell of the above mass flux, which is stored in
the working are W1.
4. The mass source terms stored in the array SMACEL are added to W1.
|i |
W1(I) = W1(I) SMACEL(I) (IV.O.21)
I

5. Call to prodsc (RNORMP = W1.W1). RNORMP will be used in the stop test of the iterative pressure
solver to normalize the residual (see routine gradco for the conjugate gradient inversion method).

Preparation for solving the system

Call to grdcel for computation of the pressure gradient pn . The result is stored in TRAV. At this
pn pn pn
level, TRAV contains , , .
x y z
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 261/402

Introduction of the explicit pressure cell-based gradient pn for use with the Rhie & Chow filter.

ARAK n
TRAV(I) = u
eI + T I pn I
I
ARAK represents the Arakawa coefficient, so-named within the code, whose default setting is 1
although this value can be modified by the user in usini1. To simplify the notations, we define
ARAK = Arak .

Call to inimas which calculates the mass flux in TRAV. The boundary conditions applied in this
case are those of the velocity (cf. subroutine navstv). This is still just an approximation of the
boundary conditions contained in TRAV. The mass flux (cf. subroutine inimas for further details
concerning the calculation at the boundary faces) is thus equal to:

u + Arak T n (pn ) f
 
m ij = e . S ij
ij

Call to itrmas to increment the mass flux at the faces13 by

Arak Teijn (pn ) f ij . S ij .

Call to clmlga to compute the inversion of the pressure matrix with the algebraic multigrid
algorithm.
initialisation of p, (p) and SMBR to 0. SMBR will serve to store the second member. In the
code, p and (p)arecontainedrespectivelyinRTP(*,IPRIPH) and DRTP.

Call to divmas for calculation of the divergence of the mass flux resulting from the last call to
itrmas. This divergence is stored in the working array W7.
Addition of the contributions of the mass source terms14 to W7.

W7(I) = W7(I) |i | SMACEL(I) (IV.O.22)

Loop over the non orthogonalities


Assuming that the mesh is orthogonal, a single inversion would enable resolving the problem. The
loop over the non-orthogonal elements is described below:

Start of the loop at k (thereafter, we are at k + 1)

? Updating of SMBR at the start of the loop15 .

SMBR(I) = W7(I) SMBR(I)

? Calculation of the norm of SMBR in prodsc. It is called RESIDU in the code. As we solve the
system incrementally, the second member must cancel out convergence.
? If RESIDU < 10 RNORMP, convergence is attained16 .
Call to itrmas to reupdate the mass flux with the facet gradient ((p)k ) f . We
calculate at each face Teijn ((p)k ) f ij . S ij et Tebnik ((p)k ) f b ik . S b ik .

13 (pn )
pn n
J pI
f ij . S ij is the gradient normal to the face that is equal to
S ij on an orthogonal mesh.
14 The
IJ
array W7 contains the second member without the gradient of p. It therefore remains invariant at each sweep.
On the other hand, SMBR contains the entire second member and consequently varies at each sweep.
15 The sign - results from the construction of the matrix.
16 is the pressure convergence tolerance which can be modified by the user in usini1, via the array EPSILO.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 262/402

l=k
Reupdate17 of the pressure pn+1 = pn + ((p))l .
P
l=1
? Alternatively,
((p))k+1 = 0,
Call to invers for inversion of the system (IV.O.19). The inversion algorithm stop
test data RESIDU is normalized by RNORMP (see gradco for the inversion of the pressure
operator).
? If the maximum number of sweeps is attained,
Call to itrmas to increment the mass flux by the pressure gradient (p)k .
Second call to itrmas for incrementation of the mass flux with the non-reconstructed
gradient of ((p))k+1 to ensure a final divergence-free field is obtained, thereby assur-
ing consistency with the pressure matrix which does not take non orthogonalities into
account18 .
Update of the pressure increment (p)k+1 = (p)k + ((p))k+1 .
? Otherwise,
Incrementation of the mass flux taking into account a coefficient of relaxation. (p)k+1 =
(p)k + RELAX (()p)k+1 . The relaxation factor has a default setting of 1; however
this can be modified in usini1.
Call to itrgrp for calculation of the T n (p) part of the second member (to which
the array W7 will be added at the start of a (new) loop).
X X
SMBR(I) = Teijn ((p)k ) f ij . S ij + Tebnik ((p)k ) fb ik . S b ik
jN eigh(i) kb (i)

End of the loop

Updating of the pressure


We update the pressure with the sum of the increments of p.

pn+1 = pn + (p)kconv

where,
k=k
Xconv

(p)kconv = ((p))k
k=1

In practice, RTP contains (p)kconv . We therefore increment pn by RTP:

RTP = RTPA + RTP

l=k
17 (p)k ((p))l is stored in RTP(*,IPRIPH).
P
=
l=1
18 Reference can be made to the subroutine navstv for further detail.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 263/402

Points to treat
There are a number of outstanding issues that still need to be resolved:

1. The use of the normal gradient as an approximation of the pressure increment gradient can pose
problems in terms of consistency, as indicated notably in the remark below.
2. The approximation Ten (T n n) . n is not made for the reconstruction of the gradients in the
second member of the pressure equation. Nor is it made when calculating the cell-based gradient
during application of the Rhie & Chow filter.
1
3. Use of the weighting factor to improve numerical stability when computing calculations based
2
on the values at the faces (e.g. in itrmas or itrgrp during reconstruction of the pressure
increment gradient at the face).
4. We could verify the normalized residual calculation (see predvv).

5. When computing the mass flux of u
e+ T pn in inimas, we use the boundary conditions of the

velocity at the time level n. The validity of this approach remains to be clarified, particularly
for the boundary conditions at the outlet. More generally, further analysis of the boundary
conditions of the variables in navstv is required. This issue is linked to the problem highlighted
at the end of visecv.
6. During the convergence test for the loop over the non-orthogonal elements, we multiply the
tolerance by a factor of 10. Is this really necessary?
7. The problem with the relaxation factor used during updates of the pressure-correction term in
the loop over the non orthogonalities (it might be worthwhile replacing this with a dynamic
relaxation factor).
8. Use of the Rhie & Chow filter can prove quite problematic in some configurations. However,
before undertaking any work to modify this, it would be worthwhile to first verify its utility by
assessing whether or not it plays a clear and positive role in any of the configurations.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 264/402

P- turbke routine

Fonction
Le but de ce sous-programme est de resoudre le syst`eme des equations de k et de mani`ere semi-
couplee.
Le syst`eme dequations resolu est le suivant :
 
k t
+ div u k ( + )k = P + G + kdiv (u) + (ki k)


t k




 +k k + k

(IV.P.1)
2

t
+ div u ( + ) = C1 [P + (1 C3 )G] C2 + div (u)





t k k
+(i ) + +

P est le terme de production par cisaillement moyen :


   
ui ui uj 2 uk 2 ui
P = Rij = t + + t ij + kij
 x j  x j xi 3 xk 3 xj
ui uj ui 2 2 2
= t + t (div u) kdiv (u)
" x j
 2
xi xj
 2
3
 2 
3
2  2  2 #
u v w u v u w v w
= t 2 +2 +2 + + + + + +
x y z y x z x z y
2 2 2
t (div u) kdiv (u)
3 3

1 t
G est le terme de production par gravite : G = gi
t xi
k2
La viscosite turbulente est t = C .

Les constantes sont :
C = 0, 09 ; C2 = 1, 92 ; k = 1 ; = 1, 3
C3 = 0 si G > 0 (stratification instable) et C3 = 1 si G 6 0 (stratification stable).

est un eventuel terme source de masse (tel que lequation de conservation de masse devienne +
t
div (u) = ). i ( = k ou ) est la valeur de associee `a la masse injectee ou retiree. Dans le cas
o`
u on retire de la masse ( < 0), on a forcement i = . De meme, quand on injecte de la masse, on
specifie souvent aussi i = . Dans ces deux cas, le terme disparat de lequation. Dans la suite du
u on a > 0 et i 6= .
document, on qualifiera dinjection forcee les cas o`
k , k , , sont des termes sources utilisateur eventuels, conduisant `a une implicitation partielle,
imposes le cas echeant par le sous-programme ustske.


Discretisation
La resolution se fait en trois etapes, afin de coupler partiellement les deux variables k et . Pour
simplifier, reecrivons le syst`eme de la facon suivante :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 265/402


k = D(k) + Sk (k, ) + kdiv (u) + (ki k) + k k + k

t (IV.P.2)


= D() + S (k, ) + div (u) + (i ) + +
t

D est loperateur de convection/diffusion. Sk (resp. S ) est le terme source de k (resp. ).

`re phase : bilan explicite


Premie

On resout le bilan explicite :


(n)

(n) ke k

= D(k (n) ) + Sk (k (n) , (n) ) + k (n) div (u) + (ki k (n) ) + k k (n) + k
t (IV.P.3)
(n)
(n) e

= D((n) ) + S (k (n) , (n) ) + (n) div (u) + (i (n) ) + (n) +
t

(le terme en nest pris en compte que dans le cas de linjection forcee)

`me phase : couplage des termes sources


Deuxie

On implicite les termes sources de mani`ere couplee :


(n)

(n) kts k

= D(k (n) ) + Sk (kts , ts ) + k (n) div (u) + (ki k (n) ) + k k (n) + k
t (IV.P.4)
(n)
(n) ts

= D((n) ) + S (kts , ts ) + (n) div (u) + (i (n) ) + (n) +
t
soit
(n)
ke k (n)

(n) kts k

= (n) + Sk (kts , ts ) Sk (k (n) , (n) )
t t (IV.P.5)
(n)
(n) ts e (n)
= (n) + S (kts , ts ) S (k (n) , (n) )

t t

Le terme en div (u) nest pas implicite car il est lie au terme D pour assurer que la matrice dimplicitation
sera `
a diagonale dominante. Le terme en et les termes sources utilisateur ne sont pas implicites non
plus, mais ils le seront dans la troisi`eme phase.
Et on ecrit (pour = k ou )

(n) (n) (n) S (n) S

S (kts , ts ) S (k , ) = (kts k ) + (ts ) (IV.P.6)
k k(n) ,(n)
k(n) ,(n)

On resout donc finalement le syst`eme 2 2 :


(n)
Sk Sk (n)
(n) ke k

(n)

t k k(n) ,(n) k(n) ,(n)  
(kts k ) t
= (IV.P.7)

(n) (n) (n)

S S ( )

ts e
(n)

k k(n) ,(n) t k(n) ,(n) t

`me phase : implicitation de la convection/diffusion


Troisie
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 266/402

On resout le syst`eme :
(n+1)
k (n)

(n) k

= D(k (n+1) ) + Sk (kts , ts ) + k (n+1) div (u) + (ki k (n+1) )
t



+k k (n+1) + k

(n+1) (n) (IV.P.8)
(n)

= D((n+1) ) + S (kts , ts ) + (n+1) div (u) + (i (n+1) )

t
+ (n+1) +

soit
k (n+1) k (n) kts k (n)


(n) = D(k (n+1) ) D(k (n) ) + (n) + (k (n+1) k (n) )div (u)
t t



(k (n+1) k (n) ) + k (k (n+1) k (n) )

(n+1) (n) (IV.P.9)
ts (n)
(n) = D((n+1) ) D((n) ) + (n) + ((n+1) (n) )div (u)




t t
((n+1) (n) ) + ((n+1) (n) )

Le terme en nest l`
a encore pris en compte que dans le cas de linjection forcee. Le terme en nest
pris en compte que si est negatif, pour eviter daffaiblir la diagonale de la matrice quon va inverser.

Precisions sur le couplage


Lors de la phase de couplage, afin de privilegier la stabilite et la realisabilite du resultat, tous les termes
ne sont pas pris en compte. Plus precisement, on peut ecrire :

2 

Sk = C k P + G 2 kdiv (u)


 3 2 (IV.P.10)
S = C C k P + (1 C )G 2 C div (u) C


1 3
3 1 2
k
 
ui uj ui 2
en notant P = + (div u)2
xj xi xj 3
1
et G = gi
t xi
On a donc en theorie
Sk k   2

= 2C P + G div (u)
k 3




S k

=
(IV.P.11)
S   2
= C1 C P + (1 C3 )G + C2 2


k k



S = 2 C1 div (u) 2C2



3 k

En pratique, on va chercher ` a assurer kts > 0 et ts > 0. En se basant sur un calcul simplifie, ainsi
que sur le retour dexperience dESTET, on montre quil est preferable de ne pas prendre en compte
certains termes. Au final, on realise le couplage suivant :

ke k (n)

(n)
  
A11 A12 (kts k ) t
= (IV.P.12)

A21 A22 (ts (n) ) e (n)

t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 267/402

avec
1 k (n) h  i 2
A11 = 2C (n) Min P + G , 0 + Max [div (u), 0]





t 3
A12 = 1


 (n) 2
  (IV.P.13)

A21 = C1 C P + (1 C3 )G C2

k (n)

(n)



A22 = 1 2
+ C Max [div (u), 0] + 2C2 (n)

t 3 1 k

(par definition de C3 , P + (1 C3 )G est toujours positif)

Mise en uvre

Calcul du terme de production


On appelle trois fois grdcel pour calculer les gradients de u, v et w. Au final, on a
 2  2  2  2  2  2
u v w u v u w v w
TINSTK = 2 +2 +2 + + + + + +
x y z y x z x z y
et
u v w
DIVU = + +
x y z
(le terme div(u) nest pas calcule par divmas, pour correspondre exactement `a la trace du tenseur des
deformations qui est calcule pour la production)

Lecture des termes sources utilisateur


Appel de cs user turbulence source terms pour charger les termes sources utilisateurs. Ils sont
stockes dans les tableaux suivants :
W7 = k
W8 =
DAM = k
W9 =
Puis on ajoute le terme en (divu)2 `
a TINSTK. On a donc
TINSTK = P

Calcul du terme de gravit e


Calcul uniquement si IGRAKE = 1.
On appelle grdcel pour ROM, avec comme conditions aux limites COEFA = ROMB et COEFB = VISCB = 0.
PRDTUR = t est mis `
a 1 si on na pas de scalaire temperature.
G est calcule et les termes sources sont mis `a jour :
TINSTK = P + G h i
TINSTE = P + Max G, 0 = P + (1 C )G
3

Si IGRAKE = 0, on a simplement
TINSTK = TINSTE = P

Calcul du terme daccumulation de masse


On stocke W1 = div (u) calcule par divmas (pour correspondre aux termes de convection de la
matrice).

Calcul des termes sources explicites


On affecte les
 termes sources explicites de k et pour
 la premi`ere etape.
2 (n) (n) (n) (n)
SMBRK = t (P + G) k div u + k (n) div (u)
3
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 268/402

(n)
   
2 (n) (n) (n) (n)
SMBRE = (n) C1 t (P + (1 C3 )G) k div u C2 + (n) div (u)
k 3
(n) (n)
soit SMBRK = Sk + k (n) div (u) et SMBRE = S + (n) div (u).

Calcul des termes sources utilisateur


On ajoute les termes sources utilisateur explicites `a SMBRK et SMBRE, soit :
(n)
SMBRK = Sk + k (n) div (u) + k k (n) + k
(n)
SMBRE = S + (n) div (u) + (n) +
Les tableaux W7 et W8 sont liberes, DAM et W9 sont conserves pour etre utilises dans la troisi`eme phase
de resolution.

Calcul des termes de convection/diffusion explicites


bilsc2 est appele deux fois, pour k et pour , afin dajouter `a SMBRK et SMBRE les termes de convec-
tion/diffusion explicites D(k (n) ) et D((n) ). Ces termes sont dabord stockes dans W7 et W8, pour etre
conserves et reutilises dans la troisi`eme phase de resolution.

Termes source de masse


Dans le cas dune injection forcee de mati`ere, on passe deux fois dans catsma pour ajouter les termes en
(ki k (n) ) et (i (n) ) `
a SMBRK et SMBRE. La partie implicite () est stockee dans les variables
W2 et W3, qui seront utilisees lors de la troisi`eme phase (les deux variables sont bien necessaires, au cas
o`
u on aurait une injection forcee sur k et pas sur , par exemple).

Fin de la premi` ere phase


Ceci termine la premi`ere phase. On a
ke k (n)
SMBRK = (n)
t
(n)
(n) e
SMBRE =
t

Phase de couplage
(uniquement si IKECOU = 1)
On renormalise SMBRK et SMBRE qui deviennent les seconds membres du syst`eme de couplage.
1 ke k (n)
SMBRK = (n)
SMBRK =
t
1 e (n)
SMBRE = SMBRE =
(n) t
2
et DIVP23 = Max [div (u), 0].
3
On remplit la matrice de couplage
1 k (n) h  i 2
A11 = 2C (n) Min P + G , 0 + Max [div (u), 0]
t 3
A12 = 1 2
(n)
  
A21 = C1 C P + (1 C3 )G C2
k (n)
(n)
1 2
A22 = + C1 Max [div (u), 0] + 2C2 (n)
t 3 k
On inverse le syst`eme 2 2, et on recup`ere :
DELTK = kts k (n)
DELTE = ts (n)

Fin de la deuxi`
eme phase
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 269/402

On met ` a jour les variables SMBRK et SMBRE.


kts k (n)
SMBRK = (n)
t
(n)
(n) ts
SMBRE =
t
Dans le cas o` u on ne couple pas (IKECOU = 0), ces deux variables gardent la meme valeur qu`a la fin
de la premi`ere etape.

Calcul des termes implicites


On retire `a SMBRK et SMBRE la partie en convection diffusion au temps n, qui etait stockee dans W7 et
W8.
kts k (n)
SMBRK = (n) D(k (n) )
t
ts (n)
SMBRE = (n) D((n) )
t
On calcule les termes implicites, hors convection/diffusion, qui correspondent `a la diagonale de la
matrice.
(n)
TINSTK = div (u) + + Max[k , 0]
t
(n)
TINSTE = div (u) + + Max[ , 0]
t
( nest pris en compte quen injection forcee, cest-`a-dire quil est forcement positif et ne risque pas
daffaiblir la diagonale de la matrice).

R
esolution finale
On passe alors deux fois dans codits, pour k et , pour resoudre les equations du type :
TINST ((n+1) (n) ) = D((n+1) ) + SMBR.

clipping final
On passe enfin dans la routine clipke pour faire un clipping eventuel de k (n+1) et (n+1) .
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 270/402

Q- turrij routine

Fonction
Le but de ce sous-programme est de resoudre le syst`eme des equations des tensions de Reynolds et de
la dissipation de mani`ere totalement decouplee dans le cadre de lutilisation du mod`ele Rij LRR1
(option ITURB = 30 dans usini1).
Le tenseur symetrique des tensions de Reynolds est note R. Les composantes de ce tenseur representent
le moment dordre deux de la vitesse : Rij = ui uj .
Pour chaque composante Rij , on resout :

Rij
+ div (u Rij Rij ) = Pij + Gij + ij + dij ij + Rij div (u)
t (IV.Q.1)
+(Rijin Rij ) + Rij Rij + Rij

P est le tenseur de production par cisaillement moyen :


 
uj ui
Pij = Rik + Rjk (IV.Q.2)
xk xk

G est le tenseur de production par gravite :


 
1
Gij = Gij C3 (Gij ij Gkk ) (IV.Q.3)
3
avec

3 C k
Gij = (ri gj + rj gi )
2 t



1

k = Rll (IV.Q.4)
2


ri = Rik


xk

Dans ce qui prec`ede, k represente lenergie turbulente2 , gi la composante de la gravite dans la direction
i, t le nombre de Prandlt turbulent et C , C3 des constantes definies dans Tab. Q.1.
est le terme de correlations pression-deformation. Il est modelise avec le terme de dissipation de
la mani`ere suivante :

2
ij [ij ij ] = ij,1 + ij,2 + ij,w (IV.Q.5)
3
Il en resulte :

2
ij ij = ij,1 + ij,2 + ij,w ij (IV.Q.6)
3
1 la description du SSG est pr
evue pour une version ult erieure de la documentation
2 Les sommations se font sur lindice l et on applique plus gen
eralement la convention de sommation dEinstein.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 271/402

Le terme ij,1 est un terme lent de retour `a lisotropie. Il est donne par :

2
ij,1 = C1 (Rij kij ) (IV.Q.7)
k 3
Le terme ij,2 est un terme rapide disotropisation de la production. Il est donne par :

2
ij,2 = C2 (Pij Pij ) (IV.Q.8)
3

avec,

1
P= Pkk
2

Le terme ij,w est appele terme decho de paroi. Il nest pas utilise par defaut dans Code Saturne,
mais peut etre active avec IRIJEC = 1. Si y represente la distance `a la paroi :
 
k 3 3 l
ij,w = C10 Rkm nk nm ij Rki nk nj Rkj nk ni f ( )
 2 2 y (IV.Q.9)
0 3 3 l
+ C2 km,2 nk nm ij ki,2 nk nj kj,2 nk ni f ( )
2 2 y

f est une fonction damortissement construite pour valoir 1 en paroi et tendre vers 0 en seloignant
des parois.
3
k2
La longueur l represente , caracteristique de la turbulence. On prend :

3
l k2
f ( ) = min(1, C0,75 ) (IV.Q.10)
y y

dij est un terme de diffusion turbulente3 qui vaut :

k Rij
dij = CS ( Rkm ) (IV.Q.11)
xk xm

k
On notera par la suite A = CS R. Ainsi, dij = div ( A (Rij )) est une diffusion avec un coefficient

tensoriel.
Le terme de dissipation turbulente est traite dans ce qui prec`ede avec le terme .
est le terme source de masse4 , Rijin est la valeur de Rij associee `a la masse injectee ou retiree.
(Rij Rij +Rij ) represente le terme source utilisateur (sous-programme cs user turbulence source terms)
eventuel avec une decomposition permettant dimpliciter la partie Rij Rij si Rij > 0.
De meme, on resout une equation de convection/diffusion/termes sources pour la dissipation . Cette
equation est tr`es semblable `
a celle du mod`ele k (voir turbke), seuls les termes de viscosite turbulente
et de gravite changent. On resout :

2
+ div [u ()] = d + C1 [P + G ] C2 + div (u) (IV.Q.12)
t k k
+( in ) + +
3 Dans la litt
erature, ce terme contient en g
eneral la dissipation par viscosit
e mol
eculaire.
4 Dans
ce cas, l
equation de continuit
e s
ecrit : + div (u) = .
t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 272/402

C C C1 C2 C1 C2 C3 CS C10 C20
0, 09 0, 18 1, 44 1, 92 1, 8 0, 6 0, 55 0, 22 0, 5 0, 3

Table Q.1: Definition des constantes utilisees.

d est le terme de diffusion turbulente :


 
k
d = C Rkm (IV.Q.13)
xk xm
k
On notera par la suite A0 = C R. Le terme de diffusion turbulente est donc modelise par :

d = div (A0 ())

La viscosite turbulente usuelle (t ) en mod`ele k est remplacee par le tenseur visqueux A0 .


1
P est le terme de production par cisaillement moyen : P = Pkk . Ce terme est modelise avec la notion
2
de viscosite turbulente dans le cadre du mod`ele k . Dans le cas present, il est calcule `a laide des
tensions de Reynolds (` a partir de Pij ).
G est le terme de production des effets de gravite pour la variable .
1
G = max(0, Gkk ) (IV.Q.14)
2


Discretisation
La resolution se fait en decouplant totalement les tensions de Reynolds entre elles et la dissipation . On
resout ainsi une equation de convection/diffusion/termes sources pour chaque variable. Les variables
sont resolues dans lordre suivant : R11 , R22 , R33 , R12 , R13 , R23 et . Lordre de la resolution nest
pas important puisque lon a opte pour une resolution totalement decouplee en nimplicitant que les
termes pouvant etre linearises par rapport `a la variable courante5 .
Les equations sont resolues `
a linstant n + 1.

Variables tensions de Reynolds


Pour chaque composante Rij , on ecrit :

Rijn+1 Rijn
n + div (u)n Rijn+1 n Rijn+1 = Pijn + Gij
n
 
tn n,n+1 n n
+ij,1 + ij,2 + ij,w
2
+dijn,n+1 n n ij + Rijn+1 div (u)n
3
+(Rijin Rijn+1 )
n
+R ij
Rijn+1 + R n
ij
(IV.Q.15)
n est la viscosite moleculaire6 .
Lindice ( n, n + 1) est relatif `
a une semi implicitation des termes (voir ci-dessous). Quand seul lindice
(n) est utilise, il suffit de reprendre lexpression des termes et de considerer que toutes les variables
sont explicites.
5 En effet, aucune variable nest actualis
ee pour la r
esolution de la suivante.
6 La viscosit
e peut d
ependre eventuellement de la temp erature ou dautres variables.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 273/402

Dans le terme n,n+1


ij,1 donne ci-dessous, la tension de Reynolds Rij est implicite (les tensions diagonales
apparaissent aussi dans lenergie turbulente k). Ainsi :
n
 
n,n+1 n ij n+1 2 n 1 n
ij,1 = C1 n (1 )Rij ij (k Rii ) (IV.Q.16)
k 3 3 2
 
Le terme de diffusion turbulente d secrit : dij = div A Rij . Le tenseur A est toujours explicite. En
integrant sur un volume de contr
ole (cellule) l , le terme d de diffusion turbulente de Rij secrit :
Z X
dijn,n+1 d = An Rijn+1
 
lm
. n lm S lm (IV.Q.17)
l mVois(l)

a la face7 lm = lm de la fronti`ere l = lm de l , face designee


n lm est la normale unitaire `
m
par abus par lm et S lm sa surface associee.
On decompose An en partie diagonale Dn et extra-diagonale E n :

An = D n + E n
Ainsi, Z X  n 
dij d = D Rij lm . n lm S lm
l mVois(l)
| {z }
X  partie diagonale (IV.Q.18)
E n Rij lm . n lm S lm

+
mV ois(l)
| {z }
partie extra-diagonale

La partie extra-diagonale sera prise totalement explicite et interviendra donc dans lexpression re-
groupant les termes purement explicites fsexp du second membre de codits.
Pour la partie diagonale, on introduit la composante normale du gradient de la variable principale
Rij . Cette contribution normale sera traitee en implicite pour la variable et interviendra `a la fois dans
lexpression de la matrice simplifiee du syst`eme resolu par codits et dans le second membre traite par
bilsc2. La contribution tangentielle sera, elle, purement explicite et donc prise en compte dans fsexp
intervenant dans le second membre de codits.
On a :
Rij = Rij (Rij . n lm ) n lm + (Rij . n lm ) n lm (IV.Q.19)

Comme  n
D [(Rij . n lm ) n lm ] . n lm = nlm (Rij . n lm )


avec :
nlm = (D11
n
) n21, lm + (D22
n
) n22, lm + (D33
n
) n23, lm
on peut traiter ce terme nlm comme une diffusion avec un coefficient de diffusion independant de la
direction.

Finalement, on ecrit :
Z
dijn,n+1 d =
l X  n
E Rijn lm . n lm S lm

+
mV ois(l)  (IV.Q.20)
Dn Rijn
P 
+ lm
. n lm S lm
mV ois(l)
nlm Rijn+1 . n lm S lm
 
nlm Rijn . n lm S lm +
P P

mV ois(l) mV ois(l)

7 La notion de face purement interne ou de bord nest pas explicitee ici, pour all
eger lexpos
e. Pour
etre rigoureux et
homog` ees, il faudrait distinguer m V ois(l) et m b (l).
ene avec les notations adopt
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 274/402

Les trois premiers termes sont totalement explicites et correspondent `a la discretisation de loperateur
continu :
div ( E n Rijn ) + div ( Dn [ Rijn (Rijn . n) n ] )
en omettant la notion de face.
Le dernier terme est implicite relativement `a la variable Rij et correspond `a loperateur continu :
div ( Dn (Rijn+1 . n) n)

Variable
On resout lequation de de facon analogue `a celle de Rij .
n+1 n
n + div (( u)n n+1 ) div (n n+1 ) = d n,n+1

tn
kn (n )2
+C1 n [P n + Gn ] n C2 n
k
+n+1 div (u)n
+( in n+1 ) + n n+1 + n
(IV.Q.21)
Le terme de diffusion turbulente d n,n+1 est traite comme celui des variables Rij et secrit :
 n
d n,n+1 = div A0 n+1


n
Le tenseur A0 est toujours explicite. On le decompose en une partie diagonale D0 et une partie
n
extra-diagonale E 0 :
n n n
A0 = D0 + E 0
Ainsi :
Z X  0n
d n,n+1 d = E n lm . n lm S lm

l mVois(l)
n
D0 n
 
nlm (n . n lm ) S lm
P P
+ lm
. n lm S lm (IV.Q.22)
mV ois(l) mV ois(l)

nlm n+1 . n lm S lm
P
+
mV ois(l)

avec :
0n 0n 0n
nlm = (D11 ) n21, lm + (D22 ) n22, lm + (D33 ) n23, lm .
On peut traiter ce terme nlm comme une diffusion avec un coefficient de diffusion independant de la
direction.
Les trois premiers termes sont totalement explicites et correspondent `a loperateur :
n n
div ( E 0 n ) + div ( D0 [ n ( n . n) n] )
en omettant la notion de face.
Le dernier terme est implicite relativement `a la variable et correspond `a loperateur :
n
div ( D0 ( n+1 . n) n)

Mise en uvre
La numero de la phase traitee fait partie des arguments de turrij. On omettra volontairement de le
preciser dans ce qui suit, on indiquera par ( ) la notion de tableau sy rattachant.

Calcul des termes de production P


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 275/402

a zero du tableau PRODUC dimensionne `a NCEL 6.


? Initialisation `
? On appelle trois fois grdcel pour calculer les gradients des composantes de la vitesse u, v et w
prises au temps n.
Au final, on a :
n n n
 
n u n u n u n
PRODUC(1,IEL) = 2 R11 + R12 + R13 (production de R11 )
x y z 
n n n

n v n v n v n
PRODUC(2,IEL) = 2 R12 + R22 + R23 (production de R22 )
x y z 
n n n

n w n w n w n
PRODUC(3,IEL) = 2 R13 + R23 + R33 (production de R33 )
x y z
n n n

n u n u n u
PRODUC(4,IEL) = R12 + R22 + R23
x y z 
n n n

n v n v n v n
R11 + R12 + R13 (production de R12 )
x y z 
n n n

n u n u n u
PRODUC(5,IEL) = R13 + R23 + R33
x y z 
n n n

n w n w n w n
R11 + R12 + R13 (production de R13 )
x y z
n n n

n v n v n v
PRODUC(6,IEL) = R13 + R23 + R33
x y z 
n n n

n w n w n w n
R12 + R22 + R23 (production de R23 )
x y z

Calcul du gradient de la masse volumique n prise au d ebut du pas de temps courant8


(n + 1)
Ce calcul na lieu que si les termes de gravite doivent etre pris en compte (IGRARI() = 1).

? Appel de grdcel pour calculer le gradient de n dans les trois directions de lespace. Les con-
ditions aux limites sur n sont des conditions de Dirichlet puisque la valeur de n aux faces de
bord ik (variable IFAC) est connue et vaut b ik . Pour ecrire les conditions aux limites sous la
forme habituelle,
b ik = COEFA + COEFB nI 0
on pose alors COEFA = PROPCE(IFAC,IPPROB(IROM)) et COEFB = VISCB = 0.
PROPCE(1,IPPROB(IROM)) (resp.VISCB) est utilise en lieu et place de lhabituel COEFA (COEFB),
lors de lappel `
a grdcel.
On a donc : n
n n
GRAROX = , GRAROY = et GRAROZ = .
x y z

Le gradient de n servira `
a calculer les termes de production par effets de gravite si ces derniers sont
pris en compte.

Boucle ISOU de 1 ` a 6 sur les tensions de Reynolds


Pour ISOU = 1, 2, 3, 4, 5, 6, on resout respectivement et dans lordre les equations de R11 , R22 , R33 ,
R12 , R13 et R23 par lappel au sous-programme resrij.
La resolution se fait par increment Rijn+1,k+1 , en utilisant la meme methode que celle decrite dans le
sous-programme codits. On adopte ici les memes notations. SMBR est le second membre du syst`eme
a inverser, syst`eme portant sur les increments de la variable. ROVSDT represente la diagonale de la
`
matrice, hors convection/diffusion.
8 i.e. calcul
ee `
a partir des variables du pas de temps pr
ec
edent n si n
ecessaire.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 276/402

On va resoudre lequation (IV.Q.15) sous forme incrementale en utilisant codits, soit :


 n
nL

L ij
n
+ L C1 n (1 ) m lm + L + max(Rij , 0) |l | (Rijn+1,p+1 ) L
n n
tn kL 3
| {z }
ROVSDT contribuant `
a la diagonale de la matrice simplifi
ee de matrix

(Rijn+1,p+1 )M (Rijn+1,p+1 )L )
" #
X n+1,p+1
+ mnlm Rij, f lm (nlm + nlm ) S lm
mV ois(l)
L0 M 0
| {z }
convection upwind pur et diffusion non reconstruite relatives ` ee de matrix9
a la matrice simplifi
nL  n+1,p 
= n (Rij )L (Rijn )L
Z t 
div [ ( u)n Rijn+1,p (n + n ) Rijn+1,p ] d

| l {z } (IV.Q.23)
convection et diffusion traiteespar bilsc2
n
Z   
2
+ Pijn+1,p + Gijn+1,p n C1 n Rijn+1,p k n ij + ij,2 n+1,p n+1,p
+ ij,w d
Zl  k 3 
2
+ n n ij + ( Rijin Rijn+1,p ) + R n
Rijn+1,p + R
n
d
l 3 h i
ij ij

E n Rijn+1,p
P
+ . n lm S lm
mV ois(l) h lm
i
Dn Rijn+1,p
P
+ . n lm S lm
mV ois(l) lm
 
nlm Rijn+1,p . n lm S lm
P

mV ois(l)
mnlm (Rijn+1,p )L
P
+
mV ois(l)

o`
u on rappelle :
pour n donne entier positif, on definit la suite (Rijn+1,p )pN par :
(
Rijn+1,0 = Rijn
Rijn+1,p+1 = Rijn+1,p + Rijn+1,p+1

(Rijn+1,p+1 ) L designe la valeur sur lelement l du ( p + 1 )-i`eme increment de Rijn+1 , mnlm le flux de
n+1,p+1
masse `a linstant n `a travers la face lm, Rij, f lm vaut (Rijn+1,p+1 )L si mnlm > 0, (Rijn+1,p+1 )M sinon,
Pijn+1,p , ij,2
n+1,p n+1,p
, ij,w les valeurs des quantites associees correspondant `a lincrement (Rijn+1,p ).

Tous ces termes sont calcules comme suit :

Terme de gauche de lequation (IV.Q.23)


Dans resrij est calculee la variable ROVSDT. Les autres termes sont completes par codits, lors
de la construction de la matrice simplifiee , via un appel au sous-programme matrix. La quantite
(nlm + nlm ) `
a la face lm est calculee lors de lappel `a visort.

Second membre de lequation (IV.Q.23)


Le premier terme non detaille est calcule par le sous-programme bilsc2, qui applique le schema
convectif choisi par lutilisateur, qui reconstruit ou non selon le souhait de lutilisateur les gradi-
ents intervenants dans la convection-diffusion.
Les termes sans accolade sont, eux, compl`etement explicites et ajoutes au fur et `a mesure dans
SMBR pour former lexpression fsexp de codits.
9 Si IRIJNU = 1, on remplace n n
lm par ( + t ) lm dans lexpression de la diffusion non reconstruite associ
ee `
a la
matrice simplifi
ee de matrix (t d
esigne la viscosit ee comme en k ).
e turbulente calcul
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 277/402

On decrit ci-dessous les etapes de resrij :

DELTIJ = 1, pour ISOU 6 3 et DELTIJ = 0 Si ISOU > 3. Cette valeur represente le symbole de
Kroeneker ij .
Initialisation `
a zero de SMBR (tableau contenant le second membre) et ROVSDT (tableau contenant
la diagonale de la matrice sauf celle relative `a la contribution de la diagonale des operateurs de
convection et de diffusion linearises 10 ), tous deux de dimension NCEL.
Lecture et prise en compte des termes sources utilisateur pour la variable Rij
Appel `a cs user turbulence source terms pour charger les termes sources utilisateurs. Ils sont
stockes comme suit. Pour la cellule l de centre L, representee par IEL, on a :

ROVSDT(IEL) = |l | Rij
SMBR(IEL) = |l | Rij
On affecte alors les valeurs adequates au second membre SMBR et `a la diagonale ROVSDT comme
suit :
n

SMBR(IEL) = SMBR(IEL) + |l | Rij (Rij )L
ROVSDT(IEL) = max ( |l | Rij , 0)
La valeur de ROVSDT est ainsi calculee pour des raisons de stabilite numerique. En effet, on ne
rajoute sur la diagonale que les valeurs positives, ce qui correspond physiquement `a impliciter
les termes de rappel uniquement.
Calcul du terme source de masse si L > 0
Appel de catsma et incrementation si necessaire de SMBR et ROVSDT via :

SMBR(IEL) = SMBR(IEL) + |l | L (Rijin )L (Rijn )L


  

ROVSDT(IEL) = ROVSDT(IEL) + |l | L

Calcul du terme daccumulation


Z de masse et du terme instationnaire
On stocke W1 = div ( u) d calcule par divmas `a laide des flux de masse aux faces in-
l
ternes mnlm = (u)nlm . S lm (tableau FLUMAS) et des flux de masse aux bords mnblk =
P
mV ois(l)
(u)nblk . S blk (tableau FLUMAB). On incremente ensuite SMBR et ROVSDT.
P
kb (l)
Z
n


SMBR(IEL) = SMBR(IEL) + ICONV div ( u) d)
(Rij )L (
l
|l | nL
Z

ROVSDT(IEL) = ROVSDT(IEL) + ISTAT ICONV ( div ( u) d)
tn

l

2
Calcul des termes sources de production, des termes ij,1 + ij,2 et de la dissipation ij :
3
On effectue une boucle dindice IEL sur les cellules l de centre L :
1 n 1
TRPROD = (P )L = [PRODUC(1,IEL) + PRODUC(2,IEL) + PRODUC(3,IEL)]
2 ii 2
1 n
TRRIJ = (Rii )L
2
SMBR(IEL) =SMBR(IEL) + 
n 2 C2 n n
L |l | ij (Pii )L + (C1 1) L
3 2
2 nL

n
+ (1 C2 ) PRODUC(ISOU,IEL) C1 n) (Rij )L
(Rii L
10 qui correspondent aux sch
emas convectif upwind pur et diffusif sans reconstruction.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 278/402

1 2 nL
ROVSDT(IEL) = ROVSDT(IEL) + nL |l | ( ij + 1) C1 n)
3 (Rii L

Appel de rijech pour le calcul des termes decho de paroi nij,w si IRIJEC() = 1 et ajout dans
SMBR.
SMBR = SMBR + nij,w
Suivant son mode de calcul (ICDPAR), la distance `a la paroi est directement accessible par
RA(IDIPAR+IEL-1) (|ICDPAR| = 1) ou bien est calculee `a partir de IA(IIFAPA+IEL - 1), qui
donne pour lelement IEL le numero de la face de bord paroi la plus proche (|ICDPAR| = 2). Ces
tableaux ont ete renseigne une fois pour toutes au debut de calcul.
n
Appel de rijthe pour le calcul des termes de gravite Gij et ajout dans SMBR.
n
Ce calcul na lieu que si IGRARI() = 1. SMBR = SMBR + Gij
 
Calcul de la partie explicite du terme de diffusion div A Rijn , plus precisement des contribu-
tions du terme extradiagonal pris aux faces purement internes (remplissage du tableau VISCF),
puis aux faces de bord (remplissage du tableau VISCB).
? Appel de grdcel pour le calcul du gradient de Rijn dans chaque direction. Ces gradients
sont respectivement stockes dans les tableaux de travail W1, W2 et W3.
? boucle dindice IEL sur les cellules l de centre L pour le calcul de E n Rijn aux cellules
dans un premier temps :

1 n
TRRIJ = (R )L
2 ii
n
(Rii )L
CSTRIJ = nL CS
2 nL
n
(Rii )L
W4(IEL) = nL CS n
n
[ (R12 n
)L W2(IEL) + (R13 )L W3(IEL) ]
2 L
n
(Rii )L
W5(IEL) = nL CS n
[ (R12 n
)L W1(IEL) + (R23 )L W3(IEL) ]
2 nL
n
(Rii )L
W6(IEL) = nL CS n
[ (R13 n
)L W1(IEL) + (R23 )L W2(IEL) ]
2 nL
? Appel de vectds11 pour assembler E n Rijn . n lm S lm aux faces lm.
 

? Appel de divmas pour calculer la divergence du flux defini par VISCF et VISCB. Le resultat
est stocke dans W4.
Ajout au second membre SMBR.
SMBR = SMBR + W4
A lissue de cette etape, seule la partie extradiagonale de la diffusion prise enti`erement explicite :
X 
E n Rijn lm . n lm S lm


mV ois(l)

a ete calculee.

Calcul de la partie diagonale du terme de diffusion12 :


Comme on la deja vu, une partie de cette contribution sera traitee en implicite (celle relative
a la composante normale du gradient) et donc ajoutee au second membre par bilsc2 ; lautre
`
partie sera explicite et prise en compte dans fsexp .
? On effectue une boucle dindice IEL sur les cellules l de centre L :
11 Le r
esultat est stock
e dans VISCF et VISCB. Dans vectds, les valeurs aux faces internes sont interpol
ees lin
eairement
sans reconstruction et VISCB est mis `a z
ero.
12 Seule la composante normale du gradient de R
ij aux faces sera implicite.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 279/402

1 n
TRRIJ = (R )L
2 ii
(Riin )L
CSTRIJ = nL CS
2 nL
(Riin )L
W4(IEL) = nL CS n
(R11 )L
2 nL
(Riin )L
W5(IEL) = nL CS n
(R22 )L
2 nL
(Riin )L
W6(IEL) = nL CS n
(R33 )L
2 nL
? On effectue une boucle dindice IFAC sur les faces purement internes lm pour remplir le
tableau VISCF :
Identification des cellules l et m de centre respectif L (variable II) et M (variable
JJ), se trouvant de chaque cote de la face lm13 .
Calcul du carre de la surface de la face. La valeur est stockee dans le tableau SURFN2.
 
Interpolation du gradient de Rijn `a la face lm (gradient facette Rijn lm ) :

1


GRDPX = (W1(II) + W1(JJ))



2


1

GRDPY = (W2(II) + W2(JJ))


2



1
GRDPZ = (W3(II) + W3(JJ))

2
 
Calcul du gradient de Rijn normal `a la face lm, Rijn lm .n lm S lm .

GRDSN = GRDPX SURFAC(1,IFAC) + GRDPY SURFAC(2,IFAC) + GRDPZ SURFAC(3,IFAC)


SURFAC est le vecteur surface de la face IFAC.
 
calcul de Rijn (Rijn . n lm )n lm , les vecteurs etant calcules `a la face lm :

GRDSN

GRDPX = GRDPX SURFAC(1,IFAC)
SURFN2






GRDSN

GRDPY = GRDPY SURFAC(2,IFAC)

SURFN2




GRDSN

GRDPZ = GRDPZ SURFAC(3,IFAC)
SURFN2
finalisation du calcul de lexpression totalement explicite
 n
D Rijn (Rijn . n lm ) n lm . n lm


1
VISCF = ( W4(II) + W4(JJ)) GRDPX SURFAC(1,IFAC)) +
2
1
( W5(II) + W5(JJ)) GRDPY SURFAC(2,IFAC)) +
2
1
( W6(II) + W6(JJ)) GRDPZ SURFAC(3,IFAC))
2
? Mise a
` zero du tableau VISCB.
13 La normale `
a la face est orient
ee de L vers M.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 280/402

? Appel de divmas pour calculer la divergence de :

D n Rijn (Rijn . n lm )n lm


defini aux faces dans VISCF et VISCB.


Le resultat est stocke dans le tableau W1.
Ajout au second membre SMBR.
SMBR = SMBR + W1
Calcul de la viscosite orthotrope nlm `a la face lm de la variable principale Rijn
Ce calcul permet au sous-programme codits de completer le second membre SMBR par :

Rijn . n lm D n n lm lm . n lm S lm
  
nlm Rijn . n lm S lm +
P P
mV ois(l) mVois(l)
(IV.Q.24)
( nlm + nlm ) Rijn . n lm S lm
P
=
mV ois(l)

sans preciser la nature de la face lm, via lappel `a bilsc2 et de disposer de la quantite (nlm + nlm )
pour construire sa matrice simplifiee.

? On effectue une boucle dindice IEL sur les cellules l :


1
TRRIJ = (Riin )L
2
n (Riin )L
RCSTE = L CS
2 nL
(Riin )L
W1(IEL) = n + nL CS n
(R11 )L
2 nL
(Riin )L
W2(IEL) = n + nL CS n
(R22 )L
2 nL
(Riin )L
W3(IEL) = n + nL CS n
(R33 )L
2 nL
? Appel de visort pour calculer la viscosite orthotrope 14 nlm = (D n n lm ).n lm aux faces lm
Le resultat est stocke dans les tableaux VISCF et VISCB.

appel de codits pour la resolution de lequation de convection/diffusion/termes sources de la


variable Rij . Le terme source est SMBR, la viscosite VISCF aux faces purement internes ( resp.
VISCB aux faces de bord) et FLUMAS le flux de masse interne ( resp. FLUMAB flux de masse au
bord). Le resultat est la variable Rij au temps n + 1, donc Rijn+1 . Elle est stockee dans le tableau
RTP des variables mises ` a jour.

Appel de reseps pour la r


esolution de la variable

On decrit ci-dessous le sous-programme reseps, les commentaires du sous-programme resrij ne seront


pas repetes puisque les deux sous-programmes ne diff`erent que par leurs termes sources.

Initialisation `
a zero de SMBR et ROVSDT.
Lecture et prise en compte des termes sources utilisateur pour la variable :
14 Comme S lm
dans le sous-programme viscfa, on multiplie la viscosit
e par u S lm et L0 M 0 repr
, o` esentent respec-
L0 M 0
tivement la surface de la face lm et la mesure alg ebrique du segment reliant les projections des centres des cellules
voisines sur la normale `a la face. On garde dans ce sous-programme la possibilite dinterpoler la viscosit
e aux cellules
lin
eairement ou dutiliser une moyenne harmonique. La viscosite au bord est celle de la cellule de bord correspondante.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 281/402

Appel de cs user turbulence source terms pour charger les termes sources utilisateurs. Ils
sont stockes dans les tableaux suivants :
pour la cellule l representee par IEL de centre L, on a :

ROVSDT(IEL) = |l |
SMBR(IEL) = |l |
On affecte alors les valeurs adequates au second membre SMBR et `a la diagonale ROVSDT comme
suit :
= SMBR(IEL) + |l | nL

SMBR(IEL)
ROVSDT(IEL) = max ( |l | , 0)
Calcul du terme source de masse si L > 0 :
SMBR(IEL) = SMBR(IEL) + |l | L (Lin nL )


ROVSDT(IEL) = ROVSDT(IEL) + |l | L

Calcul du terme daccumulation


Z de masse et du terme instationnaire
On stocke W1 = div ( u) d calcule par divmas `a laide des flux de masse internes et aux
l
bords.
On incremente ensuite SMBR et ROVSDT.
Z


SMBR(IEL) = SMBR(IEL) + ICONV nL ( div ( u) d)
l
|l | nL
Z

ROVSDT(IEL) = ROVSDT(IEL) + ISTAT ICONV ( div ( u) d)
tn

l


Traitement du terme de production C1 P et du terme de dissipation C2
k k
pour cela, on effectue une boucle dindice IEL sur les cellules l de centre L :
1 n 1
TRPROD = (Pii )L = [PRODUC(1,IEL) + PRODUC(2,IEL) + PRODUC(3,IEL)]
2 2
1 n
TRRIJ = (Rii )L
2
2 (nL )2 nL
 
n n
SMBR(IEL) = SMBR(IEL) + L |l | C2 n ) + C1 (Rn ) (Pii )L
(Rii L ii L
2 nL
ROVSDT(IEL) = ROVSDT(IEL) + C2 nL |l | n)
(Rii L

Appel de rijthe pour le calcul des termes de gravite Gn et ajout dans SMBR.
SMBR = SMBR + Gn
Ce calcul na lieu que si IGRARI() = 1.
Calcul de la diffusion de
Le terme div () + A0 () est calcule exactement de la meme mani`ere que pour les tensions
 

de Reynolds Rij en remplacant A par A0 .


Appel de codits pour la resolution de lequation de convection/diffusion/termes sources de la
variable principale . Le resultat n+1 est stocke dans le tableau RTP des variables mises `a jour.

clippings finaux
On passe enfin dans le sous-programme clprij pour faire un clipping eventuel des variables Rijn+1 et
n+1 . Le sous-programme clprij est appele15 avec ICLIP = 2 . Cette option 16 contient loption
ICLIP = 1 et permet de verifier linegalite de Cauchy-Schwarz sur les grandeurs extra-diagonales du
tenseur R (pour i 6= j, |Rij |2 Rii Rjj ).
15 Loption ICLIP = 1 consiste en un clipping minimal des variables R et en prenant la valeur absolue de ces variables
ii
puisquelles ne peuvent etre que positives.
16 Quand la valeur des grandeurs R ou est n egative, on la remplace par le minimum entre sa valeur absolue et (1,1)
ii
fois la valeur obtenue au pas de temps pr ec
edent.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 282/402

Points a` traiter
Sauf mention explicite, representera une tension de Reynolds ou la dissipation turbulente ( =
Rij ou ).

La vitesse utilisee pour le calcul de la production est explicite. Est-ce quune implicitation peut
ameliorer la precision temporelle de 17 ?
Dans quelle mesure le terme decho de paroi est-il valide ? En effet, ce terme est remis en question
par certains auteurs.

On peut envisager la resolution dun syst`eme hyperbolique pour les tensions de Reynolds afin
dintroduire un couplage avec le champ de vitesse.
Le flux au bord VISCB est annule dans le sous-programme vectds. Peut-on envisager de mettre
au bord la valeur de la variable concernee `a la cellule de bord correspondant? De meme, il
faudrait se pencher sur les hypoth`eses sous-jacentes `a lannulation des contributions aux bords
de VISCB lors du calcul de :
 n
D Rijn (Rijn . n lm ) n lm . n lm .


Un probl`eme de ponderation apparat plus generalement. Si on prend la partie explicite de


1
D (), la ponderation aux faces internes utilise le coefficient avec ponderation separee de D
2
et (), alors que pour E (), on calcule dabord ce terme aux cellules pour ensuite linterpoler
lineairement aux faces 18 . Ceci donne donc deux types dinterpolations pour des termes de meme
nature.
On laisse la possibilite dans visort dutiliser une moyenne harmonique aux faces. Est-ce que
ceci est valable puisque les interpolations utilisees lors du calcul de la partie explicite de A
sont des moyennes arithmetiques ?

Les techniques adoptees lors du clipping sont `a revoir.


On utilise dans le cadre du mod`ele Rij une semi-implicitation de termes comme ij,1 ou

C2 . On peut envisager le meme type dimplicitation dans turbke meme en presence du
k
couplage k .
Ladoption dune resolution decouplee fait perdre linvariance par rotation.
La formulation et limplantation des conditions aux limites de paroi devront etre verifiees. En
effet, il semblerait que, dans certains cas, des phenom`enes oscillatoires apparaissent, sans quil
soit aise den determiner la cause.

Limplicitation partielle (du fait de la resolution decouplee) des conditions aux limites conduit
souvent ` a des calculs instables. Il conviendrait den connatre la raison. Limplicitation partielle
avait ete mise en uvre afin de tenter dutiliser un pas de temps plus grand dans le cas de jets
axisymetriques en particulier.

17 Cette remarque peut etre gen


eralis
ee. En effet, peut-on envisager dactualiser les variables dej`
a r
esolues (sans
r
eactualiser les variables turbulentes apr` es leur r
esolution)? Ceci obligerait `
a modifier les sous-programmes tels que
condli qui sont appel es au debut de la boucle en temps.
18 Cette interpolation se fait dans vectds avec des coefficients de ponderation aux faces.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 283/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 284/402

R- viscfa routine

Fonction
Dans ce sous-programme est calcule le coefficient de diffusion isotrope aux faces. Ce coefficient fait
intervenir la valeur de la viscosite aux faces multipliee par le rapport surface de la face sur la distance
algebrique I 0 J 0 ou I 0 F (cf. figure IV.R.1), rapport resultant de lintegration du terme de diffusion. Par
analogie du terme calcule, ce sous-programme est aussi appele par le sous-programme resopv pour
calculer le coefficient diffusif de la pression faisant intervenir le pas de temps.
La valeur de la viscosite aux faces est determinee soit par une moyenne arithmetique, soit par une
moyenne harmonique de la viscosite au centre des cellules, suivant le choix de lutilisateur. Par defaut,
cette valeur est calculee par une moyenne arithmetique.


Discretisation
On rappelle dans la figure IV.R.1, la definition des differents points geometriques utilises par la suite.
11
00
00
11
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11 F I
i Sb 00
11
00
11
J 00
11
00
11
F 00
11
I J 00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11
00
11 i

Figure IV.R.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).

Lintegration du terme de diffusion sur une cellule i est la suivante :


fJ 0 fI 0 f b fI 0
Z X X
div ( (f )) d = ij 0J 0
. S ij + bik ik 0 . S bik (IV.R.1)
i jV ois(i)
I k (i)
IF
b

S ij Sb
Dans ce sous-programme, on calcule les termes de diffusion ij et bik . 0 ik .
I 0J 0 IF

La valeur de la viscosite sur la face interne ij, ij , est calculee :


F soit par moyenne arithm etique :

ij = ij i + (1 ij ) j (IV.R.2)

avec ij = 0.5 car ce choix semble stabiliser, bien que cette interpolation soit dordre 1 en espace en
convergence.
F soit par moyenne harmonique :

i j
ij =
ij i + (1 ij ) j
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 285/402

F J0
avec ij = .
I 0J 0

La valeur de la viscosite sur la face de bord ik, bik , est definie ainsi :

bik = I .
Remarque

Lors de lappel de viscfa par le sous-programme resopv, le terme `a considerer est :

div ( tn (p) )

soit :
= n = t

Mise en uvre
La valeur de la viscosite au centre des cellules est entree en argument via la variable VISTOT. On
calcule sa valeur moyenne aux faces et on la multiplie par le rapport surface SURFN sur la distance
algebrique DIST pour une face interne (SURFBN et DISTBR respectivement pour une face de bord). La
valeur du terme de diffusion resultant est mise dans le vecteur VISCF pour une face interne et VISCB
pour une face de bord.
La variable IMVISF determine quel type de moyenne est utilise pour calculer la viscosite aux faces.
Si IMVISF= 0, la moyenne est arithmetique, sinon la moyenne est harmonique.

Points a` traiter
Lobtention des interpolations utilisees dans le code Code Saturne du paragraphe R est resumee dans le
rapport de Davroux et al1 . Les auteurs de ce rapport ont montre que, pour un maillage monodimen-
sionnel irregulier et avec une viscosite non constante, la convergence mesuree est dordre 2 en espace
avec linterpolation harmonique et dordre 1 en espace avec linterpolation lineaire (pour des solution
reguli`eres).
Par consequent, il serait preferable dutiliser linterpolation harmonique pour calculer la valeur de la
viscosite aux faces. Des tests de stabilite seront necessaires au prealable.
De meme, on envisage dextrapoler la viscosite sur les faces de bord plutot que de prendre la valeur de
la viscosite au centre de la cellule jouxtant cette face.
Dans le cas de la moyenne arithmetique, lutilisation de la valeur 0.5 pour les coefficients ij serait `
a
revoir.

1 Davroux A., Archambeau F. et H erard J.M., Tests num


eriques sur quelques m
ethodes de r
esolution dune
equation
de diffusion en volumes finis, HI-83/00/027/A.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 286/402

S- visort routine

Fonction
Dans ce sous-programme est calcule le coefficient de diffusion orthotrope aux faces. Ce type de
coefficient se rencontre pour la diffusion de R ij et en R ij ( cf. turrij), ainsi que pour la
correction de pression dans le cadre de lalgorithme avec couplage vitesse-pression renforce (resopv).
Ce coefficient fait intervenir la valeur de la viscosite aux faces multipliee par le rapport surface de la
face sur la distance algebrique I 0 J 0 , rapport resultant de lintegration du terme de diffusion. La valeur
de la viscosite aux faces est basee soit sur une moyenne arithmetique, soit sur une moyenne harmonique
de la viscosite au centre des cellules.


Discretisation
La figure IV.S.1 rappelle les diverses definitions geometriques pour les faces internes et les faces de
bord.
11
00
00
11
Sij 00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11
00
11 F I
i Sb 00
11
00
11
J 00
11
00
11
F 00
11
I J 00
11
00
11
00
11
O 00
11 I
j 00
11
00
11
00
11
00
11
00
11
I 00
11
00
11 i

Figure IV.S.1: Definition des differentes entites geometriques pour les faces internes (gauche) et de
bord (droite).

Lintegration du terme de diffusion orthotrope sur une cellule est la suivante :


Z X X
div ( f ) d = ( f ) ij . S ij + ( f ) bik . S bik (IV.S.1)
i jV ois(i) kb (i)

avec :
x 0 0
=0 y 0 (IV.S.2)
0 0 z
et :
S ij = S ij n ij
(IV.S.3)
S bik = S bik n bik
Le terme ( (f )) ij n ij est calcule `
a laide de la decomposition suivante :

( f ) ij = (f . n ij ) n ij + (f. ij ) ij (IV.S.4)

o`
u ij represente un vecteur tangent (unitaire) `a la face. Une decomposition similaire est utilisee aux
faces de bord.
Dans la matrice, seul le terme (f . n ij ) n ij est integrable facilement en implicite. Par consequent,
la partie projetee sur ij est :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 287/402

negligee dans le cas du calcul des echelles de temps relatives au couplage vitesse-pression renforce,
traitee en explicite dans les termes de diffusion de R ij (cf. turrij).

Lintegration implicite du terme de diffusion secrit :


fJ 0 fI 0 f b fI 0
Z X X
div ( f ) d = ( n ij ) . S ij 0J 0
+ ( n bik ) . S bik ik 0 (IV.S.5)
i jV ois(i)
I k (i)
IF
b

( n ij ) . S ij
Dans ce sous-programme, on calcule le terme `a laide la formule :
I 0J 0
( n ij ) . n ij = moy
ij = xij (n xij )2 + yij (n yij )2 + zij (n zij )2
soit encore :
xij (S ij
x 2
) + yij (S ij
y 2
) + zij (S ij
z 2
)
moy
ij = 2
S ij
Au bord, on calcule de meme :
( n bik ) . S bik
I 0F
avec :
Ix (S bxik )2 + Iy (S byik )2 + Iz (S bzik )2
( n bik ) . n bik = moy
bik =
S 2bik

La valeur de la viscosite dans une direction l sur la face, lij , est calculee :

soit par interpolation lineaire :


lij = ij il + (1 ij )jl (IV.S.6)
avec ij = 0.5 car ce choix semble stabiliser bien que cette interpolation soit dordre 1 en espace
en convergence,
soit par interpolation harmonique :
il jl
lij =
ij il + (1 ij )jl
o`
u:
F J0
ij =
I 0J 0

Mise en uvre
La viscosite orthotrope au centre des cellules est entree en argument via les variables W1 , W2 et W3 .
On calcule la valeur moyenne de chaque viscosite aux faces de facon arithmetique ou harmonique.
S ij
Ensuite, on calcule la viscosite equivalente correspondant `a ( n ij ) . 0 0 pour les faces internes et `
a
IJ
S
( n bik ) . 0bik pour les faces de bord.
IF

Cette ecriture fait intervenir les vecteurs surface stockes dans le tableau SURFAC, la norme de la surface
SURFN et la distance algebrique DIST pour une face interne (SURFBO, SURFBN et DISTBR respectivement
pour une face de bord). La valeur du terme de diffusion resultant est mise dans le vecteur VISCF
(VISCB aux faces de bord).
La variable IMVISF determine quel type de moyenne est utilise pour calculer la viscosite dans une
direction `
a la face. Si IMVISF= 0, alors la moyenne est arithmetique, sinon la moyenne est harmonique).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 288/402

Points a` traiter
Lobtention des interpolations utilisees dans le code Code Saturne du paragraphe S est resumee dans le
rapport de Davroux et al1 . Les auteurs de ce rapport ont montre que, pour un maillage monodimen-
sionnel irregulier et avec une viscosite non constante, la convergence mesuree est dordre 2 en espace
avec linterpolation harmonique et dordre 1 en espace avec linterpolation lineaire (pour des solutions
reguli`eres). Par consequent, il serait preferable dutiliser linterpolation harmonique pour calculer la
valeur de la viscosite aux faces. Des tests de stabilite seront necessaires au prealable.
De meme, on envisage dextrapoler la viscosite sur les faces de bord plutot que de prendre la valeur de
la viscosite de la cellule jouxtant cette face.
Dans le cas de la moyenne arithmetique, lutilisation de la valeur 0.5 pour les coefficients ij serait ` a
revoir.

1 Davroux A., Archambeau F. et H erard J.M., Tests num


eriques sur quelques m
ethodes de r
esolution dune
equation
de diffusion en volumes finis, HI-83/00/027/A.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 289/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 290/402

T- visecv routine

Fonction
Dans ce sous-programme sont calcules les termes de gradient transpose et de viscosite secondaire (fluide
newtonien). Ils seront traites en explicite pur. En effet, si on traitait ces termes en implicite, cela
reviendrait `a coupler les equations des differentes composantes de la vitesse, ce qui nest pas compatible
avec le schema de resolution actuel (cf. sous-programme navstv).


Discretisation
Lintegration des termes de gradient transpose div ( tot t grad (v)) et de viscosite secondaire
2
( tot div (v)) est la suivante1 :
3
Z
div ( tot t grad (v) ) d
i "
vx vy vz
) moy,ij n xij + ( ) moy,ij n yij + ( ) moy,ij n zij )S ij
P P
= tot,ij ((
l=x,y,z jV ois(i) l l l

X vx v y v z
+ tot, bik (( ) moy, bik n xbik + ( ) moy, bik n ybik + ( ) moy, bik n zbik )S bik e l
l l l
kb (i)

Z
2
( tot div (v)) d
3 i
2 X X
l
X
= ( tot div (v)) ij S ij + ( tot div (v)) bik S bl ik e l
3
l=x,y,z jV ois(i) kb (i)

Le terme de viscosite tot est calcule en fonction du mod`ele de turbulence utilise :


(
+ t pour les mod`eles `a viscosite turbulente ou en LES,
tot =
pour les mod`eles au second ordre ou en laminaire.
o`
u et t representent respectivement la viscosite dynamique moleculaire et la viscosite dynamique
turbulente.

Mise en uvre
Terme de gradient transpose
Avant de calculer lintegration des deux termes, on calcule dans un premier temps la viscosite totale
en fonction du mod`ele de turbulence considere.
Les termes calcules dans ce sous-programme, appele par predvv, interviennent dans le second membre
de lequation de quantite de mouvement, et sont donc directement stockes dans le tableau correspon-
dant TRAV.
Le terme div ( tot t grad (v)) est calcule en operant comme suit.
On effectue une boucle sur les composantes v o` u = x, y, z de la vitesse ( correspond `a ISOU dans
le code) :
1 la viscosit
e de volume est suppos
ee nulle, cf. navstv
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 291/402

on calcule le gradient cellule de v par un appel au sous-programme grdcel.


on initialise un tableau nomme W6 `a la valeur 1 pour les cellules internes, et `a la valeur 0 pour
les cellules de bord. Ce tableau sert par la suite `a ne pas considerer la contribution du terme
de gradient transpose sur les cellules de bord. En effet, on ne sait pas ecrire de conditions aux
limites correctes pour le gradient transpose. On pref`ere donc tout simplement annuler son effet
sur les cellules de bord (cf. paragraphe T).
pour chaque direction l (l = x, y, z), l correspondant `a IDIM dans le code, on calcule pour chaque
cellule i dont le centre correspond `a la variable II ou JJ (pour les centres voisins) dans le code
:

TRAV(i, l)
= TRAV(i, l)
X v
X v
+W6 (i) tot, ij ( ) moy,ij S ij + tot, b ik ( ) moy,b ik S bik
l l
jV ois(i)   kb (i)
v 1 v v
avec ( ) moy,ij = ( )i + ( )j
l 2 l l

Fin de la boucle sur les composantes de la vitesse.

Terme de viscosite secondaire


2
Le terme de seconde viscosite ( tot div (v)) est calcule de la facon suivante :
3

on calcule la valeur de la vitesse sur la face ij en divisant le flux masse connu `a la face par la
i + j
densite moyenne moy, ij de la face ( moy, ij = ).
2
on calcule ensuite lintegrale volumique de la divergence de la vitesse sur chaque cellule en
appelant le sous-programme divmas.
2
on calcule alors pour chaque cellule i le terme ( tot div (v)) i que lon met dans le tableau
3
de travail W4 . La valeur de ce terme sur la face interne ij est obtenue en prenant la moyenne
arithmetique des valeurs des deux cellules avoisinantes (tableau VISCF) et celle sur la face de
bord est prise egale la valeur de la cellule avoisinante (tableau VISCB).
on calcule alors pour chaque direction l le terme final, i.e. :

2 X l
X
TRAV(i, l) = TRAV(i, l) ( tot div (v)) moy, ij S ij + ( tot div (v)) moy,b ik S bl ik
3
jV ois(i) kb (i)

Le traitement est similaire pour le terme de viscosite de volume dans le module compressible.

Points a` traiter
Lintegration du terme de gradient transpose pose un probl`eme de compatibilite. En effet, le gradient
transpose provient de lecriture de la divergence du tenseur des contraintes (cf. predvv), soit :

div () = div (pId + )


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 292/402

o`
u:
1 2 1
= 2 [ (grad v + t grad v) tr( (grad v + t grad v)) Id ]
|2 {z } |3 2 {z }
partie 1 partie 2

Or, lorsque lon int`egre la premi`ere partie de la divergence de , on implicite le terme div ( grad v)
et on explicite le gradient transpose div (t grad v). Ce traitement fait intervenir la vitesse au centre
des cellules. Elle ne verifie pas exactement la condition div (v) = 0. En effet, au cours de letape
de correction, on utilise un filtre Rhie et Chow (cf. resopv) et la vitesse nest mise `a jour qu`a la fin
de letape. Par contre, lorsque lon int`egre la deuxi`eme partie de la divergence de de facon explicite,
on utilise la vitesse issue du flux masse aux faces qui verifie la condition div (v) = 0 (du moins ` a
constant, linterpolation de `a la face etant egalement un point `a considerer). Ainsi, la discretisation
de ces deux parties nest pas totalement coherente. Il serait utile de baser la discretisation de ces
termes sur une vitesse verifiant la contrainte div (v) = 0.
Pour la meme raison, il est difficile de connatre les conditions aux limites du terme en gradient
transpose. Sur les cellules de bord, on sait uniquement que la contrainte totale normale doit equilibrer
le frottement et toutes les autres forces. Or, le tenseur des contraintes est scinde en une partie explicite
et une partie implicite, donc cest un peu difficile dutiliser cette condition physique.
Actuellement, la contribution aux cellules de bord du terme de gradient transpose est annulee, ce
qui elimine linfluence des conditions aux limites mais nest naturellement pas satisfaisant. Quelques
essais dintegration des conditions aux limites pour ce terme nont pas ete concluants jusqu`a present.
Cependant, des essais supplementaires sont envisageables.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 293/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 294/402

U- vortex routine

Fonction
Ce sous-programme est dedie `
a la generation des conditions dentree turbulente utilisees en LES.
La methode des vortex est basee sur une approche de tourbillons ponctuels. Lidee de la methode
consiste `a injecter des tourbillons 2D dans le plan dentree du calcul, puis `a calculer le champ de
vitesse induit par ces tourbillons au centre des faces dentree.


Discretisation
Pour utiliser la methode, on se place tout dabord dans un rep`ere local defini de mani`ere `a ce que
le plan (0yz), o`u sont injectes les vortex, soit confondu avec le plan dentree du calcul (voir figure
IV.U.1).

Lzz

P
M
Lyy

0
x
z

Figure IV.U.1: Definiton des differentes grandeurs dans le rep`ere local correspondant `a lentree dune
conduite de section carree.

u, v et w sont les composantes de la vitesse fluctuante (principale et transverse) dans ce plan, et


w v
(y, z) = la vorticite dans la direction normale au plan dentree. U (y, z) represente ici la
y z
vitesse principale moyenne imposee par lutilisateur dans le plan dentree.
Chaque vortex p va etre caracterise par sa fonction de forme (identique pour tous les vortex), sa
circulation p , son rayon p et les coordonnees (yp , zp ) du point P o`
u est situe le vortex dans le plan
(0yz).
Pour cela, on suppose que la vorticite generee par un vortex p au point M de coordonnee (y, z) secrit
:
p (y, z) = p p (r)
p
o`u r = (y yp )2 + (z zp )2 est la distance separant le point M du point P .
Dans la methode implantee, la fonction de forme est de type gaussienne modifiee :
1  r22  r2
2
(r) = 2e 2 1 e 2
2 2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 295/402

Le champ de vitesse induit par cette distribution de vorticite sobtient par inversion des deux equations
de poisson suivantes qui sont deduites de la condition dincompressibilite dans la plan1 :

= w et = v
y y

Dans le cas general, ce syst`eme peut etre integre `a laide de la formule de Biot et Savart.
Dans le cas dune distribution de vorticite de type gaussienne modifiee, les composantes de vitesse
verifient :
vp (y, x) = 1 (z zp ) 1 e 22 e 22
r2 r2
 

2 r 2

wp (y, z) = 1 (y yp ) 1 e 2 r2 r2
 
2
2
e 2

2 r2
Ces relations setendent de facon immediate au cas de N vortex distincts. Le champ de vitesse induit
par la distribution de vorticite
XN
(y, z) = p p (r) (IV.U.1)
p=1

vaut au point M :
PN PN
v(x, y) = p=1 p vp (y, z) et w(y, z) = p=1 p wp (y, z)

`
Parametres physiques
Marche en temps
La position initiale de chaque vortex est tiree de mani`ere aleatoire. On calcul les deplacements successifs
de chacun des vortex dans le plan dentree par integration explicite du champ de vitesse lagrangien :
dyp dzp
= V (y, z) et = W (y, z)
dt dt
Les vortex sont alors assimiles `
a des particules ponctuelles qui sont convectees par le champ (V, W ).
Ce champ peut etre impose par des tirages aleatoires ou bien deduit de la vitesse induite par les vortex
dans le plan dentree. Dans ce cas V (x, y) = V (y, z) + v(y, z) et W (y, z) = W (y, z) + w(y, z) o` u V et
W sont les composantes de la vitesse transverse moyenne quimpose lutilisateur `a laide des fichiers
de donnees.

Intensite et duree
de vie des vortex

Il serait possible, `
a partir de lequation de transport de la vorticite, dobtenir un mod`ele devolution
pour lintensite du vecteur tourbillon p associe `a chacun des vortex. En pratique, on pref`ere utiliser un
mod`ele simplifie dans lequel la circulation des tourbillons ne depend que de la postion de ces derniers
a linstant considere. La circulation initiale de chaque vortex est alors obtenue `a partir de la relation :
`
s
Sk
|p | = 4
3N [2ln(3) 3ln(2)]

o`
u S est la surface du plan dentree, N le nombre de vortex, et k lenergie cinetique turbulente au
point o`
u se trouve le vortex ` a linstant considere. Le signe de p correspond au sens de rotation du
vortex et est tire aleatoirement.
1 i.e v w
+ =0
y w
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 296/402

Ce param`etre est celui qui controle lintensite des fluctuations. Sa dependance en k exprime que, plus
lecoulement est turbulent, plus les vortex sont intenses. La valeur de k est specifiee par lutilisateur.
Elle peut etre constante ou imposee `a partir de profils denergie cinetique turbulente en entree.
Pour eviter que des structures trop allongees ne se developpent au niveau de lentree, lutilisateur doit
egalement specifier un temps limites p au bout duquel le vortex p va etre detruit. Ce temps p peut
etre pris constant ou estime au moyen de la relation :
3
5C k 2
p =
U

U et representent respectivement la vitesse moyenne principale et la dissipation turbulente au point


o`
u est initialement genere le vortex (C = 0, 09).
Lorsque le temps ecoule depuis la creation du vortex p est superieur `a p , le vortex est detruit et un
nouveau vortex genere (sa position et le signe de p sont tires de facon aleatoire).

Taille des vortex


La taille des vortex peut etre prise constante, ou calculee `a partir des relations :
3 3
C4 k 2
= ou = max[Lt , Lk ]

avec: s   3  41
5k
Lt = et Lk = 200

o`
u , k et sont la viscosite dynamique, lenergie cinetique turbulente et la dissipation turbulente au
point o`
u se trouve le vortex.
Dans tous les cas, la taille du vortex doit etre superieure `a la taille des mailles en entree afin que le
vortex soit effectivement simule.

Conditions aux limites


Le champ de vitesse genere ` a laide de la relation IV.U.2 ne tient pas compte a priori des conditions
aux limites appliquees sur les bords du plan dentree. Pour obtenir des valeurs de la vitesse qui soient
coherentes sur les fronti`eres du domaine dentree, des vortex images, pseudo-vortex situes en dehors
du domaine dentree, sont generes ` a des positions particuli`eres et leur champ de vitesse associe est
superpose au champ precedemment calcule.
Seuls les cas dune conduite rectangulaire et dune conduite circulaire permettent la generation de ces
pseudo-vortex. On distingue pour cela trois types de conditions aux limites.

Condition de paroi

On cree, pour chaque vortex P contenu dans le plan dentree, un vortex image P 0 identique ` a P
(i.e de meme caracteristiques) et symetrique de P par rapport au point J (J etant la projection
orthogonalement ` a la paroi du point M correspondant au centre de la face o` u lon cherche `a calculer
la vitesse). La figure IV.U.2 illustre la technique dans le cas dune conduite carree. Dans ce cas les
coordonnees du vortex situe en P 0 verifient (yp0 + yp )/2 = yJ et (zp0 + zp )/2 = zJ . Le champ de vitesse
percu depuis le point M au niveau du point J est nul, ce qui est bien leffet recherche.


Condition de symetrie

La technique est identique `


a celle utilisee pour les conditions de paroi, mais seule la composante pour
la vitesse normale au bord est modifiee dans ce cas.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 297/402

Vortex images au point M

M
P
P P
L

Condition de paroi Condition de priodicit


z

Figure IV.U.2: Principe de generation des vortex images suivant le type de conditions aux limites
dans une conduite carree.


Condition de periodicite
On cree pour chaque vortex, un vortex images P 0 identique `a P mais translate dune quantite L
correspondant `a la longueur qui separe les deux plans de la section dentree o` u sont appliquees les
conditions de periodicite. Dans le cas o`
u il y a deux directions de periodicite, on cree deux vortex
image.

Composante de vitesse principale


La methode des vortex ne generant pas de fluctuation u de la vitesse dans la direction principale, la
derni`ere composante est calculee `a partir dune equation de Langevin. Les coefficients de cette equation
sont determines par identification des expressions obtenues pour les contraintes de Reynolds en Rij .
Dans le cas dun ecoulement en canal plan, cette technique conduit `a lequation :
 
du C1 2 U p
= u+ C2 1 v + C0 dWi
dt 2T 3 y

k
avec T = , C1 = 1, 8, C2 = 0, 6, C0 = 14
15 , et dWi une variable aletoire Gaussienne de variance dt.

En pratique, lequation de Langevin nameliore pas vraiment les resultats. Elle nest utilisee que dans
le cas de conduites circulaires.

Mise en uvre
? Apres une etape de preparation de la memoire (memvor), on rep`ere dans usvort les faces dentree
pour lesquelles la methode va etre utilisee.

? Verification des dimensions rentrees (vervor).

? Le sous-programme vorpre se charge ensuite de preparer le calcul (transmission de la geometrie


des entrees `a tous les processeurs en cas de parallelisme, et construction dun tableau de connec-
tivite). Le sous-programme proc`ede ainsi :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 298/402

On compte, pour chaque entree IENT, le nombre de faces o` u est appliquee la methode.
Celui-ci est stocke dans le tableau ICVOR(IENT). Un passage dans la sous-routine memvor
(avec IAPPEL = 2) permet dallouer la memoire necessaire `a cette phase de preparation.
Pour chaque processeur, on stocke les coordonnees des faces dentree reperees precedemment
dans les tableaux de travail RA(IW1X),RA(IW1Y),RA(IW1Z),...
On regarde ensuite pour chaque processeur (boucle IPROC=1, NRANGP-1), si le processeur
IPROC a des donnees `
a envoyer aux autres processeurs (afin que tous disposent des coor-
donnees).
Si cest le cas : ICVOR(IENT)>0, et on place les donnees `a envoyer dans les tableaux
de travail RA(IW2X),RA(IW2Y),RA(IW2Z),.... La valeur NCOMV = ICVOR(IENT) cor-
respond alors `a la longueur des tableaux `a envoyer.
Sinon, on ne fait rien et NCOM=0.
Le processeur numero IPROC distribue `a tous les autres processeurs la valeur NCOM. Si
NCOM > 0, il envoie egalement les donnees contenues dans les tableaux de travails RA(IW2X),....
Ces donnees sont ensuite stockees par tous les processeurs dans les tableaux RA(IXYZV+III),...
afin de liberer les tableaux de travail pour la communication suivante, et lindice III = III + NCOM
est incremente de mani`ere ` a ranger les valeurs de facon chronologique.

Au final de la boucle sur IPROC, chaque processeur dispose des coordonnees des faces
dentree pour lesquelles la methode va etre utilisee, et il est donc simple de construire la
connectivite.

Construction de la connectivite. Au final, la vitesse au centre de la II eme face dentree


utilisant la methode est contenue `a la IA(IIFAGL+II) `eme ligne du tableau RA(IUVORT).
La routine se termine par un appel au sous-programme memvor ( avec IAPPEL = 3) afin de
reserver la memoire utile `
a la methode des vortex.

Cette phase dinitialisation est realisee une seule fois au debut du calcul. Cest apr`es cette phase
seulement que commence la methode des vortex proprement dite.

? Initialisation des variables avant intervention utilisateur (inivor).


? Appel au sous-programme utilisateur usvort (IAPPEL = 2).

? Verification des param`etres rentres (vervor).


? Calcul de la vitesse par la methode des vortex (vortex)
Initialisation du calcul generation du champ initial par appel au sous-programme vorini :
Construction du repere local (et calcul de lequation du plan dentree suivant les cas),
localisation du centre de lentree, et transformation des coordonnees de lentree dans le
rep`ere local. Les tableaux YZCEL(II,1) et YZCEL(II,2) contiennent les coordonnees
des faces du plan dentree une fois ramenees dans le rep`ere (0yz) (II est compris entre
1 et NCEVOR o` u NCEVOR=ICVOR represente le nombre de faces pour lesquelles la methode
va etre utilisee a cette entree).
Lecture du fichier de donnees, et initialisation des tableaux XDAT, YDAT, UDAT, VDAT,
WDAT, DUYDAT, KDAT, EPSDAT, ...
Si on ne fait pas de suite (ISUIVO=0) ou que lon reinitialise le calcul (INITVO=1),
tirage aleatoire de la position des vortex et de leur sens de rotation, ainsi que calcul
de leur duree de vie. Les positions sont stockees dans les tableaux YZVOR(IVOR,1) et
YZVOR(IVOR,2) (IVOR designant le numero du vortex).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 299/402

Stockage de la vitesse principale moyenne au centre de la cellule dans le tableau XU, et


recherche pour chaque vortex, de la face dentree qui lui est la plus proche.
Deplacement des vortex par appel au sous-programme vordep :
Convection des vortex.
Traitement des conditions aux limites. Les vortex qui sortent du domaine de calcul sont
replaces `a leur position dorigine.
Regeneration des vortex morts. Si le temps de vie cumule TEMPS(II) du vortex II
est superieur `a sont temps de vie limite TPSLIM(II), alors le vortex est detruit, et un
nouveau vortex est genere.
Recherche pour chaque vortex de la face dentree qui lui est la plus proche apr`es
deplacement (mise ` a jour du tableau IVORCE).
Calcul du champ de vitesse induit par appel au sous-programme vorvit :
Calcul de lintensite du vortex.
Calcul de la taille du vortex.
Calcul du champ de vitesse induit par lensemble des vortex au centre des faces dentree.
Traitement suivant les cas, des conditions de periodicite de symetrie et des conditions
de paroi par generation de vortex images.
Ajout de la vitesse moyenne dans les directions transverse aux tableaux XV et XW.
Generation des fluctuations de vitesse dans la direction principale par appel au sous-
programme vorlgv.
? appel au sous-programme vor2cl :
Communication en cas de parallelisme de la vitesse calculee en entree par le processeur 0 aux
autres processeurs.

Application des conditions aux limites apr`es utilisation dun changement de rep`ere eventuel.

Points a` traiter
Il serait possible de gagner de la memoire en liberant lespace aloue aux tableaux IW1X,...,IW2V apr`es
le passage dans vorpre.
Part V

Compressible module
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 301/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 302/402

A- cfbl** routine
Fonction
On sinteresse `
a la resolution des equations de Navier-Stokes en compressible, en particulier pour des
configurations sans choc. Le schema global correspond `a une extension des algorithmes volumes finis
mis en uvre pour simuler les equations de Navier-Stokes en incompressible.
Dans les grandes lignes, le schema est constitue dune etape acoustique fournissant la masse volu-
mique (ainsi quune prediction de pression et un debit acoustique), suivie de la resolution de lequation
de la quantite de mouvement ; on resout ensuite lequation de lenergie et, pour terminer, la pression
est mise `a jour. Moyennant une contrainte sur la valeur du pas de temps, le schema permet dassurer
la positivite de la masse volumique.
La thermodynamique prise en compte `a ce jour est celle des gaz parfaits, mais lorganisation du code
a ete prevue pour permettre `
` a lutilisateur de fournir ses propres lois.
Pour completer la presentation, on pourra se reporter `a la reference suivante :
[Mathon] P. Mathon, F. Archambeau, J.-M. Herard : Implantation dun algorithme compressible
dans Code Saturne , HI-83/03/016/A
a choc de la version 1.2 de Code Saturne permettra egalement dapporter
Le cas de validation tube `
quelques complements (tube ` a choc de Sod, discontinuite de contact instationnaire, double detente
symetrique, double choc symetrique).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 303/402

Notations
Symbole Unit
e Signification

h

Cp , Cp i J/(kg. K) capacite calorifique `a pression constante Cp = T P


Cv , Cv i J/(kg. K) capacite calorifique `a volume constant Cv = T
Df /b m2 /s diffusivite moleculaire du composant f dans le bain
E J/m3 energie totale volumique E = e
F centre de gravite dune face
H J/kg enthalpie totale massique H = E+P
I point de co-location de la cellule i
I0 pour une face ij partagee entre les cellules i et j, I 0 est le projete de
I sur la normale `a la ij passant par F , centre de ij
K kg/(m. s) diffusivite thermique
M , Mi kg/mol masse molaire (Mi pour le constituant i)
P Pa pression
Q kg/(m2 . s) vecteur quantite de mouvement Q = u
Qac kg/(m2 . s) vecteur quantite de mouvement issu de letape acoustique
Q kg/(m2 . s) norme de Q
R J/(mol. K) constante universelle des gaz parfaits
S J/(K. m3 ) entropie volumique
S [f ]. kg/(m3 . s) Terme de production/dissipation volumique pour le scalaire f
T K temperature (> 0)
Yi fraction massique du compose i (0 6 Yi 6 1)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 304/402

Symbole Unit
e Signification

P
c2 (m/s)2 carre de la vitesse du son c2 =
s
e J/kg energie totale massique e = + 12 u2
fv N/kg f v represente le terme source volumique pour la quantite de mou-
vement : gravite, pertes de charges, tenseurs des contraintes turbu-
lentes, forces de Laplace...
g m/s2 acceleration de la pesanteur
h J/kg enthalpie massique h = + P
i indice faisant reference `a la cellule i ; fi est la valeur de la variable f
associee au point de co-location I
I0 indice faisant reference `a la cellule i ; fI0 est la valeur de la variable
f associee au point I 0
jB N/m3 forces de Laplace
R
r, ri J/(kg. K) constante massique des gaz parfaits r = M (pour le constituant i, on
R
a ri = Mi )
s J/(K. kg) entropie massique
t s temps
u m/s vecteur vitesse
u m/s norme de u
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 305/402

Symbole Unit
e Signification

P

kg/(m3 . K) = s
Cp
kg/(m3 . K) constante caracteristique dun gaz parfait = Cv
J/kg energie interne massique
kg/(m. s) viscosite dynamique en volume
W/(m. K) conductivite thermique
kg/(m. s) viscosite dynamique ordinaire
kg/m3 densite
f [f ]. kg/(m2 . s) vecteur flux diffusif du compose f
f [f ]. kg/(m2 . s) norme de f

v kg/(m2 . s2 ) tenseur des contraintes visqueuses


s W/m2 vecteur flux conductif de chaleur
s W/m2 norme de s
v W/kg v represente le terme source volumique denergie, comprenant par
exemple leffet Joule j E, le rayonnement...
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 306/402

`
Systeme
dequations erence
laminaires de ref
Lalgorithme developpe propose de resoudre lequation de continuite, les equations de Navier-Stokes
ainsi que lequation denergie totale de mani`ere conservative, pour des ecoulements compressibles.




+ div (Q) = 0



t


Q

+ div (u Q) + P = f v + div (v ) (V.A.1)


t


E


+ div (u(E + P )) = f v u + div (v u) div s + v
t
Nous avons presente ici le syst`eme dequations laminaires, mais il faut preciser que la turbulence ne
pose pas de probl`eme particulier dans la mesure o` u les equations supplementaires sont decouplees du
syst`eme (V.A.1).


Expression des termes intervenant dans les equations

Energie totale volumique :
1
E = e = + u2 (V.A.2)
2
avec lenergie interne (P, ) donnee par lequation detat

Forces volumiques : f v (dans la plupart des cas f v = g)

Tenseur des contraintes visqueuses pour un fluide Newtonien :


2
v = (u + t u) + ( )div u Id (V.A.3)
3
avec (T, . . .) et (T, . . .) mais souvent = 0

Flux de conduction de la chaleur : loi de Fourier

s = T (V.A.4)

avec (T, . . .)

Source de chaleur volumique : v

Equations
detat
et expressions de lenergie interne
Gaz parfait

Equation detat : P = rT

P
Energie interne massique : =
( 1)
Soit :
1
P = ( 1)(e u2 ) (V.A.5)
2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 307/402


Melange de gaz parfaits
On consid`ere un melange de N constituants de fractions massiques (Yi )i=1...N

Equation detat : P = rmelange T

P
Energie interne massique : =
(melange 1)
Soit :
1
P = (melange 1)(e u2 ) (V.A.6)
2
N
P
Yi Cpi N
X
i=1
avec melange = N
et rmelange = Yi ri
P
Yi Cvi i=1
i=1


Equation detat de Van der Waals

Cette equation est une correction de lequation detat des gaz parfaits pour tenir compte des forces
intermoleculaires et du volume des molecules constitutives du gaz. On introduit deux coefficients cor-
rectifs : a [P a. m6 /kg 2 ] est lie aux forces intermoleculaires et b [m3 /kg] est le covolume (volume occupe
par les molecules).

Equation detat : (P + a2 )(1 b) = rT

(P + a2 )(1 b)
Energie interne massique : = a
1)
(
Soit :
1
1)
P = ( (e u2 + a) a2 (V.A.7)
(1 b) 2

P a2 (1 2b) 2a2 (1 b)
 
r Cp
avec = 1 + = +
Cv Cv P + a2 P + a2

Calcul des grandeurs thermodymamiques


Pour un gaz parfait a` constant
Equation d
etat : P = rT
On suppose connues la chaleur massique `a pression constante Cp et la masse molaire M du gaz, ainsi
que les variables detat.

R
Chaleur massique `
a volume constant : Cv = Cp = Cp r
M

Cp Cp
Constante caract
eristique du gaz : = =
Cv Cp r
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 308/402

P
Vitesse du son : c2 =


P P
Entropie : s= et = =
s

Remarque : Lentropie
 choisie
 ici nest pas lentropie physique, mais une entropie mathematique qui
2 s s
verifie c + =0
P P

Pression : P = ( 1)

1 P
Energie interne : = Cv T = avec sup = 0
1

P
Enthalpie : h = Cp T =
1


Pour un melange de gaz parfaits

Une intervention de lutilisateur dans le sous-programme utilisateur uscfth est necessaire pour pouvoir
utiliser ces lois.

N N
X X R
Equation d
etat : P = rmel T avec rmel = Yi ri = Yi
i=1 i=1
Mi
On suppose connues la chaleur massique `a pression constante des differents constituants Cp i , la masse
molaire Mi des constituants du gaz, ainsi que les variables detat (dont les fractions massiques Yi ).

N
!1
X Yi
Masse molaire du m
elange : Mmel =
i=1
M i

Chaleur massique ` a pression constante du m


elange :
N
X
Cp mel = Yi Cp i
i=1

Chaleur massique ` a volume constant du m elange :


N
X R
Cv mel = Yi Cv i = Cp mel = Cp mel rmel
i=1
M m
el

Cp mel Cp mel
Constante caract
eristique du gaz : mel = =
Cv mel Cp mel rmel

P
Vitesse du son : c2 = mel

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 309/402


P P
Entropie : s= et = = mel
mel s

Pression : P = (mel 1)

Energie interne : = Cv mel T avec sup = 0

mel P
Enthalpie : h = Cp mel T =
mel 1

Pour un gaz de Van der Waals


Ces lois nont pas ete programmees, mais lutilisateur peut intervenir dans le sous-programme utilisa-
teur uscfth sil souhaite le faire.

etat : (P + a2 )(1 b) = rT
Equation d
avec a [P a. m6 /kg 2 ] lie aux forces intermoleculaires et b [m3 /kg] le covolume (volume occupe par les
molecules).
On suppose connus les coefficients a et b, la chaleur massique `a pression constante Cp , la masse molaire
M du gaz et les variables detat.

P + a2
Chaleur massique `
a volume constant : Cv = Cp r
P a2 (1 2b)

P a2 (1 2b) 2a2 (1 b)
 
r Cp
Constante
equivalente du gaz : = 1 + = +
Cv Cv P + a2 P + a2

P + a2
Vitesse du son : c2 = 2a
(1 b)

    
1 b P
Entropie : s = (P + a2 ) et = =
s 1 b


Pression : 1)
P = ( ( + a) a2
(1 b)

Energie interne : = Cv T a avec sup = a

b P + a2
Enthalpie : h= 2a
1

Algorithme de base
On suppose connues toutes les variables au temps tn et on cherche `a les determiner `a linstant tn+1 .
On resout en deux blocs principaux : dune part le syst`eme masse-quantite de mouvement, de lautre
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 310/402

lequation portant sur lenergie et les scalaires transportes. Dans le premier bloc, on distingue le
traitement du syst`eme (couple) acoustique et le traitement de lequation de la quantite de mouvement
compl`ete.
Au debut du pas de temps, on commence par mettre `a jour les proprietes physiques variables (par
exemple (T ), (T ), Cp (Y1 , . . . , YN ) ou (T )), puis on resout les etapes suivantes :

1. Acoustique : sous-programme cfmsvl


Resolution dune equation de convection-diffusion portant sur n+1 .
On obtient ` a la fin de letape n+1 , Qn+1
ac et eventuellement une prediction de la pression
pred n+1 n
P ( , e ).

2. Quantit e de mouvement : sous-programme cfqdmv


Resolution dune equation de convection-diffusion portant sur un+1 qui fait intervenir Qn+1
ac et
P pred .
On obtient `a la fin de letape un+1 .


3. Energie totale : sous-programme cfener
Resolution dune equation de convection-diffusion portant sur en+1 qui fait intervenir Qn+1 ac ,
P pred et un+1 .
On obtient `a la fin de letape en+1 et une valeur actualisee de la pression P (n+1 , en+1 ).

4. Scalaires passifs
Resolution dune equation de convection-diffusion standard par scalaire, avec Qn+1
ac pour flux
convectif.


Discretisation
On se reportera aux sections relatives aux sous-programmes cfmsvl (masse volumique), cfqdmv (quan-
tite de mouvement) et cfener (energie). La documentation du sous-programme cfxtcl fournit des
elements relatifs aux conditions aux limites.

Mise en uvre
Le module compressible est une physique particuli`ere activee lorsque le mot-cle IPPMOD(ICOMPF) est
positif ou nul.
Dans ce qui suit, on precise les inconnues et les proprietes principales utilisees dans le module. On
fournit egalement un arbre dappel simplifie des sous-programmes du module : initialisation avec
initi1 puis (iniva0 et) inivar et enfin, boucle en temps avec tridim.

es
Inconnues et propriet
Les NSCAPP inconnues scalaires associees `a la physique particuli`ere sont definies dans cfvarp dans
lordre suivant :

la masse volumique RTP(*,ISCA(IRHO)),

lenergie totale RTP(*,ISCA(IENERG)),


la temperature RTP(*,ISCA(ITEMPK))
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 311/402

On souligne que la temperature est definie en tant que variable RTP et non pas en tant que propriete
physique PROPCE. Ce choix a ete motive par la volonte de simplifier la gestion des conditions
aux limites, au prix cependant dun encombrement memoire leg`erement superieur (une grandeur RTP
consomme plus quune grandeur PROPCE).
La pression et la vitesse sont classiquement associees aux tableaux suivants :

pression : RTP(*,IPR)
vitesse : RTP(*,IU), RTP(*,IV), RTP(*,IW).

Outre les proprietes associees en standard aux variables identifiees ci-dessus, le tableau PROPCE contient
egalement :

la chaleur massique `
a volume constant Cv , stockee dans PROPCE(*,IPPROC(ICV)), si lutilisateur
a indique dans uscfth quelle etait variable.
la viscosite en volume PROPCE(*,IPPROC(IVISCV)) si lutilisateur a indique dans uscfx2 quelle
etait variable.

Pour la gestion des conditions aux limites et en particulier pour le calcul du flux convectif par le schema
de Rusanov aux entrees et sorties (hormis en sortie supersonique), on dispose des tableaux suivants
dans PROPFB :

flux convectif de quantite de mouvement au bord pour les trois composantes dans les tableaux
PROPFB(*,IPPROB(IFBRHU)) (composante x), PROPFB(*,IPPROB(IFBRHV)) (composante y) et
PROPFB(*,IPPROB(IFBRHW)) (composante z)
flux convectif denergie au bord PROPFB(*,IPPROB(IFBENE))

et on dispose egalement dans IA :

dun tableau dentiers dont la premi`ere case est IA(IIFBRU), dimensionne au nombre de faces
de bord et permettant de reperer les faces de bord pour lesquelles on calcule le flux convectif par
le schema de Rusanov,
dun tableau dentiers dont la premi`ere case est IA(IIFBET), dimensionne au nombre de faces
de bord et permettant de reperer les faces de paroi `a temperature ou `a flux thermique impose.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 312/402

Arbre dappel simplifie

usini1 Initialisation des mots-cles utilisateur generaux et


positionnement des variables
usppmo Definition du module physique particuli`ere em-
ploye
varpos Positionnement des variables
pplecd Branchement des physiques particuli`eres pour la lec-
ture du fichier de donnees eventuel
ppvarp Branchement des physiques particuli`eres pour le po-
sitionnement des inconnues
cfvarp Positionnement des inconnues specifiques au module
compressible
uscfth Appele avec ICCFTH=-1, pour indiquer que Cp et
Cv sont constants ou variables
uscfx2 Conductivite thermique moleculaire constante ou
variable et viscosite en volume constante ou variable
(ainsi que leur valeur, si elles sont constantes)
ppprop Branchement des physiques particuli`eres pour le po-
sitionnement des proprietes
cfprop Positionnement des proprietes specifiques au module
compressible
ppini1 Branchement des physiques particuli`eres pour
linitialisation des mots-cles specifiques
cfini1 Initialisation des mots-cles specifiques au module
compressible
uscfi1 Initialisation des mots-cles utilisateur specifiques au
module compressible

Table A.1: Sous-programme initi1 : initialisation des mots-cles et positionnement des variables
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 313/402

ppiniv Branchement des physiques particuli`eres pour linitialisation des


variables
cfiniv Initialisation des variables specifiques au module compressible
memcfv Reservation de tableaux de travail locaux
uscfth Initialisation des variables par defaut (en calcul suite : seulement
Cv ; si le calcul nest pas une suite : Cv , la masse volumique et
lenergie)
uscfxi Initialisation des variables par lutilisateur (seulement si le calcul
nest pas une suite)

Table A.2: Sous-programme inivar : initialisation des variables

phyvar Calcul des proprietes physiques variables


ppphyv Branchement des physiques particuli`eres pour le calcul des pro-
prietes physiques variables
cfphyv Calcul des proprietes physiques variables pour le module com-
pressible
usphyv Calcul par lutilisateur des proprietes physiques variables pour le
module compressible (Cv est calcule dans uscfth qui est appele
par usphyv)

Table A.3: Sous-programme tridim : partie 1 (proprietes physiques)


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 314/402

dttvar Calcul du pas de temps variable


cfdttv Calcul de la contrainte liee au CFL en compressible
memcft Gestion de la memoire pour le calcul de la contrainte en CFL
cfmsfl Calcul du flux associe `a la contrainte en CFL
precli Initialisation des tableaux avant calcul des conditions aux limites
(IITYPF, ICODCL, RCODCL)
ppprcl Initialisations specifiques aux differentes physiques particuli`eres
avant calcul des conditions aux limites (pour le module compress-
ible : IZFPPP, IA(IIFBRU), IA(IIFBET), RCODCL, flux convectifs
pour la quantite de mouvement et lenergie)
ppclim Branchement des physiques particuli`eres pour les conditions aux
limites (en lieu et place de usclim)
uscfcl Intervention de lutilisateur pour les conditions aux limites (en
lieu et place de usclim, meme pour les variables qui ne sont pas
specifiques au module compressible)
condli Traitement des conditions aux limites
pptycl Branchement des physiques particuli`eres pour le traitement des
conditions aux limites
cfxtcl Traitement des conditions aux limites pour le compressible
uscfth Calculs de thermodynamique pour le calcul des conditions aux
limites
cfrusb Flux de Rusanov (entrees ou sorties sauf sortie supersonique)

Table A.4: Sous-programme tridim : partie 2 (pas de temps variable et conditions aux limites)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 315/402

memcfm Gestion de la memoire pour la resolution de letape acoustique


cfmsvl Resolution de letape acoustique
cfmsfl Calcul du flux de masse aux faces (note w n S dans la docu-
mentation du sous-programme cfmsvl)
cfdivs Calcul du terme en divergence du tenseur des contraintes
visqueuses (trois appels), eventuellement
Apr`es cfmsfl, on impose le flux de masse aux faces de bord `a
partir des conditions aux limites
cfmsvs Calcul de la viscosite aux faces (notee t c2 Sd dans la documen-
tation du sous-programme cfmsvl)
Apr`es cfmsvs, on annule la viscosite aux faces de bord pour que
le flux de masse soit bien celui souhaite
codits Resolution du syst`eme portant sur la masse volumique
clpsca Impression des bornes et clipping eventuel (pas de clipping en
standard)
uscfth Gestion eventuelle des bornes par lutilisateur
cfbsc3 Calcul du flux de masse acoustique aux faces (note Qac n dans
la documentation du sous-programme cfmsvl)
uscfth Actualisation de la pression, eventuellement
cfqdmv Resolution de la quantite de mouvement
cfcdts Resolution du syst`eme
cfbsc2 Calcul des termes de convection et de diffusion au second membre

Table A.5: Sous-programme tridim : partie 3 (Navier-Stokes)


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 316/402

scalai Resolution des equations sur les scalaires


cfener Resolution de lequation sur lenergie totale
memcfe Gestion de la memoire locale
cfdivs Calcul du terme en divergence du produit tenseur des contraintes
par vitesse
uscfth Calcul de lecart energie interne - Cv T (sup )
cfcdts Resolution du syst`eme
cfbsc2 Calcul des termes de convection et de diffusion au second membre
clpsca Impression des bornes et clipping eventuel (pas de clipping en
standard)
uscfth Gestion eventuelle des bornes par lutilisateur
uscfth Mise `a jour de la pression

Table A.6: Sous-programme tridim : partie 4 (scalaires)

Le sous-programme cfbsc3 est similaire `a bilsc2, mais il produit des flux aux faces et nest ecrit que
pour un schema upwind, `
a lordre 1 en temps (ce qui est coherent avec les choix faits dans lalgorithme
compressible).
Le sous-programme cfbsc2 est similaire `a bilsc2, mais nest ecrit que pour un schema dordre 1 en
temps. Le sous-programme cfbsc2 permet deffectuer un traitement specifique aux faces de bord pour
lesquelles on a applique un schema de Rusanov pour calculer le flux convectif total. Ce sous-programme
est appele pour la resolution de lequation de la quantite de mouvement et de lequation de lenergie.
On pourra se reporter ` a la documentation du sous-programme cfxtcl.
Le sous-programme cfcdts est similaire `a codits mais fait appel `a cfbsc2 et non pas `a bilsc2. Il
diff`ere de codits par quelques autres details qui ne sont pas genants dans limmediat : initialisation
de PVARA et de SMBINI, ordre en temps (ordre 2 non pris en compte).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 317/402

Points a` traiter
Des actions complementaires sont identifiees ci-apr`es, dans lordre durgence decroissante (on se re-
portera egalement `
a la section Points `a traiter de la documentation des autres sous-programmes du
module compressible).

Assurer la coherence des sous-programmes suivants (ou, eventuellement, les fusionner pour eviter
quils ne divergent) :
cfcdts et codits,
cfbsc2 et bilsc2,
cfbsc3 et bilsc2.
Permettre les suites de calcul incompressible/compressible et compressible/incompressible.
Apporter un complement de validation (exemple : IPHYDR).

Assurer la compatibilite avec certaines physiques particuli`eres, selon les besoins. Par exemple :
arc electrique, rayonnement, combustion.
Identifier les causes des difficultes rencontrees sur certains cas academiques, en particulier :
canal subsonique (comment saffranchir des effets indesirables associes aux conditions dentree
et de sortie, comment realiser un calcul periodique, en particulier pour la temperature dont
le gradient dans la direction de lecoulement nest pas nul, si les parois sont adiabatiques),
cavite fermee sans vitesse ni effets de gravite, avec temperature ou flux thermique impose
en paroi (il pourrait etre utile dextrapoler le gradient de pression au bord : la pression
depend de la temperature et une simple condition de Neumann homog`ene est susceptible
de creer un terme source de quantite de mouvement parasite),
maillage non conforme (non conformite dans la direction transverse dun canal),
tube `
a choc avec terme source denergie.
Completer certains points de documentation, en particulier les conditions aux limites thermiques
pour le couplage avec SYRTHES.

Ameliorer la rapidite `
a faible nombre de Mach (est-il possible de lever la limite actuelle sur la
valeur du pas de temps ?).
Enrichir, au besoin :
les thermodynamiques prises en compte (multiconstituant, gamma variable, Van der Waals...),
la gamme des conditions aux limites dentree disponibles (condition `a debit massique et
debit enthalpique imposes par exemple).
Tester des variantes de lalgorithme :
prise en compte des termes sources de lequation de la quantite de mouvement autres que
la gravite dans lequation de la masse resolue lors de letape acoustique (les tests realises
avec cette variante de lalgorithme devront etre repris dans la mesure o` u, dans cfmsfl,
IIROM et IIROMB netaient pas initialises),
implicitation du terme de convection dans lequation de la masse (eliminer cette possibilite
si elle napporte rien),
etape de prediction de la pression,
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 318/402

non reconstruction de la masse volumique pour le terme convectif (actuellement, les termes
convectifs sont traites avec decentrement amont, dordre 1 en espace ; pour lequation de
la quantite de mouvement et lequation de lenergie, on utilise les valeurs prises au centre
des cellules sans reconstruction : cest lapproche standard de Code Saturne, traduite dans
cfbsc2 ; par contre, dans cfmsvl, on reconstruit les valeurs de la masse volumique utilisees
pour le terme convectif ; il ny a pas de raison dadopter des strategies differentes, dautant
plus que la reconstruction de la masse volumique ne permet pas de monter en ordre et
augmente le risque de depassement des bornes physiques),
montee en ordre en espace (en verifier lutilite et la robustesse, en particulier relativement
au principe du maximum pour la masse volumique),
montee en ordre en temps (en verifier lutilite et la robustesse).
Optimiser lencombrement memoire.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 319/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 320/402

B- cfener routine

Fonction
Pour les notations et lalgorithme dans son ensemble, on se reportera `a cfbase.
Apr`es masse (acoustique) et quantite de mouvement, on consid`ere un dernier pas fractionnaire (de t
a t ) au cours duquel seule varie lenergie totale E = e.
`


= = n+1




= Q = Qn+1

Q
(V.B.1)

  
e P


+ div Qac e + = f v u + div (v u) div s + v



t

Pour conserver la positivite de lenergie, il est indispensable ici, comme pour les scalaires, dutiliser le
flux de masse convectif acoustique Qn+1 ac
compatible avec lequation de la masse. De plus, pour obtenir
des proprietes de positivite sur les scalaires, un schema upwind pour le terme convectif doit etre utilise
(mais les termes sources introduisent des contraintes supplementaires qui peuvent etre preponderantes
et genantes).

` la fin de cette etape, on actualise eventuellement (mais par defaut non) une deuxi`eme et derni`ere
A
fois la pression en utilisant la loi detat pour obtenir la pression finale :

P n+1 = P (n+1 , n+1 ) (V.B.2)


Discretisation

Discretisation en temps
La modelisation des flux de chaleur choisie jusqu`a present est de la forme div ( s ) = div (T ).
Pour faire apparatre un terme diffusif stabilisant dans la matrice de resolution, on cherche `a exprimer
le flux diffusif de chaleur (div ( s )) en fonction de la variable resolue (lenergie totale).
Avec sup (P, ) dependant de la loi detat, on exprime lenergie totale de la facon suivante :
1 1
e = + u2 = (Cv T + sup ) + u2 (V.B.3)
2 2

En supposant Cv constant1 , on a alors :


1
div ( s ) = div (K(e u2 sup )) avec K = /Cv (V.B.4)
2

Lorsquun mod`ele de turbulence est active, on conserve la meme forme de modelisation pour les flux
thermiques et K int`egre alors la diffusivite turbulente. On pourra se reporter `a la documentation de
cfxtcl `
a ce sujet.
1 Pour C non constant, les d eveloppements restent a
` faire : on pourra se reporter `
a P. Mathon, F. Archambeau,
v
J.-M. Herard : Implantation dun algorithme compressible dans Code Saturne , HI-83/03/016/A
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 321/402

Avec la formulation (V.B.4), on peut donc impliciter le terme en e.

a ete resolue, on implicite egalement le terme en 12 u2 . Lexposant


De plus, puisque la vitesse a dej`
1
n + 2 de sup indique que limplicitation de ce terme est partielle (elle depend de la forme de la loi
detat).
Par ailleurs, on implicite le terme de convection, le terme de puissance des forces volumiques, eventuellement
le terme de puissance des forces de pression (suivant la valeur de IGRDPP, on utilise la prediction de
pression obtenue apr`es resolution de lequation portant sur la masse volumique ou bien la pression
du pas de temps precedent) et le terme de puissance des forces visqueuses. On implicite le terme de
puissance volumique en utilisant n+1 .

On obtient alors lequation discr`ete portant sur e :

(e)n+1 (e)n Pe
n
+ div (Qn+1
ac
en+1 ) div (K n en+1 ) = n+1 f v un+1 div (Qn+1
ac n+1
)
t (V.B.5)
1
n+
+ div ((v )n+1 un+1 ) div (K n ( 12 (u2 )n+1 + sup2 )) + n+1 v

avec Pe = P P red ou P n suivant la valeur de IGRDPP (P n par defaut).


En pratique, dans Code Saturne, on resout cette equation en faisant apparatre `a gauche lecart en+1
en . Pour cela, on ecrit la derivee en temps discr`ete sous la forme suivante :

(e)n+1 (e)n n+1 en+1 n en


=
tn tn
n en+1 n en n+1 en+1 n en+1
= + (V.B.6)
tn tn n
n n+1 n
 n+1
n+1

= n
e e +e
t tn
et lon utilise lequation de la masse discr`ete pour ecrire :

(e)n+1 (e)n n
en+1 en en+1 div Qn+1

= (V.B.7)
tn tn ac


Discretisation en espace
Introduction
On int`egre lequation (V.B.5) sur la cellule i de volume i et lon proc`ede comme pour lequation de
la masse et de la quantite de mouvement.
On obtient alors lequation discr`ete suivante :
i n+1 n+1 n n
X 
n+1 n+1
 X
K n (en+1 )

n
( i e i e
i i ) + e Qac
S ij ij
S ij
t ij
jV (i) jV (i)

X  P P red  X
n+1
= i n+1 f v i un+1 (v )n+1 un+1

i i n+1
Qac
S ij + ij
S ij (V.B.8)
ij
jV (i) jV (i)

X  
1 2 n+1 n+ 1

n
K (u ) + sup2 S ij + i n+1
i v i
2 ij
jV (i)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 322/402


Discretisation de la partie convective
La valeur `
a la face secrit :
 
en+1 Qn+1
ac
S ij = en+1 n+1
ij (Qac )ij S ij (V.B.9)
ij

avec un decentrement sur la valeur de en+1 aux faces :


en+1
ij = en+1
i si (Qn+1
ac
)ij S ij > 0
(V.B.10)
= en+1
j si (Qn+1
ac
)ij S ij < 0

que lon peut noter :


en+1
ij = ij en+1
i + (1 ij )en+1
j (V.B.11)
avec
(Qn+1

ij = 1 si ac
)ij S ij > 0
(V.B.12)
ij = 0 si (Qn+1
ac
)ij S ij < 0


Discretisation de la partie diffusive
La valeur `
a la face secrit :
 n+1
n n+1
 n e
K (e ) ij
S ij = Kij Sij
n ij
et (V.B.13)
1 2
 !n+ 12
 
1 n+ 1
 2u + sup
K n 2 n+1
2 (u ) + sup2 n
S ij = Kij Sij
ij n
ij

avec une interpolation lineaire pour K n aux faces (et en pratique, ij = 12 ) :


n
Kij = ij Kin + (1 ij )Kjn (V.B.14)

et un schema centre avec reconstruction pour le gradient normal aux faces :


n+1 1 2
 !n+ 12 n+ 21 n+ 12
en+1 en+1 ( 12 u2 + sup )J 0 ( 12 u2 + sup )I 0

e 0 0 2u + sup
= J 0 0I et =
n ij IJ n I 0J 0
ij
(V.B.15)


Discretisation de la puissance des forces de pression
Ce terme est issu du terme convectif, on le discretise donc de la meme facon.
! !
Pe Pe
Qn+1 S ij = (Qn+1 )ij S ij (V.B.16)
n+1 ac n+1 ac
ij ij

P
avec un decentrement sur la valeur de aux faces :

!
(Qn+1

Pe Pei Pej ij = 1 si )ij S ij > 0
= ij + (1 ij ) avec ac (V.B.17)
n+1 n+1
i n+1
j
ij = 0 si (Qn+1
ac
)ij S ij < 0
ij
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 323/402


Discretisation de la puissance des forces visqueuses
On calcule les termes dans les cellules puis on utilise une interpolation lineaire (on utilise ij = 12 dans
la relation ci-dessous) :
n  o
(v )n+1 un+1 ij S ij = ij (v )n+1 un+1 i + (1 ij ) (v )n+1 un+1 j S ij
 
(V.B.18)

Remarques
! !
Pe
Les termes convectifs associes `
a div e n+1
+ Qn+1
sont calcules avec un decentrement
n+1 ac

amont (consistant, dordre 1 en espace). Les valeurs utilisees sont bien prises au centre de la cellule
amont (ei , Pi , i ) et non pas au projete I 0 du centre de la cellule sur la normale `a la face passant
par son centre de gravite (sur un cas test en triangles, lutilisation de PI0 et de 0I pour le terme de
transport de pression a conduit ` a un resultat insatisfaisant, mais des corrections ont ete apportees aux
sources depuis et il serait utile de verifier que cette conclusion nest pas remise en question).
  
1 2
a div K e + u + sup
Les termes diffusifs associes ` sont calcules en utilisant des valeurs aux
2
faces reconstruites pour sassurer de la consistance du schema.

Mise en uvre
Apr`es une etape de gestion de la memoire (memcfe), on calcule les differents termes sources (au centre
des cellules) :

source volumique de chaleur (ustssc),


source associee aux sources de masse (catsma),
source associee `
a laccumulation de masse div Qac (directement dans cfener),
dissipation visqueuse (cfdivs),

transport de pression (directement dans cfener),


puissance de la pesanteur (directement dans cfener),
  
1 2
termes diffusifs en div K u + sup (calcul de sup par uscfth, puis calcul du terme
2
diffusif directement dans cfener).

Le syst`eme (V.B.8) est resolu par une methode dincrement et residu en utilisant une methode de
Jacobi (cfcdts).
Limpression des bornes et la limitation eventuelle de lenergie sont ensuite effectuees par clpsca suivi
de uscfth (intervention utilisateur optionnelle).
On actualise enfin la pression et on calcule la temperature (uscfth).
Pour terminer, en parall`ele ou en periodique, on echange les variables pression, energie et temperature.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 324/402

Points a` traiter

Choix de Pe
En standard, on utilise Pe = P n , mais ce nest pas le seul choix possible. On pourrait etudier le
Pe
comportement de lalgorithme avec P P red et P n+1 (avec P n+1 , en particulier, n+1 est evalue avec la

masse volumique et lenergie prises au meme instant).

Terme source dans l equation de lenergie


La presence dun terme source externe dans lequation de lenergie gen`ere des oscillations de vitesse
quil est important danalyser et de comprendre.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 325/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 326/402

C- cfmsvl routine

Fonction
Pour les notations et lalgorithme dans son ensemble, on se reportera `a cfbase.
On consid`ere un premier pas fractionnaire au cours duquel lenergie totale est fixe. Seules varient la
masse volumique et le flux de masse acoustique normal aux faces (defini et calcule aux faces).
On a donc le syst`eme suivant, entre tn et t :



+ div Qac = 0
t





Q

ac

+ P = f

t (V.C.1)


Q = Qn










e = en

Une partie des termes sources de lequation de la quantite de mouvement peut etre prise en compte
dans cette etape (les termes les plus importants, en pretant attention aux sous-equilibres).
Il faut noter que si f est effectivement nul, on aura bien un syst`eme acoustique, mais que si lon
place des termes supplementaires dans f , la denomination est abusive (on la conservera cependant).
On obtient = n+1 en resolvant (V.C.1), et lon actualise alors le flux de masse acoustique Qn+1
ac
,
qui servira pour la convection (en particulier pour la convection de lenthalpie totale et de tous les
scalaires transportes).
Suivant la valeur de IGRDPP, on actualise eventuellement la pression, en utilisant la loi detat :
P P red = P (n+1 , n )


Discretisation

Discretisation en temps
Le syst`eme (V.C.1) discretise en temps donne :
n+1
n

+ div Qn+1 =0



tn ac


n+1 n
Qac Q


+ P = n f n (V.C.2)
tn






Q = Qn




e = en

avec fn = 0
ou fn = g
(V.C.3)
1 n
ou meme fn = fv + n
div (u Q) + div (v ) + j B

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 327/402

Dans la pratique nous avons decide de prendre f n = g :

le terme j B na pas ete teste,


le terme div (v ) etait negligeable sur les tests realises,
le terme div (u Q) a paru destabiliser les calculs (mais au moins une partie des tests a ete
realisee avec une erreur de programmation et il faudrait donc les reprendre).

Le terme Qn dans la 2`eme equation de (V.C.2) est le vecteur quantite de mouvement qui provient
de letape de resolution de la quantite de mouvement du pas de temps precedent, Qn = n un . On
pourrait theoriquement utiliser un vecteur quantite de mouvement issu de letape acoustique du pas
de temps precedent, mais il ne constitue quun predicteur plus ou moins satisfaisant (il na pas vu
les termes sources qui ne sont pas dans f n ) et cette solution na pas ete testee.

On ecrit alors la pression sous la forme :

P = c2 + s (V.C.4)

2 P P
avec c = et = tabules ou analytiques `a partir de la loi detat.
s s
On discretise lexpression precedente en :

P = (c2 )n (n+1 ) + n (sn ) (V.C.5)

On obtient alors une equation portant sur n+1 en substituant lexpression de Qn+1
ac
issue de la 2`eme
equation de (V.C.2) dans la 1`ere equation de (V.C.2) :

n+1 n
+ div (wn n ) div tn (c2 )n (n+1 ) = 0

(V.C.6)
tn

o`
u:
n
 
wn = un + tn f n n (sn ) (V.C.7)

Formulation alternative (programmee mais non testee) avec le terme de convection implicite :

n+1 n
+ div (wn n+1 ) div tn (c2 )n (n+1 ) = 0

n
(V.C.8)
t


Discretisation en espace
Introduction
On int`egre lequation precedente ( (V.C.6) ou (V.C.8) ) sur la cellule i de volume i . On transforme les
integrales de volume en integrales surfaciques et lon discretise ces integrales. Pour simplifier lexpose,
on se place sur une cellule i dont aucune face nest sur le bord du domaine.
On obtient alors lequation discr`ete suivante1 :

n+1 ni X 1
X
i
(n+ 2 wn )ij S ij tn (c2 )n (n+1 ) ij S ij = 0

i + (V.C.9)
tn
jV ois(i) jV ois(i)

1 Lexposant n+ 1
2
1
etre implicite ou explicite. En pratique on a choisi n+ 2 = n .
signifie que le terme peut
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 328/402


Discretisation de la partie convective
La valeur `
a la face secrit :
1 n+ 21
(n+ 2 wn )ij S ij = ij wnij S ij (V.C.10)
avec, pour wnij , une simple interpolation lineaire :

wnij = ij wni + (1 ij )wnj (V.C.11)


1
et un decentrement sur la valeur de n+ 2 aux faces :
n+ 21 n+ 12
ij = I 0 si wnij S ij > 0
n+ 1
(V.C.12)
= J 0 2 si wnij S ij < 0

que lon peut noter :


n+ 21 n+ 12 n+ 12
ij = ij I 0 + (1 ij )J 0 (V.C.13)
avec
wnij S ij > 0

ij = 1 si
(V.C.14)
ij = 0 si wnij S ij < 0


Discretisation de la partie diffusive

La valeur `
a la face secrit :
 n+1

tn (c2 )n (n+1 ) ij S ij = tn (c2 )nij

Sij (V.C.15)
n ij

avec, pour assurer la continuite du flux normal `a linterface, une interpolation harmonique de (c2 )n :

(c2 )ni (c2 )nj


(c2 )nij = (V.C.16)
ij (c2 )ni + (1 ij )(c2 )nj

et un schema centre pour le gradient normal aux faces :


n+1
n+1 n+1

J0 I0
= 0 0
(V.C.17)
n ij IJ

`
Systeme final
On obtient maintenant le syst`eme final, portant sur (n+1
i )i=1...N :

i n+1 X n+ 21
X n+1
J0 n+1I0
( ni ) + ij wnij S ij tn (c2 )nij Sij = 0 (V.C.18)
tn i I 0J 0
jV ois(i) jV ois(i)

Remarque : interpolation aux faces pour le terme de diffusion


Le choix de la forme de la moyenne pour le cofacteur du flux normal nest pas sans consequence sur la
vitesse de convergence, surtout lorsque lon est en presence de fortes inhomogeneites.
On utilise une interpolation harmonique pour c2 afin de conserver la continuite du flux diffusif normal

t(c2 ) a linterface ij. En effet, on suppose que le flux est derivable `a linterface. Il doit donc y
`
n
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 329/402

etre continu.

Ecrivons la continuite du flux normal `a linterface, avec la discretisation suivante2 :
 
ij I 0 J 0 ij
t(c2 ) = t(c2 )i 0
= t(c2 )j (V.C.19)
n ij IF F J0
En egalant les flux `
a gauche et `
a droite de linterface, on obtient
I 0 F (c2 )j J 0 + F J 0 (c2 )i I 0
ij = (V.C.20)
I 0 F (c2 )j + F J 0 (c2 )i
On introduit cette formulation dans la definition du flux (par exemple, du flux `a gauche) :
 
ij I 0
t(c2 ) = t(c2 )i (V.C.21)
n ij I 0F
et on utilise la definition de (c2 )ij en fonction de ce meme flux
 
2 d
ef J 0 I 0
t(c ) = t(c2 )ij (V.C.22)
n ij I 0J 0
pour obtenir la valeur de (c2 )ij correspondant `a lequation (V.C.16) :
I 0 J 0 (c2 )i (c2 )j
(c2 )ij = (V.C.23)
F J 0 (c2 )i + I 0 F (c2 )j

Mise en uvre
Le syst`eme (V.C.18) est resolu par une methode dincrement et residu en utilisant une methode de
Jacobi pour inverser le syst`eme si le terme convectif est implicite et en utilisant une methode de
gradient conjugue si le terme convectif est explicite (qui est le cas par defaut).
Attention, les valeurs du flux de masse w S et de la viscosite t c2 Sd aux faces de bord, qui sont
calculees dans cfmsfl et cfmsvs respectivement, sont modifiees immediatement apr`es lappel ` a ces
sous-programmes. En effet, il est indispensable que la contribution de bord de w t (c2 ) S
represente exactement Qac S. Pour cela,

immediatement apr`es lappel `a cfmsfl, on remplace la contribution de bord de w S par le flux


de masse exact, Qac S, determine `a partir des conditions aux limites,
puis, immediatement apr`es lappel `a cfmsvs, on annule la viscosite au bord t (c2 ) pour eliminer
la contribution de t (c2 ) ( ) S (lannulation de la viscosite nest pas problematique pour
la matrice, puisquelle porte sur des increments).

Une fois quon a obtenu n+1 , on peut actualiser le flux de masse acoustique aux faces (Qn+1 ac
)ij S ij ,
qui servira pour la convection des autres variables :
 
n+ 12 n
(Qn+1 n 2 n n+1

ac
) ij S ij = t (c ) ( ) ij
S ij + w S ij (V.C.24)
ij

Ce calcul de flux est realise par cfbsc3. Si lon a choisi lalgorithme standard, equation (V.C.6), on
compl`ete le flux dans cfmsvl immediatement apr`es lappel `a cfbsc3. En effet, dans ce cas, la convection
1
est explicite (n+ 2 = n , obtenu en imposant ICONV(ISCA(IRHO))=0) et le sous-programme cfbsc3,
1
qui calcule le flux de masse aux faces, ne prend pas en compte la contribution du terme n+ 2 wn S.
On ajoute donc cette contribution dans cfmsvl, apr`es lappel `a cfbsc3. Au bord, en particulier, cest
bien le flux de masse calcule `a partir des conditions aux limites que lon obtient.
On actualise la pression `
a la fin de letape, en utilisant la loi detat :
Pipred = P (n+1
i , ni ) (V.C.25)
2 On ne reconstruit pas les valeurs de t c2 aux points I0 et J 0.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 330/402

Points a` traiter
Le calcul du flux de masse au bord nest pas enti`erement satisfaisant si la convection est traitee de
mani`ere implicite (algorithme non standard, non teste, associe `a lequation (V.C.8), correspondant au
1
choix n+ 2 = n+1 et obtenu en imposant ICONV(ISCA(IRHO))=1). En effet, apr`es cfmsfl, il faut
determiner la vitesse de convection wn pour quapparaisse n+1 wn n au cours de la resolution par
codits. De ce fait, on doit deduire une valeur de wn `a partir de la valeur du flux de masse. Au bord,
en particulier, il faut donc diviser le flux de masse issu des conditions aux limites par la valeur de bord
de n+1 . Or, lorsque des conditions de Neumann sont appliquees `a la masse volumique, la valeur de
n+1 au bord nest pas connue avant la resolution du syst`eme. On utilise donc, au lieu de la valeur de
bord inconnue de n+1 la valeur de bord prise au pas de temps precedent n . Cette approximation est
susceptible daffecter la valeur du flux de masse au bord.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 331/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 332/402

D- cfqdmv routine

Fonction
Pour les notations et lalgorithme dans son ensemble, on se reportera `a cfbase.
Dans le premier pas fractionnaire (cfmsvl), on a resolu une equation sur la masse volumique, obtenu
une prediction de la pression et un flux convectif acoustique. On consid`ere ici un second pas frac-
tionnaire au cours duquel seul varie le vecteur flux de masse Q = u (seule varie la vitesse au centre
des cellules). On resout lequation de Navier-Stokes independamment pour chaque direction despace,
et lon utilise le flux de masse acoustique calcule precedemment comme flux convecteur (on pourrait
aussi utiliser le vecteur quantite de mouvement du pas de temps precedent). De plus, on resout en
variable u et non Q.
Le syst`eme `a resoudre entre t et t est (on exclut la turbulence, dont le traitement na rien de
particulier dans le module compressible) :



= = n+1



u

+ div (u Qac ) + P = f v + div (v ) (V.D.1)


t



e = e = en

La resolution de cette etape est similaire `a letape de prediction des vitesses du schema de base de
Code Saturne.


Discretisation

Discretisation en temps
On implicite le terme de convection, eventuellement le gradient de pression (suivant la valeur de
IGRDPP, en utilisant la pression predite lors de letape acoustique) et le terme en gradient du tenseur
des contraintes visqueuses. On explicite les autres termes du tenseur des contraintes visqueuses. On
implicite les forces volumiques en utilisant n+1 .
On obtient alors lequation discr`ete suivante :

(u)n+1 (u)n
+ div (un+1 Qn+1 ) div (n un+1 )
tn ac
(V.D.2)
2 n
n+1 n t n n n

= f v Pe + div u + ( 3 )div u Id

avec Pe = P n ou P P red suivant la valeur de IGRDPP (P n par defaut).


En pratique, dans Code Saturne, on resout cette equation en faisant apparatre `a gauche lecart un+1
un . Pour cela, on ecrit la derivee en temps discr`ete sous la forme suivante :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 333/402

(u)n+1 (u)n n+1 un+1 n un


=
tn tn
n un+1 n un n+1 un+1 n un+1
= + (V.D.3)
tn tn n
n n+1 n
 n+1
n+1

= u u +u
tn tn
et lon utilise alors lequation de la masse discr`ete pour ecrire :
(u)n+1 (u)n n
un+1 un un+1 div Qn+1

n
= n ac
(V.D.4)
t t


Discretisation en espace
Introduction
On int`egre lequation (V.D.2) sur la cellule i de volume i et on obtient lequation discretisee en
espace :

i n+1 n+1 X X
(i ui ni uni ) + (un+1 Qn+1 n un+1

n ac
)ij S ij ij
S ij
t
jV (i) jV (i)
(V.D.5)
X  2

= i n+1
i f v i i (Pe)i + n t un + (n n )div un Id S ij
3 ij
jV (i)


Discretisation de la partie convective
La valeur `
a la face secrit :
(un+1 Qn+1
ac
)ij S ij = un+1 n+1
ij (Qac )ij S ij (V.D.6)
avec un decentrement sur la valeur de un+1 aux faces :
un+1
ij = un+1
i si (Qn+1
ac
)ij S ij > 0
(V.D.7)
= un+1
j si (Qn+1
ac
)ij S ij < 0
que lon peut noter :
un+1
ij = ij un+1
i + (1 ij )un+1
j (V.D.8)
avec
(Qn+1

ij = 1 si ac
)ij S ij > 0
n+1 (V.D.9)
ij = 0 si (Qac )ij S ij < 0


Discretisation de la partie diffusive

La valeur `
a la face secrit :  n+1
n n+1 u
nij

u ij
S ij = Sij (V.D.10)
n ij

avec une interpolation lineaire pour n aux faces (en pratique avec ij = 12 ) :
nij = ij ni + (1 ij )nj (V.D.11)
et un schema centre pour le gradient normal aux faces :
 n+1
u un+1
0 un+1
0
= J 0 0I (V.D.12)
n ij IJ
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 334/402


Discretisation du gradient de pression
On utilise grdcel standard. Suivant la valeur de IMRGRA, cela correspond `a une reconstruction iterative
ou par moindres carres.


Discretisation du reste du tenseur des contraintes visqueuses

On calcule des gradients aux cellules et on utilise une interpolation lineaire aux faces (avec, en pratique,
ij = 12 ) :
n
n t un + (n 23 n )div un Id ij S ij = ij n t un + (n 23 n )div un Id i
 

(V.D.13)
n t n n 2 n n
 o
+(1 ij ) u + ( 3 )div u Id j
S ij

Mise en uvre
On resout les trois directions despace du syst`eme (V.D.5) successivement et independamment :

i n+1 n+1 n n
X
n+1 n+1
X u n+1 ui n+1
n j () ()
( u u ) + u (Q ) S Sij


n i i () i i () ij () ac ij ij ij 0J 0

t I
jV (i) jV (i)



= i n+1

i fv i() i (Pe)i ()
X X  2 n

n t n n n

+ ( u )ij S ij () + ( )div u Sij ()


3




jV (i) jV (i) ij

i = 1...N et () = x, y, z
(V.D.14)
Chaque syst`eme associe `
a une direction est resolu par une methode dincrement et residu en utilisant
une methode de Jacobi.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 335/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 336/402

E- cfxtcl routine

Fonction
Pour le traitement des conditions aux limites, on consid`ere le syst`eme (V.E.1)




+ div (Q) = 0



t


Q

+ div (u Q) + P = f v + div (v ) (V.E.1)


t


E + div (u(E + P )) = f u + div (v u) div +



v s v
t

en tant que syst`eme hyperbolique portant sur la variable vectorielle W = t (, Q, E).


Le syst`eme secrit alors :
3 3
W X X
+ F i (W ) = FD
i (W , W ) + S (V.E.2)
t i=1
xi i=1
xi

u les F i (W ) sont les vecteurs flux convectifs et les F D


o` i (W ) sont les vecteurs flux diffusifs dans les
trois directions despace, et S est un terme source.
La demarche classique de Code Saturne est adoptee : on impose les conditions aux limites en determinant,
pour chaque variable, des valeurs numeriques de bord. Ces valeurs sont calculees de telle facon que,
lorsquon les utilise dans les formules standard donnant les flux discrets, on obtienne les contributions
souhaitees au bord.
Pour rendre compte des flux convectifs (aux entrees et aux sorties en particulier), on fait abstraction des
flux diffusifs et des termes sources pour resoudre un probl`eme de Riemann qui fournit un vecteur detat
au bord. Celui-ci permet de calculer un flux, soit directement (par les formules discr`etes standard),
soit en appliquant un schema de Rusanov (schema de flux decentre).
En paroi, on resout egalement, dans certains cas, un probl`eme de Riemann pour determiner une
pression au bord.


Discretisation
Introduction
Objectif

On resume ici les differentes conditions aux limites utilisees pour lalgorithme compressible afin de
fournir une vue densemble. Pour atteindre cet objectif, il est necessaire de faire reference `a des
elements relatifs `
a la discretisation et au mode dimplantation des conditions aux limites.
Lors de limplantation, on a cherche `a preserver la coherence avec lapproche utilisee dans le cadre
standard de lalgorithme incompressible de Code Saturne. Il est donc conseille davoir pris connais-
sance du mode de traitement des conditions aux limites incompressibles avant daborder les details de
lalgorithme compressible.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 337/402

Comme pour lalgorithme incompressible, les conditions aux limites sont imposees par le biais dune
valeur de bord associee ` a chaque variable. De plus, pour certaines fronti`eres (parois `a temperature
imposee ou ` a flux thermique impose), on dispose de deux valeurs de bord pour la meme variable, lune
delles etant dediee au calcul du flux diffusif. Enfin, sur certains types dentree et de sortie, on definit
egalement une valeur du flux convectif au bord.
Comme pour lalgorithme incompressible, lutilisateur peut definir, pour chaque face de bord, des
conditions aux limites pour chaque variable, mais on conseille cependant dutiliser uniquement les types
predefinis decrits ci-apr`es (entree, sortie, paroi, symetrie) qui ont lavantage dassurer la coherence entre
les differentes variables et les differentes etapes de calcul.

Parois
Pression : on doit disposer dune condition pour le calcul du gradient qui intervient dans letape de
quantite de mouvement. On dispose de deux types de condition, au choix de lutilisateur :

par defaut, la pression imposee au bord est proportionnelle `a la valeur interne (la pression au
bord est obtenue comme solution dun probl`eme de Riemann sur les equations dEuler avec un
etat miroir ; on distingue les cas de choc et de detente et, dans le cas dune detente trop forte, une
condition de Dirichlet homog`ene est utilisee pour eviter de voir apparatre une pression negative),
si lutilisateur le souhaite (ICFGRP=1), le gradient de pression est impose `a partir du profil de
pression hydrostatique.

Vitesse et turbulence : traitement standard (voir la documentation des sous-programmes condli


et clptur).
Scalaires passifs : traitement standard (flux nul par defaut impose dans typecl).
Masse volumique : traitement standard des scalaires (flux nul par defaut impose dans typecl).

Energie et temp erature1 : traitement standard des scalaires (flux nul par defaut impose dans
typecl), hormis pour le calcul du flux diffusif dans le cas de parois `a temperature imposee ou `a flux
thermique impose.
Flux diffusif pour l energie en paroi : lutilisateur peut choisir (dans uscfcl) entre une temperature
de paroi imposee et un flux thermique diffusif (ou conductif) impose. Sil ne precise rien, on consid`ere
que la paroi est adiabatique (flux thermique diffusif impose et de valeur nulle). Dans tous les cas, il
faut donc disposer dun moyen dimposer le flux diffusif souhaite. Pour cela, on determine une valeur
de bord pour lenergie qui, introduite dans la formule donnant le flux discret, permettra dobtenir la
contribution attendue (voir le paragraphe E). Conformement `a lapproche classique de Code Saturne,
cette valeur est stockee sous la forme dun couple de coefficients (de type COEFAF, COEFBF). Il est
important de souligner que cette valeur de bord ne doit etre utilisee que pour le calcul du flux diffusif :
dans les autres situations pour lesquelles une valeur de bord de lenergie ou de la temperature est
requise (calcul de gradient par exemple), on utilise une condition de flux nul (traitement standard des
scalaires). Pour cela, on dispose dune seconde valeur de bord qui est stockee au moyen dun couple
de coefficients (COEFA, COEFB) distinct du precedent.
Flux convectifs : le flux de masse dans la direction normale `a la paroi est pris nul. De ce fait, les
flux convectifs seront nuls quelle que soit les valeurs de bord imposees pour les differentes variables
transportees.


Symetrie
Les conditions appliquees sont les conditions classiques de lalgorithme incompressible (vitesse normale
nulle, flux nul pour les autres variables).
1 Le gradient de temp
erature est a priori inutile, mais peut
etre requis par lutilisateur.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 338/402

Elles sont imposees dans le sous-programme typecl essentiellement. Pour la pression, la condition de
flux nul est imposee dans cfxtcl (au debut des developpements, on appliquait le meme traitement
quen paroi, mais une condition de flux nul a ete preferee afin de saffranchir des probl`emes potentiels
dans les configurations 2D).


Entrees et sorties

On obtient, par resolution dun probl`eme de Riemann au bord, complete par des relations de thermo-
dynamique (uscfth), des valeurs de bord pour toutes les variables (on suppose quen entree, toutes les
composantes de la vitesse sont fournies ; elles sont supposees nulles par defaut, hormis pour les entrees
a (, u) imposes, IERUCF, pour lesquelles il faut fournir la vitesse explicitement).
`
Ces valeurs de bord sont utilisees de deux facons :

elles sont utilisees pour calculer les flux convectifs, en faisant appel au schema de Rusanov (sauf
en sortie supersonique) ; ces flux sont directement integres au second membre des equations ` a
resoudre.

elles servent de valeur de Dirichlet dans toutes les autres configurations pour lesquelles une valeur
de bord est requise (calcul de flux diffusif, calcul de gradient...)

Deux cas particuliers :

aux entrees ou sorties pour lesquelles toutes les variables sont imposees (IESICF), on utilise
une condition de Neumann homog`ene pour la pression (hormis pour le calcul du gradient inter-
venant dans lequation de la quantite de mouvement, qui est pris en compte par le flux convectif
determine par le schema de Rusanov). Ce choix est arbitraire (on na pas teste le comportement
de lalgorithme si lon conserve une condition de Dirichlet sur la pression), mais a ete fait en
supposant quune condition de Neumann homog`ene serait a priori moins destabilisante, dans
la mesure o` u, pour ce type de fronti`ere, lutilisateur peut imposer une valeur de pression tr`es
differente de celle regnant `
a linterieur du domaine (la valeur imposee est utilisee pour le flux
convectif).
pour les grandeurs turbulentes et les scalaires utilisateur, si le flux de masse est entrant et que
lon a fourni une valeur de Dirichlet (RCODCL(*,*,1) dans uscfcl), on lutilise, pour le calcul
du flux convectif et du flux diffusif ; sinon, on utilise une condition de Neumann homog`ene (le
concept de sortie de type 9 ou 10 est couvert par cette approche).

`
Probleme de Riemann au bord
Introduction
On cherche `
a obtenir un etat au bord, pour les entrees, les sorties et les parois.
Pour cela, on fait abstraction des flux diffusifs et des sources. Le syst`eme resultant est alors appele
syst`eme dequations dEuler. On se place de plus dans un rep`ere oriente suivant la normale au bord
considere ( 1 , 2 , n) et lon ne consid`ere que les variations suivant cette normale. Le syst`eme devient
donc :
3 3
W X X
+ F (W ) = 0 avec F n (W ) = ni F i (W ) et = ni (V.E.3)
t n n i=1
n i=1
xi

Pour determiner les valeurs des variables au bord, on recherche levolution du probl`eme instationnaire
suivant, appele probl`eme de Riemann :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 339/402

bord
interieur
n exterieur

-
Wi
W

etat constant dans la cellule i


etat constant

avec W dependant du type de bord et different de W i a priori.

f = t (, u, P ) et
Pour resoudre ce probl`eme de Riemann, on utilisera les variables non-conservatives W
lon retrouvera lenergie gr
ace `
a lequation detat.
Pour alleger lecriture, dans le present paragraphe E, on notera aussi W le vecteur t (, u, P ) et u =
u + u n (en posant u = u n et u = u (u n)n).
La solution est une suite detats constants, dont les valeurs dependent de W i et W , separes par des
ondes se deplacant `a des vitesses donnees par les valeurs propres du syst`eme (i )i=1...5 . On represente
les caracteristiques du syst`eme sur le schema suivant :

bord
1 = u c t 2,3,4 = u
A
6-n

A W1

Wi
A


W2 5 = u + c
A

A

A

A

 W
A

 -x
Comme valeurs des variables au bord, on prendra les valeurs correspondant `a letat constant qui
contient le bord (W 1 dans lexemple precedent).
Il faut remarquer que la solution du probl`eme de Riemann depend de la thermodynamique et devra
donc etre calculee et codee par lutilisateur si la thermodynamique na pas ete prevue (en version 1.2,
la seule thermodynamique prevue est celle des gaz parfaits).


En paroi, pour la condition de pression (sans effet de gravite)

Pour les faces de paroi, on definit `


a lexterieur du domaine un etat miroir W par :

i = i
u u = u i
Wi = i W = (V.E.4)
ui u = ui
Pi P = Pi

Les solutions dependent de lorientation de la vitesse dans la cellule de bord :

1. Si ui 6 0, la solution est une double detente symetrique.


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 340/402

paroi
t
1 = u c (< 0) 6-n 5 = u + c (> 0)
= 0

2,3,4
@ \

c@ p = 1 = 2
 #
@ \

up = u1 = u2
c #
c@\ W 1
W 2 # W paroi = W 1 = W 2

P p = P1 = P2

Wi c @\
c@\
 # W

 #
c #
\


@
-x
c #
@
c\


#

La conservation de la vitesse tangentielle `a travers la 1-onde donne u p = u i . Par des con-


siderations de symetrie on trouve up = 0. Puis on obtient p et Pp en ecrivant la conservation
des invariants de Riemann ` a travers la 1-detente :
Z 1 Z i Z 1
c c c
u1 +

d = ui + d

d = ui p = 1


0 0 i
(V.E.5)



s1 = si s(P1 , 1 ) = s(Pi , i ) Pp = P1

2. Si ui > 0, la solution est un double choc symetrique.


paroi
t
1 = u c (< 0) 6-n 5 = u + c (> 0)
@
2,3,4 = 0
p = 1 = 2
@

@ W 1
W 2 W paroi = W 1 = W 2 up = u1 = u2

P p = P1 = P2

Wi @
W
@

@
-x

De meme que precedemment, on trouve u p = u i et up = 0, puis p et Pp en ecrivant les


relations de saut ` a travers le 1-choc :

1 i (u1 ui )2 = (P1 Pi )(1 i ) p = 1
avec = (P, ) (V.E.6)
21 i (1 i ) = (P1 + Pi )(1 i ) Pp = P 1

ui n
Pour les gaz parfaits, avec Mi = (Nombre de Mach de paroi), on a :
ci
Cas detente (Mi 6 0) :
1

Pp = 0 si 1+ Mi < 0


 2
 1 2
1
Pp = Pi 1 + Mi sinon


2
  1
Pp
p = i
Pi
Cas choc (Mi > 0) :
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 341/402

r !
( + 1) 2 ( + 1)2 2
Pp = P i 1+ Mi + Mi 1+ Mi
4 16
 
Pp Pi
p = i
Pp Pi i (ui n)2

En pratique, le flux convectif normal `a la paroi est nul et seule la condition de pression determinee
ci-dessus est effectivement utilisee (pour le calcul du gradient sans effet de gravite).

En sortie
Il existe deux cas de traitement des conditions en sortie, selon le nombre de Mach normal `a la face de
bord (ci est la vitesse du son dans la cellule de bord) :
ui u n
Mi = = i
ci ci

Sortie supersonique (condition ISSPCF de uscfcl) : Mi > 1 ui ci > 0

bord
t 1 = u c (> 0)
6-n

 2,3,4 = u
W

1


Wi W2 =u+c W bord = W i
 5





 

 

   W
-x






Toutes les caracteristiques sont sortantes, on connat donc toutes les conditions au bord :


b = i
u b = u i

(V.E.7)

ub = ui
Pb = Pi

Sortie subsonique (condition ISOPCF de uscfcl) : 0 6 Mi < 1 (ui > 0 et ui ci < 0)

bord
1 = u c (< 0) t 2,3,4 = u (> 0)
6-n
A
A W


1 b = 1
Wi
A


W2 5 = u + c W bord = W 1 ub = u1
A 

 Pb = P1

A

A

 W
A


A

 -x

On a une caracteristique entrante, on doit donc imposer une seule condition au bord (en general la
pression de sortie Pext ).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 342/402

On connat alors Pb = Pext et u b = u i (par conservation de la vitesse tangentielle `a travers la 1-onde).


Pour trouver les inconnues manquantes (b et ub ) on doit resoudre le passage de la 1-onde :

1. Si Pext 6 Pi , on a une 1-detente.


On ecrit la conservation des invariants de Riemann `a travers la 1-detente :


s1 = si
s(Pext , 1 ) = s(Pi , i ) b = 1

Z 1 Z i Z 1
c (V.E.8)
c c
u1 + d = ui + d u1 = ui d ub = u1



0 0 i

2. Si Pext > Pi , on a un 1-choc.


On ecrit les relations de saut `
a travers le 1-choc :

1 i (u1 ui )2 = (Pext Pi )(1 i ) b = 1
(V.E.9)
21 i ((Pext , 1 ) (Pi , i )) = (Pext + Pi )(1 i ) ub = u1

Pour les gaz parfaits, on a :

Cas detente (Pext 6 Pi ) :

Pb = Pext
  1
Pext
b = i
Pi
Cas choc (Pext > Pi ) :

Pb = Pext
   
Pext Pi ( + 1)Pext + ( 1)Pi
b = i = i
Pext Pi i (ui n ub n)2 ( 1)Pext + ( + 1)Pi

La valeur de la masse volumique au bord intervient en particulier dans le flux de masse.


En entree
Lutilisateur impose les valeurs quil souhaite pour les variables en entree :

ext
u
W ext = ext
uext
Pext

De meme que precedemment, il existe deux cas de traitement des conditions en entree, pilotes par le
nombre de Mach entrant, normalement `a la face de bord (avec cext la vitesse du son en entree) :
uext u n
Mext = = ext
cext cext
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 343/402

Entr
ee supersonique (condition IESICF de uscfcl) : Mext 6 1 uext + cext 6 0

bord
5 = u + c (6 0) t
6-n
2,3,4 = u A

W 2A

1 = u c A

W W bord = W = W ext
HH W A

H 1 A

HH

Wi H A

HHA

HA
-x

Toutes les caracteristiques sont entrantes, toutes les conditions au bord sont donc imposees par
lutilisateur.


b = ext
u b = u ext

(V.E.10)

u b = uext
Pb = Pext

Entr
ee subsonique (condition IERUCF de uscfcl) :

1 < Mext 6 0 (uext 6 0 et uext + cext > 0)

bord
2,3,4 = u (6 0) t 5 = u + c (> 0)
6-n


W2


b = 2

1 = u c W 1




W W bord = W 2 ub = u2
HH
Pb = P2

HH

H

Wi HHH


H
-x

On a une caracteristique sortante. Lutilisateur doit donc laisser un degre de liberte.


En general, on impose le flux de masse en entree, donc ext et uext , et lon calcule la pression au bord
en resolvant le passage des 14-ondes. On connat aussi u b = u ext , par conservation de la vitesse
tangentielle `a travers la 5-onde.

1. Si uext > ui , on a une 1-detente.


On ecrit la conservation des invariants de Riemann `a travers la 1-detente et la conservation de
la vitesse et de la pression `
a travers le contact :
Z 1 Z i
c c
u1 + d = ui + d


0 0 Z 1
c


d = ui uext 1
s1 = si

i
(V.E.11)


u1 = u2 = uext s(P2 , 1 ) = s(Pi , i ) Pb = P2

P1 = P2

Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 344/402

2. Si uext < ui , on a un 1-choc.


On ecrit les relations de saut `a travers le 1-choc et la conservation de la vitesse et de la pression
a travers le contact :
`


1 i (u1 ui )2 = (P1 Pi )(1 i )



21 i (1 i ) = (P1 + Pi )(1 i )
1




= (P, ) (V.E.12)

P = P

b 2
u1 = u2 = uext

P1 = P2

Pour les gaz parfaits, on a :


Cas detente (M 6 0) :
1

Pb = 0
si 1+ M < 0
2

 2
 1
1
Pb = Pi 1 + M sinon


2

b = ext
Cas choc (M > 0) :
r !
( + 1) ( + 1)2
P b = Pi 1+ M 2 + M 1+ M 2
4 16

b = ext

Condition de pression en paroi avec effets de gravite


Le probl`eme de Riemann considere precedemment ne prend pas en compte les effets de la gravite. Or,
dans certains cas, si lon ne prend pas en compte le gradient de pression hydrostatique, on peut
obtenir une solution erronee (en particulier, par exemple, on peut creer une source de quantite de
mouvement non physique dans un milieu initialement au repos).

Ecrivons lequilibre local dans la maille de bord :


P = g (V.E.13)

Pour simplifier la resolution, on peut utiliser la formulation de (V.E.13) en incompressible (cest cette
approche qui a ete adoptee dans Code Saturne) :
(P )i = i g ce qui donne Pparoi = Pi + i g (xparoi xi ) (V.E.14)

Une autre approche (dependante de lequation detat) consiste `a resoudre lequilibre local avec la
formulation compressible (V.E.13), en supposant de plus que la maille est isentropique :

P = g
(V.E.15)
P = P (, si )

Ce qui donne, pour un gaz parfait :



 1
1 i
Pparoi = Pi 1+ g (xparoi xi ) (V.E.16)
Pi
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 345/402

Remarque : la formule issue de lincompressible (V.E.14) est une linearisation de la formule (V.E.16).
Dans les cas courants elle seloigne tr`es peu de la formule exacte. Dans des conditions extremes, si lon
consid`ere par exemple de lair `a 1000K et 10bar, avec une acceleration de la pesanteur g = 1000m/s2 et
une difference de hauteur entre le centre de la cellule et le centre de la face de bord de 10m, lexpression
(V.E.16) donne Pparoi = 1034640, 4P a et lexpression (V.E.14) donne Pparoi = 1034644, 7P a, soit une
difference relative de moins de 0, 001%. On voit aussi que la difference entre la pression calculee au
centre de la cellule et celle calculee au bord est de lordre de 3%.


Schema de Rusanov pour le calcul de flux convectifs au bord
Introduction

Le schema de Rusanov est utilise pour certains types de conditions aux limites afin de passer du vecteur
detat calcule au bord comme indique precedemment (solution du probl`eme de Riemann) `a un flux
convectif de bord (pour la masse, la quantite de mouvement et lenergie). Lutilisation de ce schema
(decentre amont) permet de gagner en stabilite.
Le schema de Rusanov est applique aux fronti`eres auxquelles on consid`ere quil est le plus probable
de rencontrer des conditions en accord imparfait avec letat regnant dans le domaine, conditions qui
sont donc susceptibles de destabiliser le calcul : il sagit des entrees et des sorties (fronti`eres de type
IESICF, ISOPCF, IERUCF, IEQHCF). En sortie supersonique (ISSPCF) cependant, le schema de
Rusanov est inutile et nest donc pas applique : en effet, pour ce type de fronti`ere, letat impose au
bord est exactement letat amont et le decentrement du schema de Rusanov napporterait donc rien.

Principe
Pour le calcul du flux decentre de Rusanov, on consid`ere le syst`eme hyperbolique constitue des seuls
termes convectifs issus des equations de masse, quantite de mouvement et energie. Ce syst`eme est

ecrit, par changement de variable, en non conservatif (on utilise la relation P = et on note u
1
les composantes de u) :




+ div u + u = 0

t
u
1 P
+ u u + = 0 (V.E.17)
t
P


+ P div u + u P

= 0
t
En notant le vecteur detat W = (, u, P )t , ce syst`eme est note :
W
+ div F (W ) = 0 (V.E.18)
t
Avec W lincrement temporel du vecteur detat, n la normale `a une face, ij la face interne partagee
par les cellules i et j et ik la face de bord k associee `a la cellule i, la discretisation spatiale conduit `
a:
|i | X Z X Z
Wi + F (W ) n dS + F (W ) n dS = 0 (V.E.19)
t Sij Sb
j V ois(i) kb (i) ik

Sur une face de bord donnee, on applique le schema de Rusanov pour calculer le flux comme suit :
Z
1 1  1 
F (W ) n dS = F (W i ) + F (W bik ) n bik rus bik W bik W i = F rus bik (W )
|S bik | S b 2 2
ik
(V.E.20)
Dans cette relation, W bik est le vecteur detat W , connu au bord (tel quil resulte de la resolution
du probl`eme de Riemann au bord presentee plus haut pour chaque type de fronti`ere considere).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 346/402

`
Parametre
de decentrement rus bik
Pour chaque face de bord, le scalaire rus bik est la plus grande valeur du rayon spectral de la matrice
F n (W )
jacobienne obtenu pour les vecteurs detat W i et W bik .
W
F n est la composante du flux F dans la direction de la normale `a la face de bord, n bik . Utiliser F n pour
la determination du param`etre de decentrement rus bik rel`eve dune approche classique qui consiste ` a
remplacer le syst`eme tridimensionnel initial par le syst`eme unidimensionnel projete dans la direction
normale ` a la face, en negligeant les variations du vecteur detat W dans la direction tangeante ` a la
face :
W F n (W ) W
+ =0 (V.E.21)
t W n

De mani`ere plus explicite, si lon se place dans un rep`ere de calcul ayant n bik comme vecteur de base,
et si lon note u la composante de vitesse associee, le syst`eme est le suivant (les equations portant
sur les composantes transverses de la vitesse sont decouplees, associees `a la valeur propre u, comme le
serait un scalaire simplement convecte et ne sont pas ecrites ci-apr`es) :

u


+ +u = 0

t
u n n
u 1 P
+ u + = 0 (V.E.22)
t n n
P u P



+ P +u = 0
t n n

La matrice jacobienne associee est donc :

u 0

1
0 u (V.E.23)



0 P 0

q
P
Les valeurs propres sont u et u c (avec c = ). Le rayon spectral est donc |u| + c et le param`etre
de decentrement sen deduit :

rus bik = max (|ui | + ci , |ubik | + cbik ) (V.E.24)

Expression des flux convectifs

Les flux convectifs calcules par le schema de Rusanov pour les variables masse, quantite de mouvement
et energie representent donc la discretisation des termes suivants :


div (Q)
 Q) + P
div (u

(V.E.25)
P
div Q (e + )



Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 347/402

Pour une face de bord ik adjacente a la cellule i et avec la valeur precedente de rus bik , on a :
`
Z
1 

Q n dS = (Qi + Q b ) n bik S bik
2

ik

S bik
1


rus bik ( bik i ) S bik




Z 2

1 
(u Q + P ) n dS = ui (Qi n bik ) + Pi n bik + u bik (Q b n bik ) + P bik n bik S bik


2
ik
S bik
1  
rus bik Q b Qi S bik




Z  2 ik 
P 1 Pi P bik


(e + ) Q n dS (ei + ) (Qi n bik ) + (e bik + )(Q b n bik ) S bik


=



S bik 2 i bik ik

1

rus bik ( bik e bik i ei ) S bik
2
(V.E.26)


Conditions aux limites pour le flux diffusif denergie
Rappel
Pour le flux de diffusion denergie, les conditions aux limites sont imposees de mani`ere similaire `a ce qui
est decrit dans la documentation de clptur et de condli. La figure (V.E.1) rappelle quelques notations
usuelles et lequation (V.E.27) traduit la conservation du flux normal au bord pour la variable f .

Bord du domaine de calcul


Sb
Domaine de calcul 11111111
00000000
00000000
11111111
00000000
11111111
00000000
11111111
I
00000000
11111111 n normale sortante
00000000
11111111
I F 00000000
11111111
00000000
11111111
de norme 1
00000000
11111111
y
f
00000000
11111111
00000000
11111111
fI b,int 00000000
11111111
fb,ext fimp,ext
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
00000000
11111111
Coefficients dechange
h himp,ext
int
h
b

Figure V.E.1: Cellule de bord.



himp,ext (fimp,ext fb,ext ) (condition de Dirichlet)
|
{z }
reel impos
e
hint (fb,int fI 0 ) = hb (fb,ext fI 0 ) =
| {z } | {z } imp,ext (condition de Neumann)
int b

| {z }
reel impos
e

(V.E.27)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 348/402

Lequation (V.E.28) rappelle la formulation des conditions aux limites pour une variable f .

himp,ext hint + himp,ext (hr 1)




fimp,ext + fI 0 (condition de Dirichlet)
fb,int = hint + hr himp,ext hint + hr himp,ext
1
imp,ext + fI 0 (condition de Neumann)


hint
(V.E.28)
Les coefficients dechange sont definis comme suit2 :

hint =
I 0F



hint


hr = (V.E.29)
hb
b C uk



hb = =

fI+0

fb,ext fI 0

Dans Code Saturne, on note les conditions aux limites de mani`ere generale sous la forme suivante :

fb,int = Ab + Bb fI 0 (V.E.30)

avec Ab et Bb definis selon le type des conditions :



himp,ext
Ab =

fimp,ext 1
hint + hr himp,ext Ab = imp,ext

Dirichlet hint + himp,ext (hr 1) Neumann hint (V.E.31)
B = 1
Bb =

b
hint + hr himp,ext


Flux diffusif denergie
Dans le module compressible, on resout une equation sur lenergie, qui secrit, si lon excepte tous les
termes hormis le flux de diffusion et le terme instationnaire, pour faciliter la presentation :

e
= div s
t t
= div (K T ) avec K = + Cp
t
e 12 u2 sup
 
= div K (V.E.32)
 Cv 
K 1 2
= div (e u sup ) si Cv est constant
 Cv  2  
K K 1
= div e div ( u2 + sup )
Cv Cv 2

La decomposition en e et 21 u2 + sup est purement mathematique (elle resulte du fait que lon resout
en energie alors que le flux thermique sexprime en fonction de la temperature). Aussi, pour imposer
un flux de bord ou une temperature de bord (ce qui revient au meme puisque lon impose toujours
finalement la conservation du flux normal), on choisit de reporter la totalite de la condition ` a la
K K 1 2
limite sur le terme e et donc dannuler le flux associe au terme ( u + sup ) (en pratique,
Cv Cv 2
pour lannuler, on se contente de ne pas lajouter au second membre de lequation). Conformement
a lapproche retenue dans Code Saturne et rappelee precedemment, on determinera donc une valeur
`
2 On rappelle que, comme dans condli, d esigne + Cp t
t
si f est la temperature, C + t
t
si f represente
p
lenthalpie. Le coefficient C repr
esente Cp pour la temperature et vaut 1 pour lenthalpie. La grandeur adimensionnelle
f + est obtenue par application dun principe de similitude en paroi : pour la temp erature, elle d
epend du nombre de
Prandlt mol eculaire, du nombre de Prandtl turbulent et de la distance adimensionnelle a ` la paroi y + dans la cellule de
bord.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 349/402

de bord fictive de lenergie qui permette de reconstruire le flux diffusif total attendu `a partir de la
K
discretisation du seul terme e.
Cv
 
K t
Remarque : dans la version 1.2.0, on utilise = + , `a partir de 1.2.1, on utilise la valeur
  Cv Cv t
K Cp t
= + . On notera que le nombre de Prandtl turbulent t est associe `a la variable
Cv Cv Cv t
resolue et peut etre fixe par lutilisateur.

Condition de Neumann
La conservation du flux secrit :

hint (eb,int eI 0 ) = imp,ext (V.E.33)


| {z } | {z }
int reel impos
e

On a donc dans ce cas :


1
Ab = imp,ext

hint (V.E.34)
B = 1
b

Condition de Dirichlet
On suppose que la condition de Dirichlet porte sur la temperature Tb,ext .
La conservation du flux secrit :
hint (eb,int eI 0 ) = hb (Tb,ext TI 0 ) = h0imp,ext (Timp,ext Tb,ext ) (V.E.35)
| {z } | {z } | {z }
int (forme num
erique du flux) b qui int`
egre leffet de couche limite reel impos
e

Avec pour les coefficients dechange :



K
hint =


Cv I 0 F (V.E.36)
b Cp uk
hb = =

TI+0

Tb,ext TI 0

On tire Tb,ext de la seconde partie de legalite (V.E.35) traduisant la conservation du flux :


h0imp,ext Timp,ext + hb TI 0
Tb,ext = (V.E.37)
hb + h0imp,ext

En utilisant cette valeur et la premi`ere partie de lequation de conservation du flux (V.E.35), on


obtient :
hb h0imp,ext
eb,int = (Timp,ext TI 0 ) + eI 0 (V.E.38)
hint (hb + h0imp,ext )
 
1 1 2
On utilise alors TI 0 = eI 0 ui sup,i pour ecrire (sans reconstruction pour la vitesse et
Cv 2
sup ) :
hb h0imp,ext
+ hint (hb + h0imp,ext ) hb h0imp,ext 1 2
 
Cv 2 ui + sup,i
eb,int = eI 0 + Timp,ext +
hint (hb + h0imp,ext ) hint (hb + h0imp,ext ) Cv
(V.E.39)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 350/402

hint
Et on a donc, avec h0r = hb
:
Cv

h0imp,ext Cv hint + h0imp,ext (h0r 1)


 
1 2
eb,int = Cv Timp,ext + ui + sup,i + eI 0
Cv hint + h0r h0imp,ext 2 Cv hint + h0r h0imp,ext
| {z } | {z }
Ab Bb
(V.E.40)
Avec ces notations, hb est le coefficient habituellement calcule pour la temperature.
Le coefficient h0imp,ext est le coefficient dechange externe qui est impose pour la temperature3 . Pour
obtenir lequivalent dimensionnel de h0imp,ext pour lenergie, il faut diviser sa valeur par Cv (ce qui ne
fait pas de difference dans la majorite des cas, car il est habituellement pris infini).

Mise en uvre
Introduction
Les conditions aux limites sont imposees par une suite de sous-programmes, dans la mesure o`
u lon a
a rester coherent avec la structure standard de Code Saturne.
cherche `
Dans ppprcl (appele par precli), on initialise les tableaux avant le calcul des conditions aux limites :

IZFPPP (numero de zone, inutilise, fixe `a zero),


IA(IIFBRU) (reperage des faces de bord pour lesquelles on applique un schema de Rusanov :
initialise `
a zero, on imposera la valeur 1 dans cfrusb pour les faces auxquelles on applique le
schema de Rusanov)
IA(IIFBET) (reperage des faces de paroi `a temperature ou `a flux thermique impose : initialise `
a
0, on imposera la valeur 1 dans cfxtcl lorsque la temperature ou le flux est impose),
RCODCL(*,*,1) (initialise ` a -RINFIN en prevision du traitement des sorties reentrantes pour
lesquelles lutilisateur aurait fourni une valeur `a imposer en Dirichlet),
flux convectifs de bord pour la quantite de mouvement et lenergie (initialises `a zero).

Les types de fronti`ere (ITYPFB) et les valeurs necessaires (ICODCL, RCODCL) sont imposes par lutilisateur
dans uscfcl.
On convertit ensuite ces donnees dans condli pour quelles soient directement utilisables lors du calcul
des matrices et des seconds membres.
Pour cela, cfxtcl permet de realiser le calcul des valeurs de bord et, pour certaines fronti`eres, des flux
convectifs. On fait appel, en particulier, `a uscfth (utilisation de la thermodynamique) et `a cfrusb
(flux convectifs par le schema de Rusanov). Lors de ces calculs, on utilise COEFA et COEFB comme
tableaux de travail (transmission de valeurs `a uscfth en particulier) afin de renseigner ICODCL et
RCODCL. Apr`es cfxtcl, le sous-programme typecl compl`ete quelques valeurs par defaut de ICODCL et
de RCODCL, en particulier pour les scalaires passifs.
Apr`es cfxtcl et typecl, les tableaux ICODCL et RCODCL sont complets. Ils sont utilises dans la suite
de condli et en particulier dans clptur pour construire les tableaux COEFA et COEFB (pour lenergie,
on dispose de deux couples (COEFA, COEFB) afin de traiter les parois).
3 Le coefficient h0
imp,ext est utile pour les cas o`
u lon souhaite relaxer la condition `
a la limite : pour la temp erature,
cela correspond ` a imposer une valeur sur la face externe dune paroi unidimensionnelle id eale, sans inertie, caract
eris
ee
par un simple coefficient dechange.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 351/402

On presente ci-apr`es les points dont limplantation diff`ere de lapproche standard. Il sagit de lutilisation
dun schema de Rusanov pour le calcul des flux convectifs en entree et sortie (hormis sortie superson-
ique) et du mode de calcul des flux diffusifs denergie en paroi. On insiste en particulier sur limpact
des conditions aux limites sur la construction des seconds membres de lequation de la quantite de
mouvement et de lequation de lenergie (cfqdmv et cfener).

et sor-
Flux de Rusanov pour le calcul des flux convectifs en entree
tie
Le schema de Rusanov est utilise pour calculer des flux convectifs de bord (masse, quantite de mouve-
ment et energie) aux entrees et des sorties de type IESICF, ISOPCF, IERUCF, IEQHCF.
La gestion des conditions aux limites est differente de celle adoptee classiquement dans Code Saturne,
bien que lon se soit efforce de sy conformer le mieux possible.
En volumes finis, il faut disposer de conditions aux limites pour trois utilisations principales au moins :

imposer les flux de convection,

imposer les flux de diffusion,


calculer les gradients pour les reconstructions.

Dans lapproche standard de Code Saturne, les conditions aux limites sont definies par variable et non
pas par terme discret4 . On dispose donc, pour chaque variable, dune valeur de bord dont devront etre
deduits les flux de convection, les flux de diffusion et les gradients5 . Ici, avec lutilisation dun schema
de Rusanov, dans lequel le flux convectif est traite dans son ensemble, il est imperatif de disposer dun
moyen dimposer directement sa valeur au bord6 .
Le flux convectif calcule par le schema de Rusanov sera ajoute directement au second membre des
equations de masse, de quantite de mouvement et denergie. Comme ce flux contient, outre la con-
tribution des termes convectifs usuels (div (Q), div (u Q) et div (Q e)), celle des termes en P
(quantite de mouvement) et div (Q P ) (energie), il faut veiller `a ne pas ajouter une seconde fois les ter-
mes de bord issus de P et de div (Q P ) au second membre des equations de quantite de mouvement
et denergie.
Pour la masse, le flux convectif calcule par le schema de Rusanov definit simplement le flux de masse
au bord (PROPFB(IFAC,IPPROB(IFLUMA(ISCA(IENERG))))).
Pour la quantite de mouvement, le flux convectif calcule par le schema de Rusanov est stocke dans les
tableaux PROPFB(IFAC,IPPROB(IFBRHU)), PROPFB(IFAC,IPPROB(IFBRHV)) et PROPFB(IFAC,IPPROB(IFBRHW)).
Il est ensuite ajoute au second membre de lequation directement dans cfqdmv (boucle sur les faces
de bord). Comme ce flux contient la contribution du terme convectif usuel div (u Q), il ne faut pas
lajouter dans le sous-programme cfbsc2. De plus, le flux convectif calcule par le schema de Rusanov
contient la contribution du gradient de pression. Or, le gradient de pression est calcule dans cfqdmv
au moyen de grdcel et ajoute au second membre sous forme de contribution volumique (par cellule) :
il faut donc retirer la contribution des faces de bord auxquelles est applique le schema de Rusanov,
pour ne pas la compter deux fois (cette operation est realisee dans cfqdmv).
Pour lenergie, le flux convectif calcule par le schema de Rusanov est stocke dans le tableau PROPFB(IFAC,IPPROB(IFBENE)
Pour les faces auxquelles nest pas applique le schema de Rusanov, on ajoute la contribution du terme
4 Par exemple, pour un scalaire convect e et diffus
e, on definit une valeur de bord unique pour le scalaire et non pas
une valeur de bord pour le flux convectif et une valeur de bord pour le flux diffusif.
5 Neanmoins, pour certaines variables comme la vitesse par exemple, Code Saturne dispose de deux valeurs de bord (et
non pas dune seule) afin de pouvoir imposer de mani` ere ind
ependante le gradient normal et le flux de diffusion.
6 Il serait possible de calculer une valeur de bord fictive des variables detat qui permette de retrouver le flux convectif
calcule par le schema de Rusanov, mais cette valeur ne permettrait pas dobtenir un flux de diffusion et un gradient
satisfaisants.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 352/402

de transport de pression div (Q P ) au second membre de lequation dans cfener et on compl`ete le


second membre dans cfbsc2 avec la contribution du terme convectif usuel div (Q e). Pour les faces
auxquelles est applique le schema de Rusanov, on ajoute directement le flux de Rusanov au second
membre de lequation dans cfener, en lieu et place de la contribution du terme de transport de pres-
sion et lon prend garde de ne pas comptabiliser une seconde fois le flux convectif usuel div (Q e) dans
le sous-programme cfbsc2.
Cest lindicateur IA(IIFBRU) (renseigne dans cfrusb) qui permet, dans cfbsc2, cfqdmv et cfener,
de reperer les faces de bord pour lesquelles on a calcule un flux convectif avec le schema de Rusanov.


Flux diffusif denergie
Introduction
Une condition doit etre fournie sur toutes les fronti`eres pour le calcul du flux diffusif denergie.
Il ny a pas lieu de setendre particuli`erement sur le traitement de certaines fronti`eres. Ainsi, aux
entrees et sorties, on dispose dune valeur de bord (issue de la resolution du probl`eme de Riemann)
que lon utilise dans la formule discr`ete classique donnant le flux7 . La situation est simple aux symetries
egalement, o` u un flux nul est impose.
Par contre, en paroi, les conditions de temperature ou de flux thermique impose doivent etre traitees
avec plus dattention, en particulier lorsquune couche limite turbulente est presente.

Coexistence de deux conditions de bord

Comme indique dans la partie discretisation, les conditions de temperature ou deflux conductif im-
K
pose en paroi se traduisent, pour le flux denergie, au travers du terme div e , en imposant une
  C v
K 1
condition de flux nul sur le terme div ( u2 + sup ) . Les faces IFAC concernees sont reperees
Cv 2
dans cfxtcl par lindicateur IA(IIFBET+IFAC-1) = 1 (qui vaut 0 sinon, initialise dans ppprcl).
Sur ces faces, on calcule une valeur de bord de lenergie, qui, introduite dans la formule generale de
flux utilisee au bord dans Code Saturne, permettra de retouver le flux souhaite. La valeur de bord est
une simple valeur numerique sans signification physique et ne doit etre utilisee que pour calculer le
flux diffusif.
En plus de cette valeur de bord destinee `a retrouver le flux diffusif, il est necessaire de disposer dune
seconde valeur de bord de lenergie afin de pouvoir en calculer le gradient.
Ainsi, comme pour la vitesse en k , il est necessaire de disposer pour lenergie de deux couples
de coefficients (COEFA,COEFB), correspondant `a deux valeurs de bord distinctes, dont lune est utilisee
pour le calcul du flux diffusif specifiquement.

Calcul des COEFA et COEFB pour les faces de paroi a` temperature



imposee
Les faces de paroi IFAC `
a temperature imposee sont identifees par lutilisateur dans uscfcl au moyen
de lindicateur ICODCL(IFAC,ISCA(ITEMPK))=5 (noter que ce tableau est associe `a la temperature).
Dans cfxtcl, on impose alors ICODCL(IFAC,ISCA(IENERG))=5 et on calcule la quantite Cv Timp,ext +
1 2
2 uI + sup,I , que lon stocke dans RCODCL(IFAC,ISCA(IENERG),1) (on ne reconstruit pas les valeurs
de u2 et sup au bord, cf. E).
7 Les valeurs de u2 et de sup ne sont pas reconstruites pour le calcul du gradient au bord dans

K 1
div ( u2 + sup )
Cv 2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 353/402

` partir de ces valeurs de ICODCL et RCODCL, on renseigne ensuite dans clptur les tableaux de
A
conditions aux limites permettant le calcul du flux : COEFA(*,ICLRTP(ISCA(IENERG),ICOEFF)) et
COEFB(*,ICLRTP(ISCA(IENERG),ICOEFF)) (noter lindicateur ICOEFF qui renvoie aux coefficients dedies
au flux diffusif).

Calcul des COEFA et COEFB pour les faces de paroi a` flux thermique impose

Les faces de paroi IFAC `


a flux thermique impose sont identifees par lutilisateur dans uscfcl au moyen
de lindicateur ICODCL(IFAC,ISCA(ITEMPK))=3 (noter que le tableau est associe `a la temperature).
Dans cfxtcl, on impose alors ICODCL(IFAC,ISCA(IENERG))=3 et on transf`ere la valeur du flux de
RCODCL(IFAC,ISCA(ITEMPK),3) ` a RCODCL(IFAC,ISCA(IENERG),3).
` partir de ces valeurs de ICODCL et RCODCL, on renseigne ensuite dans condli les tableaux de
A
conditions aux limites permettant le calcul du flux, COEFA(*,ICLRTP(ISCA(IENERG),ICOEFF)) et
COEFB(*,ICLRTP(ISCA(IENERG),ICOEFF)) (noter lindicateur ICOEFF qui renvoie aux coefficients dedies
au flux diffusif).


Gradient de lenergie en paroi a` temperature
ou a` flux thermique impose
Dans les deux cas (paroi `
a temperature ou `a flux thermique impose), on utilise les tableaux COEFA(*,ICLRTP(ISCA(II),IC
COEFB(*,ICLRTP(ISCA(II),ICOEF)) (noter le ICOEF) pour disposer dune condition de flux nul pour
lenergie (avec II=IENERG) et pour la temperature (avec II=ITEMPK) si un calcul de gradient est requis.
Un gradient est en particulier utile pour les reconstructions de lenergie sur maillage non orthogonal.
Pour la temperature, il sagit dune precaution, au cas o`
u lutilisateur aurait besoin den calculer le
gradient.

`
Autres frontieres que les parois a` temperature
ou a` flux thermique impose
Pour les fronti`eres qui ne sont pas des parois `a temperature ou `a flux thermique impose, les conditions
aux limites de lenergie et de la temperature sont completees classiquement dans condli selon les choix
faits dans cfxtcl pour ICODCL et RCODCL.
En particulier, dans le cas de conditions de Dirichlet sur lenergie (entrees, sorties), les deux jeux de
conditions aux limites sont identiques (tableaux COEFA, COEFB avec ICOEFF et ICOEF).
Si un flux est impose pour lenergie totale (condition assez rare, lutilisateur ne raisonnant pas,
dordinaire, en energie totale), on le stocke au moyen de COEFA(*,ICLRTP(ISCA(IENERG),ICOEFF))
et COEFB(*,ICLRTP(ISCA(IENERG),ICOEFF)) (tableaux associes au flux diffusif). Pour le gradient, une
condition de flux nul est stockee dans COEFA(*,ICLRTP(ISCA(IENERG),ICOEF)) et COEFB(*,ICLRTP(ISCA(IENERG),ICOE
On peut remarquer que les deux jeux de conditions aux limites sont identiques pour les faces de
symetrie.

Impact dans cfener


Lors de la construction des seconds membres, dans cfener, on utilise les conditions aux limites stockees
dans les tableaux associes au flux diffusif
 COEFA(*,ICLRTP(ISCA(IENERG),ICOEFF))
 et COEFB(*,ICLRTP(ISCA(IENERG),
K
pour le terme de flux diffusif div e en prenant soin dannuler la contribution de bord du
  Cv
K 1
terme div ( u2 + sup ) sur les faces pour lesquelles cette condition prend les deux termes
Cv 2
en compte, cest-`a-dire sur les faces pour lesquelles IA(IIFBET+IFAC-1) = 1.
Pour tous les autres termes qui requi`erent une valeur de bord, on utilise les conditions aux lim-
ites que lon a stockees au moyen des deux tableaux COEFA(*,ICLRTP(ISCA(IENERG),ICOEF)) et
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 354/402

COEFB(*,ICLRTP(ISCA(IENERG),ICOEF)). Ces conditions sont donc en particulier utilisees pour le


calcul du gradient de lenergie, lors des reconstructions sur maillage non orthogonal.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 355/402

Points a` traiter
Apporter un complement de test sur une cavite fermee sans vitesse et sans gravite, avec flux de bord
ou temperature de bord imposee. Il semble que le transfert denergie via les termes de pression gen`ere
de fortes vitesses non physiques dans la premi`ere maille de paroi et que la conduction thermique ne
parvienne pas ` a etablir le profil de temperature recherche. Il est egalement possible que la condition
de bord sur la pression gen`ere une perturbation (une extrapolation pourrait se reveler indispensable).
Il pourrait etre utile de generaliser `
a lincompressible lapproche utilisee en compressible pour unifier
simplement le traitement des sorties de type 9 et 10.
Il pourrait etre utile detudier plus en detail linfluence de la non orthogonalite des mailles en sortie
supersonique (pas de reconstruction, ce qui nest pas consistant pour les flux de diffusion).
De meme, il serait utile
 detudier linfluence
 de labsence de reconstruction pour la vitesse et sup dans
1 1 2
la relation TI 0 = eI 0 ui sup,i utilisee pour les parois `a temperature imposee.
Cv 2
Apporter un complement de documentation pour le couplage avec SYRTHES (conversion energie
temperature). Ce nest pas une priorite.
Pour les thermodynamiques ` a variable, il sera necessaire de modifier non seulement uscfth mais
egalement cfrusb qui doit disposer de en argument.
Pour les thermodynamiques ` a Cv variable, il sera necessaire de prendre en compte un terme en Cv ,
issu des flux diffusifs, au second membre de lequation de lenergie (on pourra cependant remarquer
quactuellement, en incompressible, on neglige le terme en Cp dans lequation de lenthalpie).
Part VI

Electric Arcs
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 357/402
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 358/402

A- elec** routine
On sinteresse `
a la resolution des equations de la magnetohydrodynamique, constituees de la reunion
des equations de laerothermodynamique et des equations de Maxwell.
On se place dans deux cadres dutilisation bien specifiques et distincts, qui permettront chacun de
realiser des simplifications : les etudes dites darc electrique (dans lesquelles sont prises en compte
les forces de Laplace et leffet Joule) et les etudes dites Joule (dans lesquelles seul leffet Joule est
pris en compte).
Les etudes darc electrique sont associees en grande partie, pour EDF, aux problematiques relatives
aux transformateurs. Les etudes Joule sont plus secifiquement liees aux phenom`enes rencontres dans
les fours verriers.
Outre la prise en compte ou non des forces de Laplace, ces deux types detudes se differencient egalement
par le mode de determination de leffet Joule (utilisation dun potentiel complexe pour les etudes Joule
faisant intervenir un courant alternatif non monophase).
On decrit tout dabord les equations resolues pour les etudes darc electrique. Les specificites des
etudes Joule seront abordees ensuite.
Pour larc electrique, les references [douce] et [delalondre] pourront completer la presentation :
[delalondre] Delalondre, Clarisse : Modelisation aerothermodynamique darcs electriques `a forte
intensite avec prise en compte du desequilibre thermodynamique local et du transfert thermique `
a la
cathode, Th`ese de lUniversite de Rouen, 1990
[douce] Douce, Alexandre : Modelisation 3-D du chauffage dun bain metallique par plasma darc
transfere. Application `
a un reacteur axisymetrique, HE-26/99/027A, HE-44/99/043A, Th`ese de
lEcole Centrale Paris et EDF, 1999
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 359/402

Fonction
Notations
Variables utilis
ees
A potentiel vecteur reel kg m s2 A1
B champ magnetique T (ou kg s2 A1 )
D deplacement electrique A s m2
E champ electrique V m1
E energie totale massique J kg 1 (ou m2 s2 )
e energie interne massique J kg 1 (ou m2 s2 )
ec energie cinetique massique J kg 1 (ou m2 s2 )
H excitation magnetique A m1
h enthalpie massique J kg 1 (ou m2 s2 )
j densite de courant A m2
P pression kg m1 s2
PR , PI potentiel scalaire reel, imaginaire V (ou kg m2 s3 A1 )
u vitesse m s1

permittivite electrique F m1 (ou m3 kg 1 s4 A2 )


0 permittivite electrique du vide 8, 854 1012 F m1 (ou m3 kg 1 s4 A2 )
permeabilite electrique H m1 (ou m kg s2 A2 )
0 permeabilite electrique du vide 4 107 H m1 (ou m kg s2 A2 )
conductivite electrique S m1 (ou m3 kg 1 s3 A2 )

Notations danalyse vectorielle


On rappelle egalement la definition des notations employees1 :
 
grad a ij = j ai

div () = j ij
[a b] i = a b

ij i j

et donc :
[div (a b)]i = j (ai bj )


Arcs electriques
Introduction
Pour les etudes darc electrique, on calcule, `a un pas de temps donne :

la vitesse u, la pression P , la variable energetique enthalpie h (et les grandeurs turbulentes),


un potentiel scalaire reel PR (dont le gradient permet dobtenir le champ electrique E et la
densite de courant j),
un potentiel vecteur reel A (dont le rotationnel permet dobtenir le champ magnetique B).

Le champ electrique, la densite de courant et le champ magnetique sont utilises pour calculer les
termes sources deffet Joule et les forces de Laplace qui interviennent respectivement dans lequation
de lenthalpie et dans celle de la quantite de mouvement.
1 en utilisant la convention de sommation dEinstein.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 360/402

Equations continues
Syst`
eme d
equations
Les equations continues qui sont resolues sont les suivantes :

div (u) = 0



(u) + div ( u u) = div () + T S + j B



t
  
t (VI.A.1)
(h) + div ( uh) = v + div + h + PJ


t Cp t
div ( PR ) = 0




div (grad A) = 0 j

avec les relations suivantes :


PJ = j E
E = PR (VI.A.2)
j = E

Equation de la masse
Cest lequation resolue en standard par Code Saturne (contrainte stationnaire). Elle na pas de traite-
ment particulier dans le cadre du module present. Un terme source de masse peut etre pris en compte
au second membre si lutilisateur le souhaite. Pour simplifier lexpose le terme source sera suppose nul
ici, dans la mesure o` u il nest pas specifique au module electrique.

Equation de la quantit
e de mouvement
a lequation standard resolue par Code Saturne, un seul terme additionnel
Elle presente, par rapport `
(j B) qui rend compte des forces de Laplace. Pour lobtenir, on fait lhypoth`ese que le milieu est
electriquement neutre.
En effet, une charge qi (Coulomb) animee dune vitesse v i subit, sous leffet du champ electrique E
(V m1 ) et du champ magnetique B (Tesla), une force f i (kg m s2 ) :

f i = qi (E + v i B) (VI.A.3)

Avec ni charges de type qi par unite de volume et en sommant sur tous les types de charge i (electrons,
ions, molecules ionisees...), on obtient la force de Laplace totale F L (kg m2 s2 ) subie par unite de
volume : X
FL = [ni qi (E + v i B)] (VI.A.4)
i

On introduit alors la densite de courant j (A m2 ) :


X
j= ni q i v i (VI.A.5)
i

Avec lhypoth`ese que le milieu est electriquement neutre (`a un niveau macroscopique) :
X
ni qi = 0 (VI.A.6)
i

la force totale F L secrit alors :


FL = j B (VI.A.7)
et on peut donc ecrire lequation de la quantite de mouvement :

(u) + div ( u u) = div () + T S + j B (VI.A.8)
t
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 361/402

Equation de lenthalpie
Elle est obtenue `
a partir de lequation de lenergie apr`es plusieurs approximations utilisees en standard
dans Code Saturne et en prenant en compte le terme deffet Joule lie `a lenergie electromagnetique.

Energie electromagnetique
Avec les memes notations que precedemment mais sans quil soit besoin de supposer que le milieu est
electriquement neutre, la puissance recue par une charge qi (particule douee de masse) de vitesse v i
(vitesse du porteur de charge, contenant eventuellement leffet de la vitesse du fluide) sous leffet du
champ electrique E (V m1 ) et du champ magnetique B (T ) est (sans sommation sur i) :

Pi = f i v i = qi (E + v i B) v i = qi v i E (VI.A.9)

Avec ni charges par unite de volume et en sommant sur tous les types de charges i, on obtient la
puissance totale par unite de volume :
X
PJ = ni qi v i E (VI.A.10)
i

ni qi v i (en A m2 ) et on obtient lexpression usuelle


P
On introduit alors la densite de courant j =
i
de la puissance electromagnetique dissipee par effet Joule (en W m3 ) :

PJ = j E (VI.A.11)

Pour reformuler la puissance dissipee par effet Joule et obtenir une equation devolution de lenergie
electromagnetique, on utilise alors les equations de Maxwell. Les equations secrivent (lois dAmp`ere
et de Faraday) :
D rot H = j

t (VI.A.12)
B

+ rot E = 0
t

On a donc :  
D
PJ = j E = + rot H E (VI.A.13)
t
On utilise alors la relation suivante :

rot H E = H rot E div (E H) (VI.A.14)

En effet, elle permet de faire apparatre un terme en divergence, caracteristique dune redistribution
spatiale :
D
jE = E + H rot E div (E H) (VI.A.15)
t
Et en utilisant la loi de Faraday pour faire apparatre la derivee en temps du champ magnetique :
D B
jE = EH div (E H) (VI.A.16)
t t

Dans le cadre de Code Saturne, on fait les hypoth`eses suivantes :

la permeabilite et la permittivite sont constantes et uniformes (pour les gaz, en pratique, on


utilise les proprietes du vide 0 et 0 ).

on utilise B = H et D = E
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 362/402

On a alors :

0 E 2 1 B 2 1
jE = div (E B) (VI.A.17)
2 t 2 0 t 0

Energie totale
On etablit lequation de lenergie totale en prenant en compte la puissance des forces de Laplace et le
terme deffet Joule.
Sans prendre en compte lenergie electromagnetique, le premier principe de la thermodynamique secrit
dordinaire sous la forme suivante (pour un volume materiel suivi sur une unite de temps) :
Z
d EdV = Q + W (VI.A.18)
V

Dans cette relation, E est lenergie totale par unite de masse2 , soit E = e + ec , e etant lenergie interne
massique et ec = 21 uu lenergie cinetique massique. Le terme Q represente la chaleur recue au travers
des fronti`eres du domaine considere tandis que le terme W represente le travail des forces exterieures
recu par le syst`eme (y compris les forces derivant dune energie potentielle).
Pour prendre en compte lenergie electromagnetique, il suffit dintegrer `a la relation (VI.A.18) la
puissance des forces de Laplace (j B) u et le terme deffet Joule j E (transformation volumique
denergie electromagnetique en energie totale3 ). Dans cette relation, la vitesse u est la vitesse du
fluide et non pas celle des porteurs de charge : elle nest donc pas necessairement colieaire au vecteur
j (par exemple, si le courant est d u`a des electrons, la vitesse du fluide pourra etre consideree comme
decorrelee de la vitesse des porteurs de charges ; par contre, si le courant est d u `a des ions, la vitesse
du fluide pourra etre plus directement influencee par le deplacement des porteurs de charge). Ainsi, le
premier principe de la thermodynamique secrit :
Z
d EdV = Q + W + j E V dt + (j B) u V dt (VI.A.19)
V

et lequation locale pour lenergie totale est alors :



(E) + div ( uE) = div ( u) + T S u + (j B) u + v div s + j E (VI.A.20)
t
Le terme v represente les termes sources volumiques denergie autres que leffet Joule (par exemple,
il inclut le terme source de rayonnement, pour un milieu optiquement non transparent). Le terme s
est le flux denergie surfacique4 .
Enthalpie
Pour obtenir une equation sur lenthalpie, qui est la variable energetique choisie dans Code Saturne
dans le module electrique, on soustrait tout dabord `a lequation de lenergie totale celle de lenergie
cinetique pour obtenir une equation sur lenergie interne.
Lequation de lenergie cinetique (obtenue `a partir de lequation de la quantite de mouvement ecrite
sous forme non conservative) est :
t
(ec ) + div ( uec ) = div ( u) : grad (u) + T S u + (j B) u (VI.A.21)
t
de sorte que, pour lenergie interne, on a :
t
(e) + div ( ue) = : grad (u) + v div s + j E (VI.A.22)
t
2 Nepas confondre le scalaire E, energie totale, avec le vecteur E, champ electrique.
3 Leterme en divergence 1 div (E B) traduit une redistribution spatiale d energie
electromagnetique : ce nest
0
donc pas un terme source pour l energie totale.
4 Dans Code Saturne, il est modelis
e par une hypoth` ese de gradient et inclut
egalement la diffusion turbulente.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 363/402

P
et enfin, pour lenthalpie h = e + :
 
t d P
(h) + div ( uh) = : grad (u) + v div s + j E + (VI.A.23)
t dt

En faisant apparatre la pression dans le tenseur des contraintes = P Id + , on peut ecrire :

t dP
(h) + div ( uh) = : grad (u) + v div s + j E + (VI.A.24)
t dt

Les approximations habituelles de Code Saturne consistent alors `a negliger le terme dechauffement
t
issu du tenseur des contraintes : grad (u) et le terme en derivee totale de la pression dPdt , suppos
es
faibles en comparaison des autres termes dans les applications traitees (exemple : terme deffet Joule
important, effets de compressibilite faibles...). De plus, le terme de flux est modelise en suivant une
hypoth`ese de gradient applique `
a lenthalpie (et non pas `a la temperature), soit donc :
  
t
(h) + div ( uh) = v div + h + j E (VI.A.25)
t Cp t

Equations
electromagn
etiques
Elles sont obtenues `
a partir des equations de Maxwell sous les hypoth`eses detaillees dans [douce],
paragraphe 3.3.
Densite de courant
La relation liant la densite de courant et le champ electrique est issue de la loi dOhm que lon suppose
pouvoir utiliser sous la forme simplifiee suivante :

j = E (VI.A.26)

Champ electrique
Le champ electrique sobtient `
a partir dun potentiel vecteur.
En effet, la loi de Faraday secrit :
B
+ rot E = 0 (VI.A.27)
t
Avec une hypoth`ese quasi-stationnaire, il reste :

rot E = 0 (VI.A.28)

Il est donc possible de postuler lexistence dun potentiel scalaire PR tel que :

E = PR (VI.A.29)

Potentiel scalaire
Le potentiel scalaire est solution dune equation de Poisson.
En effet, la conservation de la charge q secrit :
q
+ div (j) = 0 (VI.A.30)
t
q
Pour un milieu electriquement neutre (`a lechelle macroscopique), on a = 0 soit donc :
t
div (j) = 0 (VI.A.31)
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 364/402

Cest-`
a-dire, avec la loi dOhm (VI.A.26),

div ( E) = 0 (VI.A.32)

Avec (VI.A.29), on obtient donc une equation permettant de calculer le potentiel scalaire :

div ( PR ) = 0 (VI.A.33)

Champ magnetique
Le champ magnetique sobtient `
a partir dun potentiel vecteur.
En effet, la loi dAmp`ere secrit :
D
rot H = j (VI.A.34)
t
Sous les hypoth`eses indiquees precedemment, on ecrit :
E
0 0 rot B = 0 j (VI.A.35)
t
Avec une hypoth`ese quasi-stationnaire, il reste :

rot B = 0 j (VI.A.36)

De plus, la conservation du flux magnetique secrit5 :

div B = 0 (VI.A.37)

et on peut donc postuler lexistence dun potentiel vecteur A tel que :

B = rot A (VI.A.38)

Potentiel vecteur
Le potentiel vecteur est solution dune equation de Poisson.
En prenant le rotationnel de (VI.A.38) et avec (VI.A.36), on obtient :

rot (rot A) = 0 j (VI.A.39)

Avec la relation donnant le Laplacien6 dun vecteur div (grad a) = (div a) rot (rot a) et sous la
contrainte7 que div A = 0, on obtient finalement une equation permettant de calculer le potentiel
vecteur :
div (grad A) = 0 j (VI.A.40)

Effet Joule
Introduction

Pour les etudes Joule, on calcule, `


a un pas de temps donne :

la vitesse u, la pression P , la variable energetique enthalpie h (et les grandeurs turbulentes


eventuelles),
un potentiel scalaire reel PR ,
5 Prendre la divergence de la loi de Faraday, avec div (rot E) = 0 (par analyse vectorielle) donne div B = cst.
6 En coordonnees cart
esiennes, le Laplacien du vecteur a est le vecteur dont les composantes sont egales au Laplacien
de chacune des composantes de a.
7 La condition div A = 0, dite jauge de Coulomb, est n ecessaire pour assurer lunicit
e du potentiel vecteur.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 365/402

et, si le courant nest ni continu, ni alternatif monophase, un potentiel scalaire imaginaire PI .

Le gradient du potentiel permet dobtenir le champ electrique E et la densite de courant j (partie


reelle et, eventuellement, partie imaginaire). Le champ electrique et la densite de courant sont utilises
pour calculer le terme source deffet Joule qui intervient dans lequation de lenthalpie.
La puissance instantan ee dissip ee par effet Joule est egale au produit instantane j E. Dans le
cas general, j et E sont des signaux alternatifs (j = |j|cos( t + j ) et E = |E|cos( t + E )) que lon
peut representer par des complexes (j = |j| ei ( t+j ) et E = |E| ei ( t+E ) ). La puissance instantanee
secrit alors (|j| |E|)cos( t + j )cos( t + E ).

En courant continu ( = j = E = 0), la puissance se calcule donc simplement comme le


produit scalaire PJ = |j| |E|. Le calcul de la puissance dissipee par effet Joule ne pose donc
pas de probl`eme particulier car les variables densite de courant et champ electrique resolues par
Code Saturne sont precisement |j| et |E| (les variables sont reelles).

En courant alternatif, la periode du courant est beaucoup plus petite que les echelles de
temps des phenom`enes thermohydrauliques pris en compte. Il nest donc pas utile de disposer
de la puissance instantanee dissipee par effet Joule : la moyenne sur une periode est suffisante
et elle secrit8 : PJ = 12 (|j| |E|)cos(j E ). Cette formule peut egalement secrire de mani`ere
equivalente sous forme complexe : PJ = 12 j E , o` u E est le complexe conjugue de E.

En courant alternatif monophase (j = E ), en particulier, la formule donnant la puissance


se simplifie sous la forme PJ = 12 (|j| |E|), ou encore : PJ = 12 |j| 12 |E|. Il sagit donc du
produit des valeurs efficaces. Or, les variables resolues par Code Saturne en courant alternatif
monophase sont precisement les valeurs efficaces (valeurs que lon denomme abusivement
valeurs reelles dans le code source).
En courant alternatif non monophase (triphase, en particulier), la formule donnant la puis-
sance est utilisee directement sous la forme PJ = 21 j E . On utilise pour la calculer les
variables resolues qui sont la partie reelle et la partie imaginaire de j et E.

En conclusion,

en continu, les variables resolues j Res et E Res sont les variables reelles continues et la
puissance se calcule par la formule suivante : PJ = j Res E Res
en alternatif monophase, les variables resolues j Res et E Res sont les valeurs efficaces et la
puissance se calcule par la formule suivante : PJ = j Res E Res
en alternatif non monophase, les variables resolues j Res,R , j Res,I et E Res,R , E Res,I sont
la partie reelle et la partie imaginaire de j et E, et la puissance se calcule par la formule
suivante : PJ = 21 (j Res,R E Res,R j Res,I E Res,I )

Le potentiel imaginaire nest donc utilis e dans le code que lorsque le courant est alternatif
et non monophas e. En particulier, le potentiel imaginaire nest pas utilise lorsque le courant est
continu ou alternatif monophase. En effet, la partie imaginaire nest introduite en complement de la
partie reelle que dans le cas o`
u il est necessaire de disposer de deux grandeurs pour definir le potentiel,
cest-`
a-dire lorsquil importe de connatre son amplitude et sa phase. En courant continu, on na
naturellement besoin que dune seule information. En alternatif monophase, la valeur de la phase
importe peu (on ne travaille pas sur des grandeurs electriques instantanees) : il suffit de connatre
lamplitude du potentiel et il est donc inutile dintroduire une variable imaginaire.
La variable d
enomm ee potentiel reel, PR , repr
esente une valeur efficace si le courant
est monophase et une partie r
eelle sinon. De mani`ere plus explicite, pour un potentiel physique
8 Lint
egrale de cos2 x sur un intervalle de longueur 2 est .
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 366/402

alternatif sinusodal P p, de valeur maximale notee P pmax , de phase notee , la variable PR represente
1 P pmax en monophas e et P pmax cos sinon. En courant continu, PR represente naturellement le
2
potentiel (reel, continu). Il est donc indispensable de pr eter une attention particuli` ere aux
valeurs de potentiel impos ees aux limites (facteur 12 ou cos).

Equations continues
Syst`
eme d
equations
Les equations continues qui sont resolues sont les suivantes :

div (u) = 0



(u) + div ( u u) = div () + T S



t
  
t (VI.A.41)
(h) + div ( uh) = v + div + h + PJ


t Cp t
div ( PR ) = 0




div ( PI ) = 0 en alternatif non monophase uniquement

avec, en continu ou alternatif monophase :



PJ = j E
E = PR (VI.A.42)
j = E

et, en alternatif non monophase (avec i2 = 1) :


1

PJ = j E

2 (VI.A.43)
E = (PR + i PI )
j = E

Equation de la masse
Cest lequation resolue en standard par Code Saturne (contrainte stationnaire dincompressibilite).
Elle na pas de traitement particulier dans le cadre du module present. Un terme source de masse peut
etre pris en compte au second membre si lutilisateur le souhaite. Pour simplifier lexpose, le terme
source sera suppose nul ici, dans la mesure o`u il nest pas specifique au module electrique.

Equation de la quantit
e de mouvement
Cest lequation resolue en standard par Code Saturne (les forces de Laplace (j B) sont supposees
negligeables).

Equation de lenthalpie
On letablit comme dans le cas des arcs electriques9 `a partir de lequation de lenergie apr`es plusieurs
approximations utilisees en standard dans Code Saturne et en prenant en compte le terme deffet Joule
lie `
a lenergie electromagnetique.
Par rapport `
a lequation utilisee pour les etudes darc electrique, seule lexpression de leffet Joule
` ceci pr`
9A es que la puissance des forces de Laplace napparat pas du tout, au lieu de disparatre lorsque lon soustrait
l
equation de l
energie cin
etique `
a celle de l
energie totale.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 367/402

diff`ere lorsque le courant est alternatif non monophase.

Equations
electromagn
etiques
Elles sont obtenues comme indique dans la partie relative aux arcs electriques, mais on ne conserve
que les relations associees `
a la densite de courant, au champ electrique et au potentiel dont il derive.


Discretisation
La discretisation des equations ne pose pas de probl`eme particulier (ajout de termes sources explicites
pour leffet Joule et les forces de Laplace, equations de Poisson pour la determination des potentiels).
Un point sur les conditions aux limites doit cependant etre fait ici, en particulier pour preciser la
methode de recalage automatique des potentiels.


Arcs electriques
Conditions aux limites

Seules les conditions aux limites pour les potentiels sont `a preciser.
Les conditions aux limites sur le potentiel scalaire sont des conditions de Neumann homog`enes
sur toutes les fronti`eres hormis `
a la cathode et `a lanode. A` la cathode, on impose une condition de
Dirichlet homog`ene (potentiel nul par convention). A ` lanode, on impose une condition de Dirichlet
permettant de fixer la difference de potentiel souhaitee entre lanode et la cathode. Lutilisateur peut
fixer le potentiel de lanode directement ou demander quun recalage automatique du potentiel soit
effectue pour atteindre une intensite de courant predeterminee.
Lorsque le recalage automatique est demande (IELCOR=1), lutilisateur doit fixer la valeur cible de
lintensite, COUIMP, (A) et une valeur elevee de depart de la difference de potentiel entre lanode et la
cathode10 , DPOT, (V ). Le recalage est effectue en fin de pas temps et permet de disposer, pour le pas
de temps suivant, de valeurs recalees des forces de Laplace et de leffet Joule.

Pour effectuer le recalage, Code Saturne determine lintegrale de leffet Joule estime sur le domaine
(en W ) et en compare la valeur au produit de lintensite COUIMP par la difference de potentiel11
DPOT. Un coefficient multiplicatif de recalage COEPOT en est deduit (pour eviter des variations
trop brusques, on sassure quil reste borne).
On multiplie alors par COEPOT la difference de potentiel entre lanode et la cathode, DPOT, et le
vecteur j. Leffet Joule, produit de j par E, est multiplie par le carre de COEPOT. Pour assurer
la coherence du post-traitement des variables, le potentiel vecteur et le potentiel scalaire sont
egalement multiplies par COEPOT.
Le champ electrique netant pas explicitement stocke, on ne le recale pas. Le potentiel vecteur
et les forces de Laplace seront deduits de la densite de courant et integreront donc naturellement
le recalage.

Les conditions aux limites sur le potentiel vecteur sont des conditions de Neumann homog`ene
sur toutes les fronti`eres hormis sur une zone de bord arbitrairement choisie (paroi par exemple) pour
laquelle une condition de Dirichlet est utilisee afin que le syst`eme soit inversible (la valeur imposee est
la valeur du potentiel vecteur calculee au pas de temps precedent).
10 Plus precis
ement, lutilisateur doit imposer un potentiel nul en cathode et le potentiel DPOT ` a lanode, en utilisant
explicitement, dans le sous-programme utilisateur uselcl, la variable DPOT qui sera automatiquement recal ee au cours
du calcul.
11 DPOT est la diff
erence de potentiel impos
ee entre lanode et la cathode au pas de temps qui sach`
eve. DPOT a conditionne
le champ electrique et la densit
e de courant utilis
es pour le calcul de leffet Joule.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 368/402

Effet Joule
Conditions aux limites
Seules les conditions aux limites pour les potentiels sont `a preciser.
Les conditions aux limites sur le potentiel scalaire sont `a preciser au cas par cas selon la con-
figuration des electrodes. Ainsi, on dispose classiquement de conditions de Neumann homog`enes ou de
Dirichlet (potentiel impose). On peut egalement avoir besoin dimposer des conditions dantisymetrie
(en utilisant des conditions de Dirichlet homog`enes par exemple). Lutilisateur peut egalement souhaiter
quun recalage automatique du potentiel soit effectue pour atteindre une valeur predeterminee de la
puissance dissipee par effet Joule.
Lorsque le recalage automatique est demande (IELCOR=1), lutilisateur doit fixer la valeur cible de la
puissance dissipee dans le domaine, PUISIM, (V.A). Il doit en outre, sur les fronti`eres o`
u il souhaite que
le potentiel (reel ou complexe) sadapte automatiquement, fournir en condition `a la limite une valeur
initiale du potentiel et la multiplier par la variable COEJOU qui sera automatiquement recalee au cours
du calcul (COEJOU vaut 1 au premier pas de temps). Le recalage est effectue en fin de pas temps et
permet de disposer, pour le pas de temps suivant, dune valeur recalee de leffet Joule.

Pour effectuer le recalage, Code Saturne determine lintegrale de leffet Joule estime sur le domaine
(en W ) et en compare la valeur `a la puissance cible. Un coefficient multiplicatif de recalage COEPOT
en est deduit (pour eviter des variations trop brusques, on sassure quil reste borne entre 0,75
et 1,5).

On multiplie alors par COEPOT le facteur multiplicatif COEJOU utilise pour les conditions aux
limites. La puissance dissipee par effet Joule est multipliee par le carre de COEPOT. Pour assurer
la coherence du post-traitement des variables, le potentiel est egalement multiplie par COEPOT.
Le champ electrique netant pas explicitement stocke, on ne le recale pas.

On notera que la variable DPOT est egalement recalee et quelle peut donc etre utilisee si besoin pour
imposer les conditions aux limites.

Mise en uvre
Introduction
Le module electrique est une physique particuli`ere activee lorsque les mots-cles IPPMOD(IELARC)
(arc electrique) ou IPPMOD(IELJOU) (Joule) sont strictement positifs. Les developpements concer-
nant la conduction ionique (mot-cle IPPMOD(IELION)) ont ete prevus dans le code mais restent ` a
realiser. Pour larc electrique, dans la version actuelle de Code Saturne, seule est operationnelle
loption IPPMOD(IELARC)=2 : la version 2D axisymetrique qui permettrait de saffranchir du po-
tentiel vecteur (option IPPMOD(IELARC)=1) nest pas activable. Pour leffet Joule, lorsquil nest pas
utile dintroduire un potentiel scalaire complexe (en courant continu ou alternatif monophase), on
utilise IPPMOD(IELJOU)=1. Lorsquun potentiel scalaire complexe est indispensable (courant alter-
natif triphase, par exemple), on utilise IPPMOD(IELJOU)=2.
Dans ce qui suit, on precise les inconnues et les proprietes principales utilisees dans le module. On
fournit egalement un arbre dappel simplifie des sous-programmes du module (initialisation avec initi1
puis inivar et boucle en temps avec tridim). Les sous-programmes marques dun asterisque sont
detailles ensuite.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 369/402

es
Inconnues et propriet
Les developpements ont ete realises pour une unique phase (NPHAS=1).
Les NSCAPP inconnues scalaires associees `a la physique particuli`ere sont definies dans elvarp dans
lordre suivant (en particulier afin de limiter le stockage en memoire lors de la resolution sequentielle
des scalaires par scalai) :

lenthalpie RTP(*,ISCA(IHM)),
un potentiel scalaire reel RTP(*,ISCA(IPOTR)),
un potentiel scalaire imaginaire RTP(*,ISCA(IPOTI)) ssi IPPMOD(IELJOU)=2 (etudes Joule en
courant alternatif non monophase),

les trois composantes dun potentiel vecteur reel RTP(*,ISCA(IPOTVA(i))) (avec i variant de 1
a 3) ssi IPPMOD(IELARC)=2 (arc electrique),
`
NGAZG-1 fractions massiques RTP(*,ISCA(IYCOEL(j))) (avec j variant de 1 `a NGAZG-1) pour un
fluide `
a NGAZG constituants (avec NGAZG strictement superieur `a 1). En arc electrique, la compo-
sition est fournie dans le fichier de donnees dp ELE. La fraction massique du dernier constituant
nest pas stockee en memoire. Elle est determinee chaque fois que necessaire en calculant le
complement ` a lunite des autres fractions massiques (et, en particulier, lorsque elthht est utilise
pour le calcul des proprietes physiques).

Outre les proprietes associees en standard aux variables scalaires identifiees ci-dessus, le tableau PROPCE
contient egalement :

la temperature, PROPCE(*,IPPROC(ITEMP)). En theorie, on pourrait eviter de stocker cette


variable, mais lutilisateur est presque toujours interesse par sa valeur en post-traitement et les
proprietes physiques sont souvent donnees par des lois qui en dependent explicitement. Son unite
(Kelvin ou Celsius) depend des tables enthalpie-temperature fournies par lutilisateur.
la puissance electromagnetique dissipee par effet Joule, PROPCE(*,IPPROC(IEFJOU)) (terme
source positif pour lenthalpie),
les trois composantes des forces de Laplace, PROPCE(*,IPPROC(ILAPLA(i))) (avec i variant de
1`a 3) en arc electrique (IPPMOD(IELARC)=2).

La conductivite electrique est a priori variable et conservee dans le tableau de proprietes aux cel-
lules PROPCE(*,IPPROC(IVISLS(IPOTR))). Elle intervient dans lequation de Poisson portant sur le
potentiel scalaire. Lorsque le potentiel scalaire a une partie imaginaire, la conductivite nest pas du-
pliquee : les entiers IPPROC(IVISLS(IPOTI)) et IPPROC(IVISLS(IPOTR)) pointent sur la meme case
du tableau PROPCE. La conductivite associee au potentiel vecteur est uniforme et de valeur unite
(VISLS0(IPOTVA(i))=1.D0 avec i variant de 1 `a 3).
Le champ electrique, la densite de courant et le champ magnetique ne sont stockes que de mani`ere
temporaire (voir elflux).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 370/402

Arbre dappel simplifie

usini1 Initialisation des mots-cles utilisateur generaux et positionnement


des variables
usppmo Definition du module physique particuli`ere employe
varpos Positionnement des variables
pplecd Branchement des physiques particuli`eres pour la lecture de fichier
de donnees
ellecd* Lecture du fichier de donnees pour les arcs electriques dp ELE
ppvarp Branchement des physiques particuli`eres pour le positionnement
des inconnues
elvarp* Positionnement des inconnues (enthalpie, potentiels, fractions
massiques)
ppprop Branchement des physiques particuli`eres pour le positionnement
des proprietes
elprop* Positionnement des proprietes (temperature, effet Joule, forces de
Laplace)
ppini1 Branchement des physiques particuli`eres pour linitialisation des
mots-cles specifiques
elini1 Initialisation des mots-cles pour le module electrique
useli1 Initialisation des mots-cles utilisateur pour le module electrique
elveri Verification des mots-cles pour le module electrique

Table A.1: Sous-programme initi1 : initialisation des mots-cles et positionnement des variables

ppiniv Branchement des physiques particuli`eres pour linitialisation des


variables
eliniv* Initialisation des variables specifiques au module electrique
elthht* Transformation temperature-enthalpie et enthalpie-temperature
par interpolation sur la base du fichier de donnees dp ELE (arc
electrique uniquement)
useliv Initialisation des variables par lutilisateur
elthht* Transformation temperature-enthalpie et enthalpie-temperature
par interpolation sur la base du fichier de donnees dp ELE (arc
electrique uniquement)

Table A.2: Sous-programme inivar : initialisation des variables


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 371/402

phyvar Calcul des proprietes physiques variables


ppphyv Branchement des physiques particuli`eres pour le calcul des pro-
prietes physiques variables
elphyv Calcul des proprietes physiques variables pour le module
electrique. En arc electrique, les proprietes sont calculees par in-
terpolation `a partir des tables fournies dans le fichier de donnees
dp ELE
elthht* Transformation temperature-enthalpie et enthalpie-temperature
par interpolation sur la base du fichier de donnees dp ELE (arc
electrique uniquement)
uselph Calcul par lutilisateur des proprietes physiques variables pour
le module electrique. Pour les etudes Joule, en particulier, les
proprietes doivent etre fournies ici sous forme de loi (des exemples
sont disponibles)
usthht Transformation temperature-enthalpie et enthalpie-temperature
fournie par lutilisateur (plus specifiquement pour les etudes Joule,
pour lesquelles on ne dispose pas dun fichier de donnees `a partir
duquel realiser des interpolations avec elthht)

Table A.3: Sous-programme tridim : partie 1 (proprietes physiques)


Precisions

ellecd

Ce sous-programme realise la lecture du fichier de donnees specifique aux arcs electriques. On donne ci-
dessous, `
a titre dexemple, lentete explicative et deux lignes de donnees dun fichier type. Ces valeurs
sont interpolees chaque fois que necessaire par elthht pour determiner les proprietes physiques du
fluide `
a une temperature (une enthalpie) donnee.

# Nb despeces NGAZG et Nb de points NPO (le fichier contient NGAZG blocs de NPO lignes chacun)
# NGAZG NPO
1 238
#
# Proprietes
# T H ROEL CPEL SIGEL VISEL XLABEL XKABEL
# Temperature Enthalpie Masse vol. Chaleur Conductivite Viscosite Conductivite Coefficient
# volumique massique electrique dynamique thermique dabsorption
# K J/kg kg/m3 J/(kg K) Ohm/m kg/(m s) W/(m K) -
#
300.00 14000. 1.6225 520.33 0.13214E-03 0.34224E-04 0.26712E-01 0.0000
400.00 65800. 1.2169 520.33 0.13214E-03 0.34224E-04 0.26712E-01 0.0000

elvarp

Ce sous-programme permet de positionner les inconnues de calcul listees precedemment. On y precise


egalement que la chaleur massique ` a pression constante est variable, ainsi que la conductivite de tous les
scalaires associes au module electrique, hormis la conductivite de leventuel potentiel vecteur (celle-ci
est uniforme et de valeur unite).

elprop

Cest dans ce sous-programme que sont positionnees les proprietes stockees dans le tableau PROPCE, et
en particulier la temperature, leffet Joule et les forces de Laplace.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 372/402

ppclim Branchement des physiques particuli`eres pour les conditions aux


limites
uselcl Intervention de lutilisateur pour les conditions aux limites (en
lieu et place de usclim, meme pour les variables qui ne sont pas
specifiques au module electrique). Si un recalage automatique des
potentiels est demande (IELCOR=1), il doit etre pris en compte ici
par le biais des variables DPOT ou COEJOU (voir la description des
conditions aux limites).
navstv Resolution des equations de Navier-Stokes
predvv Prediction de la vitesse : prise en compte des forces de Laplace
calculees dans elflux au pas de temps precedent
turb Turbulence : resolution des equations pour les mod`eles necessitant
des equations de convection-diffusion
scalai* Resolution des equations portant sur les scalaires associes aux
physiques particuli`eres et des scalaires utilisateur
covofi Resolution successive de lenthalpie, du potentiel scalaire reel et,
si IPPMOD(IELJOU)=2, de la partie imaginaire du potentiel scalaire
(appels successifs `a covofi qui appelle eltssc pour le calcul du
terme deffet Joule au second membre de lequation de lenthalpie)
elflux* Calcul du champ electrique, de la densite de courant et de leffet
Joule (premier de deux appels au cours du pas de temps courant)
uselrc* Recalage automatique eventuel de la densite de courant, de leffet
Joule, des potentiels et des coefficients DPOT et COEJOU. Ce re-
calage, sil a ete demande par lutilisateur (IELCOR=1), est effectue
a partir du deuxi`eme pas de temps.
`
covofi Resolution successive, si IPPMOD(IELARC)=2, des trois com-
posantes du potentiel vecteur. On proc`ede par appels successifs
a covofi qui appelle eltssc pour le calcul du second membre de
`
lequation de Poisson portant sur chaque composante du potentiel.
covofi Resolution successive des NGAZG-1 fractions massiques car-
acterisant la composition du fluide, sil est multiconstituant. On
proc`ede par appels successifs `a covofi.
elflux* En arc electrique, calcul du champ magnetique et des trois com-
posantes des forces de Laplace (deuxi`eme et dernier appel au cours
du pas de temps courant)
covofi Resolution des scalaires utilisateur

Table A.4: Sous-programme tridim : partie 2 (conditions aux limites, Navier-Stokes, turbulence et
scalaires)

postlc Post-traitement
ecrevo
Ecriture des variables `a post-traiter
uselen Ajout au post-traitement de variables calculees par lutilisateur.
En exemple active standard sont post-traites, sils existent,
loppose du champ electrique (i.e. le gradient du potentiel scalaire,
reel ou complexe), le vecteur densite de courant imaginaire (en
effet Joule), le champ magnetique (en arc electrique) et en-
fin le module et largument du potentiel (en effet Joule, avec
IPPMOD(IELJOU)=4)

Table A.5: Sous-programme tridim : partie 3 (post-traitement)


Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 373/402

eliniv

Ce sous-programme permet de realiser les initialisations par defaut specifiques au module.


En particulier, en k , les deux variables turbulentes sont initialisees `a 1010 (choix historique
arbitraire, mais repute, lors de tests non references, permettre le demarrage de certains calculs qui
echouaient avec une initialisation classique).
Les potentiels sont initialises `
a zero, de meme que leffet Joule. En arc electrique, les forces de Laplace
sont initialisees `
a zero.
Le fluide est suppose monoconstituant (seule est presente la premi`ere esp`ece).
En arc electrique, lenthalpie est initialisee `a la valeur de lenthalpie du melange suppose monoconsti-
tuant ` a la temperature T0 donnee dans usini1. En effet Joule, lenthalpie est initialisee `a zero (mais
lutilisateur peut fournir une valeur differente dans useliv).

elthht

Ce sous-programme permet de realiser (en arc electrique) les interpolations necessaires a` la deter-
mination des proprietes physiques du fluide, `a partir des tables fournies dans le fichier de donnees
dp ELE.
On notera en particulier que ce sous-programme prend en argument le tableau YESP(NESP) qui
represente la fraction massique des NGAZG constituants du fluide. Dans le code, on ne resout que
la fraction massique des NGAZG-1 premiers constituants. Avant chaque appel `a elthht, la fraction
massique du dernier constituant doit etre calculee comme le complement `a lunite des autres fractions
massiques.

scalai, elflux, uselrc

Le sous-programme scalai permet de calculer, dans lordre souhaite, les NSCAPP scalaires physique
particuli`ere associes au module electrique, puis de calculer les grandeurs intermediaires necessaires et
enfin de realiser les operations qui permettent dassurer le recalage automatique des potentiels, lorsquil
est requis par lutilisateur (i.e. si IELCOR=1).
Les NSCAPP scalaires physique particuli`ere sont calcules successivement par un appel `a covofi place
dans une boucle portant sur les NSCAPP scalaires. Lalgorithme tire profit de lordre specifique dans
lequel ils sont definis et donc resolus (dans lordre : enthalpie, potentiel scalaire, potentiel vecteur,
fractions massiques).
Pour eviter des variations trop brutales en debut de calcul, le terme source deffet Joule nest pris en
compte dans lequation de lenthalpie qu`a partir du troisi`eme pas de temps.
Apr`es la resolution de lenthalpie et du potentiel scalaire (reel ou complexe), le sous-programme
elflux permet de calculer les trois composantes du champ electrique (que lon stocke dans des
tableaux de travail), puis la densite de courant et enfin leffet Joule, que lon conserve dans le tableau
PROPCE(*,IPPROC(IEFJOU)) pour le pas temps suivant (apr`es recalage eventuel dans uselrc comme
indique ci-apr`es). Lorsque IPPMOD(IELJOU)=2, lapport de la partie imaginaire est pris en compte pour
le calcul de leffet Joule. Lorsque IPPMOD(IELARC)=2 (arc electrique), le vecteur densite de courant est
conserve dans PROPCE, en lieu et place des forces de Laplace PROPCE(*,IPPROC(ILAPLA(i))) : il est
utilise pour le calcul du potentiel vecteur dans le second appel `a elflux, apr`es recalage eventuel par
uselrc (en effet, il nest plus necessaire de conserver les forces de Laplace `a ce stade puisque la seule
equation dans laquelle elles interviennent est lequation de la quantite de mouvement et quelle a dej`a
ete resolue).
` la suite de elflux, le sous-programme uselrc effectue le recalage permettant dadapter automa-
A
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 374/402

tiquement les conditions aux limites portant sur les potentiels, si lutilisateur la demande (i.e. si
IELCOR=1). On se reportera au paragraphe relatif aux conditions aux limites. On precise ici que le co-
efficient de recalage COEPOT permet dadapter leffet Joule PROPCE(*,IPPROC(IEFJOU)) et la difference
de potentiel DPOT (utile pour les conditions aux limites portant sur le potentiel scalaire au pas de
temps suivant12 ). Pour les cas darc electrique, COEPOT permet egalement de recaler le vecteur densite
de courant que lon vient de stocker temporairement dans PROPCE(*,IPPROC(ILAPLA(i))) et qui va
servir immediatement ` a calculer le potentiel vecteur. Pour les cas Joule, on recale en outre le coefficient
COEJOU (utile pour les conditions aux limites portant sur le potentiel scalaire au pas de temps suivant).
Pour les cas darc electrique (IPPMOD(IELARC)=2), apr`es elflux et uselrc, la resolution sequentielle
des inconnues scalaires se poursuit dans scalai avec le calcul des trois composantes du potentiel
vecteur. Le second membre de lequation de Poisson consideree depend de la densite de courant qui,
dans elflux, a ete temporairement stockee dans le tableau PROPCE(*,IPPROC(ILAPLA(i))) et qui,
dans uselrc, vient detre recalee si IELCOR=1. Les valeurs du potentiel vecteur obtenues int`egrent
donc naturellement leventuel recalage.
Pour les cas darc electrique (IPPMOD(IELARC)=2), un second appel `a elflux permet alors de calculer
le champ magnetique que lon stocke dans des tableaux de travail et les forces de Laplace que lon
stocke dans PROPCE(*,IPPROC(ILAPLA(i))) pour le pas de temps suivant (la densite de courant, que
lon avait temporairement conservee dans ce tableau, ne servait qu`a calculer le second membre de
lequation de Poisson portant sur le potentiel vecteur : il nest donc plus necessaire de la conserver).
La resolution sequentielle des inconnues scalaires specifiques au module se poursuit dans scalai, avec
le calcul des NGAZG-1 fractions massiques permettant de definir la composition du fluide.
Pour terminer, scalai permet la resolution des scalaires utilisateurs (appel `a covofi dans une
boucle portant sur les NSCAUS scalaires utilisateur).
On peut remarquer pour finir que les termes sources des equations de la quantite de mouvement (forces
de Laplace) et de lenthalpie (effet Joule) sont disponibles `a la fin du pas de temps n pour une utilisation
au pas de temps n + 1 (de ce fait, pour permettre les reprises de calcul, ces termes sources sont stockes
dans le fichier suite auxiliaire, ainsi que DPOT et COEJOU).

12 A priori, DPOT nest pas n


ecessaire pour les cas Joule.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 375/402

Points a` traiter

Mobilit
e ionique
Le module est `
a developper.

Conditions aux limite en Joule


La prise en compte de conditions aux limites couplees entre electrodes reste `a faire.

Compressible en arc electrique


Les developpements du module compressible de Code Saturne doivent etre rendus compatibles avec le
module arc electrique.
Part VII

Mesh Handling
Appendix B

Mesh Algorithms
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 378/402

In this chapter, we will describe algorithms used for several operations done by Code Saturne.

Geometric Quantities
Normals and Face Centers
To calculate face normals, we take care to use an algorithm that is correct for any planar simple
polygon, including non-convex cases. The principle is as follows: take an arbitrary point Pa in the
same plane as the polygon, then compute the sum of the vector normals of triangles {Pa , Pi , Pi+1 },
where {P1 , P2 , ..., Pi , ..., Pn } are the polygon vertices and Pn+1 P0 . As shown on figure VII.B.1,
some normals have a positive contribution while others have a negative contribution (taking into
account the ordering of the polygons vertices). The length of the final normal obtained is equal to the
polygons surface.

Pa

Figure VII.B.1: Face normals calculation principle

In our implementation, we take the arbitrary Pa point as the center of the polygons vertices, so
as to limit precision problems due to truncation errors and to ensure that the chosen point is on the
polygons plane.

Figure VII.B.2: Triangles for calculation of face quantities

A faces center is defined as the weighted center G of triangles Ti defined as {Pa , Pi , Pi+1 } and whose
centers are noted Gi . Let O be the center of the coordinate system and nf the face normal, then:


n

Pn
i=1 surf(Ti ).OGi Ti .nf
OG = Pn avec surf(Ti ) =

i=1 surf(Ti ) k nf k

It is important to use the signed surface of each triangle so that this formula remains true in the case
of non convex faces.
In real cases, some faces are nor perfectly planar. In this case, a slight error is introduced, but it is
difficult to choose an exact and practical (implementation and computing cost wise) definition of a
polygons surface when its edges do not all lie in a same plane.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 379/402

So as to limit errors due to warped faces, we compare the contribution of a given face to the the
neighboring cell volumes (through Stokes formula) with the contribution obtained from the separate
triangles {Pa , Pi , Pi+1 }, and we translate the initial center of gravity along the face normal axis so as
to obtain the same contribution.

Cell Centers
If we consider that in theory, the Finite Volume method uses constant per-cell values, we can make
without a precise knowledge of a given cells center, as any point inside the cell could be chosen. In
practice, precision (spatial order) depends on a good choice of the cells center, as this point is used
for the computation of values and gradients at mesh faces. We do not compute the center a the
circumscribed sphere as a cell center, as this notion is usually linked to tetrahedral meshes, and is not
easily defined and calculated for general polyhedra.
Let us consider a cell C with p faces of centers of gravity Gk and surfaces of norm Sk . If O is the origin
of the coordinate system, Cs center G is defined as:

Pp
S .OGk
OG = Pp k
k=1
k=1 Sk

An older algorithm computed a cell Cs center of gravity as the center of gravity of its vertices q of
coordinates Xl :

q
X OXl
OG =
q
l=1

In most cases, the newer algorithm gives better results, though there are exceptions (notably near the
axis of partial meshes with rotational symmetry).
On figure VII.B.3, we show the center of gravity calculated with both algorithms on a 2D cell. On
the left, we have a simple cell. On the right, we have added additional vertices as they occur in the
case of a joining of non conforming faces. The position of the center of gravity is stable using the
newer algorithm, whilst this point is shifted towards the joined sub-faces with the older, vertex-based
algorithm (which worsens the mesh quality).

Initial Cell Identical Cell with Additional Vertices

Faces COG Vertices COG Faces COG Vertices COG

Figure VII.B.3: Choice of cell center

On figure VII.B.4, we show the possible effect of the choice of a cells COG on the position of line
segments joining the COGs of neighboring cells after a joining of non-conforming cells.
We see here that the vertex-based algorithm tends to increase non-orthogonality of faces, compared to
the present face-based algorithm.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 380/402

Faces COG Vertices COG

Figure VII.B.4: Choice of cell center and face orthogonality

Conforming Joining
The use of non conforming meshes is one of Code Saturnes key features, and the associated algorithms
constitute the most complex part of the codes preprocessor. The idea is to build new faces corre-
sponding to the intersections of the initial faces to be joined. Those initial faces are then replaced by
their covering built from the new faces, as shown on figure VII.B.5 (from a 2D sideways perspective):

Cell 3 Cell 3
Face 1,3
Cell 1 Cell 1

Face 1,4 Cell 4


Cell 4
Face 2,4

Cell 2 Cell 5 Cell 2 Face 2,5 Cell 5

Before joining After joining

Figure VII.B.5: Principle of face joinings

We speak of conforming joining, as the mesh resulting from this joining is conforming, whereas the
initial mesh was not.
The number of faces of a cell of which one side has been joined will be greater or equal to the
initial number of faces, and the new faces resulting from the joining will not always be triangles or
quadrangles, even if all of the initial faces were of theses types. For this reason, the data representations
of Code Saturne and its preprocessor are designed with arbitrary simple polygonal faces and polyhedral
cells in mind. We exclude polygons and polyhedra with holes from this representation, as shown on
figure VII.B.6. Thus the cells shown in figure VII.B.6 cannot be joined, as this would require opening
a hole in one of the larger cells faces. In the case of figure VII.B.6b, we have no such problem, as
the addition of another smaller cell splits the larger face into pieces that do not contain holes.

Robustness Factors
We have sought to build a joining algorithm that could function with a minimum of user input, on a
wide variety of cases.
Several criteria were deemed important:

1. determinism: we want to be able to predict the algorithms behavior. We especially want the
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 381/402

a) Impossible Definition b) Possible Definition

Figure VII.B.6: Possible case joinings

algorithm to produce the same results whether some mesh A was joined to mesh B or B to A.
This might not be perfectly true in the implementation due to truncation errors, but the main
point is that the user should not have to worry about the order in which he enters his meshes
for the best computational results. 1
2. non planar surfaces: We must be able to join both curved surface meshes and meshes of surfaces
assembled from a series of planar sections, but whose normal is not necessarily a continuous
function of space, as shown on figure VII.B.7.

Figure VII.B.7: Initial surfaces

3. spacing between meshes: the surfaces to be joined may not match perfectly, due to truncation
errors or precision differences, or to the approximation of curved surfaces by a set of planar faces.
The algorithm must not leave gaps where none are desired.

Basic Principle
Let us consider two surfaces to join, as in figure VII.B.8: We seek to determine the intersections of
the edges of the mesh faces, and to split these edges at those intersections, as shown on figure VII.B.9.
We will describe more precisely what we mean by intersection of two edges in a later section, as the
notion involves spanning of small gaps in our case.
The next step consists of reconstructing sub-faces derived from the initial faces. Starting from an
edge of an initial face, we try to find closed loops, choosing at each vertex the leftmost edge (as seen
standing on that face, normal pointing upwards, facing in the direction of the current edge), until we
have returned to the starting vertex. This way, we find the shortest loop turning in the trigonometric
direction. Each face to be joined is replaced by its covering of sub-faces constructed in this manner.
When traversing the loops, we must be careful to stay close to the plane of the original face. We thus
consider only the edges belonging to a face whose normal has a similar direction to that of the face
1 The geometry produced by a joining is in theory independent from the order mesh inputs, but mesh numbering is

not. The input order used for a calculation should thus be kept for any calculation restart.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 382/402

Figure VII.B.8: Surfaces to be joined

Figure VII.B.9: After edge intersections

being subdivided (i.e. the absolute value of the dot product of the two unitary normals should be close
to 1).

angle between two faces


reconstructed loop

Figure VII.B.10: Sub-face reconstruction.

Once all the sub-faces are built, we should have obtained for two tangent initial faces two topologically
identical sub-faces, each descending from one of the initial faces and thus belonging to a different cell.
All that is required at this stage is to merge those two sub-faces, conserving the properties of both.
The merged sub-face thus belongs to two cells, and becomes an internal face. The joining is thus
finalized.

Simplification of Face Joinings


For a finite-volume code such as Code Saturne, it is best that faces belonging to one same cell have
neighboring sizes. This is hard to ensure when non-conforming boundary faces are split so as to be
joined in a conforming way. On figure VII.B.11, we see that this can produce faces of highly varying
sizes when splitting a face for conformal joining.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 383/402

It is possible to simplify the covering of a face so as to limit this effect, by moving vertices slightly on
each side of the covering. We seek to move vertices so as to simplify the covering while deforming the
mesh as little as possible.
One covering example is presented figure VII.B.11, where we show several simplification opportunities.
We note that all these possibilities are associated with a given edge. Similar possibilities associated
with other edges are not shown so that the figure remains readable. After simplification, we obtain
the situation of figure VII.B.12.

Merging possibility by
Vertex displacement
along an edge

Merging Possibility by
sideways displacement of vertex
(and edge rotation)

Figure VII.B.11: Simplification possibilities

After simplification, we have the following situation:

The translation has avoided us


needing to split the horizontal
edge in 2; furthermore, the
vertical edges are merged

Rotation by sideways displacement


has provoked merging in the
lower part of this area

Figure VII.B.12: Faces after simplification

Processing
The algorithms starting point is the search for intersections of edges belonging to the faces selected
for joining. In 3D, we do not restrict ourselves to true intersections, but we consider that two edges
intersect as soon as the minimum distance between those edges is smaller than a certain tolerance.
To each vertex we associate a maximum distance, some factor of the length of the smallest edge
incident to that vertex. This factor is adjustable (we use 0.1 by default), but should always be less
than 0.5. By default, this factor is usually multiplied by the smallest sine of the angles between the
edges considered, so that the tolerance assigned to a given vertex is a good estimation of the smallest
height/width/depth or the adjacent cells.
On figure VII.B.14, we illustrate this tolerance in 2d with a factor of 0.25, with red circles showing the
tolerance region without the sine factor correction, and blue circle showing the tolerance with the sine
correction.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 384/402

s1 = 0 s2 = 0

"Intersection" Points

S2 = 1
s1 = 1

Figure VII.B.13: Intersection of edges in 3d space

Figure VII.B.14: Join tolerance for vertices of joinable faces

We consider a neighborhood of an edge defined by the spheres associated to the minimal distances
around each vertex and the shell joining this two spheres, as shown on figure VII.B.15. More precisely,
at a point on the edge of linear abscissa s, the neighborhood is defined to be the sphere of radius
dmax (s) = (1 s)dmax |s=0 +s.dmax |s=1 .
We will thus have intersection between edges E1 and E2 as soon as the point of E1 closest to E2 is
within the neighborhood of E2, and that simultaneously, the point of E2 closest to E1 is inside the
neighborhood of E1.

s1 = 0 s2 = 0

"Intersection" Points

S2 = 1
s1 = 1
Max. Associated Distances

Figure VII.B.15: Tolerances for intersection of edges

If edge E2 cuts the neighborhood of a vertex of edge E1, and this vertex is also in E2s neighborhood,
we choose this vertex to define the intersection rather than the point of E1 closest to E2. This avoids
needlessly cutting edges. We thus search for intersections with the following order of priority: vertex-
vertex, vertex-edge, then edge-edge. If the neighborhoods associated with two edges intersect, but the
criterion:
P 1 A1, P 2 A2, d(P 1, P 2) < min(dmax (P 1), dmax (P 2))
is not met, we do not have intersection. These cases are shown on figure VII.B.16.

Problems Arising From the Merging of Two Neighboring Vertices


If we have determined that a vertex V1 should be merged with a vertex V2 and independently that
this vertex V2 should be merged with a vertex V3 , then V1 and V3 should be merged as a result, even
though these vertices share no intersection. We refer to this problem as merging transitivity and show
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 385/402

EdgeEdge VertexEdge VertexVertex No Intersection No Intersection


(top view) (side view)

Figure VII.B.16: Tolerances for intersection of edges

theoretical situations leading to it on figure VII.B.17.

B
H J
F
A D E

C I

Figure VII.B.17: Merging transitivity.

On figure VII.B.18, we show cases more characteristic of what we can obtain with real meshes, given
that the definition of local tolerances reduces the risk and possible cases of this type of situation.

Figure VII.B.18: Merging transitivity (real cases)

Figure VII.B.19 illustrates the effect of a combination of merges on vertices belonging to a same edge.
We see that in this case, edges initially going through vertices G and J are strongly deformed (i.e. cut
into sub-edges that are not well aligned). Without transitivity, edges going through vertices descended
only from the merging of (G, H) on one hand and (L, J) on the other hand would be much closer to
the initial edges.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 386/402

To avoid excessive simplifications of the mesh arising from a combination of merges, we first build
chains of intersections which should be merged, compute the coordinates of the merged intersection,
and then check for all intersection couples of a given chain if excessive merging would occur. If this
is the case, we compute a local multiplicative factor (< 1) for all the intersections from this chain,
so as to reduce the merge tolerance and break this chain into smaller subchains containing only
intersections withing each others merging distances.
Tolerance reduction may be done in multiple steps, as we try to break the weakest equivalences (those
closest to the merge tolerance bounds) first.

K
K

G H I J G

Before Merging After Merging

Figure VII.B.19: Merging transitivity for an edge

On figure VII.B.20, we show the possible effect of merge transitivity limitation on vertices belonging to
several edges. Here, breaking of excessive intersection mergings should lead to merging of intersections
(G, H, J), while I is not merged with another intersection.

G
H J

K K
I I

Before Merging After Merging

Figure VII.B.20: Limited merging transitivity

Algorithm Optimization
Certain factors influence both memory and CPU requirements. We always try to optimize both, with
a slight priority regarding memory requirements.
When searching for edge intersections, we try to keep the number of intersection tests to a minimum.
We compute coordinate axis-aligned bounding boxes associated with each joinable face (augmented by
the tolerance radii of associated vertices), and run a full edge intersection test only for edges belonging
to faces whose bounding boxes intersect.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 387/402

To determine which face bounding boxes intersect, we build a bounding box-tree , similar to an
octree, but with boxes belonging to all the octree leaves they overlap. When running in parallel
using MPI, a first, coarser version of the tree with the same maximum depth on all ranks is built
so as to estimate the optimal distribution of data, to balance both the computational and memory
load. Bounding boxes are then migrated to the target ranks, where the final box-tree (which may
have different depth on different ranks) is built. Assigning the global ids of the matching faces to
the bounding boxes ensures the search results are usable independently of the distribution across MPI
ranks.

Influence on mesh quality


It is preferable for a FV solver such as Code Saturne that the mesh be as orthogonal as possible
(a face is perfectly orthogonal when the segment joining its center of mass to the center of the other
cell to which it belongs is perfectly aligned with its normal). It is also important to avoid non planar
faces 2 . By the joining algorithms principle, orthogonal faces are split into several non-orthogonal
sub-faces. In addition, the higher the tolerance setting, the more merging of neighboring vertices will
tend to warp faces on the sides of cells with joined faces.
It is thus important to know when building a mesh that a mesh built by joining two perfectly regular
hexahedral meshes may be of poor quality, especially if a high tolerance value was used and the cell-
sizes of each mesh are very different. It is thus important to use the mesh quality criteria visualizations
available in Code Saturne, and to avoid arbitrary joinings in sensible areas of the mesh. When possible,
joining faces of which one set is already a subdivision of another (to construct local refinements for
example) is recommended.

Periodicity
We use an extension of the non-conforming faces joining algorithm to build periodic structures. The
basic principle is described figure VII.B.21:

Let us select a set of boundary faces. These faces (and their edges and vertices) are duplicated,
and the copy is moved according to the periodic step (a combination of translation and rotation).
A link between original and duplicate entities is kept.
We use a conforming joining on the union of selected faces and their duplicates. This joining will
slightly deform the mesh so that vertices very close to each other may be merged, and periodic
faces may be split into conforming sub-faces (if they are not already conforming).

If necessary, the splitting of duplicated, moved, and joined faces is also applied to the faces from
which they were descended.
Duplicated entities which were not joined (i.e. excess entities) are deleted.

It is thus not necessary to use periodic boundary conditions that the periodic surfaces be meshed
in a periodic manner, though it is always best not to make to much use of the comfort provided by
conforming joinings, as it can lower mesh quality (and as a consequence, quality of computational
results).
We note that it could seem simpler to separate periodic faces in two sets of base and periodic faces,
so as to duplicate and transform only the first set. This would allow for some algorithm simplifications
and optimizations, but here we gave a higher priority to the consistency of user input for specification
of face selections, and the definition of two separate sets of faces would have made user input more
2 Computation of face COGs includes a correction such that the contribution of a warped face to a cells volume is

the same as that of the same face split into triangles joining that faces COG and outer edges, but this correction may
not be enough for second order values.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 388/402

duplicated and selected faces


translated faces
1st step
link (origin)
link (origin)

periodic step

2nd step joined faces

duplicated but
unjoined faces link (origin)

3rd step faces split based


on their link
with joined faces
joined faces link (periodicity)

Figure VII.B.21: Periodic joining principle (translation example)

complex. As for the basic conforming joining, it is usually not necessary to specify face selections for
relatively simple meshes (in which case all faces on the mesh boundary are selected).

Triangulation of faces
Face triangulation is done in two stages. The first stage uses an ear cutting algorithm, which can
triangulate any planar polygon, whether convex or not. The triangulation is arbitrary, as it depends
on the vertex chosen to start the loop around the polygon.
The second stage consists of flipping edges so that the final triangulation is constrained Delaunay,
which leads to a more regular triangulation.

Initial triangulation
The algorithm used is based on the one described in [The98]. Its principle is illustrated figure VII.B.22.
We start by checking if the triangle defined by the first vertices of the polygon, (P0 , P1 , P2 ) is an ear,
that is if it is interior to the polygon and does not intersect it. As this is the case on this example, we
obtain a first triangle, ad we must then process the remaining part of the polygon. At the next stage
triangle (P0 , P2 , P3 ) is also an ear, and may be removed.
At stage 2, we see that the next triangle which is a candidate for removal, (P0 , P3 , P4 ) is not an ear,
as it is not contained in the remaining polygon. We thus shift the indexes of vertices to consider, and
see at stage 4 that triangle (P3 , P4 , P5 ) is an ear and may be removed.
The algorithm is built in such a way that a triangle is selected based on the last vertex of the last
triangle considered (starting from triangle (P0 , P1 , P2 )). Thus, we consider at stage 5 the triangle
ending with P5 , that is (P0 , P3 , P5 ). Once this triangle is removed, the remaining polygon is a triangle,
and its handling is trivial.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 389/402

P6 P6 P6

P5 P5 P5

P1 P0 P1 P0 P1 P0

P3 P3 P3

1 P4 2 P4 3 P4
P2 P2 P2

P6 P6 P6

P5 P5 P5

P1 P0 P1 P0 P1 P0

P3 P3 P3

4 P4 5 P4 6 P4
P2 P2 P2

Figure VII.B.22: Principle of face triangulation

Improving the Triangulation


We show on figures VII.B.23 and VII.B.24 two examples of a triangulation on similar polygons whose
vertices are numbered in a different manner.

1st stage 2nd stage Triangulation end

Figure VII.B.23: Triangulation example (1)

1st stage 2nd stage Triangulation end

Figure VII.B.24: Triangulation example (2)

Not only is the obtained triangulation different, but it has a tendency to produce very flat triangles.
Once a first triangulation is obtained, we apply a corrective algorithm, based on edge flips so as to
respect the Delaunay condition [She99].
This condition is illustrated figure VII.B.25. In the first case, edge Pi Pj does not fulfill the condition,
as vertex Pl is contained in the circle going through Pi , Pj , Pk . In the second case, edge Pk Pl fulfills
this condition, as Pi is not contained in the circle going through Pj , Pk , Pl .
If triangles (Pi , Pk , Pj ) and (Pi , Pj , Pl ) originated from the initial triangulation of a same polygon, they
would thus be replaced by triangles (Pi , Pk , Pl ) and (Pl , Pk , Pj ), which fulfill the Delaunay condition.
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 390/402

Pl Pl

Pi Pj Pi Pj

Pk Pk
Non Delaunay edge Delaunay edge

Figure VII.B.25: Delaunay condition (2)

In the case of a quadrangle, we would be done, but with a more complex initial polygon, these new
triangles could be replaced by others, depending on their neighbors from the same polygon.

First permutation Second permutation

Figure VII.B.26: Edge flip example (1)

Figure VII.B.27: Edge flip example (2)

On figures VII.B.26 and VII.B.27, we illustrate this algorithm on the same examples as before (figures
VII.B.23 and VII.B.24). We see that the final result is the same. In theory, the edge flipping algorithm
always converges. To avoid issues due to truncation errors, we allow a tolerance before deciding to flip
two edges. Thus, we allow that the final triangulation only almost fulfill the Delaunay condition.
In some cases, especially that of perfect rectangles, two different triangulations may both fulfill the
Delaunay condition, notwithstanding truncation errors. For periodicity, we must avoid having two
periodic faces triangulated in a non-periodic manner (for example, along different diagonals of a quad-
rangle). In this specific case, we triangulate only one face using the geometric algorithm, and then
apply the same triangulation to its periodic face, rather then triangulate both faces independently.

Unwarping algorithm
The unwarping algorithm is a smoother, its principle is to mitigate the local defects by averaging the
mesh quality. It moves vertices using an iterative process which is expected to converge to a mesh
with better averaged warping criteria.

Warping criterion in Code Saturne


The warp face quality criterion in Code Saturne represents the non coplanarity in space of N points
Pi=1:N (N > 3).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 391/402

Let f be the face defined by Pi=1:N bv(f ) , the center of gravity Of and
n
f the face normal, the warping

criterion is calculated for each face by the maximum angle between Pi Pi+1 and n
f

i [1, N bv(f )]
where PN bv(f )+1 = P1 . For consistency purposes, the warping criterion warpf is defined in degree for
each face of the mesh M as:
 
 180
cos(Pi Pi+1 ,

f M, warpf = 90 arccos max nf )
i[1,N bv(f )]

Unwarping method
The principle of unwarping algorithm is to move vertices in the midplane of the faces using an iterating
process. At each iteration the algorithm tries to approach vertices from the midplane of the face without
increasing the warping of the neighbours faces.
The displacement is calculated by projecting vertices onto the plane defined by n and the center of
f
gravity O.
For the face f , i [1, N bv(f )], the vertices Pi are displaced by the vector fPi

i [1, N bv(f )], fPi = (Pi Of .
nf )n
f

In most cases, a vertex is shared by many faces fj=1:N bf (Pi ) , and its final displacement is:

f
X
f M, i [1, N bv(f )], fPi = Pji
j=1:N bf (Pi )

This displacement technique may cause problems because the contributions fPl and fPk can be con-
tradictory. Moreover, if a small and a large face are neighbours, the large face contribution imposes
a too big displacement to the shared vertices and the warping criterion can be deteriorated.

Displacements control
The weighting coefficients shown below allow us to reduce the conflicting contributions and equilibrate
the contributions between small and large faces.

Face weighting Every iteration, for each face the warping criterion is computed. It is used to give
more weight to the warp faces. After the renormalisation of the warping criterion, a new displacement
formula is obtained:

X warpfj f
f M, i [1, N bv(f )], fPi = j
maxf M warpf Pi
j=1:N bf (Pi )

Vertex weighting Every iteration, for each vertex P M, the vertex tolerance is computed:
minP nb(P ) P P 0
P M, vtxtolP =
maxQM minQ0nb(Q) QQ0
where nb(Q) are the first neighbors of the point Q.
This criterion is used to reduce the vertex displacement when a vertex lies on an edge much smaller
than the average length. Another vertex tolerance may have been chosen. For example a more local
coefficient can be defined as:
minP 0nb(P ) P P 0
P M, vtxtolPlocal =
maxP 0nb(P ) P P 0
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 392/402

This local coefficient has been noticed to be less efficient than the first one. That is why the first
definition is used in Code Saturne.
The unwarping displacement is updated as below:

X warpfj f
f M, i [1, N bv(f )], fPi = vtxtolPi j
maxf M warpf Pi
j=1:N bf (Pi )

Movement coefficient To ensure a better convergence, all vertices movements are multiplied by a
scale factor Cm (where Cm 6 1). This coefficient helps to converge to the best solution by preventing
a too big movement in the wrong direction. In Code Saturne the default value is set to 0.10.
The unwarping displacement is then:

X warpfj f
f M, i [1, N bv(f )], fPi = Cm vtxtolPi j
maxf M warpf Pi
j=1:N bf (Pi )

Maximum displacement To reduce the cell reversal risk, the maximum displacement is limited
for each vertex P M to M d = 0.10 minP nb(P ) P P 0.
Finally, the complete unwarping displacement formula is defined as:

f M, i [1, N bv(f )],


X warpfj f
fPi = min(Cm vtxtolPi j , M d)
maxf M warpf Pi
j=1:N bf (Pi )

Stop criterion
The algorithm automatically stops according to the warp face criterion.

1st case: the algorithm converges The algorithm stops when, at the ith iteration, the relation
below is verified.

maxf M warpif
1 < 1.E 4
maxf M warpi1
f

2nd case: the algorithm diverges The algorithm stops when at the ith iteration the relation below
is verified.

maxf M warpif
> 1.05
maxf M warpfi1

It means that the current iteration degrades the previous one. The obtained mesh is the result of the
(i 1)th iteration.

3rd case: the maximum number of iterations is reached The algorithm stops after Nmax
iterations (51 by default in Code Saturne).
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 393/402

Specific treatment for boundary faces


The unwarping algorithm may modify the mesh geometry. The function fit by feature allows to
fix boundary faces according to a feature angle. The feature angle between a vertex and one of its
adjacent faces is defined by the angle between the vertex normal and the face normal.
A vertex normal is defined by the average of the normals of the faces sharing this vertex.
This function fixes a vertex if one of its feature angles is less than cos() where is the maximum
feature angle (in degrees) defined by the user. In fact, if = 0 all boundary vertices will be fixed,
and if = 90 all boundary vertices will be free.
Fixing all boundary vertices ensures the geometry is preserved, but reduces the smoothing algorithms
effectiveness.
Appendix C

Mesh Quality
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 395/402

Flagging of bad cells


No current meshing tool that we know of is capable of generating a complex mesh in reasonable
time without some cells of bad quality. To reduce the number of iterations required to obtain an
acceptable mesh, we may try to flag the few bad quality cells that are considered almost unavoidable,
so as to limit their impact on the solvers robustness.
As of the current version of Code Saturne, no specific treatment is done, but bad cells are marked,
so as as to allow the user to know where to expect issues with the mesh.
By default, the mesh quality is inspected at the very beginning of every calculation. The estimated
quality is defined by at least five criteria:

the cells non-orthogonality,


the cells offset,
the cells distorsion (or least-squares gradient criteria),

the cells volume ratio,


guilt by association,
and possibly supplementary user criteria.

Supplementary user criteria will not be discussed here but an example of how to define them is pro-
vided in the user subroutine cs user mesh.c.

As a rule of thumb users need to be aware that bad cells could lead to a degradation of the solution
quality, or worse, to a failed calculation. Generally, a cell quality is degraded by non-conforming joining
operations, especially when joined cells have different sizes or thicknesses, but even painstakingly built
block-structured meshes may have cells of bad quality when they involve a combination of warping,
anisotropy and refinement variation.

Cell non-orthogonality
For a finite volume solver, the mesh cells should be as orthogonal as possible. Consequently, the
compliance with this criterion is of particular interest in order to avoid the degradation of the solution
quality.
A cells non-orthogonality relative to a face is evaluated as:

~S
d. ~
Qortho =
~ ||S||
||d|| ~

where d~ is a distance vector between two consecutive cell centers and S


~ is the surface vector normal
to the face.
Orthogonal cells have a value of Qortho which tends towards 1.0. Therefore, a cell is flagged bad if
Qortho < 0.1 for any of its faces.

Cell offset
A cells offset (relative to a face) is evaluated in a manner consistent with iterative gradient recontruc-
tion: !1/3
~ .S|
|OF ~
Qof f set = 1
V
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 396/402

where S is the cells volume, S~ is the surface normal to the face, and OF
~ is the difference between the
faces center and its intersection with the segment joining adjacent cell centers.
Orthogonal cells have a value of Qof f set which tends towards 1.0. Therefore, a cell is flagged bad if
Qof f set < 0.1 for any of its faces.

Cell distorsion
This criterion evaluates a distorsion level based on least squares gradient computation. As a first step,
the geometric matrix containing information on distance vectors between neighboring cells is built
(see the construction of the C matrix in the least squares gradient computation for more details).
In a second step, the matrixs eigenvalues are estimated using a Jacobi transformation method. The
min/max eigenvalues ratio is used as the cells distorsion criteria:

min(|Cegv |)
QLSQ =
max(|Cegv |)

where Cegv are the eigenvalues of the geometric matrix build according to the least squares gradient
computation.
Cubic cells have a value of QLSQ which tends towards 1.0. Therefore, a cell is flagged bad if QLSQ < 0.1.

Cell volume ratio


A cells volume ratio criteria gives an estimation of cells caracteristic size continuity. It is evaluated
as:  
V1 V2
Qvol = min ,
V2 V1
where V1 and V2 are the respective volumes of two neighboring cells.
Neighboring cells with the same size have a value of Qvol which tends towards 1.0. Therefore, two
neighboring cells are flagged bad if Qvol < 0.12 .

Guilt by association
Once we have finished with determining which cells are flagged bad, the last step is to mark initially
good cells (according to the above criteria) as bad when all their neighbors are flagged bad.
Part VIII

Appendices
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 398/402

C.1 Tensorial and index notations


In a fixed reference frame (e1 , e2 , e3 ), taking the Einstein convention on indices into account:

0th order tensor: scalar T

1st order tensor: vector u = ui ei


2nd order tensor: matrix = ij ei ej

3rd order tensor: a = aijk ei ej ek

.
3rd order ..

nth order tensor: a(n) = ai1 i2 in ei1 ei2 ein

Operators Symbols Formulae

tensorial product u u = ui uj ei ej

a(n) b(m) = ai1 in bj1 jm ei1 ein ej1 ejm

dot product . u . u = ui ui

a(n) . b(m) = ai1 in1 k bkj2 jm ei1 ein1 ej2 ejm

double dot : : = ij ij

product a(n) : b(m) = ai1 in2 kl bklj3 jm ei1 ein2 ej3 ejm

u1 v1 u2 v3 u3 v2


vectorial product or u v = u2 v2

= u3 v1 u1 v3




u3 v3 u1 v2 u2 v1

Table C.1: Tensorial operators.

C.2 Diffenrential operators and standard relationships

div (rot u) = 0 rot ( T ) = 0

div (u) = div u + .u rot (u) = rot u + u

div (u v) = v.rot u u.rot v rot (rot u) = (div u) u


 
(u.v) = grad u .v + grad v .u + u rot v + v rot u
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 399/402

Operators Symbols Definitions Cartesian formulae


  T
gradient (n+1) a(n) . dx = da(n) dx T = e
xi i
u ui
or u = ej = e ej
xj xj i
  a(n)
(n+1) a(n) = ein+1
xin+1
    ui
divergence . (n1) . a(n) = (n+1) a(n) : 1 div u =
xi
ij
or div = e
xj i
  ai1 in
div div (n1) a(n) = e ein1
xin i1
   2T
Laplacian a(n) = div (n) (n+1) a(n) T =
xi xi
2u 2 ui
or u = = e
xj xj xj xj i
2 a(n)
2 (n) a(n) =
xin+1 xin+1
2 ai1 in
= e i1 e in
xin+1 xin+1
u3 u2
x1 u1 x2 x3


rotational or rot u = u = u1
u3
x2 2 x3 x1


u2 u1
rot x3 u3 x1 x2

Table C.2: Differential operators.

Stokes Theorem Z Z
rot u . dS = u . dl
S S
where dS is the outward surface element.

Divergence theorem [Green-Ostrogradski]


Z h i Z
div (n1) a(n) d = a(n) . dS

Rotational theorem Z Z
rot u d = u dS

Leibnitz theorem
a(n)
Z Z Z
d
a(n) d = d + a(n) v . dS
dt t
where v is control volume velocity.
Part IX

References
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 401/402

[AS03] B. Aupoix and P.R. Spalart. Extensions of the spalart-allmaras turbulence model to account
for wall roughness. International Journal of Heat and Fluid Flow, 24(4):454 462, 2003.
[BD78] R. Borghi and D. Dutoya. On the scale of the fluctuation in turbulent combustion. 17th
Int.Symp. on Combustion, 1978.
[BL12] F. Billard and D. Laurence. A robust k v 2 /k elliptic blending turbulence model applied
to near-wall, separated and buoyant flows. International Journal of Heat and Fluid Flow,
33(1):45 58, 2012.
[BM00] M. Boucker and J.D. MattA i.
c Proposition de modification des conditions aux limites de

paroi turbulente pour le solveur commun dans le cadre du modAle k standard. EDF
Report HI-81/00/019/A(in French)., 2000.
[Cho68] Alexandre Joel Chorin. Numerical solution of the navier-stokes equations. Mathematics of
computation, 22(104):745762, 1968.
[Cur63] R.L. Curl. Dispersed phase mixing: theory and effects in simple reactors. AIChE J., 9:175
181, 1963.
[Dur91] PA Durbin. Near-wall turbulence closure modeling without damping functions. Theoretical
and Computational Fluid Dynamics, 3(1):113, 1991.
[Esc11] A. Escaich. Une description amelioree de la combustion turbulente dans les flammes de
charbon pulverise. PhD thesis, Universite de Rouen, 2011.
[Iac01] G. Iaccarino. Predictions of a turbulent separated flow using commercial cfd codes. Journal
of Fluids Engineering, 123:819, 2001.
[JH02] S. Jakirlic and K. Hanjalic. A new approach to modelling near-wall turbulence energy and
stress dissipation. Journal of fluid mechanics, 459(1):139166, 2002.
[JL72] WP Jones and B.E. Launder. The prediction of laminarization with a two-equation model
of turbulence. International Journal of Heat and Mass Transfer, 15(2):301314, 1972.
[K76] H. Kobayashi and ??? 16th Int.Symp. on Combustion, pages 425441, 1976.
[LRR75] BE Launder, G Jr Reece, and W Rodi. Progress in the development of a reynolds-stress
turbulence closure. Journal of fluid mechanics, 68(03):537566, 1975.
[LS74] B.E. Launder and D.B. Spalding. The numerical computation of turbulent flows. Computer
Methods in Applied Mechanics and Engineering, 3(2):269 289, 1974.
[LW00] P.A. Libby and F.A. Williams. A presumed pdf analysis of lean partially premixed turbulent
combustion. Combust. Sci. Technol., 161:351390, 2000.
[MH02] Remi Manceau and Kemal Hanjalic. Elliptic blending model: A new near-wall reynolds-
stress turbulence closure. Physics of Fluids, 14:744, 2002.
[Ner09] P. Nerisson. Modelisation du Transfert des Aerosols dans un Local Ventile. PhD thesis,
IRSN/INPT, 2009.
[PLD96] S. Parneix, D. Laurence, and P. Durbin. Second moment closure analysis of the backstep
flow database. In Proc. 1996 Summer Program, Center for Turbulence Research, NASA
Ames/Stanford Univ, pages 4762, 1996.
[R05] V. Robin and ??? Relevance of approximated pdf shapes for turbulent combustion modeling
with variable equivalence ratio. ICDERS, 2005.
[RCP04] G. Ribert, M. Champion, and P. Plion. Modeling turbulent reactive flows with variable
equivalence ratio: application to the calculation of a reactive shear layer. Combust. Sci.
Technol., 176:907923, 2004.
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 402/402

[S71] D.B. Spalding and ??? Mixing and chemical reaction in steady confined turbulent turbulent
flames. 13th Int.Symp. on Combustion, pages 649657, 1971.
[SA92] P. R. Spalart and S. R. Allmaras. Slicing an ear using prune and search. AIAA, 1992.

[Sap11] B. Sapa. Contribution `a lextension dun schema incompressible pour la flammes ` a bas
nombre de Froude - Pre-requis `
a la modelisation de lincendie. PhD thesis, Universite de
Poitiers, 2011.
[She99] J. R. Shewchuk. Lecture notes on delaunay mesh generation. http://www.cs.berkeley.
edu/~jrs/meshf99/, 1999.
[SSG91] Charles G Speziale, Sutanu Sarkar, and Thomas B Gatski. Modelling the pressurestrain
correlation of turbulence: an invariant dynamical systems approach. Journal of Fluid Me-
chanics, 227(1):245272, 1991.
[The98] T. Theul. A review of two simple polygon triangulation algorithms. http://www.cg.
tuwien.ac.at/~theussl/, 1998.
[ZSSA04] L. Zaichik, S. Soloviev, A. Skibin, and V Alipchenko. A diffusion-inertia model for predicting
dispersion of low-inertia particles in turbulent flows. In 5th International Conference on
Multiphase Flow - ICMF, volume 220, pages 117152, 2004.

You might also like