Ignore:
Timestamp:
Nov 19, 2021, 5:00:58 PM (4 years ago)
Author:
jnaar
Message:

Correction of mass conservation bug in vdifc_mod.F : the evolution of h2o_ice_s and watercap were computed independantly in the subtimestep of surface water ice condensation / sublimation scheme. As the watercap tendency can only be negative, very specific conditions where the integrated overall tendency would be condensation but where a certain subtimestep would be subliming would result in a overall mass l
oss. As a correction, the monitoring of watercap is now done outside the subtimestep (much simpler). Local variables "zwatercap" and "zdw
atercap_dif" are now obsoletes and deleted.
JN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/vdifc_mod.F

    r2531 r2587  
    131131c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    132132      REAL zdqsdif(ngrid) ! subtimestep pdqsdif for water ice
    133       REAL zwatercap(ngrid) ! subtimestep watercap for water ice
    134133      REAL ztsrf(ngrid) ! temporary surface temperature in tsub
    135134      REAL zdtsrf(ngrid) ! surface temperature tendancy in tsub
     
    158157      REAL,INTENT(IN) :: watercap(ngrid)
    159158      REAL,INTENT(OUT) :: dwatercap_dif(ngrid)
    160       REAL :: zdwatercap_dif(ngrid)
    161159
    162160c    Subtimestep to compute h2o latent heat flux:
     
    242240      pdqsdif(1:ngrid,1:nq)=0
    243241      zdqsdif(1:ngrid)=0
    244       zwatercap(1:ngrid)=0
    245242      dwatercap_dif(1:ngrid)=0
    246       zdwatercap_dif(1:ngrid)=0
    247243
    248244c    ** calcul de rho*dz et dt*rho/dz=dt*rho**2 g/dp
     
    892888            subtimestep = ptimestep/nsubtimestep(ig)
    893889            ztsrf(ig)=ptsrf(ig)  !  +pdtsrf(ig)*subtimestep
    894             zwatercap(ig)=watercap(ig)
    895890
    896891c           Debut du sous pas de temps
     
    928923             zdqsdif(ig)=rho(ig)*dryness(ig)*zcdv(ig)
    929924     &                      *(zq1temp(ig)-qsat(ig))
    930              if ((-zdqsdif(ig)*subtimestep)
     925c             write(*,*)'subliming more than available frost:  qsurf!'
     926             if(.not.watercaptag(ig)) then
     927               if ((-zdqsdif(ig)*subtimestep)
    931928     &            .gt.(zqsurf(ig))) then
    932 c             write(*,*)'subliming more than available frost:  qsurf!'
    933                if(watercaptag(ig)) then
    934 c             dwatercap_dif same sign as pdqsdif (pos. toward ground)
    935                   zdwatercap_dif(ig) = zdqsdif(ig)
    936      &                        + zqsurf(ig)/subtimestep
     929c             pdqsdif > 0 : ice condensing
     930c             pdqsdif < 0 : ice subliming
     931c             write(*,*) "subliming more than available frost:  qsurf!"
    937932                  zdqsdif(ig)=
    938933     &                        -zqsurf(ig)/subtimestep
    939 c                  write(*,*) "subliming more than available frost:  qsurf!"
    940                else  !  (case not.watercaptag(ig))
    941                   zdqsdif(ig)=
    942      &                        -zqsurf(ig)/subtimestep
    943                   zdwatercap_dif(ig) = 0.0
    944 
    945934c                write(*,*)'flux vers le sol=',pdqsdif(ig,nq)
    946935                 z1(ig)=1./(za(ig,1)+ zb(ig,2)*(1.-zd(ig,2)))
    947936                 zc(ig,1)=(za(ig,1)*zq(ig,1,igcm_h2o_vap)+
    948      $           zb(ig,2)*zc(ig,2) + 
    949      $           (-zdqsdif(ig)-zdwatercap_dif(ig)) *subtimestep) *z1(ig)
     937     $           zb(ig,2)*zc(ig,2) +
     938     $           (-zdqsdif(ig)) *subtimestep) *z1(ig)
    950939                 zq1temp(ig)=zc(ig,1)
    951940               endif  !if .not.watercaptag(ig)
     
    955944c             Actualisation de h2o_vap dans le premier niveau
    956945             zq(ig,1,igcm_h2o_vap)=zq1temp(ig)
    957              
    958 c             Take into account the H2O latent heat impact on the surface temperature
     946
     947c    Take into account the H2O latent heat impact on the surface temperature
    959948              if (latentheat_surfwater) then
    960949                lh=(2834.3-0.28*(ztsrf(ig)-To)-
    961950     &              0.004*(ztsrf(ig)-To)*(ztsrf(ig)-To))*1.e+3
    962                 zdtsrf(ig)=  (zdwatercap_dif(ig)+
    963      &               zdqsdif(ig))*lh /pcapcal(ig)
     951                zdtsrf(ig)=  zdqsdif(ig)*lh /pcapcal(ig)
    964952              endif ! (latentheat_surfwater) then
    965953
     954              DO ilay=2,nlay
     955                zq(ig,ilay,iq)=zc(ig,ilay)+zd(ig,ilay)*zq(ig,ilay-1,iq)
     956              ENDDO
    966957
    967958c             Subtimestep water budget :
     
    971962              zqsurf(ig)= zqsurf(ig)+(
    972963     &                       zdqsdif(ig))*subtimestep
    973               zwatercap(ig)= zwatercap(ig)+
    974      &                       zdwatercap_dif(ig)*subtimestep
    975964
    976965
     
    981970     &           .gt.frost_albedo_threshold) ! if there is still ice, T cannot exceed To
    982971     &           zdtsrf(ig) = min(zdtsrf(ig),(To-ztsrf(ig))/subtimestep) ! ice melt case
    983      
    984 
    985               DO ilay=2,nlay
    986                 zq(ig,ilay,iq)=zc(ig,ilay)+zd(ig,ilay)*zq(ig,ilay-1,iq)
    987               ENDDO
     972
     973
    988974
    989975c             Fin du sous pas de temps
    990 
    991976            ENDDO ! tsub=1,nsubtimestep
    992977
    993 c             Integration of subtimestep water budget :
    994 
     978c             Integration of subtimestep temp and water budget :
     979c             (btw could also compute the post timestep temp and ice
     980c             by simply adding the subtimestep trend instead of this)
    995981            pdtsrf(ig)= (ztsrf(ig) -
    996982     &                     ptsrf(ig))/ptimestep
    997983            pdqsdif(ig,igcm_h2o_ice)=
    998984     &                  (zqsurf(ig)- pqsurf(ig,igcm_h2o_ice))/ptimestep
    999             dwatercap_dif(ig)=(zwatercap(ig) -
    1000      &                     watercap(ig))/ptimestep
     985
     986c if subliming more than qsurf(ice) and on watercaptag, water
     987c sublimates from watercap reservoir (dwatercap_dif is <0)
     988            if(watercaptag(ig)) then
     989              if ((-pdqsdif(ig,igcm_h2o_ice)*ptimestep)
     990     &           .gt.(pqsurf(ig,igcm_h2o_ice))) then
     991                 dwatercap_dif(ig)=pdqsdif(ig,igcm_h2o_ice)+
     992     &                     pqsurf(ig,igcm_h2o_ice)/ptimestep
     993                 pdqsdif(ig,igcm_h2o_ice)=
     994     &                   - pqsurf(ig,igcm_h2o_ice)/ptimestep
     995              endif! ((-pdqsdif(ig)*ptimestep)
     996            endif !(watercaptag(ig)) then
    1001997
    1002998           ENDDO ! of DO ig=1,ngrid
Note: See TracChangeset for help on using the changeset viewer.