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 dttvar &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , ncepdp , ncesmp , &
35
nideve , nrdeve , nituse , nrtuse , iwarnp , &
36
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
37
ipnfac , nodfac , ipnfbr , nodfbr , &
26
( nvar , nscal , ncepdp , ncesmp , &
38
28
icepdc , icetsm , itypsm , &
39
idevel , ituser , ia , &
40
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
41
29
dt , rtp , rtpa , propce , propfa , propfb , &
42
coefa , coefb , ckupdc , smacel , &
43
viscf , viscb , dam , cofbdt , w1 , w2 , w3 , &
44
coefbr , grarox , graroy , graroz , wcf , &
45
rdevel , rtuser , ra )
30
coefa , coefb , ckupdc , smacel )
47
32
!===============================================================================
61
46
!__________________.____._____.________________________________________________.
62
47
! name !type!mode ! role !
63
48
!__________________!____!_____!________________________________________________!
64
! idbia0 ! i ! <-- ! number of first free position in ia !
65
! idbra0 ! i ! <-- ! number of first free position in ra !
66
! ndim ! i ! <-- ! spatial dimension !
67
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
68
! ncel ! i ! <-- ! number of cells !
69
! nfac ! i ! <-- ! number of interior faces !
70
! nfabor ! i ! <-- ! number of boundary faces !
71
! nfml ! i ! <-- ! number of families (group classes) !
72
! nprfml ! i ! <-- ! number of properties per family (group class) !
73
! nnod ! i ! <-- ! number of vertices !
74
! lndfac ! i ! <-- ! size of nodfac indexed array !
75
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
76
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
77
49
! nvar ! i ! <-- ! total number of variables !
78
50
! nscal ! i ! <-- ! total number of scalars !
79
! nphas ! i ! <-- ! number of phases !
80
51
! ncepdp ! i ! <-- ! number of cells with head loss !
81
52
! ncesmp ! i ! <-- ! number of cells with mass source term !
82
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
83
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
84
53
! iwarnp ! i ! <-- ! verbosity !
85
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
86
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
87
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
88
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
89
! iprfml ! ia ! <-- ! property numbers per family !
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) !
143
76
! --- tableau de travail
144
77
!===============================================================================
79
!===============================================================================
81
!===============================================================================
84
use dimens, only: ndimfb
96
!===============================================================================
148
!===============================================================================
150
!===============================================================================
164
!===============================================================================
168
integer idbia0 , idbra0
169
integer ndim , ncelet , ncel , nfac , nfabor
170
integer nfml , nprfml
171
integer nnod , lndfac , lndfbr , ncelbr
172
integer nvar , nscal , nphas
173
103
integer ncepdp , ncesmp
174
integer nideve , nrdeve , nituse , nrtuse , iwarnp
176
integer ifacel(2,nfac) , ifabor(nfabor)
177
integer ifmfbr(nfabor) , ifmcel(ncelet)
178
integer iprfml(nfml,nprfml)
179
integer ipnfac(nfac+1), nodfac(lndfac)
180
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
181
106
integer icepdc(ncepdp)
182
107
integer icetsm(ncesmp), itypsm(ncesmp,nvar)
183
integer idevel(nideve), ituser(nituse)
186
double precision xyzcen(ndim,ncelet)
187
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
188
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
189
double precision xyznod(ndim,nnod), volume(ncelet)
190
109
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
191
110
double precision propce(ncelet,*)
192
111
double precision propfa(nfac,*), propfb(ndimfb,*)
193
112
double precision coefa(ndimfb,*), coefb(ndimfb,*)
194
113
double precision ckupdc(ncepdp,6), smacel(ncesmp,nvar)
195
double precision viscf(nfac), viscb(nfabor)
196
double precision dam(ncelet ), cofbdt(nfabor)
197
double precision w1(ncelet), w2(ncelet), w3(ncelet)
198
! Attention, COEFBR n'est defini que pour IPTLRO = 1
199
double precision coefbr(nfabor)
200
! Attention, GRAROX, GRAROY, GRAROZ ne sont
201
! definis que pour IPTLRO = 1 ou en compressible
202
double precision grarox(ncelet),graroy(ncelet),graroz(ncelet)
203
! Attention, WCF n'est defini qu'en compressible
204
double precision wcf(ncelet)
205
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
207
116
! Local variables
210
integer idebia, idebra
211
120
integer ifac, iel, icfmax, icfmin, idiff0, iconv0, isym
213
integer iphas, iuiph, ipcvis, ipcvst
122
integer ipcvis, ipcvst
214
123
integer iflmas, iflmab
215
124
integer icou, ifou , icoucf
216
125
integer inc, iccocg
217
integer nswrgp, imligp , iphydp
126
integer nswrgp, imligp
218
127
integer ipcrom, ipbrom, iivar
220
129
integer ipccou, ipcfou
221
131
double precision epsrgp, climgp, extrap
222
132
double precision cfmax,cfmin, coufou, w1min, w2min, w3min
223
133
double precision unpvdt, rom
224
134
double precision xyzmax(3), xyzmin(3)
225
135
double precision dtsdtm,dtsdt0
137
double precision, allocatable, dimension(:) :: viscf, viscb
138
double precision, allocatable, dimension(:) :: dam
139
double precision, allocatable, dimension(:) :: wcf
140
double precision, allocatable, dimension(:) :: cofbdt, coefbr
141
double precision, allocatable, dimension(:,:) :: grad
142
double precision, allocatable, dimension(:) :: w1, w2, w3
227
144
!===============================================================================
229
146
!===============================================================================
230
147
! 0. INITIALISATION
231
148
!===============================================================================
238
iflmas = ipprof(ifluma(iuiph))
239
iflmab = ipprob(ifluma(iuiph))
240
ipcvis = ipproc(iviscl(iphas))
241
ipcvst = ipproc(ivisct(iphas))
242
ipcrom = ipproc(irom (iphas))
243
ipbrom = ipprob(irom (iphas))
244
ipccou = ipproc(icour (iphas))
245
ipcfou = ipproc(ifour (iphas))
150
! Allocate temporary arrays for the time-step resolution
151
allocate(viscf(nfac), viscb(nfabor))
152
allocate(dam(ncelet))
153
allocate(cofbdt(nfabor))
155
! Allocate other arrays, depending on user options
156
if (ippmod(icompf).ge.0) then
157
allocate(wcf(ncelet))
160
! Allocate work arrays
161
allocate(w1(ncelet), w2(ncelet), w3(ncelet))
164
iflmas = ipprof(ifluma(iu))
165
iflmab = ipprob(ifluma(iu))
166
ipcvis = ipproc(iviscl)
167
ipcvst = ipproc(ivisct)
168
ipcrom = ipproc(irom )
169
ipbrom = ipprob(irom )
170
ipccou = ipproc(icour )
171
ipcfou = ipproc(ifour )
247
173
if(ntlist.gt.0) then
248
174
modntl = mod(ntcabs,ntlist)
296
( idebia , idebra , &
297
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
298
nnod , lndfac , lndfbr , ncelbr , &
299
nvar , nscal , nphas , ncepdp , ncesmp , &
300
nideve , nrdeve , nituse , nrtuse , iwarnp , &
301
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
302
ipnfac , nodfac , ipnfbr , nodfbr , &
222
( nvar , nscal , ncepdp , ncesmp , &
303
224
icepdc , icetsm , itypsm , &
304
idevel , ituser , ia , &
305
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
306
225
dt , rtp , rtpa , propce , propfa , propfb , &
307
226
coefa , coefb , ckupdc , smacel , &
310
viscf , viscb , cofbdt , w1 , w2 , dam , &
311
grarox , graroy , graroz , &
312
rdevel , rtuser , ra )
229
viscf , viscb , cofbdt )
324
241
! "VITESSE" DE DIFFUSION FACETTE
326
if( idiff(iuiph).ge. 1 ) then
243
if( idiff(iu).ge. 1 ) then
328
245
w1 (iel) = propce(iel,ipcvis) &
329
+idifft(iuiph)*propce(iel,ipcvst)
246
+idifft(iu)*propce(iel,ipcvst)
333
( idebia , idebra , &
334
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
335
nnod , lndfac , lndfbr , ncelbr , &
336
nideve , nrdeve , nituse , nrtuse , imvisf , &
337
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
338
ipnfac , nodfac , ipnfbr , nodfbr , &
339
idevel , ituser , ia , &
340
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
343
rdevel , rtuser , ra )
346
255
do ifac = 1, nfac
387
( idebia , idebra , &
388
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
389
nnod , lndfac , lndfbr , ncelbr , nphas , &
390
nideve , nrdeve , nituse , nrtuse , &
391
iivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp , &
299
( iivar , imrgra , inc , iccocg , nswrgp , imligp , &
392
300
iwarnp , nfecra , epsrgp , climgp , extrap , &
393
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
394
ipnfac , nodfac , ipnfbr , nodfbr , &
395
idevel , ituser , ia , &
396
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
398
301
propce(1,ipcrom), propfb(1,ipbrom), coefbr , &
399
grarox , graroy , graroz , &
400
! ------ ------ ------
402
rdevel , rtuser , ra )
405
w3(iel) = (grarox(iel)*gx + graroy(iel)*gy + graroz(iel)*gz)&
305
w3(iel) = (grad(iel,1)*gx + grad(iel,2)*gy + grad(iel,3)*gz)&
406
306
/propce(iel,ipcrom)
407
307
w3(iel) = 1.d0/sqrt(max(epzero,w3(iel)))
411
315
! On met le nombre de clippings a 0 (il le restera pour IDTVAR=0)
434
338
! Matrice a priori non symetrique
439
( idebia , idebra , &
440
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
441
nnod , lndfac , lndfbr , ncelbr , &
442
nideve , nrdeve , nituse , nrtuse , &
443
iconv(iuiph) , idiff0 , isym , &
444
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
445
ipnfac , nodfac , ipnfbr , nodfbr , &
446
idevel , ituser , ia , &
447
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
343
( iconv(iu) , idiff0 , isym , &
448
344
cofbdt , propfa(1,iflmas), propfb(1,iflmab), viscf , viscb , &
450
rdevel , rtuser , ra )
453
348
rom = propce(iel,ipcrom)
494
389
! Matrice a priori symetrique
499
( idebia , idebra , &
500
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
501
nnod , lndfac , lndfbr , ncelbr , &
502
nideve , nrdeve , nituse , nrtuse , &
503
iconv0 , idiff(iuiph) , isym , &
504
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
505
ipnfac , nodfac , ipnfbr , nodfbr , &
506
idevel , ituser , ia , &
507
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
394
( iconv0 , idiff(iu) , isym , &
508
395
cofbdt , propfa(1,iflmas), propfb(1,iflmab), viscf , viscb , &
510
rdevel , rtuser , ra )
513
399
rom = propce(iel,ipcrom)
742
( idebia , idebra , &
743
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
744
nnod , lndfac , lndfbr , ncelbr , &
745
nideve , nrdeve , nituse , nrtuse , &
746
iconv(iuiph) , idiff0 , isym , &
747
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
748
ipnfac , nodfac , ipnfbr , nodfbr , &
749
idevel , ituser , ia , &
750
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
628
( iconv(iu) , idiff0 , isym , &
751
629
cofbdt , propfa(1,iflmas), propfb(1,iflmab), viscf , viscb , &
753
rdevel , rtuser , ra )
756
633
rom = propce(iel,ipcrom)
834
( idebia , idebra , &
835
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
836
nnod , lndfac , lndfbr , ncelbr , &
837
nideve , nrdeve , nituse , nrtuse , &
838
iconv0 , idiff(iuiph) , isym , &
839
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
840
ipnfac , nodfac , ipnfbr , nodfbr , &
841
idevel , ituser , ia , &
842
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
711
( iconv0 , idiff(iu) , isym , &
843
712
cofbdt , propfa(1,iflmas), propfb(1,iflmab), viscf , viscb , &
845
rdevel , rtuser , ra )
848
716
rom = propce(iel,ipcrom)
923
791
! MATRICE A PRIORI NON SYMETRIQUE
926
if (iconv(iuiph).gt.0) isym = 2
794
if (iconv(iu).gt.0) isym = 2
930
( idebia , idebra , &
931
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
932
nnod , lndfac , lndfbr , ncelbr , &
933
nideve , nrdeve , nituse , nrtuse , &
934
iconv(iuiph) , idiff(iuiph) , isym , &
935
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
936
ipnfac , nodfac , ipnfbr , nodfbr , &
937
idevel , ituser , ia , &
938
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
798
( iconv(iu) , idiff(iu) , isym , &
939
799
cofbdt , propfa(1,iflmas), propfb(1,iflmab), viscf , viscb , &
941
rdevel , rtuser , ra )
944
803
rom = propce(iel,ipcrom)
1076
if (iconv(iuiph).gt.0) isym = 2
935
if (iconv(iu).gt.0) isym = 2
1080
( idebia , idebra , &
1081
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
1082
nnod , lndfac , lndfbr , ncelbr , &
1083
nideve , nrdeve , nituse , nrtuse , &
1084
iconv(iuiph) , idiff(iuiph) , isym, &
1085
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
1086
ipnfac , nodfac , ipnfbr , nodfbr , &
1087
idevel , ituser , ia , &
1088
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
1089
coefb(1,iuiph) , propfa(1,iflmas), propfb(1,iflmab), &
939
( iconv(iu) , idiff(iu) , isym, &
940
coefb(1,iu) , propfa(1,iflmas), propfb(1,iflmab), &
1090
941
viscf , viscb , &
1091
dt , rdevel , rtuser , ra )
1093
944
do iel = 1, ncel
1094
dt(iel) = relaxv(iuiph)*propce(iel,ipcrom) &
945
dt(iel) = relaxv(iu)*propce(iel,ipcrom) &
1095
946
*volume(iel)/max(dt(iel),epzero)
952
deallocate(viscf, viscb)
955
if (allocated(wcf)) deallocate(wcf)
956
deallocate(w1, w2, w3)