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 csc2cl &
32
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
33
nnod , lndfac , lndfbr , ncelbr , &
34
nvar , nscal , nphas , &
35
27
nvcp , nvcpto , nfbcpl , nfbncp , &
36
nideve , nrdeve , nituse , nrtuse , &
37
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
38
ipnfac , nodfac , ipnfbr , nodfbr , &
39
28
icodcl , itrifb , itypfb , &
40
29
lfbcpl , lfbncp , &
41
idevel , ituser , ia , &
42
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
43
30
dt , rtp , rtpa , propce , propfa , propfb , &
44
31
coefa , coefb , rcodcl , &
45
w1 , w2 , w3 , w4 , w5 , w6 , coefu , &
46
rvcpfb , pndcpl , dofcpl , &
47
rdevel , rtuser , ra )
32
rvcpfb , pndcpl , dofcpl )
49
34
!===============================================================================
53
! TRADUCTION DE LA CONDITION ITYPFB(*,*) = ICSCPL
38
! Translation of the "itypfb(*, *) = icscpl" condition.
55
40
!-------------------------------------------------------------------------------
57
42
!__________________.____._____.________________________________________________.
58
43
! name !type!mode ! role !
59
44
!__________________!____!_____!________________________________________________!
60
! idbia0 ! i ! <-- ! number of first free position in ia !
61
! idbra0 ! i ! <-- ! number of first free position in ra !
62
! ndim ! i ! <-- ! spatial dimension !
63
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
64
! ncel ! i ! <-- ! number of cells !
65
! nfac ! i ! <-- ! number of interior faces !
66
! nfabor ! i ! <-- ! number of boundary faces !
67
! nfml ! i ! <-- ! number of families (group classes) !
68
! nprfml ! i ! <-- ! number of properties per family (group class) !
69
! nnod ! i ! <-- ! number of vertices !
70
! lndfac ! i ! <-- ! size of nodfac indexed array !
71
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
72
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
73
45
! nvar ! i ! <-- ! total number of variables !
74
46
! nscal ! i ! <-- ! total number of scalars !
75
! nphas ! i ! <-- ! number of phases !
76
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
77
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
78
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
79
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
80
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
81
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
82
! iprfml ! ia ! <-- ! property numbers per family !
83
! (nfml, nprfml) ! ! ! !
84
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
85
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
86
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
87
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
88
! icodcl ! te ! --> ! code de condition limites aux faces !
89
! (nfabor,nvar ! ! ! de bord !
90
! ! ! ! = 1 -> dirichlet !
91
! ! ! ! = 3 -> densite de flux !
92
! ! ! ! = 4 -> glissemt et u.n=0 (vitesse) !
93
! ! ! ! = 5 -> frottemt et u.n=0 (vitesse) !
94
! ! ! ! = 9 -> entree/sortie libre (vitesse !
95
! ! ! ! entrante eventuelle bloquee !
96
! ! ! ! = 10 -> entree/sortie libre (vitesse !
97
! ! ! ! entrante eventuelle non bloquee : !
98
! ! ! ! prescrire une valeur de dirichlet en !
99
! ! ! ! prevision pour les scalaires k, eps, !
100
! ! ! ! scal en plus du neumann usuel !
47
! icodcl ! te ! --> ! boundary condition code at boundary faces !
48
! (nfabor, nvar) ! ! ! = 1 -> dirichlet !
49
! ! ! ! = 3 -> flux density !
50
! ! ! ! = 4 -> sliding and u.n=0 (velocity) !
51
! ! ! ! = 5 -> friction and u.n=0 (velocity) !
52
! ! ! ! = 9 -> free inlet/outlet (inlet velocity !
53
! ! ! ! possibly fixed) !
54
! ! ! ! = 10 -> free inlet/outlet (possible inlet !
55
! ! ! ! volocity not fixed: prescribe a Dirichlet !
56
! ! ! ! value for scalars k, eps, scal in addition to !
57
! ! ! ! the usual Neumann !
101
58
! itrifb ! ia ! <-- ! indirection for boundary faces ordering !
102
! (nfabor, nphas) ! ! ! !
103
59
! itypfb ! ia ! --> ! boundary face types !
104
! (nfabor, nphas) ! ! ! !
105
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
106
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
107
! ia(*) ! ia ! --- ! main integer work array !
108
! xyzcen ! ra ! <-- ! cell centers !
109
! (ndim, ncelet) ! ! ! !
110
! surfac ! ra ! <-- ! interior faces surface vectors !
111
! (ndim, nfac) ! ! ! !
112
! surfbo ! ra ! <-- ! boundary faces surface vectors !
113
! (ndim, nfabor) ! ! ! !
114
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
115
! (ndim, nfac) ! ! ! !
116
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
117
! (ndim, nfabor) ! ! ! !
118
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
119
! (ndim, nnod) ! ! ! !
120
! volume(ncelet) ! ra ! <-- ! cell volumes !
121
60
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
122
61
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
123
62
! (ncelet, *) ! ! ! (at current and previous time steps) !
126
65
! propfb(nfabor, *)! ra ! <-- ! physical properties at boundary face centers !
127
66
! coefa, coefb ! ra ! <-- ! boundary conditions !
128
67
! (nfabor, *) ! ! ! !
129
! rcodcl ! tr ! --> ! valeur des conditions aux limites !
130
! (nfabor,nvar ! ! ! aux faces de bord !
131
! ! ! ! rcodcl(1) = valeur du dirichlet !
132
! ! ! ! rcodcl(2) = valeur du coef. d'echange !
133
! ! ! ! ext. (infinie si pas d'echange) !
134
! ! ! ! rcodcl(3) = valeur de la densite de !
135
! ! ! ! flux (negatif si gain) w/m2 !
136
! ! ! ! pour les vitesses (vistl+visct)*gradu !
137
! ! ! ! pour la pression dt*gradp !
138
! ! ! ! pour les scalaires !
68
! rcodcl ! tr ! --> ! value of boundary conditions at boundary faces !
69
! (nfabor, nvar) ! ! ! rcodcl(1) = Dirichlet value !
70
! ! ! ! rcodcl(2) = ext. exchange coefficient value !
71
! ! ! ! (infinite if no exchange) !
72
! ! ! ! rcodcl(3) = value of the flux density !
73
! ! ! ! (negative if gain) in w/m2 !
74
! ! ! ! for velocities: (vistl+visct)*gradu !
75
! ! ! ! for pressure: dt*gradp !
76
! ! ! ! for scalars: !
139
77
! ! ! ! cp*(viscls+visct/sigmas)*gradt !
140
! w1,2,3,4,5,6 ! ra ! --- ! work arrays !
141
! (ncelet) ! ! ! (computation of pressure gradient) !
142
! rdevel(nrdeve) ! ra ! <-> ! real work array for temporary development !
143
! rtuser(nrtuse) ! ra ! <-> ! user-reserved real work array !
144
! ra(*) ! ra ! --- ! main real work array !
145
78
!__________________!____!_____!________________________________________________!
147
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
148
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
149
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
150
! --- tableau de travail
80
! Type: i (integer), r (real), s (string), a (array), l (logical),
81
! and composite types (ex: ra real array)
82
! mode: <-- input, --> output, <-> modifies data, --- work array
83
!===============================================================================
85
!===============================================================================
87
!===============================================================================
151
100
!===============================================================================
155
!===============================================================================
157
!===============================================================================
170
!===============================================================================
174
integer idbia0 , idbra0
175
integer ndim , ncelet , ncel , nfac , nfabor
176
integer nfml , nprfml
177
integer nnod , lndfac , lndfbr , ncelbr
178
integer nvar , nscal , nphas
179
integer nideve , nrdeve , nituse , nrtuse
180
107
integer nvcp , nvcpto
181
108
integer nfbcpl , nfbncp
183
integer ifacel(2,nfac) , ifabor(nfabor)
184
integer ifmfbr(nfabor) , ifmcel(ncelet)
185
integer iprfml(nfml,nprfml)
186
integer ipnfac(nfac+1) , nodfac(lndfac)
187
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
188
110
integer icodcl(nfabor,nvar)
189
111
integer lfbcpl(nfbcpl) , lfbncp(nfbncp)
190
integer itrifb(nfabor,nphas), itypfb(nfabor,nphas)
191
integer idevel(nideve), ituser(nituse)
112
integer itrifb(nfabor), itypfb(nfabor)
194
double precision xyzcen(ndim,ncelet)
195
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
196
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
197
double precision xyznod(ndim,nnod), volume(ncelet)
198
114
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
199
115
double precision propce(ncelet,*)
200
116
double precision propfa(nfac,*), propfb(nfabor,*)
201
117
double precision coefa(nfabor,*), coefb(nfabor,*)
202
118
double precision rcodcl(nfabor,nvar,3)
203
double precision w1(ncelet),w2(ncelet),w3(ncelet)
204
double precision w4(ncelet),w5(ncelet),w6(ncelet)
205
double precision coefu(nfabor,ndim)
206
119
double precision rvcpfb(nfbcpl,nvcpto), pndcpl(nfbcpl)
207
120
double precision dofcpl(3,nfbcpl)
208
double precision rdevel(nrdeve), rtuser(nrtuse)
209
double precision ra(*)
211
122
! Local variables
214
integer idebia, idebra
215
integer ifac, iel,isou, iphas
216
integer inc, iccocg, iphydp, iclvar, nswrgp, imligp
124
integer ifac, iel,isou
125
integer inc, iccocg, iclvar, nswrgp, imligp
217
126
integer iwarnp, ivar
227
136
double precision xif, yif, zif, xopf, yopf, zopf
228
137
double precision gradi, pondj, flumab
230
!===============================================================================
237
!================================================================================
238
! 1. TRADUCTION DU COUPLAGE EN TERMES DE CONDITIONS AUX LIMITES
239
!================================================================================
241
! On rappelle que les variables sont re�ues dans l'ordre de VARPOS ;
242
! il suffit dont de boucler sur les variables.
139
double precision, allocatable, dimension(:,:) :: grad
141
!===============================================================================
146
!===============================================================================
147
! 1. Translation of the coupling to boundary conditions
148
!===============================================================================
150
! Allocate a temporary array for gradient computation
151
allocate(grad(ncelet,3))
153
! Reminder: variables are received in the order of VARPOS;
154
! loopin on variables is thus sufficient.
244
156
do ivar = 1, nvcp
246
! --- Calcul du gradient de la variable si celle-ci est interpol�e
247
! Les �changes pour le parall�lisme et la p�diocit� (PARCOM
248
! et PERCOM) ont d�j� �t� fait dans CSCPFB.
249
! Inutile de les refaire.
158
! --- Compute gradient of variable if it is interpolated.
159
! Exchanges for parallelism and periodicity have already been
160
! done in CSCPFB. Non need to do them again.
255
165
iclvar = iclrtp(ivar,icoef)
256
166
nswrgp = nswrgr(ivar)
265
( idebia , idebra , &
266
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml, &
267
nnod , lndfac , lndfbr , ncelbr , nphas , &
268
nideve , nrdeve , nituse , nrtuse , &
269
ivar , imrgra , inc , iccocg , nswrgp , imligp , iphydp, &
175
( ivar , imrgra , inc , iccocg , nswrgp , imligp , &
270
176
iwarnp , nfecra , &
271
177
epsrgp , climgp , extrap , &
272
ifacel , ifabor , ifmfbr , ifmcel , iprfml , &
273
ipnfac , nodfac , ipnfbr , nodfbr , &
274
idevel , ituser , ia , &
275
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume, &
277
178
rtp(1,ivar) , coefa(1,iclvar) , coefb(1,iclvar) , &
279
! ------ ------ ------
281
rdevel , rtuser , ra )
284
182
! For a specific face to face coupling, geometric assumptions are made
308
205
ipf = sqrt(xipf**2+yipf**2+zipf**2)
311
iii = idiipb-1+3*(ifac-1)
316
207
xopf = dofcpl(1,ipt)
317
208
yopf = dofcpl(2,ipt)
318
209
zopf = dofcpl(3,ipt)
320
if (ivar.eq.ipr(1)) then
322
! --- On veut imposer un dirichlet de pression de mani�re � conserver
323
! le gradient de pression � la travers�e du couplage et �tre consistant
324
! avec la r�solution du gradient de pression sur maillage orthogonal
326
xip = rtp(iel,ivar) + (w1(iel)*xiip + w2(iel)*yiip + w3(iel)*ziip)
328
else if (ivar.eq.iu(1).or.ivar.eq.iv(1).or.ivar.eq.iw(1)) then
330
! --- Pour toutes les autres variables, on veut imposer un dirichlet
331
! en accord avec les flux convectifs au centre. On se laisse le choix
332
! entre UPWIND, SOLU et CENTRE. Seul le centr� respecte la diffusion
333
! des faces internes du somaine. Pour l'UPWIND et le SOLU, le d�centrement
334
! est r�alis� ici et plus dans bilsc2.F pour les faces coupl�es.
338
! xip = rtp(iel,ivar)
342
! xip = rtp(iel,ivar) + (w1(iel)*xif + w2(iel)*yif + w3(iel)*zif)
346
xip = rtp(iel,ivar) + w1(iel)*xiip + w2(iel)*yiip + w3(iel)*ziip
211
if (ivar.eq.ipr) then
213
! --- We want to prescribe a Direchlet for pressure so as to conserve
214
! the pressure gradient through the coupling and remain consistent
215
! with the resolution of the pressure gradient on an orthogonal mesh.
217
xip = rtp(iel,ivar) &
218
+ (grad(iel,1)*xiip + grad(iel,2)*yiip + grad(iel,3)*ziip)
220
else if (ivar.eq.iu.or.ivar.eq.iv.or.ivar.eq.iw) then
222
! --- For all other variables, we want to prescribe a Dirichlet matching
223
! the convective fluxes at the center. We resrve a choice between
224
! UPWIND, SOLU, and CENTERED. Only the centered case respects the diffusion
225
! at the domain's interior faces. For UPWIND and SOLU, the decentering
226
! is done here and in bilsc2.f90 for coupled faces.
230
! xip = rtp(iel,ivar)
234
! xip = rtp(iel,ivar) &
235
! + (grad(iel,1)*xif + grad(iel,2)*yif + grad(iel,3)*zif)
239
xip = rtp(iel,ivar) &
240
+ (grad(iel,1)*xiip + grad(iel,2)*yiip + grad(iel,3)*ziip)
352
! xip = rtp(iel,ivar)
356
! xip = rtp(iel,ivar) + (w1(iel)*xif + w2(iel)*yif + w3(iel)*zif)
360
xip = rtp(iel,ivar) + (w1(iel)*xiip + w2(iel)*yiip + w3(iel)*ziip)
246
! xip = rtp(iel,ivar)
250
! xip = rtp(iel,ivar) &
251
! + (grad(iel,1)*xif + grad(iel,2)*yif + grad(iel,3)*zif)
255
xip = rtp(iel,ivar) &
256
+ (grad(iel,1)*xiip + grad(iel,2)*yiip + grad(iel,3)*ziip)
364
! -- on a besoin de alpha_ij pour interpolation centr�e et du flumab
365
! pour le d�centrement
260
! -- We need alpha_ij for centered interpolation and flumab for decentering
367
262
pondj = pndcpl(ipt)
368
flumab = propfb(ifac,ipprob(ifluma(iu(1))))
263
flumab = propfb(ifac,ipprob(ifluma(iu)))
370
! Informations recues de l'instance distante en J'/O'
265
! Information received from distant instance at J'/O'
371
266
xjp = rvcpfb(ipt,ivar)
375
itypfb(ifac,iphas) = icscpl
378
if (ivar.eq.ipr(1)) then
380
icodcl(ifac,ivar ) = 1
381
rcodcl(ifac,ivar,1) = (1.d0-pondj)*xjp + pondj*xip + p0(1)
383
else if (ivar.eq.iu(1).or.ivar.eq.iv(1).or.ivar.eq.iw(1)) then
385
icodcl(ifac,ivar ) = 1
387
! -- DECENTRE (SOLU ou UPWIND)
389
! if (flumab.ge.0.d0) then
390
! rcodcl(ifac,ivar,1) = xip
392
! rcodcl(ifac,ivar,1) = xjp
269
itypfb(ifac) = icscpl
271
if (ivar.eq.ipr) then
273
icodcl(ifac,ivar ) = 1
274
rcodcl(ifac,ivar,1) = (1.d0-pondj)*xjp + pondj*xip + p0
276
else if (ivar.eq.iu.or.ivar.eq.iv.or.ivar.eq.iw) then
278
icodcl(ifac,ivar ) = 1
280
! -- DECENTERED (SOLU or UPWIND)
282
! if (flumab.ge.0.d0) then
283
! rcodcl(ifac,ivar,1) = xip
285
! rcodcl(ifac,ivar,1) = xjp
397
290
rcodcl(ifac,ivar,1) = (1.d0-pondj)*xjp + pondj*xip