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 codits &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , &
35
nideve , nrdeve , nituse , nrtuse , &
36
27
idtvar , ivar , iconvp , idiffp , ireslp , ndircp , nitmap , &
37
28
imrgra , nswrsp , nswrgp , imligp , ircflp , &
38
29
ischcp , isstpp , iescap , &
39
30
imgrp , ncymxp , nitmfp , ipp , iwarnp , &
40
31
blencp , epsilp , epsrsp , epsrgp , climgp , extrap , &
41
32
relaxp , thetap , &
42
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
43
ipnfac , nodfac , ipnfbr , nodfbr , &
44
idevel , ituser , ia , &
45
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
47
34
coefap , coefbp , cofafp , cofbfp , flumas , flumab , &
48
35
viscfm , viscbm , viscfs , viscbs , &
49
36
rovsdt , smbrp , pvar , &
51
w1 , w2 , w3 , w4 , w5 , &
52
w6 , w7 , w8 , smbini , &
53
rdevel , rtuser , ra )
55
39
!===============================================================================
107
91
!__________________.____._____.________________________________________________.
108
92
! name !type!mode ! role !
109
93
!__________________!____!_____!________________________________________________!
110
! idbia0 ! i ! <-- ! number of first free position in ia !
111
! idbra0 ! i ! <-- ! number of first free position in ra !
112
! ndim ! i ! <-- ! spatial dimension !
113
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
114
! ncel ! i ! <-- ! number of cells !
115
! nfac ! i ! <-- ! number of interior faces !
116
! nfabor ! i ! <-- ! number of boundary faces !
117
! nfml ! i ! <-- ! number of families (group classes) !
118
! nprfml ! i ! <-- ! number of properties per family (group class) !
119
! nnod ! i ! <-- ! number of vertices !
120
! lndfac ! i ! <-- ! size of nodfac indexed array !
121
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
122
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
123
94
! nvar ! i ! <-- ! total number of variables !
124
95
! nscal ! i ! <-- ! total number of scalars !
125
! nphas ! i ! <-- ! number of phases !
126
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
127
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
128
96
! idtvar ! e ! <-- ! indicateur du schema temporel !
129
97
! ivar ! e ! <-- ! variable traitee !
130
98
! iconvp ! e ! <-- ! indicateur = 1 convection, 0 sinon !
168
136
! ! ! ! totalement centre en temps (mixage !
169
137
! ! ! ! entre crank-nicolson et adams- !
170
138
! ! ! ! bashforth) !
171
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
172
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
173
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
174
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
175
! iprfml ! ia ! <-- ! property numbers per family !
176
! (nfml, nprfml) ! ! ! !
177
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
178
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
179
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
180
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
181
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
182
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
183
! ia(*) ! ia ! --- ! main integer work array !
184
! xyzcen ! ra ! <-- ! cell centers !
185
! (ndim, ncelet) ! ! ! !
186
! surfac ! ra ! <-- ! interior faces surface vectors !
187
! (ndim, nfac) ! ! ! !
188
! surfbo ! ra ! <-- ! boundary faces surface vectors !
189
! (ndim, nfabor) ! ! ! !
190
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
191
! (ndim, nfac) ! ! ! !
192
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
193
! (ndim, nfabor) ! ! ! !
194
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
195
! (ndim, nnod) ! ! ! !
196
! volume(ncelet) ! ra ! <-- ! cell volumes !
197
139
! pvara(ncelet ! tr ! <-- ! variable resolue (instant precedent) !
198
140
! pvark(ncelet ! tr ! <-- ! variable de la sous-iteration !
199
141
! ! ! ! precedente. pour un point fixe sur !
215
157
! rovsdt(ncelet ! tr ! <-- ! rho*volume/dt !
216
158
! smbrp(ncelet ! tr ! <-- ! bilan au second membre !
217
159
! pvar (ncelet ! tr ! <-- ! variable resolue !
218
! dam(ncelet ! tr ! --> ! tableau de travail pour matrice !
219
! ! ! ! et resultat estimateur !
220
! xam(nfac,*) ! tr ! --- ! tableau de travail pour matrice !
221
! w1...8(ncelet ! tr ! --- ! tableau de travail !
222
! smbini(ncelet ! tr ! --- ! tableau de travail !
223
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
224
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
225
! ra(*) ! ra ! --- ! main real work array !
160
! eswork(ncelet) ! ra ! <-- ! prediction-stage error estimator (iescap > 0) !
226
161
!__________________!____!_____!________________________________________________!
228
163
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
231
166
! --- tableau de travail
232
167
!===============================================================================
169
!===============================================================================
171
!===============================================================================
180
use optcal, only: rlxp1
183
!===============================================================================
236
!===============================================================================
238
!===============================================================================
248
!===============================================================================
252
integer idbia0 , idbra0
253
integer ndim , ncelet , ncel , nfac , nfabor
254
integer nfml , nprfml
255
integer nnod , lndfac , lndfbr , ncelbr
256
integer nvar , nscal , nphas
257
integer nideve , nrdeve , nituse , nrtuse
258
190
integer idtvar , ivar , iconvp , idiffp , ndircp
260
192
integer imrgra , nswrsp , nswrgp , imligp , ircflp
264
196
double precision blencp , epsilp , epsrgp , climgp , extrap
265
197
double precision relaxp , thetap , epsrsp
267
integer ifacel(2,nfac) , ifabor(nfabor)
268
integer ifmfbr(nfabor) , ifmcel(ncelet)
269
integer iprfml(nfml,nprfml)
270
integer ipnfac(nfac+1), nodfac(lndfac)
271
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
272
integer idevel(nideve), ituser(nituse)
275
double precision xyzcen(ndim,ncelet)
276
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
277
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
278
double precision xyznod(ndim,nnod), volume(ncelet)
279
200
double precision pvara(ncelet), pvark(ncelet)
280
201
double precision coefap(nfabor), coefbp(nfabor)
281
202
double precision cofafp(nfabor), cofbfp(nfabor)
284
205
double precision viscfs(nfac), viscbs(nfabor)
285
206
double precision rovsdt(ncelet), smbrp(ncelet)
286
207
double precision pvar(ncelet)
287
double precision dam(ncelet), xam(nfac ,2)
288
double precision dpvar(ncelet)
289
double precision w1(ncelet), w2(ncelet), w3(ncelet), w4(ncelet)
290
double precision w5(ncelet), w6(ncelet), w7(ncelet), w8(ncelet)
291
double precision smbini(ncelet)
292
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
208
double precision eswork(ncelet)
294
210
! Local variables
296
212
character*80 chaine
299
integer idebia, idebra
300
215
integer isym,ireslp,ireslq,ipol,isqrt
301
216
integer inc,isweep,niterf,iccocg,iel,icycle,nswmod
302
integer iphas,idimte,itenso,iinvpe, iinvpp
217
integer idimte,itenso,iinvpe, iinvpp
304
219
integer iagmax, nagmax, npstmg
305
222
double precision residu,rnorm
306
223
double precision thetex
225
double precision, allocatable, dimension(:) :: dam
226
double precision, allocatable, dimension(:,:) :: xam
227
double precision, allocatable, dimension(:) :: dpvar, smbini, w1
308
229
!===============================================================================
310
231
!===============================================================================
311
232
! 1. INITIALISATIONS
312
233
!===============================================================================
235
! Allocate temporary arrays
236
allocate(dam(ncelet), xam(nfac,2))
237
allocate(dpvar(ncelet), smbini(ncelet))
318
241
chaine = nomvar(ipp)
321
244
! MATRICE A PRIORI SYMETRIQUE ( = 1)
362
if(ivar.eq.iu(iphas).or.ivar.eq.iv(iphas).or. &
363
ivar.eq.iw(iphas).or. &
364
ivar.eq.ir11(iphas).or.ivar.eq.ir12(iphas).or. &
365
ivar.eq.ir13(iphas).or.ivar.eq.ir22(iphas).or. &
366
ivar.eq.ir23(iphas).or.ivar.eq.ir33(iphas)) then
368
! Pour la vitesse et les tensions de Reynolds, et les tpucou
369
! seules seront echangees les informations sur les faces periodiques
370
! de translation dans percom ; on ne touche pas aux informations
371
! relatives aux faces de periodicite de rotation.
375
! Lors de la resolution par increments, on echangera egalement les
376
! informations relatives aux faces de periodicite de translation.
377
! Pour les faces de periodicite de rotation, l'increment sera
378
! annule dans percom (iinvpe=2).
284
if(ivar.eq.iu.or.ivar.eq.iv.or.ivar.eq.iw.or. &
285
ivar.eq.ir11.or.ivar.eq.ir12.or. &
286
ivar.eq.ir13.or.ivar.eq.ir22.or. &
287
ivar.eq.ir23.or.ivar.eq.ir33) then
289
! Pour la vitesse et les tensions de Reynolds, et les tpucou
290
! seules seront echangees les informations sur les faces periodiques
291
! de translation dans percom ; on ne touche pas aux informations
292
! relatives aux faces de periodicite de rotation.
296
! Lors de la resolution par increments, on echangera egalement les
297
! informations relatives aux faces de periodicite de translation.
298
! Pour les faces de periodicite de rotation, l'increment sera
299
! annule dans percom (iinvpe=2).
448
( idebia , idebra , &
449
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
450
nnod , lndfac , lndfbr , ncelbr , &
451
nvar , nscal , nphas , &
452
nideve , nrdeve , nituse , nrtuse , &
453
369
idtvar , ivar , iconvp , idiffp , nswrgp , imligp , ircflp , &
454
370
ischcp , isstpp , inc , imrgra , iccocg , &
456
372
blencp , epsrgp , climgp , extrap , relaxp , thetex , &
457
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
458
ipnfac , nodfac , ipnfbr , nodfbr , &
459
idevel , ituser , ia , &
460
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
461
373
pvara , pvara , coefap , coefbp , cofafp , cofbfp , &
462
374
flumas , flumab , viscfs , viscbs , &
465
w1 , w2 , w3 , w4 , w5 , w6 , &
466
rdevel , rtuser , ra )
469
378
! AVANT DE BOUCLER SUR LES SWEEP, ON STOCKE LE SECOND MEMBRE SANS
522
( idebia , idebra , &
523
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
524
nnod , lndfac , lndfbr , ncelbr , &
525
nvar , nscal , nphas , &
526
nideve , nrdeve , nituse , nrtuse , &
527
432
idtvar , ivar , iconvp , idiffp , nswrgp , imligp , ircflp , &
528
433
ischcp , isstpp , inc , imrgra , iccocg , &
530
435
blencp , epsrgp , climgp , extrap , relaxp , thetap , &
531
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
532
ipnfac , nodfac , ipnfbr , nodfbr , &
533
idevel , ituser , ia , &
534
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
535
436
pvar , pvara , coefap , coefbp , cofafp , cofbfp , &
536
437
flumas , flumab , viscfs , viscbs , &
539
w1 , w2 , w3 , w4 , w5 , w6 , &
540
rdevel , rtuser , ra )
542
440
call prodsc(ncelet,ncel,isqrt,smbrp,smbrp,residu)
574
476
dpvar(iel) = 0.d0
579
( cnom , idebia , idebra , &
580
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
581
nnod , lndfac , lndfbr , ncelbr , &
582
nideve , nrdeve , nituse , nrtuse , &
583
isym , ipol , ireslq , nitmap , imgrp , &
482
( cnom , isym , ibsize , &
483
ipol , ireslq , nitmap , imgrp , &
584
484
ncymxp , nitmfp , &
585
485
iwarnp , nfecra , niterf , icycle , iinvpe , &
586
486
epsilp , rnorm , residu , &
587
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
588
ipnfac , nodfac , ipnfbr , nodfbr , &
589
idevel , ituser , ia , &
590
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
591
dam , xam , smbrp , dpvar , &
592
w3 , w4 , w5 , w6 , w7 , w8 , &
593
rdevel , rtuser , ra )
487
dam , xam , smbrp , dpvar )
596
490
nbivar(ipp) = niterf
630
524
if( residu.le.epsrsp*rnorm ) then
631
525
if(iwarnp.ge.1) then
632
write( nfecra,1000) cnom,isweep,residu,rnorm
526
write(nfecra,1000) cnom,isweep,residu,rnorm
637
531
if(iwarnp.ge.3) then
638
write( nfecra,1000) cnom,isweep,residu,rnorm
532
write(nfecra,1000) cnom,isweep,residu,rnorm
643
537
if(iwarnp.ge.2) then
644
write( nfecra,1100)cnom, nswmod
538
write(nfecra,1100) cnom, nswmod
647
541
!===============================================================================
675
( idebia , idebra , &
676
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
677
nnod , lndfac , lndfbr , ncelbr , &
678
nvar , nscal , nphas , &
679
nideve , nrdeve , nituse , nrtuse , &
680
570
idtva0 , ivar , iconvp , idiffp , nswrgp , imligp , ircflp , &
681
571
ischcp , isstpp , inc , imrgra , iccocg , &
683
573
blencp , epsrgp , climgp , extrap , relaxp , thetap , &
684
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
685
ipnfac , nodfac , ipnfbr , nodfbr , &
686
idevel , ituser , ia , &
687
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
688
574
pvar , pvara , coefap , coefbp , cofafp , cofbfp , &
689
575
flumas , flumab , viscfs , viscbs , &
692
w1 , w2 , w3 , w4 , w5 , w6 , &
693
rdevel , rtuser , ra )
695
578
! CONTRIBUTION DES NORMES L2 DES DIFFERENTES COMPOSANTES
696
! DANS LE TABLEAU DAM QUI EST ICI DISPONIBLE.
579
! DANS LE TABLEAU ESWORK
699
dam(iel) = (smbrp(iel)/ volume(iel))**2
582
eswork(iel) = (smbrp(iel)/ volume(iel))**2