1
1
!-------------------------------------------------------------------------------
3
! This file is part of the Code_Saturne Kernel, element of the
4
! Code_Saturne CFD tool.
6
! Copyright (C) 1998-2010 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 testel &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , nphas , nvar , &
34
nideve , nrdeve , nituse , nrtuse , &
35
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
36
ipnfac , nodfac , ipnfbr , nodfbr , &
37
idevel , ituser , ia , &
38
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
41
rdevel , rtuser , ra )
43
29
!===============================================================================
49
35
!__________________.____._____.________________________________________________.
50
36
! name !type!mode ! role !
51
37
!__________________!____!_____!________________________________________________!
52
! idbia0 ! i ! <-- ! number of first free position in ia !
53
! idbra0 ! i ! <-- ! number of first free position in ra !
54
! ndim ! i ! <-- ! spatial dimension !
55
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
56
! ncel ! i ! <-- ! number of cells !
57
! nfac ! i ! <-- ! number of interior faces !
58
! nfabor ! i ! <-- ! number of boundary faces !
59
! nfml ! i ! <-- ! number of families (group classes) !
60
! nprfml ! i ! <-- ! number of properties per family (group class) !
61
! nnod ! i ! <-- ! number of vertices !
62
! lndfac ! i ! <-- ! size of nodfac indexed array !
63
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
64
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
65
38
! nvar ! i ! <-- ! total number of variables !
66
39
! nscal ! i ! <-- ! total number of scalars !
67
! nphas ! i ! <-- ! number of phases !
68
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
69
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
70
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
71
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
72
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
73
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
74
! iprfml ! ia ! <-- ! property numbers per family !
75
! (nfml, nprfml) ! ! ! !
76
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
77
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
78
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
79
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
80
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
81
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
82
! ia(*) ! ia ! --- ! main integer work array !
83
! xyzcen ! ra ! <-- ! cell centers !
84
! (ndim, ncelet) ! ! ! !
85
! surfac ! ra ! <-- ! interior faces surface vectors !
86
! (ndim, nfac) ! ! ! !
87
! surfbo ! ra ! <-- ! boundary faces surface vectors !
88
! (ndim, nfabor) ! ! ! !
89
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
90
! (ndim, nfac) ! ! ! !
91
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
92
! (ndim, nfabor) ! ! ! !
93
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
94
! (ndim, nnod) ! ! ! !
95
! volume(ncelet) ! ra ! <-- ! cell volumes !
96
40
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
97
41
! (ncelet, *) ! ! ! (at current and previous time steps) !
98
42
! coefa, coefb ! ra ! <-- ! boundary conditions !
99
43
! (nfabor, *) ! ! ! !
100
44
! w1,2,3,4,5,6 ! ra ! --- ! work arrays !
101
45
! (ncelet) ! ! ! (computation of pressure gradient) !
102
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
103
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
104
! ra(*) ! ra ! --- ! main real work array !
105
46
!__________________!____!_____!________________________________________________!
107
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
108
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
109
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
110
! --- tableau de travail
48
! Type: i (integer), r (real), s (string), a (array), l (logical),
49
! and composite types (ex: ra real array)
50
! mode: <-- input, --> output, <-> modifies data, --- work array
51
!===============================================================================
53
!===============================================================================
55
!===============================================================================
58
use dimens, only: ndimfb
111
68
!===============================================================================
115
!===============================================================================
117
!===============================================================================
129
!===============================================================================
133
integer idbia0 , idbra0
134
integer ndim , ncelet , ncel , nfac , nfabor
135
integer nfml , nprfml
136
integer nnod , lndfac , lndfbr , ncelbr , nphas , nvar
137
integer nideve , nrdeve , nituse , nrtuse
139
integer ifacel(2,nfac) , ifabor(nfabor)
140
integer ifmfbr(nfabor) , ifmcel(ncelet)
141
integer iprfml(nfml,nprfml)
142
integer ipnfac(nfac+1), nodfac(lndfac)
143
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
144
integer idevel(nideve), ituser(nituse)
147
double precision xyzcen(ndim,ncelet)
148
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
149
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
150
double precision xyznod(ndim,nnod), volume(ncelet)
151
77
double precision rtp(ncelet,*)
152
78
double precision coefa(ndimfb,*), coefb(ndimfb,*)
153
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
157
integer idebia, idebra, ifinia, ifinra
158
integer ifac , iel , ivar , iphas
159
integer inc , iccocg, iphydp
160
integer iuiph , iviph , iwiph
83
integer ifac , iel , ivar
161
85
integer nswrgp, imligp, iwarnp
163
integer iw1 , iw2 , iw3
86
integer ipclip, ialold
164
87
integer indwri, indact, ipart, idimt, ientla, ivarpr
89
double precision ttpost
166
90
double precision epsrgp, climgp, extrap
167
91
double precision xx, yy, zz
168
92
double precision rbid(1)
170
94
character*32 namevr
96
double precision, allocatable, dimension(:,:) :: grad
172
98
!===============================================================================
174
100
!===============================================================================
175
101
! 0. INITIALISATIONS
176
102
!===============================================================================
104
! Allocate temporary arrays
105
allocate(grad(ncelet,3))
180
107
! On positionne l'indicateur ALE a 1 de maniere a forcer le recalcul
181
108
! de la contribution des cellules de bord a chaque appel de GRDCEL
187
ifinra = iw3 + ncelet
189
CALL RASIZE('TESTEL',IFINRA)
112
! Postprocessing should be time-independent
193
117
! value 0 avoids extrapolating the gradient on boundary faces.
194
118
do ifac = 1, nfabor
195
ia(iisymp-1+ifac) = 0
198
122
!===============================================================================
199
123
! 1. FONCTION ANALYTIQUE SIN(X+2Y+3Z)
200
124
!===============================================================================
208
127
ipclip = iclrtp(ivar,icoef)
210
129
do iel = 1, ncelet
271
( ifinia , ifinra , &
272
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
273
nnod , lndfac , lndfbr , ncelbr , nphas , &
274
nideve , nrdeve , nituse , nrtuse , &
275
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp ,&
189
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
276
190
iwarnp , nfecra , &
277
191
epsrgp , climgp , extrap , &
278
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
279
ipnfac , nodfac , ipnfbr , nodfbr , &
280
idevel , ituser , ia , &
281
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
282
ra(iw1), ra(iw1), ra(iw1), &
283
192
rtp(1,ivar) , coefa(1,ipclip) , coefb(1,ipclip) , &
284
rtp(1,iuiph) , rtp(1,iviph) , rtp(1,iwiph) , &
285
ra(iw1), ra(iw2), ra(iw3), &
286
rdevel , rtuser , ra )
288
195
! On sort le gradient
291
if (ichrvl.eq.1) then
292
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
294
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
198
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
200
ntpost, ttpost, grad, rbid, rbid)
297
202
! Calcul de l'erreur absolue
326
( ifinia , ifinra , &
327
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
328
nnod , lndfac , lndfbr , ncelbr , nphas , &
329
nideve , nrdeve , nituse , nrtuse , &
330
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp ,&
229
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
331
230
iwarnp , nfecra , &
332
231
epsrgp , climgp , extrap , &
333
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
334
ipnfac , nodfac , ipnfbr , nodfbr , &
335
idevel , ituser , ia , &
336
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
337
ra(iw1), ra(iw1), ra(iw1), &
338
232
rtp(1,ivar) , coefa(1,ipclip) , coefb(1,ipclip) , &
339
rtp(1,iuiph) , rtp(1,iviph) , rtp(1,iwiph) , &
340
ra(iw1), ra(iw2), ra(iw3), &
341
rdevel , rtuser , ra )
344
235
! On sort le gradient
347
if (ichrvl.eq.1) then
348
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
350
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
238
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
240
ntpost, ttpost, grad, rbid, rbid)
353
242
! Calcul de l'erreur absolue
382
( ifinia , ifinra , &
383
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
384
nnod , lndfac , lndfbr , ncelbr , nphas , &
385
nideve , nrdeve , nituse , nrtuse , &
386
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp ,&
269
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
387
270
iwarnp , nfecra , &
388
271
epsrgp , climgp , extrap , &
389
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
390
ipnfac , nodfac , ipnfbr , nodfbr , &
391
idevel , ituser , ia , &
392
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
393
ra(iw1), ra(iw1), ra(iw1), &
394
272
rtp(1,ivar) , coefa(1,ipclip) , coefb(1,ipclip) , &
395
rtp(1,iuiph) , rtp(1,iviph) , rtp(1,iwiph) , &
396
ra(iw1), ra(iw2), ra(iw3), &
397
rdevel , rtuser , ra )
399
275
! On sort le gradient
401
NAMEVR = 'Grad_LSQ_Ext'
402
if (ichrvl.eq.1) then
403
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
405
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
277
namevr = 'Grad_LSQ_Ext'
278
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
280
ntpost, ttpost, grad, rbid, rbid)
408
282
! Calcul de l'erreur absolue
411
285
xx = xyzcen(1,iel)
412
286
yy = xyzcen(2,iel)
413
287
zz = xyzcen(3,iel)
414
rtp(iel,iuiph) = rtp(iel,iuiph)- cos(xx+2.d0*yy+3.d0*zz)
415
rtp(iel,iviph) = rtp(iel,iviph)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
416
rtp(iel,iwiph) = rtp(iel,iwiph)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
288
grad(iel,1) = grad(iel,1)- cos(xx+2.d0*yy+3.d0*zz)
289
grad(iel,2) = grad(iel,2)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
290
grad(iel,3) = grad(iel,3)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
419
293
! On sort l'erreur
421
NAMEVR = 'Err_Grad_LSQ_Ext'
422
if (ichrvl.eq.1) then
423
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
425
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
295
namevr = 'Err_Grad_LSQ_Ext'
296
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
298
ntpost, ttpost, grad, rbid, rbid)
429
301
! 2.4 APPEL A GRDCEL AVEC IMRGRA = 4
437
( ifinia , ifinra , &
438
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
439
nnod , lndfac , lndfbr , ncelbr , nphas , &
440
nideve , nrdeve , nituse , nrtuse , &
441
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp ,&
309
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
442
310
iwarnp , nfecra , &
443
311
epsrgp , climgp , extrap , &
444
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
445
ipnfac , nodfac , ipnfbr , nodfbr , &
446
idevel , ituser , ia , &
447
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
448
ra(iw1), ra(iw1), ra(iw1), &
449
312
rtp(1,ivar) , coefa(1,ipclip) , coefb(1,ipclip) , &
450
rtp(1,iuiph) , rtp(1,iviph) , rtp(1,iwiph) , &
451
ra(iw1), ra(iw2), ra(iw3), &
452
rdevel , rtuser , ra )
454
315
! On sort le gradient
456
NAMEVR = 'Grad_LSQ_RC'
457
if (ichrvl.eq.1) then
458
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
460
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
317
namevr = 'Grad_LSQ_RC'
318
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
320
ntpost, ttpost, grad, rbid, rbid)
463
322
! Calcul de l'erreur absolue
466
325
xx = xyzcen(1,iel)
467
326
yy = xyzcen(2,iel)
468
327
zz = xyzcen(3,iel)
469
rtp(iel,iuiph) = rtp(iel,iuiph)- cos(xx+2.d0*yy+3.d0*zz)
470
rtp(iel,iviph) = rtp(iel,iviph)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
471
rtp(iel,iwiph) = rtp(iel,iwiph)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
328
grad(iel,1) = grad(iel,1)- cos(xx+2.d0*yy+3.d0*zz)
329
grad(iel,2) = grad(iel,2)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
330
grad(iel,3) = grad(iel,3)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
474
333
! On sort l'erreur
476
NAMEVR = 'Err_Grad_LSQ_RC'
477
if (ichrvl.eq.1) then
478
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
480
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
335
namevr = 'Err_Grad_LSQ_RC'
336
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
338
ntpost, ttpost, grad, rbid, rbid)
484
341
! 2.5 APPEL A GRDCEL AVEC IMRGRA = 3
497
( ifinia , ifinra , &
498
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
499
nnod , lndfac , lndfbr , ncelbr , nphas , &
500
nideve , nrdeve , nituse , nrtuse , &
501
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp ,&
354
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
502
355
iwarnp , nfecra , &
503
356
epsrgp , climgp , extrap , &
504
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
505
ipnfac , nodfac , ipnfbr , nodfbr , &
506
idevel , ituser , ia , &
507
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
508
ra(iw1), ra(iw1), ra(iw1), &
509
357
rtp(1,ivar) , coefa(1,ipclip) , coefb(1,ipclip) , &
510
rtp(1,iuiph) , rtp(1,iviph) , rtp(1,iwiph) , &
511
ra(iw1), ra(iw2), ra(iw3), &
512
rdevel , rtuser , ra )
514
360
! On sort le gradient
516
NAMEVR = 'Grad_LSQ_ExtRed'
517
if (ichrvl.eq.1) then
518
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
520
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
362
namevr = 'Grad_LSQ_ExtRed'
363
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
365
ntpost, ttpost, grad, rbid, rbid)
523
367
! Calcul de l'erreur absolue
526
370
xx = xyzcen(1,iel)
527
371
yy = xyzcen(2,iel)
528
372
zz = xyzcen(3,iel)
529
rtp(iel,iuiph) = rtp(iel,iuiph)- cos(xx+2.d0*yy+3.d0*zz)
530
rtp(iel,iviph) = rtp(iel,iviph)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
531
rtp(iel,iwiph) = rtp(iel,iwiph)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
373
grad(iel,1) = grad(iel,1)- cos(xx+2.d0*yy+3.d0*zz)
374
grad(iel,2) = grad(iel,2)-2.d0*cos(xx+2.d0*yy+3.d0*zz)
375
grad(iel,3) = grad(iel,3)-3.d0*cos(xx+2.d0*yy+3.d0*zz)
534
378
! On sort l'erreur
536
NAMEVR = 'Err_Grad_LSQ_ExtRed'
537
if (ichrvl.eq.1) then
538
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
540
ntcabs, ttcabs, rtp(1,iuiph), rbid, rbid)
380
namevr = 'Err_Grad_LSQ_ExtRed'
381
call psteva(ipart , namevr, idimt, ientla, ivarpr, &
383
ntpost, ttpost, grad, rbid, rbid)
385
! Reset ALE flag to old value
386
! de la contribution des cellules de bord a chaque appel de GRDCEL