Changeset 3842


Ignore:
Timestamp:
Jul 9, 2025, 11:52:15 AM (38 hours ago)
Author:
jbclement
Message:

PEM:

  • Handling the situation in the layering algorithm when CO2 ice sublimation and H2O ice condensation happen simultaneously.
  • Correction of the incorporation of the sub-surface sublimation tendency into the overall tendency to be more robust.
  • Revision of the layering initialization in the case where there is no "startpem.nc" file.

JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3840 r3842  
    728728- Update of "visu_evol_layering.py", in particular to show value at cursor for 2D heatmaps.
    729729- Few cleanings.
     730
     731== 09/07/2025 == JBC
     732- Handling the situation in the layering algorithm when CO2 ice sublimation and H2O ice condensation happen simultaneously.
     733- Correction of the incorporation of the sub-surface sublimation tendency into the overall tendency to be more robust.
     734- Revision of the layering initialization in the case where there is no "startpem.nc" file.
  • trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def

    r3840 r3842  
    7878#---------- Ice management parameters ----------#
    7979# Amount of H2O ice to initialize the huge reservoir if the variable is not present in "startfi_PEM.nc". Default = 9200. kg.m-2 (= 10 m)
    80 # ini_huge_h2oice=1.e4
     80# ini_huge_h2oice=9200.
    8181
    8282# Threshold to consider the amount of H2O ice as an infinite reservoir. Default = 460. kg.m-2 (= 0.5 m)
    83 # inf_h2oice_threshold=2.e3
     83# inf_h2oice_threshold=460.
    8484
    8585# Do you want H2O frost to transform into perennial H2O ice? Default = .false.
     
    8787
    8888# Threshold to consider frost is becoming perennial H2O ice. Default = 460. kg.m-2 (= 0.5 m)
    89 # metam_h2oice_threshold=5.e-2
     89# metam_h2oice_threshold=460.
    9090
    9191# Do you want the H2O ice to flow along subslope inside a cell? Default = .true.
     
    9696
    9797# Threshold to consider frost is becoming perennial CO2 ice. Default = 16500. kg.m-2 (= 10 m)
    98 # metam_co2ice_threshold=16.e3
     98# metam_co2ice_threshold=16500.
    9999
    100100# Do you want the CO2 ice to flow along subslope inside a cell? Default = .true.
  • trunk/LMDZ.COMMON/libf/evolution/layering_mod.F90

    r3840 r3842  
    598598else if (current%h_co2ice > 0. .and. current%h_co2ice > current%h_h2oice) then ! No, there is more CO2 ice than H2O ice
    599599    h_toplag = 0. ! Because it matters only for H2O ice
    600     if (h_toplag < h_patchy_ice) then ! But the dust lag is too thin to considered ice as subsurface ice
    601         co2_ice = current%h_co2ice
    602     endif
     600    if (h_toplag < h_patchy_ice) co2_ice = current%h_co2ice ! But the dust lag is too thin to considered ice as subsurface ice
    603601endif
    604602
     
    713711
    714712!---- Local variables
    715 real                   :: dh_co2ice, dh_h2oice, dh_dust
     713real                   :: dh_co2ice, dh_h2oice, dh_dust, dh_dust_co2, dh_dust_h2o
    716714real                   :: h_co2ice_old, h_h2oice_old, h_dust_old
    717715real                   :: h2subl_co2ice, h2subl_h2oice, h2subl_co2ice_tot, h2subl_h2oice_tot
     
    724722dh_h2oice = d_h2oice/rho_h2oice
    725723dh_dust = 0.
    726 if (dh_h2oice >= 0. .and. dh_co2ice >= 0.) then ! To put a dust sedimentation tendency only when ice is condensing
     724if (dh_h2oice >= 0.) then ! To put a dust sedimentation tendency only when ice is condensing
    727725    if (impose_dust_ratio) then
    728         dh_dust = dust2ice_ratio*(dh_h2oice + dh_co2ice)
    729     else
     726        if (dh_co2ice >= 0.) then
     727            dh_dust = dust2ice_ratio*(dh_h2oice + dh_co2ice)
     728        else
     729            dh_dust = dust2ice_ratio*dh_h2oice
     730        endif
     731    else
    730732        dh_dust = d_dust/rho_dust
    731733    endif
     
    838840!-----------------------------------------------------------------------
    839841! CO2 ICE SUBLIMATION + H2O ICE CONDENSATION
    840 else if (dh_co2ice < 0. .and. dh_h2oice > 0.) then
    841 !~     if (abs(dh_co2ice) > dh_h2oice .and. dh_co2ice < dh_dust .and. dh_dust <= 0.) then ! CO2 sublimation is dominant
    842 
    843 !~     else if (dh_h2oice > abs(dh_co2ice) .and. 0 <= dh_dust .and. dh_dust < dh_h2oice) then ! H2O condensation is dominant
    844 
    845 !~     else
    846         unexpected = .true.
    847 !~     endif
     842else if (dh_co2ice <= 0. .and. dh_h2oice >= 0.) then
     843    if (dh_dust >= 0.) then
     844        dh_dust_co2 = 0.
     845        dh_dust_h2o = dh_dust
     846    else
     847        dh_dust_co2 = dh_dust
     848        dh_dust_h2o = 0.
     849    endif
     850    if (abs(dh_co2ice) > dh_h2oice) then ! CO2 ice sublimation is dominant
     851        ! CO2 ICE SUBLIMATION: retreating a stratum
     852        h2subl_co2ice_tot = abs(dh_co2ice)
     853        h2lift_tot = abs(dh_dust_co2)
     854        do while ((h2subl_co2ice_tot > 0. .or. h2lift_tot > 0.) .and. associated(current))
     855            h_co2ice_old = current%h_co2ice
     856
     857            ! How much is CO2 ice sublimation inhibited by the top dust lag?
     858            R_subl = 1.
     859            if (associated(current%up)) then ! If there is an upper stratum
     860                h_toplag = 0.
     861                currentloc => current%up
     862                do while (is_dust_lag(currentloc) .and. associated(currentloc%up))
     863                    h_toplag = h_toplag + thickness(currentloc)
     864                    currentloc => currentloc%up
     865                enddo
     866                if (currentloc%h_h2oice >= h_patchy_ice) then
     867                    R_subl = 0.
     868                else if (0. < currentloc%h_h2oice .and. currentloc%h_h2oice < h_patchy_ice) then
     869                    h_toplag = h_toplag + thickness(currentloc)
     870                    R_subl = fred_sublco2**(h_toplag/hmin_lag_co2)
     871                else
     872                    R_subl = fred_sublco2**(h_toplag/hmin_lag_co2)
     873                endif
     874            endif
     875           h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl
     876
     877            ! Is there CO2 ice to sublimate?
     878            h2subl_co2ice = 0.
     879            if (h_co2ice_old > 0. .and. h2subl_co2ice_tot > 0.) then
     880                h2subl_co2ice = min(h2subl_co2ice_tot,h_co2ice_old)
     881                h2subl_co2ice_tot = h2subl_co2ice_tot - h2subl_co2ice
     882            endif
     883            ! Ice sublimation
     884            if (h2subl_co2ice > 0.) call sublimate_ice(this,current,h2subl_co2ice,0.,new_lag,zlag)
     885
     886            ! Is there dust to lift?
     887            h2lift = 0.
     888            if (is_dust_lag(current) .and. h2lift_tot > 0.) then
     889                h2lift = min(h2lift_tot,current%h_dust)
     890                h2lift_tot = h2lift_tot - h2lift
     891                ! Dust lifting
     892                if (h2lift > 0.) call lift_dust(this,current,h2lift)
     893            else if (associated(current%up)) then
     894                if (is_dust_lag(current%up) .and. h2lift_tot > 0.) then
     895                    h2lift = min(h2lift_tot,current%up%h_dust)
     896                    h2lift_tot = h2lift_tot - h2lift
     897                    ! Dust lifting
     898                    if (h2lift > 0.) call lift_dust(this,current%up,h2lift)
     899                endif
     900            endif
     901
     902            ! Still ice to be sublimated or dust to be lifted and no more ice in the current stratum so we move to the underlying stratum
     903            if ((h2subl_co2ice_tot > 0. .or. h2lift_tot > 0.) .and. current%h_co2ice < tol) then
     904                current => current%down
     905                new_lag = .true.
     906            else
     907                exit
     908            endif
     909        enddo
     910        if (h2subl_co2ice_tot > 0.) dh_co2ice = 0. ! No CO2 ice available anymore so the tendency is set to 0
     911        if (h2lift_tot > 0.) dh_dust = 0. ! No dust available anymore so the tendency is set to 0
     912
     913        ! H2O ICE CONDENSATION: building a stratum
     914        h_pore = dh_h2oice*h2oice_porosity/(1. - h2oice_porosity)
     915        h_tot = dh_h2oice + dh_dust_h2o + h_pore
     916        ! New stratum at the top of the layering
     917        if (new_str) then
     918            call add_stratum(this,this%top%top_elevation + h_tot,0.,dh_h2oice,dh_dust_h2o,h_pore,0.)
     919            new_str = .false.
     920        else
     921            this%top%top_elevation = this%top%top_elevation + h_tot
     922            this%top%h_h2oice      = this%top%h_h2oice      + dh_h2oice
     923            this%top%h_dust        = this%top%h_dust        + dh_dust_h2o
     924            this%top%h_pore        = this%top%h_pore        + h_pore
     925        endif
     926    else ! H2O ice condensation is dominant
     927        ! H2O ICE CONDENSATION: building a stratum
     928        h_pore = dh_h2oice*h2oice_porosity/(1. - h2oice_porosity)
     929        h_tot = dh_h2oice + dh_dust_h2o + h_pore
     930        ! New stratum at the top of the layering
     931        if (new_str) then
     932            call add_stratum(this,this%top%top_elevation + h_tot,0.,dh_h2oice,dh_dust_h2o,h_pore,0.)
     933            new_str = .false.
     934        else
     935            this%top%top_elevation = this%top%top_elevation + h_tot
     936            this%top%h_h2oice      = this%top%h_h2oice      + dh_h2oice
     937            this%top%h_dust        = this%top%h_dust        + dh_dust_h2o
     938            this%top%h_pore        = this%top%h_pore        + h_pore
     939        endif
     940
     941        ! CO2 ICE SUBLIMATION: retreating a stratum
     942        h2subl_co2ice_tot = abs(dh_co2ice)
     943        h2lift_tot = abs(dh_dust_co2)
     944        do while ((h2subl_co2ice_tot > 0. .or. h2lift_tot > 0.) .and. associated(current))
     945            h_co2ice_old = current%h_co2ice
     946
     947            ! How much is CO2 ice sublimation inhibited by the top dust lag?
     948            R_subl = 1.
     949            if (associated(current%up)) then ! If there is an upper stratum
     950                h_toplag = 0.
     951                currentloc => current%up
     952                do while (is_dust_lag(currentloc) .and. associated(currentloc%up))
     953                    h_toplag = h_toplag + thickness(currentloc)
     954                    currentloc => currentloc%up
     955                enddo
     956                if (currentloc%h_h2oice >= h_patchy_ice) then
     957                    R_subl = 0.
     958                else if (0. < currentloc%h_h2oice .and. currentloc%h_h2oice < h_patchy_ice) then
     959                    h_toplag = h_toplag + thickness(currentloc)
     960                    R_subl = fred_sublco2**(h_toplag/hmin_lag_co2)
     961                else
     962                    R_subl = fred_sublco2**(h_toplag/hmin_lag_co2)
     963                endif
     964            endif
     965           h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl
     966
     967            ! Is there CO2 ice to sublimate?
     968            h2subl_co2ice = 0.
     969            if (h_co2ice_old > 0. .and. h2subl_co2ice_tot > 0.) then
     970                h2subl_co2ice = min(h2subl_co2ice_tot,h_co2ice_old)
     971                h2subl_co2ice_tot = h2subl_co2ice_tot - h2subl_co2ice
     972            endif
     973            ! Ice sublimation
     974            if (h2subl_co2ice > 0.) call sublimate_ice(this,current,h2subl_co2ice,0.,new_lag,zlag)
     975
     976            ! Is there dust to lift?
     977            h2lift = 0.
     978            if (is_dust_lag(current) .and. h2lift_tot > 0.) then
     979                h2lift = min(h2lift_tot,current%h_dust)
     980                h2lift_tot = h2lift_tot - h2lift
     981                ! Dust lifting
     982                if (h2lift > 0.) call lift_dust(this,current,h2lift)
     983            else if (associated(current%up)) then
     984                if (is_dust_lag(current%up) .and. h2lift_tot > 0.) then
     985                    h2lift = min(h2lift_tot,current%up%h_dust)
     986                    h2lift_tot = h2lift_tot - h2lift
     987                    ! Dust lifting
     988                    if (h2lift > 0.) call lift_dust(this,current%up,h2lift)
     989                endif
     990            endif
     991
     992            ! Still ice to be sublimated or dust to be lifted and no more ice in the current stratum so we move to the underlying stratum
     993            if ((h2subl_co2ice_tot > 0. .or. h2lift_tot > 0.) .and. current%h_co2ice < tol) then
     994                current => current%down
     995                new_lag = .true.
     996            else
     997                exit
     998            endif
     999        enddo
     1000        if (h2subl_co2ice_tot > 0.) dh_co2ice = 0. ! No CO2 ice available anymore so the tendency is set to 0
     1001        if (h2lift_tot > 0.) dh_dust = 0. ! No dust available anymore so the tendency is set to 0
     1002    endif
    8481003!-----------------------------------------------------------------------
    8491004! NOT EXPECTED SITUATION
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3840 r3842  
    7070use co2condens_mod,             only: CO2cond_ps
    7171use layering_mod,               only: layering, del_layering, make_layering, layering_algo, subsurface_ice_layering,            &
    72                                       ptrarray, stratum, get_nb_str_max, nb_str_max, is_dust_lag, is_co2ice_str, is_h2oice_str
     72                                      ptrarray, stratum, get_nb_str_max, nb_str_max, is_dust_lag, is_co2ice_str, is_h2oice_str, print_layering
    7373use dyn_ss_ice_m_mod,           only: dyn_ss_ice_m
    7474use parse_args_mod,             only: parse_args
     
    294294
    295295! CODE
     296! Elapsed time with system clock
     297call system_clock(count_rate = cr)
     298call system_clock(c1)
     299
     300! Parse command-line options
     301call parse_args()
     302
     303! Header
    296304write(*,*) '  *    .          .   +     .    *        .  +      .    .       .      '
    297305write(*,*) '           +         _______  ________  ____    ____      *           + '
     
    302310write(*,*) '            +       |_____|  |________||_____||_____|   +     .         '
    303311write(*,*) '  .      *          .   *       .   +       *          .        +      .'
    304 
    305 ! Elapsed time with system clock
    306 call system_clock(count_rate = cr)
    307 call system_clock(c1)
    308 call parse_args()
    309312
    310313! Some user info
     
    618621    enddo
    619622    ! We put the sublimating tendency coming from subsurface ice into the overall tendency
    620     where (zdqsdif_ssi_tot < 0.)
    621         d_h2oice = zdqsdif_ssi_tot
    622     end where
     623    where (h2o_ice_depth > 0. .and. zdqsdif_ssi_tot < -1.e-10) d_h2oice = zdqsdif_ssi_tot
    623624endif
    624625do i = 1,ngrid
     
    781782            do ig = 1,ngrid
    782783                call make_layering(layerings_map(ig,islope),d_co2ice(ig,islope),d_h2oice(ig,islope),new_str(ig,islope),zshift_surf(ig,islope),new_lag(ig,islope),zlag(ig,islope),current(ig,islope)%p)
     784                !call print_layering(layerings_map(ig,islope))
    783785                co2_ice(ig,islope) = 0.
    784786                h2o_ice(ig,islope) = 0.
     
    9991001        do islope = 1,nslope
    10001002            totmass_co2ice = totmass_co2ice + co2_ice(ig,islope)*cell_area(ig)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180.)
    1001         enddo 
     1003        enddo
    10021004    enddo
    10031005    write(*,'(a,f8.3,a)') " > Relative total CO2 mass balance = ", 100.*(totmass_atmco2 + totmass_co2ice + totmass_adsco2 - totmass_atmco2_ini - totmass_co2ice_ini - totmass_adsco2_ini)/(totmass_atmco2_ini + totmass_co2ice_ini + totmass_adsco2_ini), ' %'
  • trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90

    r3789 r3842  
    2323use layering_mod,               only: layering, array2stratif, nb_str_max, layering_algo, add_stratum, ini_layering
    2424use callkeys_mod,               only: startphy_file
     25use glaciers_mod,               only: rho_co2ice, rho_h2oice
    2526
    2627#ifndef CPP_STD
     
    5455real, dimension(ngrid,nslope),           intent(out) :: h2o_ice                  ! h2o ice amount [kg/m^2]
    5556real, dimension(ngrid,nslope),           intent(out) :: co2_ice                  ! co2 ice amount [kg/m^2]
    56 type(layering), dimension(ngrid,nslope), intent(inout) :: layerings_map             ! Layerings
     57type(layering), dimension(ngrid,nslope), intent(inout) :: layerings_map       ! Layerings
    5758real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: TI_PEM              ! soil (mid-layer) thermal inertia in the PEM grid [SI]
    5859real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: tsoil_PEM           ! soil (mid-layer) temperature [K]
     
    184185                    do islope = 1,nslope
    185186                        call ini_layering(layerings_map(ig,islope))
    186                         call add_stratum(layerings_map(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.)
     187                        call add_stratum(layerings_map(ig,islope),1.05*ini_huge_h2oice/rho_h2oice,0.,ini_huge_h2oice/rho_h2oice,0.05*ini_huge_h2oice/rho_h2oice,0.,0.)
    187188                    enddo
    188189                else
    189190                    do islope = 1,nslope
    190191                        call ini_layering(layerings_map(ig,islope))
    191                         if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.)
     192                        if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),1.05*perennial_co2ice(ig,islope)/rho_co2ice,perennial_co2ice(ig,islope)/rho_co2ice,0.,0.05*perennial_co2ice(ig,islope)/rho_co2ice,0.,0.)
    192193                    enddo
    193194                endif
     
    392393                do islope = 1,nslope
    393394                    call ini_layering(layerings_map(ig,islope))
    394                     call add_stratum(layerings_map(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.)
     395                    print*, 'coucou', 1.05*ini_huge_h2oice/rho_h2oice, layerings_map(ig,islope)%top%top_elevation
     396                    call add_stratum(layerings_map(ig,islope),1.05*ini_huge_h2oice/rho_h2oice,0.,ini_huge_h2oice/rho_h2oice,0.05*ini_huge_h2oice/rho_h2oice,0.,0.)
    395397                enddo
    396398            else
    397399                do islope = 1,nslope
    398400                    call ini_layering(layerings_map(ig,islope))
    399                     if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.)
     401                    if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),1.05*perennial_co2ice(ig,islope)/rho_co2ice,perennial_co2ice(ig,islope)/rho_co2ice,0.,0.05*perennial_co2ice(ig,islope)/rho_co2ice,0.,0.)
    400402                enddo
    401403            endif
Note: See TracChangeset for help on using the changeset viewer.