Skip to content

Commit

Permalink
gammz initialization required
Browse files Browse the repository at this point in the history
  • Loading branch information
JhanSrbinovsky committed Jan 23, 2025
1 parent 3178b8b commit 31a233f
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/science/soilsnow/cbl_soilsnow_init_special.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ SUBROUTINE spec_init_soil_snow(dels, soil, ssnow, canopy, met, bal, veg,heat_cap
REAL, DIMENSION(mp) :: xx, tgg_old, tggsn_old
REAL(r_2), DIMENSION(mp) :: xxx,deltat,sinfil1,sinfil2,sinfil3
REAL :: zsetot
INTEGER, SAVE :: ktau =0
REAL :: heat_cap_lower_limit(mp,ms)

ktau = ktau +1
! since CMIP5 only ever (potentially) TRUE offline if special initialization
! requested and then only on first timestep
IF( .NOT.cable_user%cable_runtime_coupled ) THEN

IF( ktau_gl <= 1 ) THEN

! after discussion with BP
! N.B. snmin should exceed sum of layer depths, i.e. .11 m
ssnow%wbtot = 0.0
Expand Down Expand Up @@ -75,18 +72,18 @@ SUBROUTINE spec_init_soil_snow(dels, soil, ssnow, canopy, met, bal, veg,heat_cap
ssnow%gammzz(:,1) = MAX( (1.0 - soil%ssat) * soil%css * soil%rhosoil &
& + (ssnow%wb(:,1) - ssnow%wbice(:,1) ) * Ccswat * Cdensity_liq &
& + ssnow%wbice(:,1) * Ccsice * Cdensity_ice, xx ) * soil%zse(1)
END IF

ENDIF ! if(.NOT.cable_runtime_coupled)

! this is done in all cases? overwrites gammzz from above and mediates thru
! snowd% (but only for single layer snow)
IF (ktau <= 1) THEN
xx=heat_cap_lower_limit(:,1)
ssnow%gammzz(:,1) = MAX( (1.0 - soil%ssat) * soil%css * soil%rhosoil &
& + (ssnow%wb(:,1) - ssnow%wbice(:,1) ) * Ccswat * Cdensity_liq &
& + ssnow%wbice(:,1) * Ccsice * Cdensity_ice, xx ) * soil%zse(1) + &
& (1. - ssnow%isflag) * Ccgsnow * ssnow%snowd
END IF

! Evaluated on first timestep offline/ ESM1.5
xx=heat_cap_lower_limit(:,1)
ssnow%gammzz(:,1) = MAX( (1.0 - soil%ssat) * soil%css * soil%rhosoil &
& + (ssnow%wb(:,1) - ssnow%wbice(:,1) ) * Ccswat * Cdensity_liq &
& + ssnow%wbice(:,1) * Ccsice * Cdensity_ice, xx ) * soil%zse(1) + &
& (1. - ssnow%isflag) * Ccgsnow * ssnow%snowd

END SUBROUTINE spec_init_soil_snow

Expand Down

0 comments on commit 31a233f

Please sign in to comment.