1
!-------------------------------------------------------------------------------
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.
21
!-------------------------------------------------------------------------------
23
subroutine cs_fuel_scast &
24
!=======================
26
( nvar , nscal , ncepdp , ncesmp , &
29
icepdc , icetsm , itypsm , &
31
dt , rtpa , rtp , propce , propfa , propfb , &
32
coefa , coefb , ckupdc , smacel , &
35
!===============================================================================
39
! ROUTINE PHYSIQUE PARTICULIERE : FLAMME FUEL
40
! ON PRECISE LES TERMES SOURCES POUR UN SCALAIRE PP
44
! ATTENTION : LE TRAITEMENT DES TERMES SOURCES EST DIFFERENT
45
! --------- DE CELUI DE USTSSC.F
47
! ON RESOUT ROVSDT*D(VAR) = SMBRS
49
! ROVSDT ET SMBRS CONTIENNENT DEJA D'EVENTUELS TERMES SOURCES
50
! UTILISATEUR. IL FAUT DONC LES INCREMENTER ET PAS LES
53
! POUR DES QUESTIONS DE STABILITE, ON NE RAJOUTE DANS ROVSDT
54
! QUE DES TERMES POSITIFS. IL N'Y A PAS DE CONTRAINTE POUR
57
! DANS LE CAS D'UN TERME SOURCE EN CEXP + CIMP*VAR ON DOIT
59
! SMBRS = SMBRS + CEXP + CIMP*VAR
60
! ROVSDT = ROVSDT + MAX(-CIMP,ZERO)
62
! ON FOURNIT ICI ROVSDT ET SMBRS (ILS CONTIENNENT RHO*VOLUME)
63
! SMBRS en kg variable/s :
64
! ex : pour la vitesse kg m/s2
65
! pour les temperatures kg degres/s
66
! pour les enthalpies Joules/s
69
!-------------------------------------------------------------------------------
71
!__________________.____._____.________________________________________________.
72
! name !type!mode ! role !
73
!__________________!____!_____!________________________________________________!
74
! nvar ! i ! <-- ! total number of variables !
75
! nscal ! i ! <-- ! total number of scalars !
76
! ncepdp ! i ! <-- ! number of cells with head loss !
77
! ncesmp ! i ! <-- ! number of cells with mass source term !
78
! iscal ! i ! <-- ! scalar number !
79
! icepdc(ncelet ! te ! <-- ! numero des ncepdp cellules avec pdc !
80
! icetsm(ncesmp ! te ! <-- ! numero des cellules a source de masse !
81
! itypsm ! te ! <-- ! type de source de masse pour les !
82
! (ncesmp,nvar) ! ! ! variables (cf. ustsma) !
83
! izfppp ! te ! --> ! numero de zone de la face de bord !
84
! (nfabor) ! ! ! pour le module phys. part. !
85
! dt(ncelet) ! ra ! <-- ! time step (per cell) !
86
! rtp, rtpa ! ra ! <-- ! calculated variables at cell centers !
87
! (ncelet, *) ! ! ! (at current and previous time steps) !
88
! propce(ncelet, *)! ra ! <-- ! physical properties at cell centers !
89
! propfa(nfac, *) ! ra ! <-- ! physical properties at interior face centers !
90
! propfb(nfabor, *)! ra ! <-- ! physical properties at boundary face centers !
91
! coefa, coefb ! ra ! <-- ! boundary conditions !
93
! ckupdc ! tr ! <-- ! tableau de travail pour pdc !
95
! smacel ! tr ! <-- ! valeur des variables associee a la !
96
! (ncesmp,* ) ! ! ! source de masse !
97
! ! ! ! pour ivar=ipr, smacel=flux de masse !
98
! smbrs(ncelet) ! tr ! --> ! second membre explicite !
99
! rovsdt(ncelet ! tr ! --> ! partie diagonale implicite !
100
!__________________!____!_____!________________________________________________!
102
! TYPE : E (ENTIER), R (REEL), A (ALPHANUMERIQUE), T (TABLEAU)
103
! L (LOGIQUE) .. ET TYPES COMPOSES (EX : TR TABLEAU REEL)
104
! MODE : <-- donnee, --> resultat, <-> Donnee modifiee
105
! --- tableau de travail
106
!===============================================================================
108
!===============================================================================
110
!===============================================================================
112
use dimens, only: ndimfb
130
!===============================================================================
137
integer ncepdp , ncesmp
140
integer itypfb(nfabor)
141
integer icepdc(ncepdp)
142
integer icetsm(ncesmp), itypsm(ncesmp,nvar)
143
integer izfppp(nfabor)
145
double precision dt(ncelet), rtp(ncelet,*), rtpa(ncelet,*)
146
double precision propce(ncelet,*)
147
double precision propfa(nfac,*), propfb(ndimfb,*)
148
double precision coefa(ndimfb,*), coefb(ndimfb,*)
149
double precision ckupdc(ncepdp,6), smacel(ncesmp,nvar)
150
double precision smbrs(ncelet), rovsdt(ncelet)
155
integer ivar , ipcrom, iel, icla , numcla
156
integer iexp1 , iexp2 , iexp3 , ifac
158
integer ipcro2 , ipcte1 , ipcte2
159
integer ipcdia , ipcvst
161
integer ipcgev , ipcght , ipchgl
162
integer itermx,nbpauv,nbrich,nbepau,nberic
163
integer nbarre,nbimax,nbpass
165
double precision aux, rhovst
166
double precision t1, h1, t2, h2
167
double precision xng,rhofol , rom
168
double precision gameva,fdev,fsd,ftrac,hfov
169
double precision ho2,hco,xesp(ngazem),xcoke,t2mt1
170
double precision gmech,gmvap,gmhet
172
double precision xxco,xxo2,xxco2,xxh2o,xco2mx
173
double precision xkp,xk0p,xkm,xk0m,wplus,wmoins,t0p,t0m
174
double precision auxp,auxm, aux1 , aux2 , aux3 , w1
176
double precision xeq,anmr,xcot,xo2t,xco2e,xo2e,xcoe,tauchi,tautur
177
double precision sqh2o , x2 , wmhcn , wmno ,wmo2
180
double precision err1mx,err2mx
182
double precision errch,ter1,ddelta,fn,qpr
183
double precision auxmax,auxmin
184
double precision ymoy,volm,volmp,dmp
186
double precision fn0,fn1,fn2,anmr0,anmr1,anmr2
187
double precision lnk0p,l10k0e,lnk0m,t0e,xco2eq,xcoeq,xo2eq
188
double precision xcom,xo2m,xkcequ,xkpequ,xden
189
!===============================================================================
191
!===============================================================================
193
! --- Numero du scalaire a traiter : ISCAL
195
! --- Numero de la variable associee au scalaire a traiter ISCAL
198
! --- Nom de la variable associee au scalaire a traiter ISCAL
199
chaine = nomvar(ipprtp(ivar))
201
! --- Numero des grandeurs physiques (voir usclim)
202
ipcrom = ipproc(irom)
203
ipcvst = ipproc(ivisct)
205
! --- Temperature phase gaz
207
ipcte1 = ipproc(itemp1)
209
!===============================================================================
210
! 2. PRISE EN COMPTE DES TERMES SOURCES POUR LES VARIABLES RELATIVES
211
! AUX CLASSES DE PARTICULES
212
!===============================================================================
214
! --> Terme source pour l'enthalpie du liquide
216
if ( ivar .ge. isca(ih2(1)) .and. &
217
ivar .le. isca(ih2(nclafu)) ) then
219
if (iwarni(ivar).ge.1) then
220
write(nfecra,1000) chaine(1:8)
223
numcla = ivar-isca(ih2(1))+1
225
ipcro2 = ipproc(irom2 (numcla))
226
ipcdia = ipproc(idiam2(numcla))
227
ipcte2 = ipproc(itemp2(numcla))
228
ipcgev = ipproc(igmeva(numcla))
229
ipcght = ipproc(igmhtf(numcla))
230
ipchgl = ipproc(ih1hlf(numcla))
232
! La variable est l'enthalpie du liquide ramen�e �
233
! la masse de m�lange
234
! Les flux interfaciaux contribuent � faire varier l'enthalpie
236
! La vapeur emporte son enthalpie
237
! flux = PROPCE(IEL,IPPROC(IGMEVA))
238
! enthalpie massique reconstitu�e � partir de EHGAZE(IFOV )
239
! � la temp�rature de la goutte
240
! L'oxydation h�terog�ne comporte un flux "entrant" d'O2
241
! un flux sortant de CO
242
! le flux net est celui du carbone
243
! fluxIN = 16/12 * PROPCE(IEL,IPPROC(IGMHTF))
244
! fluxOUT = 28/12 * PROPCE(IEL,IPPROC(IGMHTF))
245
! Enthalpie entrante reconstitu�e � partir de EHGAZE(IO2 )
246
! � la temp�rature du gaz environnant
247
! Enthalpie sortante reconstitu�e � partir de EHGAZE(ICO )
248
! � la temp�rature du grain
253
if ( rtpa(iel,isca(iyfol(numcla))) .gt. epsifl ) then
255
rom = propce(iel,ipcrom)
262
call cs_fuel_htconvers1(imode,hfov,xesp,propce(iel,ipcte2))
266
call cs_fuel_htconvers1(imode,ho2 ,xesp,propce(iel,ipcte1))
270
call cs_fuel_htconvers1(imode,hco,xesp,propce(iel,ipcte2))
272
t2mt1 = propce(iel,ipcte2)-propce(iel,ipcte1)
274
gmech = -propce(iel,ipchgl)*t2mt1
275
gmvap = propce(iel,ipcgev)*hfov*t2mt1
276
gmhet = 16.d0/12.d0*propce(iel,ipcght)*ho2 &
277
-28.d0/12.d0*propce(iel,ipcght)*hco
279
smbrs(iel) = smbrs(iel) + &
280
( gmech+gmvap+gmhet )*rom*volume(iel)
281
rhovst = ( propce(iel,ipchgl) &
282
-propce(iel,ipcgev)*hfov )/cp2fol &
284
rovsdt(iel) = rovsdt(iel) + max(zero,rhovst)
290
! --> T.S. pour la masse de liquide
292
elseif ( ivar .ge. isca(iyfol(1)) .and. &
293
ivar .le. isca(iyfol(nclafu)) ) then
295
if (iwarni(ivar).ge.1) then
296
write(nfecra,1000) chaine(1:8)
299
numcla = ivar-isca(iyfol(1))+1
301
ipcro2 = ipproc(irom2 (numcla))
302
ipcdia = ipproc(idiam2(numcla))
303
ipcte2 = ipproc(itemp2(numcla))
304
ipcgev = ipproc(igmeva(numcla))
305
ipcght = ipproc(igmhtf(numcla))
306
ipchgl = ipproc(ih1hlf(numcla))
310
t2mt1 = propce(iel,ipcte2)-propce(iel,ipcte1)
311
gmvap = -propce(iel,ipcgev)*t2mt1
312
gmhet = -propce(iel,ipcght)
314
smbrs(iel) = smbrs(iel) &
315
- propce(iel,ipcrom)*volume(iel)*(gmvap+gmhet)
316
if ( rtpa(iel,ivar).gt.epsifl ) then
317
rhovst = propce(iel,ipcrom)*volume(iel)*(gmvap + gmhet) &
322
rovsdt(iel) = rovsdt(iel) + max(zero,rhovst)
326
! --> T.S. pour le traceur de la vapeur
328
elseif ( ivar .eq. isca(ifvap) ) then
330
if (iwarni(ivar).ge.1) then
331
write(nfecra,1000) chaine(1:8)
336
ipcte2 = ipproc(itemp2(icla))
337
ipcgev = ipproc(igmeva(icla))
341
t2mt1 = propce(iel,ipcte2)-propce(iel,ipcte1)
342
if ( rtpa(iel,isca(iyfol(icla))) .gt. epsifl ) then
343
gmvap = -propce(iel,ipcgev)*t2mt1*rtp(iel,isca(iyfol(icla))) &
344
/ rtpa(iel,isca(iyfol(icla)))
346
gmvap = -propce(iel,ipcgev)*t2mt1
349
smbrs(iel) = smbrs(iel) &
350
+ gmvap*propce(iel,ipcrom)*volume(iel)
355
! --> T.S. pour le traceur du C ex r�action heterogene
357
elseif ( ivar .eq. isca(if7m) ) then
359
if (iwarni(ivar).ge.1) then
360
write(nfecra,1000) chaine(1:8)
365
ipcght = ipproc(igmhtf(icla))
368
if (rtpa(iel,isca(iyfol(icla))) .gt. epsifl) then
369
smbrs(iel) = smbrs(iel) &
370
-propce(iel,ipcrom)*propce(iel,ipcght)*volume(iel) &
371
*rtp(iel,isca(iyfol(icla))) &
372
/rtpa(iel,isca(iyfol(icla)))
374
smbrs(iel) = smbrs(iel) &
375
-propce(iel,ipcrom)*propce(iel,ipcght)*volume(iel)
384
! --> Terme source pour la variance du traceur 4 (Air)
386
if ( ivar.eq.isca(ifvp2m) ) then
388
if (iwarni(ivar).ge.1) then
389
write(nfecra,1000) chaine(1:8)
392
! ---- Calcul des termes sources explicite et implicite
393
! relatif aux echanges interfaciaux entre phases
397
( nvar , nscal , ncepdp , ncesmp , &
400
icepdc , icetsm , itypsm , &
401
dt , rtpa , rtp , propce , propfa , propfb , &
407
! --> Terme source pour CO2
409
if ( ieqco2 .ge. 1 ) then
411
if ( ivar.eq.isca(iyco2) ) then
414
if (iwarni(ivar).ge.1) then
415
write(nfecra,1000) chaine(1:8)
418
! ---- Contribution du TS interfacial aux bilans explicite et implicite
423
! Dryer Glassman : XK0P en (moles/m3)**(-0.75) s-1
425
! XK0P = 1.26D7 * (1.1)**(NTCABS)
426
! IF ( XK0P .GT. 1.26D10 ) XK0P=1.26D10
428
! Howard : XK0P en (moles/m3)**(-0.75) s-1
436
! Hawkin et Smith Purdue University Engeneering Bulletin, i
437
! Research series 108 vol 33, n 3n 1949
438
! Kp = 10**(4.6-14833/T)
439
! Constante d'equilibre en pression partielle (atm !)
440
! XKOE est le log decimal de la constante pre-exponentielle
441
! TOE n'est PAS une temerature d'activation ... il reste un lg(e)
442
! pour repasser en Kc et utiliser des concetrations (moles/m3)
443
! Kc = (1/RT)**variation nb moles * Kp
444
! ici Kc = sqrt(0.082*T)*Kp
448
! Dissociation du CO2 (Trinh Minh Chinh)
449
! ===================
461
! Nombre d'iterations
463
! Nombre de points converges
472
! Precision pour la convergence
477
xxco = propce(iel,ipproc(iym1(ico )))/wmole(ico) &
478
*propce(iel,ipproc(irom1))
479
xxo2 = propce(iel,ipproc(iym1(io2 )))/wmole(io2) &
480
*propce(iel,ipproc(irom1))
481
xxco2 = propce(iel,ipproc(iym1(ico2 )))/wmole(ico2) &
482
*propce(iel,ipproc(irom1))
483
xxh2o = propce(iel,ipproc(iym1(ih2o )))/wmole(ih2o) &
484
*propce(iel,ipproc(irom1))
486
xxco = max(xxco ,zero)
487
xxo2 = max(xxo2 ,zero)
488
xxco2 = max(xxco2,zero)
489
xxh2o = max(xxh2o,zero)
492
xkp = exp(lnk0p-t0p/propce(iel,ipproc(itemp1)))
493
xkm = exp(lnk0m-t0m/propce(iel,ipproc(itemp1)))
495
xkpequ = 10.d0**(l10k0e-t0e/propce(iel,ipproc(itemp1)))
497
/sqrt(8.32d0*propce(iel,ipproc(itemp1))/1.015d5)
499
! initialisation par l'�tat transport�
503
xo2m = xxo2 + 0.5d0*xxco2
505
if ( propce(iel,ipproc(itemp1)) .gt. 1200.d0 ) then
507
! Recherche de l'�tat d'�quilibre
508
! Recerche it�rative sans controle de convergence
509
! (pour conserver la parallelisation sur les mailles)
510
! sur le nombre de moles de reaction s�parant
511
! l'etat avant r�action (tel que calcul� par Cpcym)
512
! de l'�tat d'�quilibre
513
! ANMR doit etre borne entre 0 et Min(XCOM,2.*XO2M)
514
! on recherche la solution par dichotomie
517
anmr1 = min(xcom,2.d0*xo2m)
520
fn0 = -0.5d0 * anmr0**3 &
521
+ ( xcom + xo2m - xkcequ**2) * anmr0**2 &
522
- (.5d0*xcom +2.d0*xo2m)*xcom * anmr0 &
524
fn1 = -0.5d0 * anmr1**3 &
525
+ ( xcom + xo2m - xkcequ**2) * anmr1**2 &
526
- (.5d0*xcom +2.d0*xo2m)*xcom * anmr1 &
529
if ( xo2m.gt.1.d-6) then
530
do while ( iterch.lt.itermx .and. fn2.gt.errch )
531
anmr2 = 0.5d0*(anmr0+anmr1)
532
fn2 = -0.5d0 * anmr2**3 &
533
+ ( xcom + xo2m - xkcequ**2) * anmr2**2 &
534
- (.5d0*xcom +2.d0*xo2m)*xcom * anmr2 &
536
if(fn0*fn2 .gt. 0.d0) then
539
elseif(fn1*fn2 .gt. 0.d0) then
542
elseif(fn0*fn1 .gt. 0.d0) then
544
anmr2 = min(xcom,2.d0*xo2m)
550
if ( iterch .ge. itermx) then
553
nbimax = max(nbimax,iterch)
555
err1mx = max(err1mx,fn2)
559
xo2eq = xo2m - 0.5d0 * anmr2
568
xco2eq = min(xcom,2.d0*xo2m)
569
xo2eq = xo2m - 0.5d0*xco2eq
570
xcoeq = xcom - xco2eq
574
if ( xco2eq.gt.xxco2 ) then
576
xden = xkp*sqh2o*(xxo2)**0.25d0
581
if ( xden .ne. 0.d0 ) then
584
tautur = rtpa(iel,ik)/rtpa(iel,iep)
588
x2 = x2 + rtpa(iel,isca(iyfol(icla)))
593
smbrs(iel) = smbrs(iel) &
594
+wmole(ico2)/propce(iel,ipproc(irom1)) &
595
* (xco2eq-xxco2)/(tauchi+tautur) &
597
* volume(iel) * propce(iel,ipcrom)
599
w1 = volume(iel)*propce(iel,ipcrom)/(tauchi+tautur)
600
rovsdt(iel) = rovsdt(iel) + max(w1,zero)
603
rovsdt(iel) = rovsdt(iel) + 0.d0
604
smbrs(iel) = smbrs(iel) + 0.d0
618
write(nfecra,*) ' Max Error = ', err1mx
619
write(nfecra,*) ' no Points ', nberic, nbarre, nbpass
620
write(nfecra,*) ' Iter max number ', nbimax
628
! --> Terme source pour HCN et NO : uniquement a partir de la 2eme
631
if ( ieqnox .eq. 1 .and. ntcabs .gt. 1) then
633
if ( ivar.eq.isca(iyhcn) .or. ivar.eq.isca(iyno) ) then
635
iexp1 = ipproc(ighcn1)
636
iexp2 = ipproc(ighcn2)
637
iexp3 = ipproc(ignoth)
639
! QPR= %N lib�r� pendant l'evaporation/taux de matieres volatiles
644
! YMOY = % vapeur en sorties
658
if ( ivar.eq.isca(iyhcn) ) then
662
if (iwarni(ivar).ge.1) then
663
write(nfecra,1000) chaine(1:8)
671
xxo2 = propce(iel,ipproc(iym1(io2))) &
672
*propce(iel,ipproc(immel))/wmo2
674
aux = volume(iel)*propce(iel,ipcrom) &
675
*( propce(iel,iexp2) &
676
+propce(iel,iexp1)*rtpa(iel,isca(iyno)) &
677
*propce(iel,ipproc(immel))/wmno )
679
smbrs(iel) = smbrs(iel) - aux*rtpa(iel,ivar)
680
rovsdt(iel) = rovsdt(iel) + aux
686
ipcgev = ipproc(igmeva(icla))
687
ipcght = ipproc(igmhtf(icla))
688
ipcte2 = ipproc(itemp2(icla))
689
ipcte1 = ipproc(itemp1)
692
+ propce(iel,ipcrom)*propce(iel,ipcgev) &
693
*(propce(iel,ipcte2)-propce(iel,ipcte1))
696
+propce(iel,ipcrom)*propce(iel,ipcght)
699
if ( xxo2 .gt. 0.03d0 ) then
700
aux = -volume(iel)*fn*wmhcn/(wmole(in2)/2.d0) &
701
*( qpr*gmvap+(1.d0-qpr*ymoy)/(1.d0-ymoy)*gmhet )
703
aux = -volume(iel)*fn*wmhcn/(wmole(in2)/2.d0) &
706
smbrs(iel) = smbrs(iel) + aux
712
if ( ivar.eq.isca(iyno) ) then
716
if (iwarni(ivar).ge.1) then
717
write(nfecra,1000) chaine(1:8)
722
aux1 = volume(iel)*propce(iel,ipcrom) &
723
*propce(iel,iexp1)*rtpa(iel,isca(iyhcn)) &
724
*propce(iel,ipproc(immel))/wmhcn
725
aux2 = volume(iel)*propce(iel,ipcrom) &
726
*propce(iel,iexp2)*rtpa(iel,isca(iyhcn)) &
728
aux3 = volume(iel)*propce(iel,ipcrom)**1.5d0 &
730
*propce(iel,ipproc(iym1(in2)))
732
smbrs(iel) = smbrs(iel) - aux1*rtpa(iel,ivar) &
734
rovsdt(iel) = rovsdt(iel) + aux1
747
1000 format(' TERMES SOURCES PHYSIQUE PARTICULIERE POUR LA VARIABLE ' &
749
2000 format(' ATTENTION : LE TAUX DE VAPEUR EN SORTIE', &
751
' ON PREND QPR = 0.5')