Ignore:
Timestamp:
Feb 17, 2026, 2:45:53 PM (10 days ago)
Author:
jbclement
Message:

PEM:

  • Correct management of H2O ice tendency in 1D when there is not enough ice anymore.
  • Clean initialization of allocatable module arrays (especially needed when no slope)
  • One more renaming for consistency + few small updates thoughout the code.

JBC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/surf_ice.F90

    r4071 r4074  
    6262if (.not. allocated(is_h2o_perice_PCM)) allocate(is_h2o_perice_PCM(ngrid))
    6363if (.not. allocated(co2_perice_PCM)) allocate(co2_perice_PCM(ngrid,nslope))
     64is_h2o_perice_PCM(:) = .false.
     65co2_perice_PCM(:,:) = 0._dp
    6466
    6567END SUBROUTINE ini_surf_ice
     
    359361
    360362if (ngrid == 1) then ! In 1D
    361     h2o_ice = h2o_ice + d_h2oice*dt
    362     zshift_surf = d_h2oice*dt/rho_h2oice
     363    where (d_h2oice(:,:) < 0._dp .and. abs(d_h2oice(:,:)*dt) > h2o_ice(:,:)) ! Not enough ice to sublimate everything
     364        ! We sublimate what we can
     365        d_h2oice_new(:,:) = h2o_ice(:,:)/dt
     366        ! It means the tendency is zero next time
     367        d_h2oice(:,:) = 0._dp
     368    else where
     369        d_h2oice_new(:,:) = d_h2oice(:,:)
     370    end where
    363371else ! In 3D
    364372    call stopping_crit_h2o(delta_h2o_ads,delta_icetable,h2o_ice,d_h2oice,S_atm_2_h2o,S_h2o_2_atm,S_atm_2_h2oice,S_h2oice_2_atm,stopcrit)
    365373    if (stopcrit%stop_code() > 0) return
    366 
    367374    call balance_h2oice_reservoirs(S_atm_2_h2o,S_h2o_2_atm,S_atm_2_h2oice,S_h2oice_2_atm,h2o_ice,d_h2oice,d_h2oice_new)
    368     h2o_ice = h2o_ice + d_h2oice_new*dt
    369     zshift_surf = d_h2oice_new*dt/rho_h2oice
    370375end if
     376
     377h2o_ice = h2o_ice + d_h2oice_new*dt
     378zshift_surf = d_h2oice_new*dt/rho_h2oice
    371379
    372380END SUBROUTINE evolve_h2oice
     
    408416! ---------------
    409417integer(di) :: i, islope
    410 real(qp)    :: S_target, S_target_subl_h2oice, S_target_cond_h2oice, S_ghostice, d_target ! Balance variables
     418real(qp)    :: S_target, S_target_subl_h2oice, S_target_cond_h2oice, S_ghostice ! Balance variables
     419real(dp)    :: d_target
    411420
    412421! CODE
     
    421430    do islope = 1,nslope
    422431        if (d_h2oice(i,islope) > 0._dp) then ! Condensing
    423             d_h2oice_new(i,islope) = d_h2oice_new(i,islope)*real(S_target_cond_h2oice/S_atm_2_h2oice,dp)
     432            d_h2oice_new(i,islope) = d_h2oice(i,islope)*real(S_target_cond_h2oice/S_atm_2_h2oice,dp)
    424433        else if (d_h2oice(i,islope) < 0._dp) then ! Sublimating
    425434            d_target = d_h2oice(i,islope)*real(S_target_subl_h2oice/S_h2oice_2_atm,dp)
    426             if (abs(d_target*dt) < h2o_ice(i,islope)) then ! Enough ice to sublimate everything
    427                 d_h2oice_new(i,islope) = real(d_target,dp)
     435            if (abs(d_target*dt) <= h2o_ice(i,islope)) then ! Enough ice to sublimate everything
     436                d_h2oice_new(i,islope) = d_target
    428437            else ! Not enough ice to sublimate everything
    429438                ! We sublimate what we can
     
    438447end do
    439448
    440 ! We need to remove this ice unable to sublimate from places where ice condenseds in order to keep balance
     449! We need to remove this ice unable to sublimate from places where ice condensed in order to keep balance
    441450where (d_h2oice_new > 0._dp) d_h2oice_new = d_h2oice_new*real((S_target_cond_h2oice - S_ghostice)/S_target_cond_h2oice,dp)
    442451
Note: See TracChangeset for help on using the changeset viewer.