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
26
!-------------------------------------------------------------------------------
31
( ncevor , nvor , ient , &
32
ivorce , xyz , yzcel , xu , xv , xw , &
33
yzvor , signv , temps , tpslim )
35
!===============================================================================
39
! INITIALISATION DE LA METHODE DES VORTEX POUR LES ENTREES EN L.E.S.
41
!-------------------------------------------------------------------------------
43
!__________________.____._____.________________________________________________.
44
! name !type!mode ! role !
45
!__________________!____!_____!________________________________________________!
46
! ncevor ! e ! <-- ! nombre de face a l'entree ou est !
47
! ! ! ! utilise la methode !
48
! nvor ! e ! <-- ! nombre de vortex a l'entree !
49
! ient ! e ! <-- ! numero de l'entree !
50
! ivorce ! te ! <-- ! numero du vortex le plus proche d'une !
51
! (nvomax) ! ! ! face donnee !
52
! xyz(icvmax,3) ! ! <-- ! coordonnees des faces d'entree dans !
54
! yzcel ! tr ! <-- ! coordonnees des faces d'entree dans !
55
! (icvmax ,2) ! ! ! le referentiel local !
56
! xu(icvmax) ! tr ! --- ! composante de vitesse principale !
57
! xv(icvmax) ! tr ! <-- ! composantes de vitesse transverses !
58
! xw(icvmax) ! tr ! <-- ! !
59
! yzvor ! tr ! <-- ! coordonnees du centre des vortex !
61
! signv(nvomax) ! tr ! <-- ! sens de rotation des vortex !
62
! temps ! tr ! <-- ! temps ecoule depuis la creation !
63
! (nvomax) ! ! ! du vortex !
64
! tpslim ! tr ! <-- ! duree de vie du vortex !
66
!__________________.____._____.________________________________________________.
68
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
69
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
70
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
71
! --- tableau de travail
72
!===============================================================================
76
!===============================================================================
78
!===============================================================================
87
!===============================================================================
91
integer ncevor , nvor , ient
92
integer ivorce(nvomax)
94
double precision xyz(icvmax,3) , yzcel(icvmax,2)
95
double precision xu(icvmax) , xv(icvmax) , xw(icvmax)
96
double precision yzvor(nvomax,2) , signv(nvomax)
97
double precision temps(nvomax) , tpslim(nvomax)
102
integer ii, jj, kk, iii, iun, ivort, iient, iok
105
double precision drand(1), phidat, xx, yy, zz
106
double precision uu, vv, ww
107
double precision u_vor, ek_vor, ee_vor
112
!===============================================================================
113
! 1. CALCUL DU REPERE LOCAL ET CHANGEMENT DE REPERE
114
!===============================================================================
118
write(nfecra,1000) nnent, isuivo
121
if(icas(ient).eq.1.or.icas(ient).eq.2.or.icas(ient).eq.3) then
123
dir3(1,ient)=dir1(2,ient)*dir2(3,ient)-dir1(3,ient)*dir2(2,ient)
124
dir3(2,ient)=dir1(3,ient)*dir2(1,ient)-dir1(1,ient)*dir2(3,ient)
125
dir3(3,ient)=dir1(1,ient)*dir2(2,ient)-dir1(2,ient)*dir2(1,ient)
127
elseif(icas(ient).eq.4) then
129
! On s'aide du vecteur surface d'une face de l'entree (supposee plane)
130
! pour definir le repere local
132
vv = sqrt(surf(1,ient)**2 + surf(2,ient)**2 + surf(3,ient)**2)
134
dir3(1,ient) = -surf(1,ient)/vv
135
dir3(2,ient) = -surf(2,ient)/vv
136
dir3(3,ient) = -surf(3,ient)/vv
138
! On se fixe, par exemple, x1 = 0 et y1 = 1 et on norme le vecteur
142
if (abs(dir3(3,ient)).gt.epzero) then
143
dir1(3,ient) = -dir3(2,ient)/dir3(3,ient)
148
vv = sqrt(dir1(1,ient)**2 + dir1(2,ient)**2 + dir1(3,ient)**2)
150
dir1(1,ient) = dir1(1,ient)/vv
151
dir1(2,ient) = dir1(2,ient)/vv
152
dir1(3,ient) = dir1(3,ient)/vv
154
! On obtient le dernier vecteur par produit vectoriel des deux autres
157
dir3(2,ient)*dir1(3,ient) - dir3(3,ient)*dir1(2,ient)
159
dir3(3,ient)*dir1(1,ient) - dir3(1,ient)*dir1(3,ient)
161
dir3(1,ient)*dir1(2,ient) - dir3(2,ient)*dir1(1,ient)
165
! - Changement de repere (on suppose que les vecteurs sont normes)
168
xx = xyz(ii,1) - cen(1,ient)
169
yy = xyz(ii,2) - cen(2,ient)
170
zz = xyz(ii,3) - cen(3,ient)
171
yzcel(ii,1) = dir1(1,ient)*xx+dir1(2,ient)*yy+dir1(3,ient)*zz
172
yzcel(ii,2) = dir2(1,ient)*xx+dir2(2,ient)*yy+dir2(3,ient)*zz
175
! - Dimensions min et max de l entree
182
ymax(ient) = max(ymax(ient),yzcel(ii,1))
183
ymin(ient) = min(ymin(ient),yzcel(ii,1))
184
zmax(ient) = max(zmax(ient),yzcel(ii,2))
185
zmin(ient) = min(zmin(ient),yzcel(ii,2))
190
if(icas(ient).eq.1) then
191
if(lly(ient).lt.ymax(ient)-ymin(ient).or. &
192
llz(ient).lt.zmax(ient)-zmin(ient)) then
193
write(nfecra,2000) ient
196
elseif(icas(ient).eq.2) then
197
if(lld(ient).lt.ymax(ient)-ymin(ient).or. &
198
lld(ient).lt.zmax(ient)-zmin(ient)) then
199
write(nfecra,2000) ient
203
!===============================================================================
204
! 2. IMPRESSIONS DES PARAMETES A CHAQUE ENTREE
205
!===============================================================================
209
!===============================================================================
210
! 3. REMPLISSAGE DES TABLEAUX DE DONNEES EN ENTREE
211
!===============================================================================
215
if(icas(ient).eq.1.or.icas(ient).eq.2.or.icas(ient).eq.3) then
216
open(file=ficvor(ient),unit=impdvo)
218
do ii = 1, ndat(ient)
220
xdat(ii,ient) , ydat(ii,ient) , zdat(ii,ient) , &
221
udat(ii,ient) , vdat(ii,ient) , wdat(ii,ient) , &
222
dudat(ii,ient), kdat(ii,ient) , epsdat(ii,ient)
226
elseif(icas(ient).eq.4) then
227
xdat(1,ient) = cen(1,ient)
228
ydat(1,ient) = cen(2,ient)
229
zdat(1,ient) = cen(3,ient)
230
udat(1,ient) = udebit(ient)
234
kdat(1,ient) = kdebit(ient)
235
epsdat(1,ient) = edebit(ient)
238
! On suppose que les donnees sont fournies
239
! dans le repere du calcul (et non dans le repere local).
240
! C'est plus simple pour l'utilisateur, et plus
241
! naturel pour faire du couplage
243
do ii = 1, ndat(ient)
244
xx = xdat(ii,ient) - cen(1,ient)
245
yy = ydat(ii,ient) - cen(2,ient)
246
zz = zdat(ii,ient) - cen(3,ient)
250
ydat(ii,ient) = dir1(1,ient)*xx+dir1(2,ient)*yy+dir1(3,ient)*zz
251
zdat(ii,ient) = dir2(1,ient)*xx+dir2(2,ient)*yy+dir2(3,ient)*zz
252
udat(ii,ient) = dir3(1,ient)*uu+dir3(2,ient)*vv+dir3(3,ient)*ww
253
vdat(ii,ient) = dir1(1,ient)*uu+dir1(2,ient)*vv+dir1(3,ient)*ww
254
wdat(ii,ient) = dir2(1,ient)*uu+dir2(2,ient)*vv+dir2(3,ient)*ww
257
! --- Verfication des donnees
260
do ii = 1, ndat(ient)
261
if(udat(ii,ient).le.0.d0.or.kdat(ii,ient).le.0.d0.or. &
262
epsdat(ii,ient).le.0.d0) then
263
write(nfecra,3100) ient
266
if(icas(ient).eq.1) then
267
if(ydat(ii,ient).lt.-lly(ient)/2.d0.or. &
268
ydat(ii,ient).gt.lly(ient)/2.d0.or. &
269
zdat(ii,ient).lt.-llz(ient)/2.d0.or. &
270
zdat(ii,ient).gt.llz(ient)/2.d0) then
273
elseif(icas(ient).eq.2) then
274
if(ydat(ii,ient).lt.-lld(ient)/2.d0.or. &
275
ydat(ii,ient).gt.lld(ient)/2.d0.or. &
276
zdat(ii,ient).lt.-lld(ient)/2.d0.or. &
277
zdat(ii,ient).gt.lld(ient)/2.d0) then
284
write(nfecra,3200) ient
287
!===============================================================================
288
! 4. LECTURE DU FICHIER SUITE / INITIALISATION DU CHAMP DE VORTEX
289
!===============================================================================
294
open(unit=impmvo,file=ficmvo)
298
read(impmvo,100) iient
299
read(impmvo,100) ivort
300
if(ivort.ne.nvor.or.iient.ne.ient) then
301
write(nfecra,4500) ient, ivort, nvor
305
read(impmvo,200) yzvor(ii,1), yzvor(ii,2), &
306
temps(ii), tpslim(ii), signv(ii)
312
if(ient.eq.nnent) then
318
if(isuivo.eq.0.or.initvo(ient).eq.1) then
320
!-------------------------------
321
! Tirage des positions
322
!-------------------------------
324
if(icas(ient).eq.1)then
326
call zufall(iun,drand(1))
327
yzvor(ii,1) = lly(ient) * drand(1) - lly(ient)/2.d0
328
call zufall(iun,drand(1))
329
yzvor(ii,2) = llz(ient) * drand(1) - llz(ient)/2.d0
331
elseif(icas(ient).eq.2) then
334
call zufall(iun,drand(1))
335
yzvor(ii,1) = lld(ient) * drand(1) - lld(ient)/2.0d0
336
call zufall(iun,drand(1))
337
yzvor(ii,2) = lld(ient) * drand(1) - lld(ient)/2.0d0
338
if ((yzvor(ii,1)**2+yzvor(ii,2)**2).gt. &
339
(lld(ient)/2.d0)**2) then
343
elseif(icas(ient).eq.3.or.icas(ient).eq.4) then
345
call zufall(iun,drand(1))
346
yzvor(ii,1) = ymin(ient) + lly(ient) * drand(1)
347
call zufall(iun,drand(1))
348
yzvor(ii,2) = zmin(ient) + llz(ient) * drand(1)
354
if(itlivo(ient).eq.1) then
356
call zufall(iun,drand(1))
357
temps(ii) = drand(1)*tlimvo(ient)
359
! on fait cela pour que les vortex ne disparaissent pas tous
362
tpslim(ii) = tlimvo(ient)
364
elseif(itlivo(ient).eq.2) then
369
u_vor = phidat(nfecra,icas(ient),ndat(ient),yy,zz, &
370
ydat(1,ient),zdat(1,ient),udat(1,ient),iii)
371
ek_vor = phidat(nfecra,icas(ient),ndat(ient),yy,zz, &
372
ydat(1,ient),zdat(1,ient),kdat(1,ient),iii)
373
ee_vor = phidat(nfecra,icas(ient),ndat(ient),yy,zz, &
374
ydat(1,ient),zdat(1,ient),epsdat(1,ient),iii)
375
tpslim(ii) = 5.d0*cmu*ek_vor**(3.d0/2.d0)/ee_vor
376
tpslim(ii) = tpslim(ii)/u_vor
385
call zufall(iun,drand(1))
386
if (drand(1).lt.0.5d0) signv(ii) = -1.d0
390
!===============================================================================
391
! 5. AJOUT DE LA VITESSE MOYENNE POUR U
392
!===============================================================================
398
u_vor = phidat(nfecra,icas(ient),ndat(ient),yy,zz, &
399
ydat(1,ient),zdat(1,ient),udat(1,ient),iii)
403
!===============================================================================
404
! 6. RECHERCHE DE LA FACE LA PLUS PROCHE DE CHAQUE VORTEX
405
!===============================================================================
410
if(((yzcel(jj,1)-yzvor(ii,1))**2+ &
411
(yzcel(jj,2)-yzvor(ii,2))**2).lt.dd)then
412
dd = (yzcel(jj,1)-yzvor(ii,1))**2 &
413
+(yzcel(jj,2)-yzvor(ii,2))**2
422
#if defined(_CS_LANG_FR)
426
' ** METHODE DES VORTEX ',/,&
427
' ------------------ ',/,&
428
' NNENT = ',4X,I10, ' (Nombre d entrees )',/,&
429
' ISUIVO = ',4X,I10, ' (1 : suite de calcul )' )
433
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
435
'@ @@ ATTENTION : ARRET A L''ENTREE DES DONNEES ',/,&
437
'@ LES DIMENSIONS MAX DE L''ENTREE SONT INCOMPATIBLES AVEC ',/,&
438
'@ LES DONNEES A L''ENTREE ',I10 ,/,&
440
'@ Le calcul ne peut etre execute. ',/,&
442
'@ Verifier usvort. ',/,&
444
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
449
' -- Fin de la lecture du fichier de donnees ',/)
452
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
454
'@ @@ ATTENTION : ARRET A L''ENTREE DES DONNEES ',/,&
456
'@ U, K ET EPSILON SONT DES GRANDEURS QUI SONT DEFINIES ',/,&
457
'@ POSITIVES DANS LE REPERE LOCAL DE L''ENTREE ',/,&
459
'@ VERIFIER LE FICHIER DE DONNEE DE L''ENTREE ',I10 ,/,&
461
'@ Le calcul ne peut etre execute. ',/,&
463
'@ Verifier usvort. ',/,&
465
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
469
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
471
'@ @@ ATTENTION : A L''ENTREE DES DONNEES ',/,&
473
'@ LES DIMENSIONS MAX DE L''ENTREE SONT INCOMPATIBLES AVEC ',/,&
474
'@ CELLES DU FICHIER DE DONNEES ',/,&
476
'@ VERIFIER LE FICHIER DE DONNEE DE L''ENTREE ',I10 ,/,&
478
'@ Le calcul sera execute. ',/,&
480
'@ Verifier usvort. ',/,&
482
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
486
' -- Fin de la lecture du fichier suite ',/)
490
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
492
'@ @@ ATTENTION : A L''ENTREE DES DONNEES ',/,&
494
'@ LE NOMBRE DE VORTEX A CHANGE A L''ENTREE',I10 ,/,&
495
'@ NVORT VALAIT PRECECEDEMENT ',I10 ,/,&
496
'@ A L''ENTREE ',I10 ,/,&
497
'@ ET VAUT MAINTENANT ',I10 ,/,&
499
'@ LA METHODE EST REINITIALISE A CETTE ENTREE ',/,&
501
'@ Le calcul sera execute ',/,&
503
'@ Verifier usvort. ',/,&
505
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
515
' ** VORTEX METHOD ',/,&
516
' ------------- ',/,&
517
' NNENT = ',4X,I10, ' (Number of inlets )',/,&
518
' ISUIVO = ',4X,I10, ' (1: calculation restart )' )
522
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
524
'@ @@ WARNING: ABORT IN THE DATA SPECIFICATION ',/,&
526
'@ THE MAX DIMENSIONS OF THE INLET ARE INCOMPATIBLE WITH ',/,&
527
'@ THE DATA AT THE INLET ',I10 ,/,&
529
'@ The calculation will not be run. ',/,&
531
'@ Verify usvort. ',/,&
533
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
538
' -- End reading the data file ',/)
541
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
543
'@ @@ WARNING: ABORT IN THE DATA SPECIFICATION ',/,&
545
'@ U, K AND EPSILON ARE QUANTITIES WHICH MUST BE POSITIVE ',/,&
546
'@ IN THE LOCAL FRAME OF THE INLET ',/,&
548
'@ VERIFY THE DATA FILE FOR THE INLET ',I10 ,/,&
550
'@ The calculation will not be run. ',/,&
552
'@ Verify usvort. ',/,&
554
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
558
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
560
'@ @@ WARNING: IN THE DATA SPECIFICATION ',/,&
562
'@ THE MAX DIMENSIONS OF THE INLET ARE INCOMPATIBLE WITH ',/,&
563
'@ THE ONES FROM THE DATA FILE ',/,&
565
'@ VERIFY THE DATA FILE FOR THE INLET ',I10 ,/,&
567
'@ The calculation will be run. ',/,&
569
'@ Verify usvort. ',/,&
571
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
575
' -- End reading the restart file ',/)
579
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
581
'@ @@ WARNING: IN THE DATA SPECIFICATION ',/,&
583
'@ THE NUMBER OF VORTICES HAS CHANGED AT THE INLET ',I10 ,/,&
584
'@ NVORT WAS PREVIOUSLY ',I10 ,/,&
585
'@ AT THE INLET ',I10 ,/,&
586
'@ IT IS CURRENTLY ',I10 ,/,&
588
'@ THE METHOD IS RE-INITIALIZED AT THIS INLET ',/,&
590
'@ The calculation will be run. ',/,&
592
'@ Verify usvort. ',/,&
594
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&