6
! This file is part of the Code_Saturne Kernel, element of the
7
! Code_Saturne CFD tool.
9
! Copyright (C) 1998-2009 EDF S.A., France
11
! contact: saturne-support@edf.fr
13
! The Code_Saturne Kernel is free software; you can redistribute it
14
! and/or modify it under the terms of the GNU General Public License
15
! as published by the Free Software Foundation; either version 2 of
16
! the License, or (at your option) any later version.
18
! The Code_Saturne Kernel is distributed in the hope that it will be
19
! useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20
! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
! GNU General Public License for more details.
23
! You should have received a copy of the GNU General Public License
24
! along with the Code_Saturne Kernel; if not, write to the
25
! Free Software Foundation, Inc.,
26
! 51 Franklin St, Fifth Floor,
27
! Boston, MA 02110-1301 USA
5
! This file is part of Code_Saturne, a general-purpose CFD tool.
7
! Copyright (C) 1998-2011 EDF S.A.
9
! This program is free software; you can redistribute it and/or modify it under
10
! the terms of the GNU General Public License as published by the Free Software
11
! Foundation; either version 2 of the License, or (at your option) any later
14
! This program is distributed in the hope that it will be useful, but WITHOUT
15
! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19
! You should have received a copy of the GNU General Public License along with
20
! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
21
! Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
23
!-------------------------------------------------------------------------------
31
25
subroutine uskpdc &
35
ndim , ncelet , ncel , nfac , nfabor , nfml , nprfml , &
36
nnod , lndfac , lndfbr , ncelbr , &
37
nvar , nscal , nphas , &
38
nideve , nrdeve , nituse , nrtuse , &
39
ncepdp , iphas , iappel , &
40
ifacel , ifabor , ifmfbr , ifmcel , iprfml , maxelt , lstelt , &
41
ipnfac , nodfac , ipnfbr , nodfbr , icepdc , &
42
idevel , ituser , ia , &
43
xyzcen , surfac , surfbo , cdgfac , cdgfbo , xyznod , volume , &
44
31
dt , rtpa , rtp , propce , propfa , propfb , &
45
coefa , coefb , ckupdc , &
46
rdevel , rtuser , ra )
32
coefa , coefb , ckupdc )
48
34
!===============================================================================
52
38
! PERTES DE CHARGE (PDC)
56
41
! CALCUL DU NOMBRE DE CELLULES OU L'ON IMPOSE UNE PDC
103
88
!__________________.____._____.________________________________________________.
104
89
! name !type!mode ! role !
105
90
!__________________!____!_____!________________________________________________!
106
! idbia0 ! i ! <-- ! number of first free position in ia !
107
! idbra0 ! i ! <-- ! number of first free position in ra !
108
! ndim ! i ! <-- ! spatial dimension !
109
! ncelet ! i ! <-- ! number of extended (real + ghost) cells !
110
! ncel ! i ! <-- ! number of cells !
111
! nfac ! i ! <-- ! number of interior faces !
112
! nfabor ! i ! <-- ! number of boundary faces !
113
! nfml ! i ! <-- ! number of families (group classes) !
114
! nprfml ! i ! <-- ! number of properties per family (group class) !
115
! nnod ! i ! <-- ! number of vertices !
116
! lndfac ! i ! <-- ! size of nodfac indexed array !
117
! lndfbr ! i ! <-- ! size of nodfbr indexed array !
118
! ncelbr ! i ! <-- ! number of cells with faces on boundary !
119
91
! nvar ! i ! <-- ! total number of variables !
120
92
! nscal ! i ! <-- ! total number of scalars !
121
! nphas ! i ! <-- ! number of phases !
122
93
! ncepdp ! i ! <-- ! number of cells with head loss !
123
! nideve, nrdeve ! i ! <-- ! sizes of idevel and rdevel arrays !
124
! nituse, nrtuse ! i ! <-- ! sizes of ituser and rtuser arrays !
125
94
! iappel ! e ! <-- ! indique les donnes a renvoyer !
126
! ifacel(2, nfac) ! ia ! <-- ! interior faces -> cells connectivity !
127
! ifabor(nfabor) ! ia ! <-- ! boundary faces -> cells connectivity !
128
! ifmfbr(nfabor) ! ia ! <-- ! boundary face family numbers !
129
! ifmcel(ncelet) ! ia ! <-- ! cell family numbers !
130
! iprfml ! ia ! <-- ! property numbers per family !
131
! (nfml, nprfml) ! ! ! !
132
! maxelt ! i ! <-- ! max number of cells and faces (int/boundary) !
133
! lstelt(maxelt) ! ia ! --- ! work array !
134
! ipnfac(nfac+1) ! ia ! <-- ! interior faces -> vertices index (optional) !
135
! nodfac(lndfac) ! ia ! <-- ! interior faces -> vertices list (optional) !
136
! ipnfbr(nfabor+1) ! ia ! <-- ! boundary faces -> vertices index (optional) !
137
! nodfbr(lndfbr) ! ia ! <-- ! boundary faces -> vertices list (optional) !
138
95
! icepdc(ncepdp ! te ! <-- ! numero des ncepdp cellules avec pdc !
139
! idevel(nideve) ! ia ! <-> ! integer work array for temporary development !
140
! ituser(nituse) ! ia ! <-> ! user-reserved integer work array !
141
! ia(*) ! ia ! --- ! main integer work array !
142
! xyzcen ! ra ! <-- ! cell centers !
143
! (ndim, ncelet) ! ! ! !
144
! surfac ! ra ! <-- ! interior faces surface vectors !
145
! (ndim, nfac) ! ! ! !
146
! surfbo ! ra ! <-- ! boundary faces surface vectors !
147
! (ndim, nfabor) ! ! ! !
148
! cdgfac ! ra ! <-- ! interior faces centers of gravity !
149
! (ndim, nfac) ! ! ! !
150
! cdgfbo ! ra ! <-- ! boundary faces centers of gravity !
151
! (ndim, nfabor) ! ! ! !
152
! xyznod ! ra ! <-- ! vertex coordinates (optional) !
153
! (ndim, nnod) ! ! ! !
154
! volume(ncelet) ! ra ! <-- ! cell volumes !
96
! izcpdc(ncelet) ! ia ! <-- ! cells zone for head loss definition !
155
97
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
156
98
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
157
99
! (ncelet, *) ! ! ! (at current and previous time steps) !
172
111
! mode: <-- input, --> output, <-> modifies data, --- work array
173
112
!===============================================================================
114
!===============================================================================
116
!===============================================================================
126
!===============================================================================
177
!===============================================================================
179
!===============================================================================
189
!===============================================================================
193
integer idbia0 , idbra0
194
integer ndim , ncelet , ncel , nfac , nfabor
195
integer nfml , nprfml
196
integer nnod , lndfac , lndfbr , ncelbr
197
integer nvar , nscal , nphas
199
integer nideve , nrdeve , nituse , nrtuse
202
integer ifacel(2,nfac) , ifabor(nfabor)
203
integer ifmfbr(nfabor) , ifmcel(ncelet)
204
integer iprfml(nfml,nprfml)
205
integer maxelt, lstelt(maxelt)
206
integer ipnfac(nfac+1), nodfac(lndfac)
207
integer ipnfbr(nfabor+1), nodfbr(lndfbr)
208
136
integer icepdc(ncepdp)
209
integer idevel(nideve), ituser(nituse), ia(*)
211
double precision xyzcen(ndim,ncelet)
212
double precision surfac(ndim,nfac), surfbo(ndim,nfabor)
213
double precision cdgfac(ndim,nfac), cdgfbo(ndim,nfabor)
214
double precision xyznod(ndim,nnod), volume(ncelet)
215
139
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
216
140
double precision propce(ncelet,*)
217
141
double precision propfa(nfac,*), propfb(nfabor,*)
218
142
double precision coefa(nfabor,*), coefb(nfabor,*)
219
143
double precision ckupdc(ncepdp,6)
220
double precision rdevel(nrdeve), rtuser(nrtuse), ra(*)
222
145
! Local variables
224
integer idebia, idebra
225
integer iel, ielpdc, iphas, ikpdc
147
integer iel, ielpdc, ikpdc
226
148
integer ilelt, nlelt
229
152
double precision alpha, cosalp, sinalp, vit, ck1, ck2
154
integer, allocatable, dimension(:) :: lstelt
231
156
!===============================================================================
233
158
! TEST_TO_REMOVE_FOR_USE_OF_SUBROUTINE_START
369
! --- Tenseur diagonal
370
! Exemple de pertes de charges dans la direction x
373
if (iutile.eq.0) return
375
do ielpdc = 1, ncepdp
377
vit = sqrt( rtpa(iel,iu(iphas))**2 &
378
+ rtpa(iel,iv(iphas))**2 &
379
+ rtpa(iel,iw(iphas))**2)
380
ckupdc(ielpdc,1) = 10.d0*vit
381
ckupdc(ielpdc,2) = 0.d0*vit
382
ckupdc(ielpdc,3) = 0.d0*vit
386
! Exemple de pertes de charges a ALPHA = 45 degres x,y
387
! la direction x resiste par ck1 et y par ck2
388
! ck2 nul represente des ailettes comme ceci : ///////
389
! dans le repere de calcul X Y
400
if (iutile.eq.0) return
408
do ielpdc = 1, ncepdp
410
vit = sqrt( rtpa(iel,iu(iphas))**2 &
411
+ rtpa(iel,iv(iphas))**2 &
412
+ rtpa(iel,iw(iphas))**2)
413
ckupdc(ielpdc,1) = (cosalp**2*ck1 + sinalp**2*ck2)*vit
414
ckupdc(ielpdc,2) = (sinalp**2*ck1 + cosalp**2*ck2)*vit
415
ckupdc(ielpdc,3) = 0.d0
416
ckupdc(ielpdc,4) = cosalp*sinalp*(-ck1+ck2)*vit
417
ckupdc(ielpdc,5) = 0.d0
418
ckupdc(ielpdc,6) = 0.d0
294
! --- Tenseur diagonal
295
! Exemple de pertes de charges dans la direction x
298
if (iutile.eq.0) return
300
do ielpdc = 1, ncepdp
302
vit = sqrt( rtpa(iel,iu)**2 &
305
ckupdc(ielpdc,1) = 10.d0*vit
306
ckupdc(ielpdc,2) = 0.d0*vit
307
ckupdc(ielpdc,3) = 0.d0*vit
311
! Exemple de pertes de charges a ALPHA = 45 degres x,y
312
! la direction x resiste par ck1 et y par ck2
313
! ck2 nul represente des ailettes comme ceci : ///////
314
! dans le repere de calcul X Y
325
if (iutile.eq.0) return
333
do ielpdc = 1, ncepdp
335
vit = sqrt( rtpa(iel,iu)**2 &
338
ckupdc(ielpdc,1) = (cosalp**2*ck1 + sinalp**2*ck2)*vit
339
ckupdc(ielpdc,2) = (sinalp**2*ck1 + cosalp**2*ck2)*vit
340
ckupdc(ielpdc,3) = 0.d0
341
ckupdc(ielpdc,4) = cosalp*sinalp*(-ck1+ck2)*vit
342
ckupdc(ielpdc,5) = 0.d0
343
ckupdc(ielpdc,6) = 0.d0
424
346
!-------------------------------------------------------------------------------
350
! Deallocate the temporary array