CS Theory
CS Theory
6, quai Watier
F-78401 Chatou Cedex
Tel: 33 1 30 87 75 40
Fax: 33 1 30 87 79 16 APRIL 2015
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 Introduction 9
1.1 Aims of the document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
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
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
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
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
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 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
Governing equations
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 13/402
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.
+ 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.
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.
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
+ 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
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]).
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.
S 2 = 2S D : S D . (I.2.24)
q 00 = T, (I.2.25)
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
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)
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
(a)
+ div (a u)) div (Ka) = STa + ain , (I.2.38)
t | {z } | {z }
advection diffusion
(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.
In this equation:
A physical interpretation of the different terms involved in the transport equation of the aerosols
follows:
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
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:
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
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:
If = 1/2, or if an extrapolation is used, the time step t is constant in time and uniform in space.
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.
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
explicit:
n
[Se (, )] = Se n+ , n ,
(I.3.7)
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.
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
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.
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)
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 = ,
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.
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,
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
= 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)
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
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)
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.
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:
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.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
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
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 .
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
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
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
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.
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
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
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.
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
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
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 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|
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.
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 .
(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
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 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.
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.
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.
Y K
= W.m1 .K 1
h enthalpy m2 .s2 /Cp thermal conductivity over specific heat kg.m1 .s1
= J.kg 1
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.
imp
Remark 5.2 Dib must be specified by the user. The boundary type code is 3 (see Table 5.3).
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.
Remark 5.4 Both C and Yfnb must be specified by the user, the boundary code is 2 (see Table 5.3).
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
Y Dimp
T temperature K (( + Cp t /t )T ) n kg.s3
W.m2
J.kg 1 W.m2
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
T u+
1+ = 1, (I.5.14)
y +
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 49/402
Lm = y, (I.5.15)
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
!
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
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
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
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
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
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
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?
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+
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 +
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
= 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 .
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
Velocity u 1 2 3 4 5 6 9
Pressure P 1 2 3
Y (except variances) Y 1 2 3 5 6
Variance of a variable Y 1 2 3
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
Advanced modelling
Chapter 7
Turbulence modelling
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 62/402
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
C C 1 C 2 k
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 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
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).
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
C CT CL C C1 C2
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 ) .
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.
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
hs
rough = + cR1
drug
drough = d + d0 (II.7.25)
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
Inlet: the profile of is imposed, the value is deduced from the profiles imposed on k and for a
k turbulence model assuming ' T .
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 .
1
k = 2 trR,
(II.7.32)
1
P = 2 tr P ,
= + + + , (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
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
2 q
t = Cs 2S : S, (II.7.37)
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.
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,
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)
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
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:
Every permeatic version involves the transport of enthalpy (one more variable).
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).
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).
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
computed to reach the mean specific enthalpy. By this way every heat loss removed from the mean
enthalpy is charged to the hottest gases.
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).
0 1 f
Lean variance Strong variance
Fuel Diracs
Oxydizer Diracs peak
peak
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
hox
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
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
stoechiometry being able to burn -then destroy Yf- faster than the particles in poor regime).
Fuel
Yf
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.
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
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
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
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):
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 :
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.
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
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
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
O2
CO CHx2
CHx1
SO2
H2S
0 fs4 fs1
fs3 fs2 1 F1+F2
O2
CO2 CO CHx2
CHx1
SO2
H2S
0 fs4 fs1
fs3 fs2 1 F1+F2
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 )]
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.
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.
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.
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
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
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
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
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
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.
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):
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).
pyrol . (II.9.58)
dry . (II.9.60)
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)
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:
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
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.
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.
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.
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.
(h)
= div (K(h)H) + Qs (II.10.6)
t
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
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:
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:
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).
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.
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;
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:
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.
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.
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 .
Physically, The coefficients l and t are representative of the size of the biggest heterogeneities on
the solute path. Their determination is empirical.
where:
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| .
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:
Magneto-Hydro Dynamics
See A.
Chapter 12
See A.
Chapter 13
Cavitation modelling
Code Saturne
documentation
EDF R&D Code Saturne 4.0.0 Theory Guide
Page 117/402
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
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
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
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
:
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)
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:
a centered scheme:
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)
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
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
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)
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 .
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 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.
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:
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 .
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
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.
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).
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.
|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
The quantity TESQCK corresponding to T P 3d , is computed dynamically, depending on the sign of the
mass flux snij .
consequently :
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
otherwise :
the centered or the SOLU scheme values values are used as before :
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
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).
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).
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).
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.
+
where DH is the hydraulic diameter made dimensionless using uk , , udeb the mean streamwise
velocity and the relative roughness.
DH
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)
(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 :
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
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 :
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 :
A pair of coefficients Agrad and Bgrad can be deduced from the above equation (for each velocity
component separately).
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
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 :
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 :
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
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.
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)
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
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+
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
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).
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 .
= 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.
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
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
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)
(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
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.
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 :
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 ) :
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 :
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.
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 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
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
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
UF = A . UI 0 (IV.D.5)
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 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.
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)
Or
SF = A . S avec Aij = Pq(i)q(j) Pr(i)r(j) (IV.D.14)
F
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)
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
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 :
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
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).
Annexe A
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)
Thus t A . A = Id. Similarly, it can be shown that A . t A = Id. Thus A is an orthogonal matrix.
Annexe B
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
i 1 2 3 4 5 6 7 8 9
s(i) 1 4 5 4 2 6 5 6 3
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
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
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
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
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 :
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 :
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 :
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
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 )
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
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,
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.
pour k = 2,
de facon analogue, on obtient :
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 :
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
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
Fin de la boucle.
Points a` traiter
Test de convergence
La quantite definissant le test de convergence est egalement `a revoir, eventuellement `a simplifier.
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
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
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.
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.
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
(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
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)
Remarques
- pour la temperature m = et C = Cp
- pour lenthalpie m = et C = 1
Cp
- 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
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
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.
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).
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
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.
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.
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
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)
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
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
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.
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
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
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 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
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
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
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) .
i=1
1
(u)
S
12
12
i=2
2
(u)
S 23
23
i=3
3
(u)b
Sb
2
2
x
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
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
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
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
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).
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
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
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.
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)
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
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)
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
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
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
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.
(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)
Conclusion
On peut recapituler toutes ces situations via la formule :
PF b ik = PI 0 + EXTRAP (I 0 F b ik . (P )I )
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, 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.
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 .
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 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.
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.
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 :
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 :
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 :
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 :
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.
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
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
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.
` noter que les tableaux VISCF et VISCB contiennent respectivement t ij S ij et t bik S bik .
A
I 0J 0 I 0F
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.
`
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 :
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).
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 .
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.
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 :
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 :
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.
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.
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 .
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
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
Figure IV.M.1: Schema of the geometric entities defined for internal and boundary faces.
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.
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
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).
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:
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)
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
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
Applying the divergence of the first equation of the system (IV.M.7), we obtain:
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)
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.
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
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)
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:
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 )
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.
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
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:
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+ = 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
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
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.
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
- 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 , ...).
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.
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
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:
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.
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).
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
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).
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
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
Points to treat
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.
(K e u)n+S + K nd un+
(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)
1 n
un+1 = un T p (IV.O.2)
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)
Let D be the divergence operator. The continuity equation (IV.O.4) is rewritten in compact form as:
DW =
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
With the fractional step method, ??? is decomposed into a sequence of two steps:
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)
B (W n+1 W
f ) = G (P n+1 P n ) (IV.O.9)
with:
W n+1 = Rn V n+1
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 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
[ T nb (p) f b ik ] . S b ik
ik
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
def
h i
. S ij = T n (a) ij . S ij
(G
e a) cell
ij
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
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:
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.
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.
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).
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 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.
? 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)
pn+1 = pn + (p)kconv
where,
k=k
Xconv
(p)kconv = ((p))k
k=1
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 ) + +
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
(le terme en nest pris en compte que dans le cas de linjection forcee)
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 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.
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
Mise en uvre
Si IGRAKE = 0, on a simplement
TINSTK = TINSTE = P
(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).
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
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
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
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
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.
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
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.
? 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.
(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 ).
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 :
ROVSDT(IEL) = ROVSDT(IEL) + |l | 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.
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 .
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
D n Rijn (Rijn . n lm )n lm
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.
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
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
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 .
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.
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).
S ij Sb
Dans ce sous-programme, on calcule les termes de diffusion ij et bik . 0 ik .
I 0J 0 IF
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
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.
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).
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).
( 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 :
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.
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)
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
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
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 :
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.
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
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
M
P
P P
L
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.
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.
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.
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.
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
`
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
s = T (V.A.4)
avec (T, . . .)
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
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).
(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
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
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)
mel P
Enthalpie : h = Cp mel T =
mel 1
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)
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 :
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 :
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))
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
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
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
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 :
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
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
(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
(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
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
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) :
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).
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
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.
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 :
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 :
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 :
`
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)
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,
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
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
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.
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...)
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
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)
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\
#
@ W 1
W 2 W paroi = W 1 = W 2 up = u1 = u2
P p = P1 = P2
Wi @
W
@
@
-x
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
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
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
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
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) :
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
P1 = P2
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 344/402
P1 = P2
b = ext
Cas choc (M > 0) :
r !
( + 1) ( + 1)2
P b = Pi 1+ M 2 + M 1+ M 2
4 16
b = ext
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 )
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
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 :
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 .
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 .
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)
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 :
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
hint
Et on a donc, avec h0r = hb
:
Cv
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 :
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 :
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
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.
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.
` 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
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.
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
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 :
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
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
Avec lhypoth`ese que le milieu est electriquement neutre (`a un niveau macroscopique) :
X
ni qi = 0 (VI.A.6)
i
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
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 :
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
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
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
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)
div B = 0 (VI.A.37)
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 :
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
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 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
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
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 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
Table A.1: Sous-programme initi1 : initialisation des mots-cles et positionnement des variables
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
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
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)
eliniv
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.
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).
Points a` traiter
Mobilit
e ionique
Le module est `
a developper.
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
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.
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).
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
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
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
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.
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
being subdivided (i.e. the absolute value of the dot product of the two unitary normals should be close
to 1).
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.
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)
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
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
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.
B
H J
F
A D E
C I
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.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
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
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.
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
periodic step
duplicated but
unjoined faces link (origin)
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
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
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.
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.
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:
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
Mesh Quality
Code Saturne
EDF R&D Code Saturne 4.0.0 Theory Guide documentation
Page 395/402
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|| ~
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.
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
.
3rd order ..
tensorial product u u = ui uj ei ej
dot product . u . u = ui ui
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
Stokes Theorem Z Z
rot u . dS = u . dl
S S
where dS is the outward surface element.
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.