Changeset 2966 for trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F
- Timestamp:
- May 19, 2023, 12:49:25 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F
r2934 r2966 27 27 & qperemin 28 28 use dimradmars_mod, only: naerkind 29 use conc_mod, only: mmean 29 30 use write_output_mod, only: write_output 30 31 IMPLICIT NONE … … 45 46 c 46 47 c 2004 - 2012 48 c 49 c 2023: J. Naar, adding different subtimestep on each grid cell 50 c plus not doing microphysics if no water present 51 c plus simpleclouds no longer in the loop for microphysics 47 52 c======================================================================= 48 53 … … 105 110 106 111 ! global tendency (clouds+physics) 112 ! JN : keeping this for simpleclouds scheme 107 113 REAL sum_subpdq(ngrid,nlay,nq) ! cf. pdqcloud 108 114 REAL sum_subpdt(ngrid,nlay) ! cf. pdtcloud … … 137 143 138 144 !$OMP THREADPRIVATE(flagcloud) 145 146 ! Scheme for adaptative timestep J. Naar 2023 147 c LOGICAL :: computed_micro(ngrid,nlay) ! Check if microphy was done in this cell 148 REAL :: computed_micro(ngrid,nlay) ! Check if microphy was done inthis cell (logical) 149 REAL :: zt_micro(ngrid,nlay) ! Temperature during microphysics (K) 150 REAL :: zq_micro(ngrid,nlay,nq) ! Tracers during microphysics (kg/kg) 151 REAL :: zqsat_micro(ngrid,nlay) ! Theoritical q(h2o_vap) at saturation (kg/kg) 152 INTEGER :: zimicro(ngrid,nlay) ! Number of ptimestep divisions 153 REAL :: zpotcond_inst(ngrid,nlay) ! condensable water at the beginning of physics (kg/kg) 154 REAL :: zpotcond_full(ngrid,nlay) ! condensable water with integrated tendancies (kg/kg) 155 REAL :: zpotcond(ngrid,nlay) ! maximal condensable water, used to 156 compute adaptative subdivision of ptimestep 157 139 158 140 159 c ** un petit test de coherence … … 282 301 c------------------------------------------------------------------ 283 302 rhocloud(1:ngrid,1:nlay) = rho_dust 284 DO microstep=1,imicro 285 303 304 305 c Initialisation of all the stuff JN2023 306 c computed_micro(1:ngrid,1:nlay)=.false. 307 computed_micro(1:ngrid,1:nlay)=0. 308 zt_micro(:,:)=pt(:,:) 309 zq_micro(:,:,:)=pq(:,:,:) 310 zq_micro(:,:,:)=pq(:,:,:) 311 call watersat(ngrid*nlay,zt_micro,pplay,zqsat_micro) 312 zpotcond_inst=zq_micro(:,:,igcm_h2o_vap) - zqsat_micro 313 call watersat(ngrid*nlay,zt_micro+pdt*ptimestep,pplay,zqsat_micro) 314 zpotcond_full=(zq_micro(:,:,igcm_h2o_vap)+ 315 & pdq(:,:,igcm_h2o_vap)*ptimestep) - zqsat_micro 316 zimicro(1:ngrid,1:nlay)=imicro 317 if (cloud_adapt_ts) then 318 call adapt_imicro(ptimestep,zpotcond(ig,l), 319 $ zimicro(ig,l)) 320 endif! (cloud_adapt_ts) then 321 DO l=1,nlay 322 DO ig=1,ngrid 323 c Start by computing the condensable water vapor amount 324 if (zpotcond_full(ig,l).gt.0.) then 325 zpotcond(ig,l)=max(zpotcond_inst(ig,l),zpotcond_full(ig,l)) 326 else if (zpotcond_full(ig,l).le.0.) then 327 zpotcond(ig,l)=min(zpotcond_inst(ig,l),zpotcond_full(ig,l)) 328 endif! (zpotcond_full.gt.0.) then 329 microtimestep=ptimestep/real(zimicro(ig,l)) 330 c Check if microphysics is even needed, that is if enough action 331 c is happening water-wise 332 if ((pq(ig,l,igcm_h2o_ice)+pdq(ig,l,igcm_h2o_ice)*ptimestep 333 & .gt.1e-22) .or. (abs(zpotcond(ig,l)).gt.1e-22)) then 334 c Eventuellement sortir simpleclouds de la boucle egalement 335 computed_micro(ig,l)=1. 336 DO microstep=1,zimicro(ig,l) 337 338 339 c JN : incrementing after main microphysics scheme 340 c Previously we were incrementing tendencies, we now 341 c increment tracers and temperature directly 342 c We are thus starting at the end of the first iteration 343 c 286 344 c------------------------------------------------------------------- 287 c 1. Tendencies: 288 c------------------ 289 290 291 c------ Temperature tendency subpdt 292 ! Each microtimestep we give the cloud scheme a stepped entry subpdt instead of pdt 293 ! If imicro=1 subpdt is the same as pdt 294 DO l=1,nlay 295 DO ig=1,ngrid 296 sum_subpdt(ig,l) = sum_subpdt(ig,l) 297 & + pdt(ig,l) ! At each micro timestep we add pdt in order to have a stepped entry 298 ENDDO 299 ENDDO 300 c------ Tracers tendencies subpdq are additionned 301 c------ At each micro timestep we add pdq in order to have a stepped entry 302 IF (microphys) THEN 303 DO l=1,nlay 304 DO ig=1,ngrid 305 sum_subpdq(ig,l,igcm_dust_mass) = 306 & sum_subpdq(ig,l,igcm_dust_mass) 307 & + pdq(ig,l,igcm_dust_mass) 308 sum_subpdq(ig,l,igcm_dust_number) = 309 & sum_subpdq(ig,l,igcm_dust_number) 310 & + pdq(ig,l,igcm_dust_number) 311 sum_subpdq(ig,l,igcm_ccn_mass) = 312 & sum_subpdq(ig,l,igcm_ccn_mass) 313 & + pdq(ig,l,igcm_ccn_mass) 314 sum_subpdq(ig,l,igcm_ccn_number) = 315 & sum_subpdq(ig,l,igcm_ccn_number) 316 & + pdq(ig,l,igcm_ccn_number) 317 ENDDO 318 ENDDO 319 ENDIF 320 DO l=1,nlay 321 DO ig=1,ngrid 322 sum_subpdq(ig,l,igcm_h2o_ice) = 323 & sum_subpdq(ig,l,igcm_h2o_ice) 324 & + pdq(ig,l,igcm_h2o_ice) 325 sum_subpdq(ig,l,igcm_h2o_vap) = 326 & sum_subpdq(ig,l,igcm_h2o_vap) 327 & + pdq(ig,l,igcm_h2o_vap) 328 IF (hdo) THEN 329 sum_subpdq(ig,l,igcm_hdo_ice) = 330 & sum_subpdq(ig,l,igcm_hdo_ice) 331 & + pdq(ig,l,igcm_hdo_ice) 332 sum_subpdq(ig,l,igcm_hdo_vap) = 333 & sum_subpdq(ig,l,igcm_hdo_vap) 334 & + pdq(ig,l,igcm_hdo_vap) 335 ENDIF !hdo 336 ENDDO 337 ENDDO 338 339 c------------------------------------------------------------------- 340 c 2. Main call to the different cloud schemes: 345 c 1. Main call to the different cloud schemes: 341 346 c------------------------------------------------ 342 347 IF (microphys) THEN 343 CALL improvedclouds( ngrid,nlay,microtimestep,344 & pplay,pteff,sum_subpdt,345 & pqeff,sum_subpdq,subpdqcloud,subpdtcloud,346 & nq,tauscaling)348 CALL improvedclouds(microtimestep, 349 & pplay(ig,l),zt_micro(ig,l), 350 & zq_micro(ig,l,:),subpdqcloud(ig,l,:), 351 & subpdtcloud(ig,l),nq,tauscaling(ig),mmean(ig,l)) 347 352 348 353 ELSE 354 c Simpleclouds should maybe be taken out and put in a specific loop ? 349 355 CALL simpleclouds(ngrid,nlay,microtimestep, 350 356 & pplay,pzlay,pteff,sum_subpdt, … … 354 360 355 361 c------------------------------------------------------------------- 356 c 3. Updating tendenciesafter cloud scheme:362 c 2. Updating tracers and temperature after cloud scheme: 357 363 c----------------------------------------------- 358 364 359 365 IF (microphys) THEN 360 DO l=1,nlay 361 DO ig=1,ngrid 362 sum_subpdq(ig,l,igcm_dust_mass) = 363 & sum_subpdq(ig,l,igcm_dust_mass) 364 & + subpdqcloud(ig,l,igcm_dust_mass) 365 sum_subpdq(ig,l,igcm_dust_number) = 366 & sum_subpdq(ig,l,igcm_dust_number) 367 & + subpdqcloud(ig,l,igcm_dust_number) 368 sum_subpdq(ig,l,igcm_ccn_mass) = 369 & sum_subpdq(ig,l,igcm_ccn_mass) 370 & + subpdqcloud(ig,l,igcm_ccn_mass) 371 sum_subpdq(ig,l,igcm_ccn_number) = 372 & sum_subpdq(ig,l,igcm_ccn_number) 373 & + subpdqcloud(ig,l,igcm_ccn_number) 374 ENDDO 375 ENDDO 366 zq_micro(ig,l,igcm_dust_mass) = 367 & zq_micro(ig,l,igcm_dust_mass)+(pdq(ig,l,igcm_dust_mass) 368 & +subpdqcloud(ig,l,igcm_dust_mass))*microtimestep 369 zq_micro(ig,l,igcm_dust_number) = 370 & zq_micro(ig,l,igcm_dust_number) 371 & +(pdq(ig,l,igcm_dust_number) 372 & + subpdqcloud(ig,l,igcm_dust_number))*microtimestep 373 zq_micro(ig,l,igcm_ccn_mass) = 374 & zq_micro(ig,l,igcm_ccn_mass) + 375 & (pdq(ig,l,igcm_ccn_mass) 376 & +subpdqcloud(ig,l,igcm_ccn_mass))*microtimestep 377 zq_micro(ig,l,igcm_ccn_number) = 378 & zq_micro(ig,l,igcm_ccn_number) + 379 & (pdq(ig,l,igcm_ccn_number) 380 & + subpdqcloud(ig,l,igcm_ccn_number))*microtimestep 376 381 ENDIF 377 DO l=1,nlay378 DO ig=1,ngrid379 sum_subpdq(ig,l,igcm_h2o_ice) =380 & sum_subpdq(ig,l,igcm_h2o_ice)381 & + subpdqcloud(ig,l,igcm_h2o_ice)382 sum_subpdq(ig,l,igcm_h2o_vap) =383 & sum_subpdq(ig,l,igcm_h2o_vap)384 & + subpdqcloud(ig,l,igcm_h2o_vap) 382 zq_micro(ig,l,igcm_h2o_ice) = 383 & zq_micro(ig,l,igcm_h2o_ice)+ 384 & (pdq(ig,l,igcm_h2o_ice) 385 & + subpdqcloud(ig,l,igcm_h2o_ice))*microtimestep 386 zq_micro(ig,l,igcm_h2o_vap) = 387 & zq_micro(ig,l,igcm_h2o_vap)+ 388 & (pdq(ig,l,igcm_h2o_vap) 389 & + subpdqcloud(ig,l,igcm_h2o_vap))*microtimestep 385 390 386 391 IF (hdo) THEN 387 sum_subpdq(ig,l,igcm_hdo_ice) = 388 & sum_subpdq(ig,l,igcm_hdo_ice) 389 & + subpdqcloud(ig,l,igcm_hdo_ice) 390 sum_subpdq(ig,l,igcm_hdo_vap) = 391 & sum_subpdq(ig,l,igcm_hdo_vap) 392 & + subpdqcloud(ig,l,igcm_hdo_vap) 392 zq_micro(ig,l,igcm_hdo_ice) = 393 & zq_micro(ig,l,igcm_hdo_ice)+ 394 & (pdq(ig,l,igcm_hdo_ice) 395 & + subpdqcloud(ig,l,igcm_hdo_ice))*microtimestep 396 zq_micro(ig,l,igcm_hdo_vap) = 397 & zq_micro(ig,l,igcm_hdo_vap)+ 398 & (pdq(ig,l,igcm_hdo_vap) 399 & + subpdqcloud(ig,l,igcm_hdo_vap))*microtimestep 393 400 ENDIF ! hdo 394 401 395 ENDDO 396 ENDDO397 402 c Could also set subpdtcloud to 0 if not activice to make it simpler 403 zt_micro(ig,l) = zt_micro(ig,l)+ 404 & pdt(ig,l)*microtimestep 398 405 IF (activice) THEN 399 DO l=1,nlay 400 DO ig=1,ngrid 401 sum_subpdt(ig,l) = 402 & sum_subpdt(ig,l) + subpdtcloud(ig,l) 403 ENDDO 404 ENDDO 406 zt_micro(ig,l) = zt_micro(ig,l)+ 407 & subpdtcloud(ig,l)*microtimestep 405 408 ENDIF 406 407 409 ! !! Example of how to use writediagmicrofi useful to 408 410 ! !! get outputs at each microphysical sub-timestep (better to be used in 1D) … … 411 413 ! & 'subpdtcloud','K/s',1,subpdtcloud(:,:)) 412 414 413 ENDDO ! of DO microstep=1,imicro 414 415 ENDDO ! of DO microstep=1,imicro 416 endif! (zq(ig,l,igcm_h2o_ice)+pdq(ig,l,igcm_h2o_ice)*ptimestep 417 ! & .gt.1e-22).or.(abs(zpotcond).gt.1e-22) then 418 ENDDO ! ig=1,ngrid 419 ENDDO ! l=1,nlay 420 421 422 c------ Useful outputs to check how it went 423 call write_output("computed_micro","computed_micro "// 424 & "after microphysics","logical",computed_micro(:,:)) 425 call write_output("zimicro","Used number of subtimestep "// 426 & "in cloud microphysics","integer",real(zimicro(:,:))) 415 427 c------------------------------------------------------------------- 416 c 6. Compute final tendencies after time loop:428 c 3. Compute final tendencies after time loop: 417 429 c------------------------------------------------ 418 430 … … 420 432 DO l=1,nlay 421 433 DO ig=1,ngrid 422 pdtcloud(ig,l) =423 & sum_subpdt(ig,l)/real(imicro)-pdt(ig,l)424 434 pdtcloud(ig,l) = -pdt(ig,l)+ 435 & (zt_micro(ig,l)-pt(ig,l)) / ptimestep 436 ENDDO 425 437 ENDDO 426 438 427 439 c------ Tracers tendencies pdqcloud 428 440 DO l=1,nlay 429 441 DO ig=1,ngrid 430 pdqcloud(ig,l,igcm_h2o_ice) = 431 & sum_subpdq(ig,l,igcm_h2o_ice)/real(imicro) 432 & - pdq(ig,l,igcm_h2o_ice) 433 pdqcloud(ig,l,igcm_h2o_vap) = 434 & sum_subpdq(ig,l,igcm_h2o_vap)/real(imicro) 435 & - pdq(ig,l,igcm_h2o_vap) 442 pdqcloud(ig,l,igcm_h2o_ice) = 443 & -pdq(ig,l,igcm_h2o_ice)+ 444 & (zq_micro(ig,l,igcm_h2o_ice) - 445 & pq(ig,l,igcm_h2o_ice)) / ptimestep 446 pdqcloud(ig,l,igcm_h2o_vap) = 447 & -pdq(ig,l,igcm_h2o_vap)+ 448 & (zq_micro(ig,l,igcm_h2o_vap) - 449 & pq(ig,l,igcm_h2o_vap)) / ptimestep 436 450 IF (hdo) THEN 437 pdqcloud(ig,l,igcm_hdo_ice) = 438 & sum_subpdq(ig,l,igcm_hdo_ice)/real(imicro) 439 & - pdq(ig,l,igcm_hdo_ice) 440 pdqcloud(ig,l,igcm_hdo_vap) = 441 & sum_subpdq(ig,l,igcm_hdo_vap)/real(imicro) 442 & - pdq(ig,l,igcm_hdo_vap) 451 pdqcloud(ig,l,igcm_hdo_ice) = 452 & -pdq(ig,l,igcm_hdo_ice)+ 453 & (zq_micro(ig,l,igcm_hdo_ice) - 454 & pq(ig,l,igcm_hdo_ice)) / ptimestep 455 pdqcloud(ig,l,igcm_hdo_vap) = 456 & -pdq(ig,l,igcm_hdo_vap)+ 457 & (zq_micro(ig,l,igcm_hdo_vap) - 458 & pq(ig,l,igcm_hdo_vap)) / ptimestep 443 459 ENDIF !hdo 444 460 ENDDO 445 ENDDO 446 461 ENDDO 462 447 463 IF(microphys) THEN 448 464 DO l=1,nlay 449 465 DO ig=1,ngrid 450 pdqcloud(ig,l,igcm_ccn_mass) = 451 & sum_subpdq(ig,l,igcm_ccn_mass)/real(imicro) 452 & - pdq(ig,l,igcm_ccn_mass) 453 pdqcloud(ig,l,igcm_ccn_number) = 454 & sum_subpdq(ig,l,igcm_ccn_number)/real(imicro) 455 & - pdq(ig,l,igcm_ccn_number) 466 pdqcloud(ig,l,igcm_ccn_mass) = 467 & -pdq(ig,l,igcm_ccn_mass)+ 468 & (zq_micro(ig,l,igcm_ccn_mass) - 469 & pq(ig,l,igcm_ccn_mass)) / ptimestep 470 pdqcloud(ig,l,igcm_ccn_number) = 471 & -pdq(ig,l,igcm_ccn_number)+ 472 & (zq_micro(ig,l,igcm_ccn_number) - 473 & pq(ig,l,igcm_ccn_number)) / ptimestep 456 474 ENDDO 457 475 ENDDO 458 476 ENDIF 459 477 460 478 IF(scavenging) THEN 461 479 DO l=1,nlay 462 480 DO ig=1,ngrid 463 pdqcloud(ig,l,igcm_dust_mass) = 464 & sum_subpdq(ig,l,igcm_dust_mass)/real(imicro) 465 & - pdq(ig,l,igcm_dust_mass) 466 pdqcloud(ig,l,igcm_dust_number) = 467 & sum_subpdq(ig,l,igcm_dust_number)/real(imicro) 468 & - pdq(ig,l,igcm_dust_number) 481 pdqcloud(ig,l,igcm_dust_mass) = 482 & -pdq(ig,l,igcm_dust_mass)+ 483 & (zq_micro(ig,l,igcm_dust_mass) - 484 & pq(ig,l,igcm_dust_mass)) / ptimestep 485 pdqcloud(ig,l,igcm_dust_number) = 486 & -pdq(ig,l,igcm_dust_number)+ 487 & (zq_micro(ig,l,igcm_dust_number) - 488 & pq(ig,l,igcm_dust_number)) / ptimestep 469 489 ENDDO 470 490 ENDDO … … 764 784 end subroutine end_watercloud_mod 765 785 786 787 788 SUBROUTINE adapt_imicro(ptimestep,potcond, 789 $ zimicro) 790 791 c Pas de temps adaptatif pour les nuages 792 793 real,intent(in) :: ptimestep ! total duration of physics (sec) 794 real,intent(in) :: potcond ! total duration of physics (sec) 795 real :: alpha, beta ! total duration of physics (sec) 796 integer,intent(out) :: zimicro ! number of ptimestep division 797 798 c zimicro = ptimestep*alpha*potcond**beta 799 zimicro = 30 800 801 END SUBROUTINE adapt_imicro 802 803 766 804 END MODULE watercloud_mod
Note: See TracChangeset
for help on using the changeset viewer.