Skip to content

Commit

Permalink
wip - correct initialization of altmax_ever
Browse files Browse the repository at this point in the history
Changes needed to get altmax_ever values to initialize correctly.
Fixes an issue where altmax_ever would be >30 meters regardless of
location/climate due to carrying forward the initial conditions.
Now includes a spinup_state flag so that it is set as 0 during spinup,
and then increases based on thaw depths over non-spinup cases.
  • Loading branch information
rfiorella committed Apr 3, 2024
1 parent 6911dbf commit 0f6496a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions components/elm/src/biogeophys/ActiveLayerMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ActiveLayerMod
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_const_mod , only : SHR_CONST_TKFRZ
use elm_varctl , only : iulog
use elm_varctl , only : iulog, spinup_state
use TemperatureType , only : temperature_type
use CanopyStateType , only : canopystate_type
use GridcellType , only : grc_pp
Expand Down Expand Up @@ -153,8 +153,13 @@ subroutine alt_calc(num_soilc, filter_soilc, &
altmax_indx(c) = alt_indx(c)
endif
if (alt(c) > altmax_ever(c)) then
altmax_ever(c) = alt(c)
altmax_ever_indx(c) = alt_indx(c)
if (spinup_state .eq. 0) then !overwrite if in spinup
altmax_ever(c) = alt(c)
altmax_ever_indx(c) = alt_indx(c)
else
altmax_ever(c) = 0._r8
altmax_ever_indx(c) = 0
endif
endif

end do
Expand Down
2 changes: 1 addition & 1 deletion components/elm/src/biogeophys/CanopyStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ subroutine InitAllocate(this, bounds )
allocate(this%alt_indx_col (begc:endc)) ; this%alt_indx_col (:) = huge(1)
allocate(this%altmax_indx_col (begc:endc)) ; this%altmax_indx_col (:) = huge(1)
allocate(this%altmax_lastyear_indx_col (begc:endc)) ; this%altmax_lastyear_indx_col (:) = huge(1)
allocate(this%altmax_ever_indx_col (begc:endc)) ; this%altmax_ever_indx_col (:) = huge(1)
allocate(this%altmax_ever_indx_col (begc:endc)) ; this%altmax_ever_indx_col (:) = huge(1)

allocate(this%dewmx_patch (begp:endp)) ; this%dewmx_patch (:) = spval
allocate(this%dleaf_patch (begp:endp)) ; this%dleaf_patch (:) = spval
Expand Down

0 comments on commit 0f6496a

Please sign in to comment.