7 &
detr,zqla,lev_out,lunout1,igout)
17 #include "thermcell.h"
25 REAL zlev(ngrid,
klev+1)
26 REAL masse(ngrid,
klev)
28 REAL rhobarz(ngrid,
klev)
35 integer ncorecfm1,ncorecfm2,ncorecfm3,ncorecalpha
36 integer ncorecfm4,ncorecfm5,ncorecfm6,ncorecfm7,ncorecfm8
47 REAL f_old,ddd0,eee0,ddd,eee,zzz
49 REAL fomass_max,alphamax
50 save fomass_max,alphamax
52 logical check_debug,labort_gcm
54 character (len=20) :: modname=
'thermcell_flux2'
55 character (len=80) :: abort_message
74 write(lunout1,*)
'Dans thermcell_flux 0'
75 write(lunout1,*)
'flux base ',
f(igout)
76 write(lunout1,*)
'lmax ',lmax(igout)
77 write(lunout1,*)
'lalim ',lalim(igout)
78 write(lunout1,*)
'ig= ',igout
79 write(lunout1,*)
' l E* A* D* '
96 if (
l.le.lmax(ig))
then
97 if (entr_star(ig,
l).gt.1.)
then
98 print*,
'WARNING thermcell_flux 1 ig,l,lmax(ig)',ig,
l,lmax(ig)
99 print*,
'entr_star(ig,l)',entr_star(ig,
l)
105 print*,
'cas 1 : ig,l,lmax(ig)',ig,
l,lmax(ig)
106 print*,
'entr_star(ig,l)',entr_star(ig,
l)
128 write(lunout1,*)
'Dans thermcell_flux 1'
129 write(lunout1,*)
'flux base ',
f(igout)
130 write(lunout1,*)
'lmax ',lmax(igout)
131 write(lunout1,*)
'lalim ',lalim(igout)
132 write(lunout1,*)
'ig= ',igout
133 write(lunout1,*)
' l E D W2'
134 write(lunout1,
'(i4,3e15.5)') (
l,entr(igout,
l),
detr(igout,
l) &
135 & ,
zw2(igout,
l+1),
l=1,lmax(igout))
141 if (
l.lt.lmax(ig))
then
142 fm(ig,
l+1)=fm(ig,
l)+entr(ig,
l)-
detr(ig,
l)
143 elseif(
l.eq.lmax(ig))
then
160 if (
detr(ig,
l).gt.fm(ig,
l))
then
161 ncorecfm8=ncorecfm8+1
185 if (
l.lt.lmax(ig))
then
186 fm(ig,
l+1)=fm(ig,
l)+entr(ig,
l)-
detr(ig,
l)
187 elseif(
l.eq.lmax(ig))
then
202 if (fm(ig,
l+1).lt.0.)
then
204 ncorecfm1=ncorecfm1+1
212 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
213 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
218 if (iflag_thermals_optflux==0)
then
221 if (
l.ge.lalim(ig).and.
l.le.lmax(ig) &
222 & .and.(
zw2(ig,
l+1).gt.1.e-10).and.(
zw2(ig,
l).gt.1.e-10) )
then
224 zzz=fm(ig,
l)*rhobarz(ig,
l+1)*
zw2(ig,
l+1) &
225 & /(rhobarz(ig,
l)*
zw2(ig,
l))
226 if (fm(ig,
l+1).gt.zzz)
then
229 ncorecfm4=ncorecfm4+1
237 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
238 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
244 if (iflag_thermals_optflux==0)
then
247 if ((fm(ig,
l+1).gt.fm(ig,
l)).and.(
l.gt.lalim(ig)))
then
251 ncorecfm5=ncorecfm5+1
258 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
259 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
274 if (entr(ig,
l)<0.)
then
282 print*,
'N1 ig,l,entr',igout,lout,entr(igout,lout)
283 abort_message =
'entr negatif'
288 if (
detr(ig,
l).gt.fm(ig,
l))
then
289 ncorecfm6=ncorecfm6+1
291 entr(ig,
l)=fm(ig,
l+1)
305 if(
l.gt.lmax(ig))
then
314 if (entr(ig,
l).lt.0.)
then
321 print*,
'ig,l,lmax(ig)',ig,
l,lmax(ig)
322 print*,
'entr(ig,l)',entr(ig,
l)
323 print*,
'fm(ig,l)',fm(ig,
l)
324 abort_message =
'probleme dans thermcell flux'
334 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
335 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
343 if (fm(ig,
l+1).lt.0.)
then
346 ncorecfm2=ncorecfm2+1
352 if (
detr(ig,
l).lt.0.)
then
359 print*,
'cas 2 : ig,l,lmax(ig)',ig,
l,lmax(ig)
360 print*,
'detr(ig,l)',
detr(ig,
l)
361 print*,
'fm(ig,l)',fm(ig,
l)
362 abort_message =
'probleme dans thermcell flux'
368 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
369 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
392 if (
zw2(ig,
l+1).gt.1.e-10)
then
393 zfm=rhobarz(ig,
l+1)*
zw2(ig,
l+1)*alphamax
394 if ( fm(ig,
l+1) .gt. zfm)
then
403 ncorecalpha=ncorecalpha+1
412 &
write(lunout1,
'(i4,4e14.4)')
l,masse(igout,
l)/ptimestep, &
413 & entr(igout,
l),
detr(igout,
l),fm(igout,
l+1)
434 eee=entr(ig,
l)-masse(ig,
l)*fomass_max/ptimestep
437 ncorecfm3=ncorecfm3+1
438 entr(ig,
l)=entr(ig,
l)-eee
446 if(
l.eq.lmax(ig))
then
449 if(
l.ge.lmax(ig).and.0.eq.1)
then
454 entr(ig,
l+1)=entr(ig,
l+1)-ddd
456 fm(ig,
l+1)=fm(ig,
l)+entr(ig,
l)
471 print*,
'entr',entr(ig,
l)
472 print*,
'detr',
detr(ig,
l)
473 print*,
'masse',masse(ig,
l)
474 print*,
'fomass_max',fomass_max
475 print*,
'masse(ig,l)*fomass_max/ptimestep',masse(ig,
l)*fomass_max/ptimestep
476 print*,
'ptimestep',ptimestep
477 print*,
'lmax(ig)',lmax(ig)
478 print*,
'fm(ig,l+1)',fm(ig,
l+1)
479 print*,
'fm(ig,l)',fm(ig,
l)
480 abort_message =
'probleme dans thermcell_flux'
490 detr(ig,lmax(ig))=fm(ig,lmax(ig))+entr(ig,lmax(ig))