Changeset 4152 for trunk/LMDZ.COMMON/libf/evolution/surf_ice.F90
- Timestamp:
- Mar 25, 2026, 11:19:02 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/LMDZ.COMMON/libf/evolution/surf_ice.F90 (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/surf_ice.F90
r4147 r4152 378 378 end if 379 379 380 h2o_ice = h2o_ice + d_h2oice_new*dt381 zshift_surf = d_h2oice_new*dt/rho_h2oice380 h2o_ice(:,:) = h2o_ice(:,:) + d_h2oice_new(:,:)*dt 381 zshift_surf(:,:) = d_h2oice_new(:,:)*dt/rho_h2oice 382 382 383 383 END SUBROUTINE evolve_h2oice … … 385 385 386 386 !======================================================================= 387 SUBROUTINE 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)387 SUBROUTINE balance_h2oice_reservoirs(S_atm_2_h2o,S_h2o_2_atm,S_atm_2_h2oice,S_h2oice_2_atm,h2o_ice,d_h2oice,d_balanced) 388 388 !----------------------------------------------------------------------- 389 389 ! NAME … … 414 414 real(dp), dimension(:,:), intent(in) :: h2o_ice 415 415 real(dp), dimension(:,:), intent(inout) :: d_h2oice 416 real(dp), dimension(:,:), intent(out) :: d_ h2oice_new416 real(dp), dimension(:,:), intent(out) :: d_balanced 417 417 418 418 ! LOCAL VARIABLES 419 419 ! --------------- 420 420 integer(di) :: i, islope 421 real(qp) :: S_ target, S_target_subl_h2oice, S_target_cond_h2oice, S_ghostice ! Balance variables421 real(qp) :: S_corr_subl, S_corr_cond, S_target_subl, S_target_cond, S_ghostice ! Balance variables 422 422 real(dp) :: d_target 423 423 424 424 ! CODE 425 425 ! ---- 426 S_target = (S_atm_2_h2o + S_h2o_2_atm)/2._dp 427 S_target_cond_h2oice = S_atm_2_h2oice + S_target - S_atm_2_h2o 428 S_target_subl_h2oice = S_h2oice_2_atm + S_target - S_h2o_2_atm 429 430 d_h2oice_new = 0._dp 426 ! Compute global targets 427 S_corr_cond = (S_h2o_2_atm - S_atm_2_h2o)/2._qp ! Correction = deviation to the mean 428 S_corr_subl = (S_atm_2_h2o - S_h2o_2_atm)/2._qp ! Correction = deviation to the mean 429 S_target_cond = abs(S_atm_2_h2oice + S_corr_cond) 430 S_target_subl = abs(S_h2oice_2_atm + S_corr_subl) 431 432 ! Compute balanced tendencies with positivity limiter 433 d_balanced(:,:) = 0._dp 431 434 S_ghostice = 0._qp 432 435 do i = 1,ngrid 433 436 do islope = 1,nslope 434 if (d_h2oice(i,islope) > 0._dp) then ! Condens ing435 d_ h2oice_new(i,islope) = d_h2oice(i,islope)*real(S_target_cond_h2oice/S_atm_2_h2oice,dp)436 else if (d_h2oice(i,islope) < 0._dp) then ! Sublimati ng437 d_target = d_h2oice(i,islope)*real(S_target_subl _h2oice/S_h2oice_2_atm,dp)438 if (abs(d_target*dt) <= h2o_ice(i,islope)) then ! Enough ice to sublimate everything439 d_ h2oice_new(i,islope) = d_target440 else ! Not enough ice to sublimate everything441 ! We sublimate what we can442 d_ h2oice_new(i,islope) =h2o_ice(i,islope)/dt443 ! I t means the tendency is zeronext time437 if (d_h2oice(i,islope) > 0._dp) then ! Condensation 438 d_balanced(i,islope) = d_h2oice(i,islope)*real(S_target_cond/S_atm_2_h2oice,dp) 439 else if (d_h2oice(i,islope) < 0._dp) then ! Sublimation 440 d_target = d_h2oice(i,islope)*real(S_target_subl/S_h2oice_2_atm,dp) 441 if (abs(d_target*dt) <= h2o_ice(i,islope)) then ! Enough ice to sublimate 442 d_balanced(i,islope) = d_target 443 else ! Not enough ice to sublimate 444 ! Sublimate all the available ice 445 d_balanced(i,islope) = -h2o_ice(i,islope)/dt 446 ! If fully depleted, zero tendency for next time 444 447 d_h2oice(i,islope) = 0._dp 445 ! We compute the amount of H2O ice that we could not makesublimate446 S_ghostice = S_ghostice + abs(d_target*dt) - h2o_ice(i,islope)448 ! Compute the amount of H2O ice unable to sublimate 449 S_ghostice = S_ghostice + real(abs(d_target*dt),qp) - real(h2o_ice(i,islope),qp) 447 450 end if 448 451 end if … … 450 453 end do 451 454 452 ! We need to remove this ice unable to sublimate from places where ice condensed in order to keep balance453 where (d_ h2oice_new > 0._dp) d_h2oice_new = d_h2oice_new*real((S_target_cond_h2oice - S_ghostice)/S_target_cond_h2oice,dp)455 ! Enforce conservation removing the ghost ice from places where ice condensed 456 where (d_balanced(:,:) > 0._dp) d_balanced(:,:) = d_balanced(:,:)*real((S_target_cond - S_ghostice)/S_target_cond,dp) 454 457 455 458 END SUBROUTINE balance_h2oice_reservoirs
Note: See TracChangeset
for help on using the changeset viewer.
