Changeset 4044 for trunk/LMDZ.MARS/libf
- Timestamp:
- Feb 5, 2026, 3:39:30 PM (3 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/improvedclouds_mod.F90
r3939 r4044 79 79 REAL, dimension(ngrid,nlay) :: alpha ! HDO equilibrium fractionation coefficient (Saturation=1) 80 80 REAL, dimension(ngrid,nlay) :: alpha_c ! HDO real fractionation coefficient 81 ! REAL :: sumcheck82 81 REAL*8 :: ph2o ! Water vapor partial pressure (Pa) 83 82 REAL*8 :: satu ! Water vapor saturation ratio over ice … … 93 92 REAL :: Dv,Dv_hdo ! Water/HDO vapor diffusion coefficient 94 93 95 ! Parameters of the size discretization used by the microphysical scheme94 ! Parameters of the size discretization used by the microphysical scheme 96 95 DOUBLE PRECISION, PARAMETER :: rmin_cld = 0.1e-6 ! Minimum radius (m) 97 96 DOUBLE PRECISION, PARAMETER :: rmax_cld = 10.e-6 ! Maximum radius (m) … … 111 110 REAL, dimension(ngrid,nlay) :: subpdtcloud ! Temperature variation due to latent heat 112 111 REAL, dimension(ngrid,nlay,nq) :: zq0 ! local initial value of tracers 113 ! REAL, dimension(ngrid,nlay,nq) :: zt0 ! local initial value of temperature114 112 INTEGER, dimension(ngrid,nlay) :: zimicro ! Subdivision of ptimestep 115 113 INTEGER, dimension(ngrid,nlay) :: count_micro ! Number of microphys calls 116 REAL, dimension(ngrid,nlay) :: zpotcond_inst ! condensable water at the beginning of physics (kg/kg)117 REAL, dimension(ngrid,nlay) :: zpotcond_full ! condensable water with integrated tendancies (kg/kg)118 114 REAL, dimension(ngrid,nlay) :: zpotcond ! maximal condensable water (previous two) 119 115 REAL, dimension(1) :: zqsat_tmp ! maximal condensable water (previous two) … … 154 150 rad_cld(1) = rmin_cld 155 151 vol_cld(1) = 4./3. * dble(pi) * rmin_cld*rmin_cld*rmin_cld 156 ! vol_cld(1) = 4./3. * pi * rmin_cld*rmin_cld*rmin_cld157 152 158 153 do i=1,nbin_cld-1 … … 179 174 180 175 ! we save that so that it is not computed at each timestep and gridpoint 181 ! rb_cld(i) = log(rb_cld(i))182 176 rb_cld(:) = log(rb_cld(:)) 183 177 … … 207 201 rice(:,:) = 1.e-8 208 202 209 ! Initialize the temperature, tracers 210 zt(:,:)=pt(:,:) 211 zq(:,:,:)=pq(:,:,:) 203 ! Initialize the temperature and tracers with tendencies 204 205 ! If scavenging, add tendency for dust all-at-once 206 IF (scavenging) THEN 207 zq(:,:,igcm_dust_mass) =zq(:,:,igcm_dust_mass)+pdq(:,:,igcm_dust_mass)*ptimestep 208 zq(:,:,igcm_dust_number) =zq(:,:,igcm_dust_number)+pdq(:,:,igcm_dust_number)*ptimestep 209 ENDIF ! scavenging 210 211 ! Add tendency for ccn all-at-once 212 zq(:,:,igcm_ccn_mass) = zq(:,:,igcm_ccn_mass) + pdq(:,:,igcm_ccn_mass)*ptimestep 213 zq(:,:,igcm_ccn_number) = zq(:,:,igcm_ccn_number) + pdq(:,:,igcm_ccn_number)*ptimestep 214 215 ! Add tendency for water all-at-once 216 zq(:,:,igcm_h2o_ice) = zq(:,:,igcm_h2o_ice)+pdq(:,:,igcm_h2o_ice)*ptimestep 217 zq(:,:,igcm_h2o_vap) = zq(:,:,igcm_h2o_vap)+pdq(:,:,igcm_h2o_vap)*ptimestep 218 219 ! Add tendency for HDO (if computed) all-at-once 220 IF (hdo) THEN 221 zq(:,:,igcm_hdo_ice) = zq(:,:,igcm_hdo_ice)+pdq(:,:,igcm_hdo_ice)*ptimestep 222 zq(:,:,igcm_hdo_vap) = zq(:,:,igcm_hdo_vap)+pdq(:,:,igcm_hdo_vap)*ptimestep 223 ENDIF 224 225 ! Add tendency for temp all-at-one 226 zt(:,:)=pt(:,:)+pdt(:,:)*ptimestep 227 228 ! Local temp tendency from clouds (due to latent heath release) 212 229 subpdtcloud(:,:)=0 213 230 231 ! Handle very small values to prevent precision error 214 232 WHERE( zq(:,:,:) < 1.e-30 ) zq(:,:,:) = 1.e-30 215 233 … … 221 239 222 240 ! Compute the condensable amount of water vapor or the sublimable water ice (if negative) 223 ! Attention ici pdt*ptimestep peut etre severe 224 call watersat(ngrid*nlay,max(1.,zt+pdt*ptimestep),pplay,zqsat) ! DIFF: "temp+trend" at least 1 225 zpotcond_full=(zq(:,:,igcm_h2o_vap)+pdq(:,:,igcm_h2o_vap)*ptimestep) - zqsat 226 zpotcond_full=max(zpotcond_full,-zq(:,:,igcm_h2o_ice)) 227 call watersat(ngrid*nlay,zt,pplay,zqsat) 228 zpotcond_inst=zq(:,:,igcm_h2o_vap) - zqsat 229 zpotcond_inst=max(zpotcond_inst,-zq(:,:,igcm_h2o_ice)) 230 ! zpotcond is the most strict criterion between the two 231 DO l=1,nlay 232 DO ig=1,ngrid 233 if (zpotcond_full(ig,l).gt.0.) then 234 zpotcond(ig,l)=max(zpotcond_inst(ig,l),zpotcond_full(ig,l)) 235 else if (zpotcond_full(ig,l).le.0.) then 236 zpotcond(ig,l)=min(zpotcond_inst(ig,l),zpotcond_full(ig,l)) 237 endif ! (zpotcond_full.gt.0.) then 238 ! zpotcond(ig,l)=1.e-2 239 ENDDO !ig=1,ngrid 240 ENDDO !l=1,nlay 241 call watersat(ngrid*nlay,max(1.,zt),pplay,zqsat) ! Make sure "temp+tendency" at least 1 242 zpotcond=zq(:,:,igcm_h2o_vap) - zqsat 241 243 242 244 countcells = 0 … … 250 252 IF (cloud_adapt_ts) call adapt_imicro(ptimestep,zpotcond(ig,l), zimicro(ig,l)) 251 253 spenttime = 0. 252 dMicetot= 0. ! DIFF: dMicetot=new var254 dMicetot= 0. 253 255 ending_ts=.false. 254 256 DO while (.not.ending_ts) … … 259 261 satu = zq(ig,l,igcm_h2o_vap) / zqsat(ig,l) 260 262 microtimestep=ptimestep/real(zimicro(ig,l)) 261 ! if (satu.lt.1.0) then262 ! microtimestep=ptimestep/30.263 ! write(*,*) "saturation correction" !JN264 ! endif265 263 266 264 ! Initialize tracers for scavenging + hdo computations (JN) … … 298 296 enddo 299 297 300 ! sumcheck = 0301 ! do i = 1, nbin_cld302 ! sumcheck = sumcheck + n_aer(i)303 ! enddo304 ! sumcheck = abs(sumcheck/No - 1)305 ! if ((sumcheck .gt. 1e-5).and. (1./Rn .gt. rmin_cld)) then306 ! print*, "WARNING, No sumcheck PROBLEM"307 ! print*, "sumcheck, No",sumcheck, No308 ! print*, "min radius, Rn, ig, l", rmin_cld, 1./Rn, ig, l309 ! print*, "Dust binned distribution", n_aer310 ! endif311 !312 ! sumcheck = 0313 ! do i = 1, nbin_cld314 ! sumcheck = sumcheck + m_aer(i)315 ! enddo316 ! sumcheck = abs(sumcheck/Mo - 1)317 ! if ((sumcheck .gt. 1e-5) .and. (1./Rn .gt. rmin_cld)) then318 ! print*, "WARNING, Mo sumcheck PROBLEM"319 ! print*, "sumcheck, Mo",sumcheck, Mo320 ! print*, "min radius, Rm, ig, l", rmin_cld, 1./Rm, ig, l321 ! print*, "Dust binned distribution", m_aer322 ! endif323 324 298 ! Get the rates of nucleation 325 299 call nuclea(ph2o,zt(ig,l),satu,n_aer,rate) … … 368 342 369 343 ! With the above scheme, dMice cannot be bigger than vapor, but can be bigger than all available ice. 370 ! dMice = max(dMice,-zq(ig,l,igcm_h2o_ice)) 371 dMice = max(dMice,-zq(ig,l,igcm_h2o_ice) - pdq(ig,l,igcm_h2o_ice)*microtimestep) ! DIFF: take trend into account 372 ! dMice = min(dMice,zq(ig,l,igcm_h2o_vap)) ! this should be useless... 373 dMice = min(dMice,zq(ig,l,igcm_h2o_vap) + pdq(ig,l,igcm_h2o_vap)*microtimestep) 344 dMice = max(dMice,-zq(ig,l,igcm_h2o_ice)) 345 dMice = min(dMice,zq(ig,l,igcm_h2o_vap)) 374 346 375 347 zq(ig,l,igcm_h2o_ice) = zq(ig,l,igcm_h2o_ice)+dMice … … 400 372 ! Calculation of the fractionnation coefficient at equilibrium 401 373 alpha(ig,l) = exp(16288./zt(ig,l)**2.-9.34d-2) 402 ! alpha = exp(13525./zt(ig,l)**2.-5.59d-2) !Lamb403 374 ! Calculation of the 'real' fractionnation coefficient 404 375 alpha_c(ig,l) = (alpha(ig,l)*satu)/( (alpha(ig,l)*(Dv/Dv_hdo)*(satu-1.)) + 1.) 405 ! alpha_c(ig,l) = alpha(ig,l) ! to test without the effect of cinetics406 376 else 407 377 alpha_c(ig,l) = 1.d0 … … 459 429 ! No more getting tendency : we increment tracers & temp directly 460 430 461 ! Increment tracers & temp for following microtimestep 462 ! Dust : 463 ! Special treatment of dust_mass / number for scavenging ? 464 IF (scavenging) THEN 465 zq(ig,l,igcm_dust_mass) =zq(ig,l,igcm_dust_mass)+pdq(ig,l,igcm_dust_mass)*microtimestep 466 zq(ig,l,igcm_dust_number) =zq(ig,l,igcm_dust_number)+pdq(ig,l,igcm_dust_number)*microtimestep 467 ELSE 468 zq(ig,l,igcm_dust_mass) =zq0(ig,l,igcm_dust_mass) 469 zq(ig,l,igcm_dust_number) =zq0(ig,l,igcm_dust_number) 470 ENDIF !(scavenging) THEN 471 zq(ig,l,igcm_ccn_mass) = zq(ig,l,igcm_ccn_mass) + pdq(ig,l,igcm_ccn_mass)*microtimestep 472 zq(ig,l,igcm_ccn_number) = zq(ig,l,igcm_ccn_number) + pdq(ig,l,igcm_ccn_number)*microtimestep 473 474 ! Water : 475 zq(ig,l,igcm_h2o_ice) = zq(ig,l,igcm_h2o_ice)+pdq(ig,l,igcm_h2o_ice)*microtimestep 476 zq(ig,l,igcm_h2o_vap) = zq(ig,l,igcm_h2o_vap)+pdq(ig,l,igcm_h2o_vap)*microtimestep 477 478 ! HDO (if computed) : 479 IF (hdo) THEN 480 zq(ig,l,igcm_hdo_ice) = zq(ig,l,igcm_hdo_ice)+pdq(ig,l,igcm_hdo_ice)*microtimestep 481 zq(ig,l,igcm_hdo_vap) = zq(ig,l,igcm_hdo_vap)+pdq(ig,l,igcm_hdo_vap)*microtimestep 482 ENDIF ! hdo 483 484 ! Could also set subpdtcloud to 0 if not activice to make it simpler or change name of the flag 431 ! If not activice, the tendency from latent heat release is set to zero 485 432 IF (.not.activice) subpdtcloud(ig,l)=0. 486 433 487 ! Temperature :488 zt(ig,l) = zt(ig,l)+ (pdt(ig,l)+subpdtcloud(ig,l))*microtimestep434 ! Temperature change as a feedback from latent heat release 435 zt(ig,l) = zt(ig,l)+subpdtcloud(ig,l)*microtimestep 489 436 490 437 ! Prevent negative tracers ! JN … … 493 440 IF (cloud_adapt_ts) then 494 441 ! Estimation of how much is actually condensing/subliming 495 dMicetot=dMicetot+abs(dMice) ! DIFF: accumulation of absolute dMice 496 ! dMicetot=dMicetot+dMice 497 ! write(*,*) "dMicetot= ", dMicetot 498 ! write(*,*) "we are in (l,ig):", l,ig !JN 442 dMicetot=dMicetot+abs(dMice) ! total accumulated ice formation since the beginning 499 443 IF (spenttime.ne.0) then 500 444 zdq=(dMicetot/spenttime)!*(ptimestep-spenttime) 501 ELSE502 !Initialization for spenttime=0503 zdq=zpotcond(ig,l)*((ptimestep-spenttime)/ptimestep)504 445 ENDIF 505 ! Threshold with powerlaw (sanity check)506 ! zdq=min(abs(zdq),507 ! & abs(zpotcond(ig,l)*((ptimestep-spenttime)/ptimestep)))508 446 zdq=abs(zdq) 509 447 call adapt_imicro(ptimestep,zdq,zimicro(ig,l)) … … 517 455 518 456 !------ Useful outputs to check how it went 519 call write_output("zpotcond_inst","zpotcond_inst microphysics","(kg/kg)",zpotcond_inst(:,:))520 call write_output("zpotcond_full","zpotcond_full microphysics","(kg/kg)",zpotcond_full(:,:))521 457 call write_output("zpotcond","zpotcond microphysics","(kg/kg)",zpotcond(:,:)) 522 458 call write_output("count_micro","count_micro after microphysics","integer",count_micro(:,:)) … … 524 460 !!!!!!!!!!!!!! TESTS OUTPUTS TESTS OUTPUTS TESTS OUTPUTS TESTS OUTPUTS 525 461 IF (test_flag) then 526 ! error2d(:) = 0.527 462 DO l=1,nlay 528 463 DO ig=1,ngrid 529 ! error2d(ig) = max(abs(error_out(ig,l)),error2d(ig))530 464 satubf(ig,l) = zq0(ig,l,igcm_h2o_vap)/zqsat(ig,l) 531 465 satuaf(ig,l) = zq(ig,l,igcm_h2o_vap)/zqsat(ig,l) 532 466 ENDDO 533 467 ENDDO 534 535 468 print*, 'count is ',countcells, ' i.e. ', countcells*100/(nlay*ngrid), '% for microphys computation' 536 469 ENDIF ! endif test_flag 537 470 538 471 END SUBROUTINE improvedclouds 539 540 !=============================================================541 ! The so -called "phi" function is such as phi(r) - phi(r0) = t - t0542 ! It is an analytical solution to the ice radius growth equation,543 ! with the approximation of a constant 'reduced' cunningham correction factor544 ! (lambda in growthrate.F) taken at radius req instead of rice545 !=============================================================546 547 ! subroutine phi(rice,req,coeff1,coeff2,time)548 !549 ! implicit none550 !551 ! ! inputs552 ! real rice ! ice radius553 ! real req ! ice radius at equilibirum554 ! real coeff1 ! coeff for the log555 ! real coeff2 ! coeff for the arctan556 !557 ! ! output558 ! real time559 !560 ! !local561 ! real var562 !563 ! 1.73205 is sqrt(3)564 !565 ! var = max(566 ! & abs(rice-req) / sqrt(rice*rice + rice*req + req*req),1e-30)567 !568 ! time =569 ! & coeff1 *570 ! & log( var )571 ! & + coeff2 * 1.73205 *572 ! & atan( (2*rice+req) / (1.73205*req) )573 !574 ! return575 ! end576 577 !=======================================================================578 472 579 473 SUBROUTINE adapt_imicro(ptimestep,potcond,zimicro) … … 598 492 ! alpha=1.81846504e+11 599 493 ! beta=1.54550140e+00 600 alpha=1.88282793e+05 ! DIFF: new power law coefficients 601 beta=4.57764370e-01 602 zimicro=ceiling(coef*min(max(alpha*abs(potcond)**beta,50.),7000.)) 603 zimicro=2*zimicro ! DIFF: prefiction times two, allow to complete year 494 alpha=1.88282793e+05 ! Latest values for high obliquity 495 beta=4.57764370e-01 ! Latest values for high obliquity 496 !alpha=1.72198978e+10 ! Present day Mars 497 !beta=1.88473210e+00 498 zimicro=ceiling(coef*min(max(alpha*abs(potcond)**beta,5.),7000.)) 499 !zimicro=2*zimicro ! Prediction times two, allow to complete year at high obliquity 604 500 605 501 END SUBROUTINE adapt_imicro
Note: See TracChangeset
for help on using the changeset viewer.
