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 cptsvc &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , ncepdp , ncesmp , &
35
nideve , nrdeve , nituse , nrtuse , iscal , iscala , &
36
ifacel , ifabor , ifmfbr , ifmcel , iprfml , itypfb , &
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 , &
29
icepdc , icetsm , itypsm , &
40
30
dt , rtpa , rtp , propce , propfa , propfb , &
44
w1 , w2 , w3 , w4 , w5 , &
46
rdevel , rtuser , ra )
48
34
!===============================================================================
58
44
!__________________.____._____.________________________________________________.
59
45
! name !type!mode ! role !
60
46
!__________________!____!_____!________________________________________________!
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
47
! nvar ! i ! <-- ! total number of variables !
75
48
! nscal ! i ! <-- ! total number of scalars !
76
! nphas ! i ! <-- ! number of phases !
77
49
! ncepdp ! i ! <-- ! number of cells with head loss !
78
50
! ncesmp ! i ! <-- ! number of cells with mass source term !
79
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
80
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
81
51
! iscal ! i ! <-- ! scalar number !
82
52
! iscala ! e ! <-- ! numero du scalaire associe !
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 ! te ! <-- ! proprietes d'une famille !
88
53
! itypfb ! ia ! <-- ! boundary face types !
89
! (nfabor, nphas) ! ! ! !
90
! nfml ,nprfml ! ! ! !
91
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
92
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
93
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
94
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
95
54
! icepdc(ncelet ! te ! <-- ! numero des ncepdp cellules avec pdc !
96
55
! icetsm(ncesmp ! te ! <-- ! numero des cellules a source de masse !
97
56
! itypsm ! te ! <-- ! type de source de masse pour les !
98
57
! (ncesmp,nvar) ! ! ! variables (cf. ustsma) !
99
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
100
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
101
! ia(*) ! ia ! --- ! main integer work array !
102
! xyzcen ! ra ! <-- ! cell centers !
103
! (ndim, ncelet) ! ! ! !
104
! surfac ! ra ! <-- ! interior faces surface vectors !
105
! (ndim, nfac) ! ! ! !
106
! surfbo ! ra ! <-- ! boundary faces surface vectors !
107
! (ndim, nfabor) ! ! ! !
108
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
109
! (ndim, nfac) ! ! ! !
110
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
111
! (ndim, nfabor) ! ! ! !
112
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
113
! (ndim, nnod) ! ! ! !
114
! volume(ncelet) ! ra ! <-- ! cell volumes !
115
58
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
116
59
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
117
60
! (ncelet, *) ! ! ! (at current and previous time steps) !
122
65
! (nfabor, *) ! ! ! !
123
66
! smbrs(ncelet) ! tr ! --> ! second membre explicite !
124
67
! rovsdt(ncelet ! tr ! --> ! partie diagonale implicite !
125
! wfb(nfabor) ! tr ! --- ! tableau de travail faces de bord !
126
! w1..8(ncelet) ! tr ! --- ! tableau de travail cellules !
127
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
128
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
129
! ra(*) ! ra ! --- ! main real work array !
130
68
!__________________!____!_____!________________________________________________!
132
70
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
133
71
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
134
72
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
135
73
! --- tableau de travail
136
!-------------------------------------------------------------------------------
74
!===============================================================================
76
!===============================================================================
78
!===============================================================================
137
95
!===============================================================================
141
!===============================================================================
143
!===============================================================================
159
!===============================================================================
163
integer idbia0 , idbra0
164
integer ndim , ncelet , ncel , nfac , nfabor
165
integer nfml , nprfml
166
integer nnod , lndfac , lndfbr , ncelbr
167
integer nvar , nscal , nphas
168
102
integer ncepdp , ncesmp
169
integer nideve , nrdeve , nituse , nrtuse
170
103
integer iscal , iscala
172
integer ifacel(2,nfac) , ifabor(nfabor)
173
integer ifmfbr(nfabor) , ifmcel(ncelet)
174
integer iprfml(nfml,nprfml) , itypfb(nfabor,nphas)
175
integer ipnfac(nfac+1), nodfac(lndfac)
176
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
105
integer itypfb(nfabor)
177
106
integer icepdc(ncepdp)
178
107
integer icetsm(ncesmp), itypsm(ncesmp,nvar)
179
integer idevel(nideve)
180
integer ituser(nituse), ia(*)
182
double precision xyzcen(ndim,ncelet)
183
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
184
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
185
double precision xyznod(ndim,nnod), volume(ncelet)
186
109
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
187
110
double precision propce(ncelet,*)
188
111
double precision propfa(nfac,*), propfb(nfabor,*)
189
112
double precision coefa(nfabor,*), coefb(nfabor,*)
190
113
double precision smbrs(ncelet), rovsdt(ncelet)
191
double precision wfb(nfabor)
192
double precision w1(ncelet), w2(ncelet), w3(ncelet)
193
double precision w4(ncelet), w5(ncelet), w6(ncelet)
194
double precision w7(ncelet), w8(ncelet)
195
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
197
115
! Local variables
199
integer idebia , idebra
200
117
integer ivar , ivarsc , ivarut , ivar0
201
integer iel , iphas , ifac
202
119
integer ipcrom , ipcvst
203
integer ikiph , ieiph , iomgip , iphydp
204
integer ir11ip , ir22ip , ir33ip
205
120
integer ixchcl , ixckcl , ixnpcl , icla , icha
206
121
integer inc , iccocg , nswrgp , imligp , iwarnp
207
integer ifinra , icoefa , icoefb
208
integer idimte , itenso
210
123
double precision x2 , xk , xe , rhovst
211
124
double precision epsrgp , climgp , extrap
126
double precision, allocatable, dimension(:) :: coefap, coefbp
127
double precision, allocatable, dimension(:,:) :: grad
128
double precision, allocatable, dimension(:) :: w1, w2
129
double precision, allocatable, dimension(:) :: w7, w8
214
131
!===============================================================================
318
226
( (w1(iel) + w2(iel) + rtp(iel,isca(if3m))) &
229
! Free some work arrays
323
233
w7(iel) = rtp(iel,ivarsc) / w8(iel)
327
! --> Calcul des COEFA et COEFB de FIM afin d'en calculer son gradient
328
! On alloue localement 2 tableaux de NFABOR pour le calcul
329
! de COEFA et COEFB de FIM
332
icoefb = icoefa + nfabor
333
ifinra = icoefb + nfabor
334
CALL RASIZE ('CPTSVC',IFINRA)
237
! Allocate temporary arrays
238
allocate(coefap(nfabor), coefbp(nfabor))
337
240
do ifac = 1, nfabor
338
ra(icoefa+ifac-1) = zero
339
ra(icoefb+ifac-1) = 1.d0
340
if ( itypfb(ifac,iphas).eq.ientre ) then
341
ra(icoefa+ifac-1) = zero
342
ra(icoefb+ifac-1) = zero
343
if (ivarsc.eq.0) ra(icoefa+ifac-1) = 1.d0
243
if ( itypfb(ifac).eq.ientre ) then
246
if (ivarsc.eq.0) coefap(ifac) = 1.d0
347
! En periodique et parallele, echange avant calcul du gradient
361
( idimte , itenso , &
250
! En periodique et parallele, echange avant calcul du gradient
251
if (irangp.ge.0.or.iperio.eq.1) then
256
! Allocate a temporary array for gradient computation
257
allocate(grad(ncelet,3))
367
259
! IVAR0 = 0 (indique pour la periodicite de rotation que la variable
368
260
! n'est pas la vitesse ni Rij)
373
( idebia , ifinra , &
374
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
375
nnod , lndfac , lndfbr , ncelbr , nphas , &
376
nideve , nrdeve , nituse , nrtuse , &
377
ivar0 , imrgra , inc , iccocg , nswrgp , imligp , iphydp , &
264
( ivar0 , imrgra , inc , iccocg , nswrgp , imligp , &
378
265
iwarnp , nfecra , epsrgp , climgp , extrap , &
379
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
380
ipnfac , nodfac , ipnfbr , nodfbr , &
381
idevel , ituser , ia , &
382
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
384
w7 , ra(icoefa) , ra(icoefb) , &
266
w7 , coefap , coefbp , &
385
267
! FIM COEFA COEFB
387
! ------ ------ ------
389
rdevel , rtuser , ra )
271
deallocate(coefap, coefbp)
392
if ( itytur(iphas).eq.2 .or. iturb(iphas).eq.50 ) then
395
elseif ( itytur(iphas).eq.3 ) then
397
0.5d0*(rtpa(iel,ir11ip)+rtpa(iel,ir22ip)+rtpa(iel,ir33ip))
399
elseif ( iturb(iphas).eq.60 ) then
401
xe = cmu*xk*rtpa(iel,iomgip)
274
if ( itytur.eq.2 .or. iturb.eq.50 ) then
277
elseif ( itytur.eq.3 ) then
278
xk = 0.5d0*(rtpa(iel,ir11)+rtpa(iel,ir22)+rtpa(iel,ir33))
280
elseif ( iturb.eq.60 ) then
282
xe = cmu*xk*rtpa(iel,iomg)
404
285
rhovst = propce(iel,ipcrom)*xe/ &
405
286
(xk * rvarfl(iscal))*volume(iel)
406
287
rovsdt(iel) = rovsdt(iel) + max(zero,rhovst)
407
smbrs(iel) = smbrs(iel) + &
408
2.d0*propce(iel,ipcvst)*volume(iel)/sigmas(iscal) &
409
* (w1(iel)**2 + w2(iel)**2 + w3(iel)**2) * w8(iel)&
288
smbrs(iel) = smbrs(iel) + &
289
2.d0*propce(iel,ipcvst)*volume(iel)/sigmas(iscal) &
290
* (grad(iel,1)**2 + grad(iel,2)**2 + grad(iel,3)**2) * w8(iel) &
410
291
- rhovst*rtpa(iel,ivar)
413
! On libere COEFA COEFB