Changeset 852 for LMDZ4/trunk/libf/phytherm/thermcell_flux.F90
- Timestamp:
- Oct 11, 2007, 3:43:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk/libf/phytherm/thermcell_flux.F90
r814 r852 28 28 29 29 integer ncorecfm1,ncorecfm2,ncorecfm3,ncorecalpha 30 integer ncorecfm4,ncorecfm5,ncorecfm6 30 integer ncorecfm4,ncorecfm5,ncorecfm6,ncorecfm7,ncorecfm8 31 31 32 32 33 33 REAL entr(ngrid,klev),detr(ngrid,klev) 34 34 REAL fm(ngrid,klev+1) 35 REAL zfm 35 36 36 37 integer igout … … 40 41 REAL f_old,ddd0,eee0,ddd,eee,zzz 41 42 42 REAL fracmax 43 save fracmax 44 45 fracmax=0.5 43 REAL fomass_max,alphamax 44 save fomass_max,alphamax 45 46 fomass_max=0.5 47 alphamax=0.7 46 48 47 49 ncorecfm1=0 … … 51 53 ncorecfm5=0 52 54 ncorecfm6=0 55 ncorecfm7=0 56 ncorecfm8=0 53 57 ncorecalpha=0 54 58 … … 56 60 fm(:,:)=0. 57 61 62 if (lev_out.ge.10) then 63 write(lunout,*) 'Dans thermcell_flux 0' 64 write(lunout,*) 'flux base ',f(igout) 65 write(lunout,*) 'lmax ',lmax(igout) 66 write(lunout,*) 'lalim ',lalim(igout) 67 write(lunout,*) 'ig= ',igout 68 write(lunout,*) ' l E* A* D* ' 69 write(lunout,'(i4,3e15.5)') (l,entr_star(igout,l),alim_star(igout,l),detr_star(igout,l) & 70 & ,l=1,lmax(igout)) 71 endif 72 58 73 59 74 !------------------------------------------------------------------------- … … 66 81 if (l.le.lmax(ig)) then 67 82 if (entr_star(ig,l).gt.1.) then 68 print*,'ig,l,lmax(ig)',ig,l,lmax(ig) 83 print*,'WARNING thermcell_flux 1 ig,l,lmax(ig)',ig,l,lmax(ig) 84 print*,'entr_star(ig,l)',entr_star(ig,l) 85 print*,'alim_star(ig,l)',alim_star(ig,l) 86 print*,'detr_star(ig,l)',detr_star(ig,l) 87 ! stop 88 endif 89 else 90 if (abs(entr_star(ig,l))+abs(alim_star(ig,l))+abs(detr_star(ig,l)).gt.0.) then 91 print*,'cas 1 : ig,l,lmax(ig)',ig,l,lmax(ig) 69 92 print*,'entr_star(ig,l)',entr_star(ig,l) 70 93 print*,'alim_star(ig,l)',alim_star(ig,l) … … 72 95 stop 73 96 endif 74 else75 if (abs(entr_star(ig,l))+abs(alim_star(ig,l))+abs(detr_star(ig,l)).gt.0) then76 print*,'ig,l,lmax(ig)',ig,l,lmax(ig)77 print*,'entr_star(ig,l)',entr_star(ig,l)78 print*,'alim_star(ig,l)',alim_star(ig,l)79 print*,'detr_star(ig,l)',detr_star(ig,l)80 stop81 endif82 97 endif 83 98 enddo … … 92 107 detr(:,l)=f(:)*detr_star(:,l) 93 108 enddo 109 110 if (lev_out.ge.10) then 111 write(lunout,*) 'Dans thermcell_flux 1' 112 write(lunout,*) 'flux base ',f(igout) 113 write(lunout,*) 'lmax ',lmax(igout) 114 write(lunout,*) 'lalim ',lalim(igout) 115 write(lunout,*) 'ig= ',igout 116 write(lunout,*) ' l E D W2' 117 write(lunout,'(i4,3e15.5)') (l,entr(igout,l),detr(igout,l) & 118 & ,zw2(igout,l+1),l=1,lmax(igout)) 119 endif 94 120 95 121 fm(:,1)=0. … … 107 133 enddo 108 134 109 if (lev_out.ge.10) then 110 write(lunout,*) 'Dans thermcell_flux 1' 111 write(lunout,*) 'flux base ',f(igout) 112 write(lunout,*) 'lmax ',lmax(igout) 113 write(lunout,*) 'lalim ',lalim(igout) 114 write(lunout,'(i6,i4,3e15.5)') (ig,l,entr(igout,l),detr(igout,l) & 115 & ,fm(igout,l+1),l=1,lmax(igout)) 116 endif 135 136 137 ! Test provisoire : pour comprendre pourquoi on corrige plein de fois 138 ! le cas fm6, on commence par regarder une premiere fois avant les 139 ! autres corrections. 140 141 do l=1,klev 142 do ig=1,ngrid 143 if (detr(ig,l).gt.fm(ig,l)) then 144 ncorecfm8=ncorecfm8+1 145 ! igout=ig 146 endif 147 enddo 148 enddo 149 150 if (lev_out.ge.10) & 151 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 152 & ptimestep,masse,entr,detr,fm,'2 ') 117 153 118 154 !------------------------------------------------------------------------- … … 130 166 enddo 131 167 enddo 168 169 if (lev_out.ge.10) & 170 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 171 & ptimestep,masse,entr,detr,fm,'3 ') 132 172 133 173 !------------------------------------------------------------------------- … … 151 191 enddo 152 192 193 if (lev_out.ge.10) & 194 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 195 & ptimestep,masse,entr,detr,fm,'4 ') 196 153 197 154 198 !------------------------------------------------------------------------- … … 167 211 enddo 168 212 213 if (lev_out.ge.10) & 214 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 215 & ptimestep,masse,entr,detr,fm,'5 ') 216 169 217 !------------------------------------------------------------------------- 170 218 !detr ne peut pas etre superieur a fm … … 172 220 173 221 if(1.eq.1) then 222 174 223 do l=1,klev 175 224 do ig=1,ngrid … … 181 230 ncorecfm6=ncorecfm6+1 182 231 detr(ig,l)=fm(ig,l) 183 entr(ig,l)=fm(ig,l+1) 184 endif 232 ! entr(ig,l)=fm(ig,l+1) 233 234 ! Dans le cas ou on est au dessus de la couche d'alimentation et que le 235 ! detrainement est plus fort que le flux de masse, on stope le thermique. 236 if (l.gt.lalim(ig)) then 237 lmax(ig)=l 238 fm(ig,l+1)=0. 239 entr(ig,l)=0. 240 else 241 ncorecfm7=ncorecfm7+1 242 endif 243 endif 244 245 if(l.gt.lmax(ig)) then 246 detr(ig,l)=0. 247 fm(ig,l+1)=0. 248 entr(ig,l)=0. 249 endif 250 185 251 if (entr(ig,l).lt.0.) then 186 252 print*,'ig,l,lmax(ig)',ig,l,lmax(ig) … … 194 260 195 261 262 if (lev_out.ge.10) & 263 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 264 & ptimestep,masse,entr,detr,fm,'6 ') 265 196 266 !------------------------------------------------------------------------- 197 267 !fm ne peut pas etre negatif … … 207 277 endif 208 278 if (detr(ig,l).lt.0.) then 209 print*,' ig,l,lmax(ig)',ig,l,lmax(ig)279 print*,'cas 2 : ig,l,lmax(ig)',ig,l,lmax(ig) 210 280 print*,'detr(ig,l)',detr(ig,l) 211 281 print*,'fm(ig,l)',fm(ig,l) … … 215 285 enddo 216 286 287 if (lev_out.ge.10) & 288 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 289 & ptimestep,masse,entr,detr,fm,'7 ') 290 217 291 !----------------------------------------------------------------------- 218 292 !la fraction couverte ne peut pas etre superieure a 1 219 293 !----------------------------------------------------------------------- 294 295 296 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 297 ! FH Partie a revisiter. 298 ! Il semble qu'etaient codees ici deux optiques dans le cas 299 ! F/ (rho *w) > 1 300 ! soit limiter la hauteur du thermique en considerant que c'est 301 ! la derniere chouche, soit limiter F a rho w. 302 ! Dans le second cas, il faut en fait limiter a un peu moins 303 ! que ca parce qu'on a des 1 / ( 1 -alpha) un peu plus loin 304 ! dans thermcell_main et qu'il semble de toutes facons deraisonable 305 ! d'avoir des fractions de 1.. 306 ! Ci dessous, et dans l'etat actuel, le premier des deux if est 307 ! sans doute inutile. 308 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 309 310 if(1.eq.0) then 311 220 312 do l=1,klev 221 313 do ig=1,ngrid 222 314 if (zw2(ig,l+1).gt.1.e-10) then 223 if ((((fm(ig,l+1))/(rhobarz(ig,l+1)*zw2(ig,l+1))).gt. &224 & 1.)) then315 zfm=rhobarz(ig,l+1)*zw2(ig,l+1)*alphamax 316 if ( fm(ig,l+1) .gt. zfm) then 225 317 f_old=fm(ig,l+1) 226 fm(ig,l+1)= rhobarz(ig,l+1)*zw2(ig,l+1)227 228 318 fm(ig,l+1)=zfm 319 ! zw2(ig,l+1)=0. 320 ! zqla(ig,l+1)=0. 229 321 detr(ig,l)=detr(ig,l)+f_old-fm(ig,l+1) 230 231 322 ! lmax(ig)=l+1 323 ! zmax(ig)=zlev(ig,lmax(ig)) 232 324 ! print*,'alpha>1',l+1,lmax(ig) 233 325 ncorecalpha=ncorecalpha+1 … … 237 329 enddo 238 330 ! 331 if (lev_out.ge.10) & 332 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 333 & ptimestep,masse,entr,detr,fm,'8 ') 334 335 endif 239 336 240 337 !----------------------------------------------------------------------- … … 248 345 eee0=entr(ig,l) 249 346 ddd0=detr(ig,l) 250 eee=entr(ig,l)-masse(ig,l)*f racmax/ptimestep347 eee=entr(ig,l)-masse(ig,l)*fomass_max/ptimestep 251 348 ddd=detr(ig,l)-eee 252 349 if (eee.gt.0.) then … … 272 369 print*,'detr',detr(ig,l) 273 370 print*,'masse',masse(ig,l) 274 print*,'f racmax',fracmax275 print*,'masse(ig,l)*f racmax/ptimestep',masse(ig,l)*fracmax/ptimestep371 print*,'fomass_max',fomass_max 372 print*,'masse(ig,l)*fomass_max/ptimestep',masse(ig,l)*fomass_max/ptimestep 276 373 print*,'ptimestep',ptimestep 277 374 print*,'lmax(ig)',lmax(ig) … … 309 406 & ncorecfm4,'x fm4',ncorecfm5,'x fm5 et', & 310 407 & ncorecfm6,'x fm6', & 408 & ncorecfm7,'x fm7', & 409 & ncorecfm8,'x fm8', & 311 410 & ncorecalpha,'x alpha' 312 411 endif 313 412 413 if (lev_out.ge.10) & 414 & call printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 415 & ptimestep,masse,entr,detr,fm,'fin') 416 314 417 315 418 return 316 419 end 420 421 subroutine printflux(ngrid,klev,lunout,igout,f,lmax,lalim, & 422 & ptimestep,masse,entr,detr,fm,descr) 423 424 implicit none 425 426 integer ngrid,klev,lunout,igout,l,lm 427 428 integer lmax(klev),lalim(klev) 429 real ptimestep,masse(ngrid,klev),entr(ngrid,klev),detr(ngrid,klev) 430 real fm(ngrid,klev+1),f(ngrid) 431 432 character*3 descr 433 434 lm=lmax(igout)+5 435 if(lm.gt.klev) lm=klev 436 437 print*,'Impression jusque lm=',lm 438 439 write(lunout,*) 'Dans thermcell_flux '//descr 440 write(lunout,*) 'flux base ',f(igout) 441 write(lunout,*) 'lmax ',lmax(igout) 442 write(lunout,*) 'lalim ',lalim(igout) 443 write(lunout,*) 'ig= ',igout 444 write(lunout,'(a3,4a14)') 'l','M','E','D','F' 445 write(lunout,'(i4,4e14.4)') (l,masse(igout,l)/ptimestep, & 446 & entr(igout,l),detr(igout,l) & 447 & ,fm(igout,l+1),l=1,lm) 448 449 450 do l=lmax(igout)+1,klev 451 if (abs(entr(igout,l))+abs(detr(igout,l))+abs(fm(igout,l)).gt.0.) then 452 print*,'cas 1 : igout,l,lmax(igout)',igout,l,lmax(igout) 453 print*,'entr(igout,l)',entr(igout,l) 454 print*,'detr(igout,l)',detr(igout,l) 455 print*,'fm(igout,l)',fm(igout,l) 456 stop 457 endif 458 enddo 459 460 return 461 end 462
Note: See TracChangeset
for help on using the changeset viewer.