1
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
3
! This file is part of Code_Saturne, a general-purpose CFD tool.
5
! Copyright (C) 1998-2011 EDF S.A.
7
! This program is free software; you can redistribute it and/or modify it under
8
! the terms of the GNU General Public License as published by the Free Software
9
! Foundation; either version 2 of the License, or (at your option) any later
12
! This program is distributed in the hope that it will be useful, but WITHOUT
13
! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17
! You should have received a copy of the GNU General Public License along with
18
! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
19
! Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
21
!-------------------------------------------------------------------------------
28
23
subroutine cfdivs &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , ncepdp , ncesmp , &
35
nideve , nrdeve , nituse , nrtuse , iphas , &
36
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
37
ipnfac , nodfac , ipnfbr , nodfbr , icepdc , icetsm , itypsm , &
38
idevel , ituser , ia , &
39
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
26
( nvar , nscal , ncepdp , ncesmp , &
27
icepdc , icetsm , itypsm , &
40
28
rtp , propce , propfa , propfb , &
41
29
coefa , coefb , ckupdc , smacel , &
42
diverg , ux , uy , uz , &
44
w1 , w2 , w3 , w4 , w5 , w6 , &
45
rdevel , rtuser , ra )
30
diverg , ux , uy , uz )
47
32
!===============================================================================
73
58
!__________________.____._____.________________________________________________.
74
59
! name !type!mode ! role !
75
60
!__________________!____!_____!________________________________________________!
76
! idbia0 ! i ! <-- ! number of first free position in ia !
77
! idbra0 ! i ! <-- ! number of first free position in ra !
78
! ndim ! i ! <-- ! spatial dimension !
79
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
80
! ncel ! i ! <-- ! number of cells !
81
! nfac ! i ! <-- ! number of interior faces !
82
! nfabor ! i ! <-- ! number of boundary faces !
83
! nfml ! i ! <-- ! number of families (group classes) !
84
! nprfml ! i ! <-- ! number of properties per family (group class) !
85
! nnod ! i ! <-- ! number of vertices !
86
! lndfac ! i ! <-- ! size of nodfac indexed array !
87
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
88
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
89
61
! nvar ! i ! <-- ! total number of variables !
90
62
! nscal ! i ! <-- ! total number of scalars !
91
! nphas ! i ! <-- ! number of phases !
92
63
! ncepdp ! i ! <-- ! number of cells with head loss !
93
64
! ncesmp ! i ! <-- ! number of cells with mass source term !
94
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
95
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
96
! iphas ! i ! <-- ! phase number !
97
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
98
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
99
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
100
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
101
! iprfml ! ia ! <-- ! property numbers per family !
102
! (nfml, nprfml) ! ! ! !
103
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
104
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
105
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
106
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
107
65
! icepdc(ncelet ! te ! <-- ! numero des ncepdp cellules avec pdc !
108
66
! icetsm(ncesmp ! te ! <-- ! numero des cellules a source de masse !
109
67
! itypsm ! te ! <-- ! type de source de masse pour les !
110
68
! (ncesmp,nvar) ! ! ! variables (cf. ustsma) !
111
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
112
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
113
! ia(*) ! ia ! --- ! main integer work array !
114
! xyzcen ! ra ! <-- ! cell centers !
115
! (ndim, ncelet) ! ! ! !
116
! surfac ! ra ! <-- ! interior faces surface vectors !
117
! (ndim, nfac) ! ! ! !
118
! surfbo ! ra ! <-- ! boundary faces surface vectors !
119
! (ndim, nfabor) ! ! ! !
120
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
121
! (ndim, nfac) ! ! ! !
122
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
123
! (ndim, nfabor) ! ! ! !
124
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
125
! (ndim, nnod) ! ! ! !
126
! volume(ncelet) ! ra ! <-- ! cell volumes !
127
69
! rtp ! tr ! <-- ! variables de calcul au centre des !
128
70
! (ncelet,*) ! ! ! cellules (instant courant) !
129
71
! propce(ncelet, *)! ra ! <-- ! physical properties at cell centers !
138
80
! ! ! ! pour ivar=ipr, smacel=flux de masse !
139
81
! diverg(ncelet ! tr ! --> ! div(sigma.u) !
140
82
! ux,y,z(ncelet ! tr ! <-- ! composantes du vecteur u !
141
! vistot(ncelet ! tr ! --- ! tableau de travail pour mu !
142
! w1...6(ncelet ! tr ! --- ! tableau de travail !
143
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
144
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
145
! ra(*) ! ra ! --- ! main real work array !
146
83
!__________________!____!_____!________________________________________________!
148
85
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
153
90
!===============================================================================
92
!===============================================================================
94
!===============================================================================
108
!===============================================================================
157
!===============================================================================
159
!===============================================================================
173
!===============================================================================
177
integer idbia0 , idbra0
178
integer ndim , ncelet , ncel , nfac , nfabor
179
integer nfml , nprfml
180
integer nnod , lndfac , lndfbr , ncelbr
181
integer nvar , nscal , nphas
182
115
integer ncepdp , ncesmp
183
integer nideve , nrdeve , nituse , nrtuse , iphas
185
integer ifacel(2,nfac) , ifabor(nfabor)
186
integer ifmfbr(nfabor) , ifmcel(ncelet)
187
integer iprfml(nfml,nprfml)
188
integer ipnfac(nfac+1), nodfac(lndfac)
189
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
190
117
integer icepdc(ncepdp)
191
118
integer icetsm(ncesmp), itypsm(ncesmp,nvar)
192
integer idevel(nideve), ituser(nituse)
195
double precision xyzcen(ndim,ncelet)
196
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
197
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
198
double precision xyznod(ndim,nnod), volume(ncelet)
199
120
double precision rtp(ncelet,*)
200
121
double precision propce(ncelet,*)
201
122
double precision propfa(nfac,*), propfb(nfabor,*)
203
124
double precision ckupdc(ncepdp,6), smacel(ncesmp,nvar)
204
125
double precision diverg(ncelet)
205
126
double precision ux(ncelet), uy(ncelet), uz(ncelet)
206
double precision vistot(ncelet)
207
double precision w1(ncelet), w2(ncelet), w3(ncelet)
208
double precision w4(ncelet), w5(ncelet), w6(ncelet)
209
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
211
128
! Local variables
213
integer idebia, idebra
214
130
integer iccocg, inc, iel, ifac, ivar, isou, ii, jj
215
integer iuiph, iviph, iwiph
217
132
integer nswrgp, imligp, iwarnp
218
133
integer ipcvis, ipcvst, ipcvsv
219
integer idimte, itenso, iphydp
220
135
double precision epsrgp, climgp, extrap
221
136
double precision vecfac, visttt
138
double precision, allocatable, dimension(:) :: vistot
139
double precision, allocatable, dimension(:,:) :: grad
140
double precision, allocatable, dimension(:) :: w4, w5, w6
223
142
!===============================================================================
225
144
!===============================================================================
226
145
! 1. INITIALISATION
227
146
!===============================================================================
236
ipcvis = ipproc(iviscl(iphas))
237
ipcvst = ipproc(ivisct(iphas))
238
if(iviscv(iphas).gt.0) then
239
ipcvsv = ipproc(iviscv(iphas))
148
! Allocate temporary arrays
149
allocate(vistot(ncelet))
150
allocate(grad(ncelet,3))
152
! Allocate work arrays
153
allocate(w4(ncelet), w5(ncelet), w6(ncelet))
156
ipcvis = ipproc(iviscl)
157
ipcvst = ipproc(ivisct)
159
ipcvsv = ipproc(iviscv)
260
180
! cellules halo (calcul sur le halo, exceptionnellement).
261
181
! Pour le parallelisme, on s'aligne sur la sequence ainsi definie.
263
! ---> TRAITEMENT DU PARALLELISME
269
call parcom (propce(1,ipcvsv))
274
! ---> TRAITEMENT DE LA PERIODICITE
281
( idimte , itenso , &
282
vistot , vistot , vistot , &
283
vistot , vistot , vistot , &
284
vistot , vistot , vistot )
288
( idimte , itenso , &
289
propce(1,ipcvsv) , propce(1,ipcvsv) , propce(1,ipcvsv) , &
290
propce(1,ipcvsv) , propce(1,ipcvsv) , propce(1,ipcvsv) , &
291
propce(1,ipcvsv) , propce(1,ipcvsv) , propce(1,ipcvsv) )
183
! ---> TRAITEMENT DU PARALLELISME ET DE LA PERIODICITE
185
if (irangp.ge.0.or.iperio.eq.1) then
188
if (ipcvsv.gt.0) then
189
call synsca(propce(1,ipcvsv))
318
217
epsrgp = epsrgr(ivar)
319
218
climgp = climgr(ivar)
320
219
extrap = extrag(ivar)
325
( idebia , idebra , &
326
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
327
nnod , lndfac , lndfbr , ncelbr , nphas , &
328
nideve , nrdeve , nituse , nrtuse , &
329
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp , &
223
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
330
224
iwarnp , nfecra , epsrgp , climgp , extrap , &
331
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
332
ipnfac , nodfac , ipnfbr , nodfbr , &
333
idevel , ituser , ia , &
334
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
336
225
rtp(1,ivar) , coefa(1,iclvar) , coefb(1,iclvar) , &
338
! ------ ------ ------
340
rdevel , rtuser , ra )
349
235
if (isou.eq.1) then
350
236
do iel = 1, ncelet
351
237
visttt = propce(iel,ipcvsv) - 2.d0/3.d0*vistot(iel)
352
w4(iel) = vistot(iel)*( 2.d0*w1(iel)*ux(iel) &
354
+ w3(iel)*uz(iel) ) &
355
+ visttt*w1(iel)*ux(iel)
356
w5(iel) = vistot(iel)*w2(iel)*ux(iel) &
357
+ visttt*w1(iel)*uy(iel)
358
w6(iel) = vistot(iel)*w3(iel)*ux(iel) &
359
+ visttt*w1(iel)*uz(iel)
238
w4(iel) = vistot(iel)*( 2.d0*grad(iel,1)*ux(iel) &
239
+ grad(iel,2)*uy(iel) &
240
+ grad(iel,3)*uz(iel) ) &
241
+ visttt*grad(iel,1)*ux(iel)
242
w5(iel) = vistot(iel)*grad(iel,2)*ux(iel) &
243
+ visttt*grad(iel,1)*uy(iel)
244
w6(iel) = vistot(iel)*grad(iel,3)*ux(iel) &
245
+ visttt*grad(iel,1)*uz(iel)
362
248
elseif(isou.eq.2) then
363
249
do iel = 1, ncelet
364
250
visttt = propce(iel,ipcvsv) - 2.d0/3.d0*vistot(iel)
365
w4(iel) = vistot(iel)*w1(iel)*uy(iel) &
366
+ visttt*w2(iel)*ux(iel)
367
w5(iel) = vistot(iel)*( w1(iel)*ux(iel) &
368
+ 2.d0*w2(iel)*uy(iel) &
369
+ w3(iel)*uz(iel) ) &
370
+ visttt*w2(iel)*uy(iel)
371
w6(iel) = vistot(iel)*w3(iel)*uy(iel) &
372
+ visttt*w2(iel)*uz(iel)
251
w4(iel) = vistot(iel)*grad(iel,1)*uy(iel) &
252
+ visttt*grad(iel,2)*ux(iel)
253
w5(iel) = vistot(iel)*( grad(iel,1)*ux(iel) &
254
+ 2.d0*grad(iel,2)*uy(iel) &
255
+ grad(iel,3)*uz(iel) ) &
256
+ visttt*grad(iel,2)*uy(iel)
257
w6(iel) = vistot(iel)*grad(iel,3)*uy(iel) &
258
+ visttt*grad(iel,2)*uz(iel)
375
261
elseif(isou.eq.3) then
376
262
do iel = 1, ncelet
377
263
visttt = propce(iel,ipcvsv) - 2.d0/3.d0*vistot(iel)
378
w4(iel) = vistot(iel)*w1(iel)*uz(iel) &
379
+ visttt*w3(iel)*ux(iel)
380
w5(iel) = vistot(iel)*w2(iel)*uz(iel) &
381
+ visttt*w3(iel)*uy(iel)
382
w6(iel) = vistot(iel)*( w1(iel)*ux(iel) &
384
+ 2.d0*w3(iel)*uz(iel) ) &
385
+ visttt*w3(iel)*uz(iel)
264
w4(iel) = vistot(iel)*grad(iel,1)*uz(iel) &
265
+ visttt*grad(iel,3)*ux(iel)
266
w5(iel) = vistot(iel)*grad(iel,2)*uz(iel) &
267
+ visttt*grad(iel,3)*uy(iel)
268
w6(iel) = vistot(iel)*( grad(iel,1)*ux(iel) &
269
+ grad(iel,2)*uy(iel) &
270
+ 2.d0*grad(iel,3)*uz(iel) ) &
271
+ visttt*grad(iel,3)*uz(iel)
392
278
if (isou.eq.1) then
393
279
do iel = 1, ncelet
394
visttt = viscv0(iphas) - 2.d0/3.d0*vistot(iel)
395
w4(iel) = vistot(iel)*( 2.d0*w1(iel)*ux(iel) &
397
+ w3(iel)*uz(iel) ) &
398
+ visttt*w1(iel)*ux(iel)
399
w5(iel) = vistot(iel)*w2(iel)*ux(iel) &
400
+ visttt*w1(iel)*uy(iel)
401
w6(iel) = vistot(iel)*w3(iel)*ux(iel) &
402
+ visttt*w1(iel)*uz(iel)
280
visttt = viscv0 - 2.d0/3.d0*vistot(iel)
281
w4(iel) = vistot(iel)*( 2.d0*grad(iel,1)*ux(iel) &
282
+ grad(iel,2)*uy(iel) &
283
+ grad(iel,3)*uz(iel) ) &
284
+ visttt*grad(iel,1)*ux(iel)
285
w5(iel) = vistot(iel)*grad(iel,2)*ux(iel) &
286
+ visttt*grad(iel,1)*uy(iel)
287
w6(iel) = vistot(iel)*grad(iel,3)*ux(iel) &
288
+ visttt*grad(iel,1)*uz(iel)
405
291
elseif(isou.eq.2) then
406
292
do iel = 1, ncelet
407
visttt = viscv0(iphas) - 2.d0/3.d0*vistot(iel)
408
w4(iel) = vistot(iel)*w1(iel)*uy(iel) &
409
+ visttt*w2(iel)*ux(iel)
410
w5(iel) = vistot(iel)*( w1(iel)*ux(iel) &
411
+ 2.d0*w2(iel)*uy(iel) &
412
+ w3(iel)*uz(iel) ) &
413
+ visttt*w2(iel)*uy(iel)
414
w6(iel) = vistot(iel)*w3(iel)*uy(iel) &
415
+ visttt*w2(iel)*uz(iel)
293
visttt = viscv0 - 2.d0/3.d0*vistot(iel)
294
w4(iel) = vistot(iel)*grad(iel,1)*uy(iel) &
295
+ visttt*grad(iel,2)*ux(iel)
296
w5(iel) = vistot(iel)*( grad(iel,1)*ux(iel) &
297
+ 2.d0*grad(iel,2)*uy(iel) &
298
+ grad(iel,3)*uz(iel) ) &
299
+ visttt*grad(iel,2)*uy(iel)
300
w6(iel) = vistot(iel)*grad(iel,3)*uy(iel) &
301
+ visttt*grad(iel,2)*uz(iel)
418
304
elseif(isou.eq.3) then
419
305
do iel = 1, ncelet
420
visttt = viscv0(iphas) - 2.d0/3.d0*vistot(iel)
421
w4(iel) = vistot(iel)*w1(iel)*uz(iel) &
422
+ visttt*w3(iel)*ux(iel)
423
w5(iel) = vistot(iel)*w2(iel)*uz(iel) &
424
+ visttt*w3(iel)*uy(iel)
425
w6(iel) = vistot(iel)*( w1(iel)*ux(iel) &
427
+ 2.d0*w3(iel)*uz(iel) ) &
428
+ visttt*w3(iel)*uz(iel)
306
visttt = viscv0 - 2.d0/3.d0*vistot(iel)
307
w4(iel) = vistot(iel)*grad(iel,1)*uz(iel) &
308
+ visttt*grad(iel,3)*ux(iel)
309
w5(iel) = vistot(iel)*grad(iel,2)*uz(iel) &
310
+ visttt*grad(iel,3)*uy(iel)
311
w6(iel) = vistot(iel)*( grad(iel,1)*ux(iel) &
312
+ grad(iel,2)*uy(iel) &
313
+ 2.d0*grad(iel,3)*uz(iel) ) &
314
+ visttt*grad(iel,3)*uz(iel)
454
!MO VECFAC = SURFAC(ISOU,IFAC)
455
!MO & *(POND(IFAC)*W4(II)+(1.D0-POND(IFAC))*W4(JJ))
456
vecfac = surfac(1,ifac)*(w4(ii)+w4(jj))*0.5d0 &
457
+ surfac(2,ifac)*(w5(ii)+w5(jj))*0.5d0 &
458
+ surfac(3,ifac)*(w6(ii)+w6(jj))*0.5d0
459
diverg(ii) = diverg(ii) + vecfac
460
diverg(jj) = diverg(jj) - vecfac
465
! VECTORISATION NON FORCEE
469
!MO VECFAC = SURFAC(ISOU,IFAC)
470
!MO & *(POND(IFAC)*W4(II)+(1.D0-POND(IFAC))*W4(JJ))
471
vecfac = surfac(1,ifac)*(w4(ii)+w4(jj))*0.5d0 &
472
+ surfac(2,ifac)*(w5(ii)+w5(jj))*0.5d0 &
473
+ surfac(3,ifac)*(w6(ii)+w6(jj))*0.5d0
474
diverg(ii) = diverg(ii) + vecfac
475
diverg(jj) = diverg(jj) - vecfac
337
!MO VECFAC = SURFAC(ISOU,IFAC)
338
!MO & *(POND(IFAC)*W4(II)+(1.D0-POND(IFAC))*W4(JJ))
339
vecfac = surfac(1,ifac)*(w4(ii)+w4(jj))*0.5d0 &
340
+ surfac(2,ifac)*(w5(ii)+w5(jj))*0.5d0 &
341
+ surfac(3,ifac)*(w6(ii)+w6(jj))*0.5d0
342
diverg(ii) = diverg(ii) + vecfac
343
diverg(jj) = diverg(jj) - vecfac
481
347
! --- Assemblage sur les faces de bord
488
vecfac = surfbo(1,ifac)*w4(ii) &
489
+ surfbo(2,ifac)*w5(ii) &
490
+ surfbo(3,ifac)*w6(ii)
491
diverg(ii) = diverg(ii) + vecfac
496
! VECTORISATION NON FORCEE
499
vecfac = surfbo(1,ifac)*w4(ii) &
500
+ surfbo(2,ifac)*w5(ii) &
501
+ surfbo(3,ifac)*w6(ii)
502
diverg(ii) = diverg(ii) + vecfac
351
vecfac = surfbo(1,ifac)*w4(ii) &
352
+ surfbo(2,ifac)*w5(ii) &
353
+ surfbo(3,ifac)*w6(ii)
354
diverg(ii) = diverg(ii) + vecfac
360
deallocate(w4, w5, w6)