1
!-------------------------------------------------------------------------------
3
! This file is part of the Code_Saturne Kernel, element of the
4
! Code_Saturne CFD tool.
6
! Copyright (C) 1998-2009 EDF S.A., France
8
! contact: saturne-support@edf.fr
10
! The Code_Saturne Kernel is free software; you can redistribute it
11
! and/or modify it under the terms of the GNU General Public License
12
! as published by the Free Software Foundation; either version 2 of
13
! the License, or (at your option) any later version.
15
! The Code_Saturne Kernel is distributed in the hope that it will be
16
! useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17
! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
! GNU General Public License for more details.
20
! You should have received a copy of the GNU General Public License
21
! along with the Code_Saturne Kernel; if not, write to the
22
! Free Software Foundation, Inc.,
23
! 51 Franklin St, Fifth Floor,
24
! Boston, MA 02110-1301 USA
26
!-------------------------------------------------------------------------------
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , &
35
nideve , nrdeve , nituse , nrtuse , &
36
iphas , ivar , isou , ipp , &
37
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
38
ipnfac , nodfac , ipnfbr , nodfbr , &
39
idevel , ituser , ia , &
40
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
41
rtp , rtpa , propce , propfa , propfb , &
42
coefa , coefb , produc , smbr , &
44
produk , w2 , w3 , w4 , epsk , w6 , &
45
rdevel , rtuser , ra )
47
!===============================================================================
51
! TERMES D'ECHO DE PAROI
53
! VAR = R11 R22 R33 R12 R13 R23
56
!-------------------------------------------------------------------------------
58
!__________________.____._____.________________________________________________.
59
! name !type!mode ! role !
60
!__________________!____!_____!________________________________________________!
61
! idbia0 ! i ! <-- ! number of first free position in ia !
62
! idbra0 ! i ! <-- ! number of first free position in ra !
63
! ndim ! i ! <-- ! spatial dimension !
64
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
65
! ncel ! i ! <-- ! number of cells !
66
! nfac ! i ! <-- ! number of interior faces !
67
! nfabor ! i ! <-- ! number of boundary faces !
68
! nfml ! i ! <-- ! number of families (group classes) !
69
! nprfml ! i ! <-- ! number of properties per family (group class) !
70
! nnod ! i ! <-- ! number of vertices !
71
! lndfac ! i ! <-- ! size of nodfac indexed array !
72
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
73
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
74
! nvar ! i ! <-- ! total number of variables !
75
! nscal ! i ! <-- ! total number of scalars !
76
! nphas ! i ! <-- ! number of phases !
77
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
78
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
79
! iphas ! i ! <-- ! phase number !
80
! ivar ! i ! <-- ! variable number !
81
! isou ! e ! <-- ! numero de passage !
82
! ipp ! e ! <-- ! numero de variable pour sorties post !
83
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
84
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
85
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
86
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
87
! iprfml ! ia ! <-- ! property numbers per family !
88
! (nfml, nprfml) ! ! ! !
89
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
90
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
91
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
92
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
93
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
94
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
95
! ia(*) ! ia ! --- ! main integer work array !
96
! xyzcen ! ra ! <-- ! cell centers !
97
! (ndim, ncelet) ! ! ! !
98
! surfac ! ra ! <-- ! interior faces surface vectors !
99
! (ndim, nfac) ! ! ! !
100
! surfbo ! ra ! <-- ! boundary faces surface vectors !
101
! (ndim, nfabor) ! ! ! !
102
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
103
! (ndim, nfac) ! ! ! !
104
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
105
! (ndim, nfabor) ! ! ! !
106
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
107
! (ndim, nnod) ! ! ! !
108
! volume(ncelet) ! ra ! <-- ! cell volumes !
109
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
110
! (ncelet, *) ! ! ! (at current and previous time steps) !
111
! propce(ncelet, *)! ra ! <-- ! physical properties at cell centers !
112
! propfa(nfac, *) ! ra ! <-- ! physical properties at interior face centers !
113
! propfb(nfabor, *)! ra ! <-- ! physical properties at boundary face centers !
114
! coefa, coefb ! ra ! <-- ! boundary conditions !
115
! (nfabor, *) ! ! ! !
116
! produc ! tr ! <-- ! production !
118
! smbr(ncelet ! tr ! <-- ! tableau de travail pour sec mem !
119
! coefax,coefbx ! tr ! --- ! tableau de travail pour les cond. !
120
! (nfabor) ! ! ! aux limites de la dist. paroi !
121
! produk(ncelet ! tr ! --- ! tableau de travail production !
122
! epsk (ncelet ! tr ! --- ! tableau de travail epsilon/k !
123
! w2...6(ncelet ! tr ! --- ! tableau de travail production !
124
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
125
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
126
! ra(*) ! ra ! --- ! main real work array !
127
!__________________!____!_____!________________________________________________!
129
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
130
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
131
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
132
! --- tableau de travail
133
!-------------------------------------------------------------------------------
134
!===============================================================================
138
!===============================================================================
140
!===============================================================================
152
!===============================================================================
156
integer idbia0 , idbra0
157
integer ndim , ncelet , ncel , nfac , nfabor
158
integer nfml , nprfml
159
integer nnod , lndfac , lndfbr , ncelbr
160
integer nvar , nscal , nphas
161
integer nideve , nrdeve , nituse , nrtuse
162
integer iphas , ivar , isou , ipp
164
integer ifacel(2,nfac) , ifabor(nfabor)
165
integer ifmfbr(nfabor) , ifmcel(ncelet)
166
integer iprfml(nfml,nprfml)
167
integer ipnfac(nfac+1), nodfac(lndfac)
168
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
169
integer idevel(nideve), ituser(nituse), ia(*)
171
double precision xyzcen(ndim,ncelet)
172
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
173
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
174
double precision xyznod(ndim,nnod), volume(ncelet)
175
double precision rtp(ncelet,*), rtpa(ncelet,*)
176
double precision propce(ncelet,*)
177
double precision propfa(nfac,*), propfb(nfabor,*)
178
double precision coefa(nfabor,*), coefb(nfabor,*)
179
double precision produc(6,ncelet)
180
double precision smbr(ncelet)
181
double precision coefax(nfabor), coefbx(nfabor)
182
double precision produk(ncelet),w2(ncelet),w3(ncelet)
183
double precision w4(ncelet),epsk(ncelet),w6(ncelet)
184
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
188
integer idebia, idebra
189
integer ifacpt, iel , ii , jj , kk , mm
190
integer irkm , irki , irkj , iskm , iski , iskj
191
integer ir11ip, ir22ip, ir33ip, ir12ip, ir13ip, ir23ip
192
integer ieiph , ipcrom, ipcroo
193
integer ifac , idimte, itenso
194
integer inc , iccocg, iphydp, ivar0 , iityph
196
double precision cmu075, distxn, d2s3 , trrij , xk
197
double precision unssur, vnk , vnm , vni , vnj
198
double precision deltki, deltkj, deltkm, deltij
199
double precision aa , bb , surfbn, xnorme
202
!===============================================================================
204
!===============================================================================
206
!===============================================================================
219
ipcrom = ipproc(irom (iphas))
221
if(isto2t(iphas).gt.0.and.iroext(iphas).gt.0) then
222
ipcroo = ipproc(iroma(iphas))
233
!===============================================================================
234
! 2. CALCUL AUX CELLULES DES NORMALES EN PAROI CORRESPONDANTES
235
!===============================================================================
237
! On stocke les composantes dans les tableaux de travail W2, W3 et W4
239
if(abs(icdpar).eq.2) then
241
! On connait la face de paroi correspondante
244
ifacpt = ia(iifapa(iphas)-1+iel)
245
surfbn = ra(isrfbn-1+ifacpt)
247
w2(iel)= surfbo(1,ifacpt)*unssur
248
w3(iel)= surfbo(2,ifacpt)*unssur
249
w4(iel)= surfbo(3,ifacpt)*unssur
252
elseif(abs(icdpar).eq.1) then
254
! La normale est definie comme - gradient de la distance
257
! La distance a la paroi vaut 0 en paroi
258
! par definition et obeit a un flux nul ailleurs
260
iityph = iitypf+(iphas-1)*nfabor
262
if(ia(iityph+ifac-1).eq.iparoi .or. &
263
ia(iityph+ifac-1).eq.iparug) then
274
if(irangp.ge.0) call parcom (ra(idipar))
281
( idimte , itenso , &
282
ra(idipar), ra(idipar), ra(idipar), &
283
ra(idipar), ra(idipar), ra(idipar), &
284
ra(idipar), ra(idipar), ra(idipar))
294
( idebia , idebra , &
295
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
296
nnod , lndfac , lndfbr , ncelbr , nphas , &
297
nideve , nrdeve , nituse , nrtuse , &
298
ivar0 , imrgra , inc , iccocg , nswrgy , imligy , iphydp , &
300
epsrgy , climgy , extray , &
301
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
302
ipnfac , nodfac , ipnfbr , nodfbr , &
303
idevel , ituser , ia , &
304
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
306
ra(idipar) , coefax , coefbx , &
308
! ------ ------ ------
309
produk , epsk , w6 , &
310
rdevel , rtuser , ra )
313
! Normalisation (attention, le gradient peut etre nul, parfois)
316
xnorme = max(sqrt(w2(iel)**2+w3(iel)**2+w4(iel)**2),epzero)
317
w2(iel) = -w2(iel)/xnorme
318
w3(iel) = -w3(iel)/xnorme
319
w4(iel) = -w4(iel)/xnorme
324
!===============================================================================
325
! 2. CALCUL DE VARIABLES DE TRAVAIL
326
!===============================================================================
330
! ---> Production et k
333
produk(iel) = 0.5d0 * (produc(1,iel) + produc(2,iel) + &
335
xk = 0.5d0 * (rtpa(iel,ir11ip) + rtpa(iel,ir22ip) + &
337
epsk(iel) = rtpa(iel,ieiph)/xk
342
! ---> Indices des tensions
344
if ((isou.eq.1).or.(isou.eq.4).or.(isou.eq.5)) then
346
elseif ((isou.eq.2).or.(isou.eq.6)) then
348
elseif (isou.eq.3) then
352
if ((isou.eq.3).or.(isou.eq.5).or.(isou.eq.6)) then
354
elseif ((isou.eq.2).or.(isou.eq.4)) then
356
elseif (isou.eq.1) then
360
! ---> Boucle pour construction des termes sources
382
if ((kk*mm).eq.1) then
385
elseif ((kk*mm).eq.4) then
388
elseif ((kk*mm).eq.9) then
391
elseif ((kk*mm).eq.2) then
394
elseif ((kk*mm).eq.3) then
397
elseif ((kk*mm).eq.6) then
402
! --> Termes en R km et Phi km
422
w6(iel) = w6(iel) + vnk*vnm*deltij*( &
423
crijp1*rtpa(iel,irkm)*epsk(iel) &
425
*crij2*(produc(iskm,iel)-d2s3*produk(iel)*deltkm) )
430
! ---> Fin des sommes sur m
435
if ((kk*ii).eq.1) then
438
elseif ((kk*ii).eq.4) then
441
elseif ((kk*ii).eq.9) then
444
elseif ((kk*ii).eq.2) then
447
elseif ((kk*ii).eq.3) then
450
elseif ((kk*ii).eq.6) then
457
if ((kk*jj).eq.1) then
460
elseif ((kk*jj).eq.4) then
463
elseif ((kk*jj).eq.9) then
466
elseif ((kk*jj).eq.2) then
469
elseif ((kk*jj).eq.3) then
472
elseif ((kk*jj).eq.6) then
519
w6(iel) = w6(iel) + 1.5d0*vnk*( &
520
-crijp1*(rtpa(iel,irki)*vnj+rtpa(iel,irkj)*vni)*epsk(iel) &
522
*crij2*((produc(iski,iel)-d2s3*produk(iel)*deltki)*vnj &
523
+(produc(iskj,iel)-d2s3*produk(iel)*deltkj)*vni) )
530
! ---> Distance a la paroi et fonction d'amortissement : W3
531
! Pour chaque mode de calcul : meme code, test
532
! en dehors de la boucle
534
if(abs(icdpar).eq.2) then
536
ifacpt = ia(iifapa(iphas)-1+iel)
538
(cdgfbo(1,ifacpt)-xyzcen(1,iel))**2 &
539
+(cdgfbo(2,ifacpt)-xyzcen(2,iel))**2 &
540
+(cdgfbo(3,ifacpt)-xyzcen(3,iel))**2
541
distxn = sqrt(distxn)
542
trrij = 0.5d0 * (rtpa(iel,ir11ip) + rtpa(iel,ir22ip) + &
545
bb = cmu075*trrij**1.5d0/(xkappa*rtpa(iel,ieiph)*distxn)
546
w3(iel) = min(aa, bb)
550
distxn = max(ra(idipar+iel-1),epzero)
551
trrij = 0.5d0 * (rtpa(iel,ir11ip) + rtpa(iel,ir22ip) + &
554
bb = cmu075*trrij**1.5d0/(xkappa*rtpa(iel,ieiph)*distxn)
555
w3(iel) = min(aa, bb)
560
! ---> Increment du terme source
563
smbr(iel) = smbr(iel) &
564
+ propce(iel,ipcroo)*volume(iel)*w6(iel)*w3(iel)