5 & lalim,
lmax,alim_star, &
6 & entr_star,detr_star,f,rhobarz,zlev,zw2,fm,entr, &
7 & detr,zqla,lev_out,lunout1,igout)
17 #include "thermcell.h"
22 REAL alim_star(ngrid,klev),entr_star(ngrid,klev)
23 REAL detr_star(ngrid,klev)
24 REAL zw2(ngrid,klev+1)
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
39 REAL entr(ngrid,klev),detr(ngrid,klev)
47 REAL f_old,ddd0,eee0,ddd,eee,zzz
49 REAL fomass_max,alphamax
50 save fomass_max,alphamax
52 logical check_debug,labort_physic
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* '
80 write(lunout1,
'(i4,3e15.5)') (l,entr_star(igout,l),alim_star(igout,l),detr_star(igout,l) &
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)
100 print*,
'alim_star(ig,l)',alim_star(ig,l)
101 print*,
'detr_star(ig,l)',detr_star(ig,l)
104 if (abs(entr_star(ig,l))+abs(alim_star(ig,l))+abs(detr_star(ig,l)).gt.0.)
then
105 print*,
'cas 1 : ig,l,lmax(ig)',ig,l,lmax(ig)
106 print*,
'entr_star(ig,l)',entr_star(ig,l)
107 print*,
'alim_star(ig,l)',alim_star(ig,l)
108 print*,
'detr_star(ig,l)',detr_star(ig,l)
123 entr(:,l)=f(:)*(entr_star(:,l)+alim_star(:,l))
124 detr(:,l)=f(:)*detr_star(:,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
145 detr(ig,l)=fm(ig,l)+entr(ig,l)
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
189 detr(ig,l)=fm(ig,l)+entr(ig,l)
202 if (fm(ig,l+1).lt.0.)
then
204 ncorecfm1=ncorecfm1+1
206 detr(ig,l)=entr(ig,l)
212 &
write(lunout1,
'(i4,4e14.4)') l,masse(igout,l)/ptimestep, &
213 & entr(igout,l),detr(igout,l),fm(igout,l+1)
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
227 detr(ig,l)=detr(ig,l)+fm(ig,l+1)-zzz
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)
247 if ((fm(ig,l+1).gt.fm(ig,l)).and.(l.gt.lalim(ig)))
then
250 detr(ig,l)=detr(ig,l)+f_old-fm(ig,l+1)
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)
272 labort_physic=.
false.
274 if (entr(ig,l)<0.)
then
281 if (labort_physic)
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
312 labort_physic=.
false.
314 if (entr(ig,l).lt.0.)
then
319 if (labort_physic)
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
344 detr(ig,l)=detr(ig,l)+fm(ig,l+1)
346 ncorecfm2=ncorecfm2+1
350 labort_physic=.
false.
352 if (detr(ig,l).lt.0.)
then
357 if (labort_physic)
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
399 detr(ig,l)=detr(ig,l)+f_old-fm(ig,l+1)
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)
429 labort_physic=.
false.
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
447 detr(ig,l)=fm(ig,l)+entr(ig,l)
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)
463 if (labort_physic)
then
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))
nsplit_thermals!nrlmd le iflag_clos_bl tau_trig_deep real::s_trig!fin nrlmd le fact_thermals_ed_dz iflag_wake iflag_thermals_optflux
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL false
!FH On elimine toutes les clefs physiques dans la dynamique prt_level
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL ulevSTD CALL &zphi philevSTD CALL &zx_rh rhlevSTD!DO klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon du jour ou toutes les read_climoz CALL true
subroutine thermcell_flux2(ngrid, klev, ptimestep, masse, lalim, lmax, alim_star, entr_star, detr_star, f, rhobarz, zlev, zw2, fm, entr, detr, zqla, lev_out, lunout1, igout)
subroutine abort_physic(modname, message, ierr)