1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
!-------------------------------------------------------------------------------
! This file is part of Code_Saturne, a general-purpose CFD tool.
!
! Copyright (C) 1998-2011 EDF S.A.
!
! This program 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.
!
! This program 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.
!
! You should have received a copy of the GNU General Public License along with
! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
! Street, Fifth Floor, Boston, MA 02110-1301, USA.
!-------------------------------------------------------------------------------
subroutine cptsvc &
!================
( nvar , nscal , ncepdp , ncesmp , &
iscal , iscala , &
itypfb , &
icepdc , icetsm , itypsm , &
dt , rtpa , rtp , propce , propfa , propfb , &
coefa , coefb , &
smbrs , rovsdt )
!===============================================================================
! FONCTION :
! ----------
! ROUTINE PHYSIQUE PARTICULIERE : FLAMME CHARBON PULVERISE
! TERMES SOURCES DE PRODUCTION ET DE DISSIPATION POUR
! LA VARIANCE (BILANS EXPLICITE ET IMPLICITE)
!-------------------------------------------------------------------------------
!ARGU ARGUMENTS
!__________________.____._____.________________________________________________.
! name !type!mode ! role !
!__________________!____!_____!________________________________________________!
! nvar ! i ! <-- ! total number of variables !
! nscal ! i ! <-- ! total number of scalars !
! ncepdp ! i ! <-- ! number of cells with head loss !
! ncesmp ! i ! <-- ! number of cells with mass source term !
! iscal ! i ! <-- ! scalar number !
! iscala ! e ! <-- ! numero du scalaire associe !
! itypfb ! ia ! <-- ! boundary face types !
! icepdc(ncelet ! te ! <-- ! numero des ncepdp cellules avec pdc !
! icetsm(ncesmp ! te ! <-- ! numero des cellules a source de masse !
! itypsm ! te ! <-- ! type de source de masse pour les !
! (ncesmp,nvar) ! ! ! variables (cf. ustsma) !
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
! (ncelet, *) ! ! ! (at current and previous time steps) !
! propce(ncelet, *)! ra ! <-- ! physical properties at cell centers !
! propfa(nfac, *) ! ra ! <-- ! physical properties at interior face centers !
! propfb(nfabor, *)! ra ! <-- ! physical properties at boundary face centers !
! coefa, coefb ! ra ! <-- ! boundary conditions !
! (nfabor, *) ! ! ! !
! smbrs(ncelet) ! tr ! --> ! second membre explicite !
! rovsdt(ncelet ! tr ! --> ! partie diagonale implicite !
!__________________!____!_____!________________________________________________!
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
! --- tableau de travail
!===============================================================================
!===============================================================================
! Module files
!===============================================================================
use paramx
use numvar
use entsor
use optcal
use cstphy
use cstnum
use parall
use period
use ppppar
use ppthch
use coincl
use cpincl
use ppincl
use mesh
!===============================================================================
implicit none
! Arguments
integer nvar , nscal
integer ncepdp , ncesmp
integer iscal , iscala
integer itypfb(nfabor)
integer icepdc(ncepdp)
integer icetsm(ncesmp), itypsm(ncesmp,nvar)
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
double precision propce(ncelet,*)
double precision propfa(nfac,*), propfb(nfabor,*)
double precision coefa(nfabor,*), coefb(nfabor,*)
double precision smbrs(ncelet), rovsdt(ncelet)
! Local variables
integer ivar , ivarsc , ivarut , ivar0
integer iel , ifac
integer ipcrom , ipcvst
integer ixchcl , ixckcl , ixnpcl , icla , icha
integer inc , iccocg , nswrgp , imligp , iwarnp
double precision x2 , xk , xe , rhovst
double precision epsrgp , climgp , extrap
double precision, allocatable, dimension(:) :: coefap, coefbp
double precision, allocatable, dimension(:,:) :: grad
double precision, allocatable, dimension(:) :: w1, w2
double precision, allocatable, dimension(:) :: w7, w8
!===============================================================================
!===============================================================================
! 1. INITIALISATION
!===============================================================================
! Initialize variables to avoid compiler warnings
xe = 0.d0
xk = 0.d0
! Memoire
! --- Numero du scalaire a traiter : ISCAL
! --- Numero de la variable associee au scalaire a traiter ISCAL
ivar = isca(iscal)
! --- Numero du scalaire eventuel associe dans le cas fluctuation
! ISCALA et numero de variable de calcul
if (iscala.gt.0) then
ivarsc = isca(iscala)
else
ivarsc = 0
endif
! --- Numero des grandeurs physiques
ipcrom = ipproc(irom)
ipcvst = ipproc(ivisct)
!===============================================================================
! 2. PRISE EN COMPTE DES TERMES SOURCES DE PRODUCTION PAR LES GRADIENTS
! ET DE DISSIPATION
!===============================================================================
if ( itytur.eq.2 .or. itytur.eq.3 &
.or. iturb.eq.50 .or. iturb.eq.60) then
inc = 1
iccocg = 1
if (ivarsc.gt.0) then
ivarut = ivarsc
else
! A defaut de savoir pour F4M on prend comme pour F3M
ivarut = isca(if3m)
endif
nswrgp = nswrgr(ivarut)
imligp = imligr(ivarut)
iwarnp = iwarni(ivarut)
epsrgp = epsrgr(ivarut)
climgp = climgr(ivarut)
extrap = extrag(ivarut)
! Allocate work arrays
allocate(w7(ncelet), w8(ncelet))
! --> Calcul de FIM et X2 dans W7 et W8
do iel = 1, ncel
w7(iel) = zero
w8(iel) = 1.d0
enddo
! ---- W8 = X1
do icla = 1, nclacp
ixchcl = isca(ixch(icla))
ixckcl = isca(ixck(icla))
ixnpcl = isca(inp(icla ))
do iel = 1, ncel
x2 = rtp(iel,ixchcl)+rtp(iel,ixckcl) &
+ rtp(iel,ixnpcl)*xmash(icla)
w8(iel) = w8(iel) - x2
enddo
enddo
! ---- W7 = FJM (kg/kg du melange gazeux)
if (ivarsc.eq.0) then
! Allocate work arrays
allocate(w1(ncelet), w2(ncelet))
do iel = 1, ncel
w1(iel) = zero
w2(iel) = zero
enddo
do icha = 1, ncharb
do iel = 1, ncel
w1(iel) = w1(iel) + rtp(iel,isca(if1m(icha)))
w2(iel) = w2(iel) + rtp(iel,isca(if2m(icha)))
enddo
enddo
do iel = 1, ncel
w7(iel) = 1.d0 - &
( (w1(iel) + w2(iel) + rtp(iel,isca(if3m))) &
/ w8(iel) )
enddo
! Free some work arrays
deallocate(w1, w2)
else
do iel = 1, ncel
w7(iel) = rtp(iel,ivarsc) / w8(iel)
enddo
endif
! Allocate temporary arrays
allocate(coefap(nfabor), coefbp(nfabor))
do ifac = 1, nfabor
coefap(ifac) = zero
coefbp(ifac) = 1.d0
if ( itypfb(ifac).eq.ientre ) then
coefap(ifac) = zero
coefbp(ifac) = zero
if (ivarsc.eq.0) coefap(ifac) = 1.d0
endif
enddo
! En periodique et parallele, echange avant calcul du gradient
if (irangp.ge.0.or.iperio.eq.1) then
call synsca(w7)
!==========
endif
! Allocate a temporary array for gradient computation
allocate(grad(ncelet,3))
! IVAR0 = 0 (indique pour la periodicite de rotation que la variable
! n'est pas la vitesse ni Rij)
ivar0 = 0
call grdcel &
!==========
( ivar0 , imrgra , inc , iccocg , nswrgp , imligp , &
iwarnp , nfecra , epsrgp , climgp , extrap , &
w7 , coefap , coefbp , &
! FIM COEFA COEFB
grad )
! Free memory
deallocate(coefap, coefbp)
do iel = 1, ncel
if ( itytur.eq.2 .or. iturb.eq.50 ) then
xk = rtpa(iel,ik)
xe = rtpa(iel,iep)
elseif ( itytur.eq.3 ) then
xk = 0.5d0*(rtpa(iel,ir11)+rtpa(iel,ir22)+rtpa(iel,ir33))
xe = rtpa(iel,iep)
elseif ( iturb.eq.60 ) then
xk = rtpa(iel,ik)
xe = cmu*xk*rtpa(iel,iomg)
endif
rhovst = propce(iel,ipcrom)*xe/ &
(xk * rvarfl(iscal))*volume(iel)
rovsdt(iel) = rovsdt(iel) + max(zero,rhovst)
smbrs(iel) = smbrs(iel) + &
2.d0*propce(iel,ipcvst)*volume(iel)/sigmas(iscal) &
* (grad(iel,1)**2 + grad(iel,2)**2 + grad(iel,3)**2) * w8(iel) &
- rhovst*rtpa(iel,ivar)
enddo
! Free memory
deallocate(grad)
deallocate(w7, w8)
endif
!--------
! FORMATS
!--------
!----
! FIN
!----
return
end subroutine
|