Skip to content

Commit

Permalink
Merge pull request #1208 from rgknox/history-zerofixes
Browse files Browse the repository at this point in the history
Updates and fixes to history zeroing and flushing
  • Loading branch information
glemieux authored Jun 11, 2024
2 parents f0185f7 + 8d028eb commit b8e4eee
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 83 deletions.
6 changes: 0 additions & 6 deletions main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ subroutine ed_ecosystem_dynamics(currentSite, bc_in, bc_out)
call currentSite%flux_diags(el)%ZeroFluxDiags()
end do

! zero dynamics (upfreq_in = 1) output history variables
call fates_hist%zero_site_hvars(currentSite,upfreq_in=1)

! zero nutrient fluxes (upfreq_in=5) output hist variables
call fates_hist%zero_site_hvars(currentSite,upfreq_in=5)

! Call a routine that simply identifies if logging should occur
! This is limited to a global event until more structured event handling is enabled
call IsItLoggingTime(hlm_masterproc,currentSite)
Expand Down
21 changes: 19 additions & 2 deletions main/EDTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ module EDTypesMod
type, public :: site_fluxdiags_type

! ----------------------------------------------------------------------------------
! Diagnostics for fluxes into the litter pool from plants
! these fluxes are the total from
! Diagnostics of fluxes
! These act as an intermediary to write fluxes to the history
! file after number densities of plants have changed. They also
! allow the history flux diagnostics to be rebuilt during restart
!
!
! Litter fluxes are the total from
! (1) turnover from living plants
! (2) mass transfer from non-disturbance inducing mortality events
! (3) mass transfer from disturbance inducing mortality events
Expand All @@ -162,6 +167,13 @@ module EDTypesMod
real(r8) :: cwd_bg_input(1:ncwd)
real(r8),allocatable :: leaf_litter_input(:)
real(r8),allocatable :: root_litter_input(:)

! This variable is slated as to-do, but the fluxdiags type needs
! to be refactored first. Currently this type is allocated
! by chemical species (ie C, N or P). GPP is C, but not N or P (RGK 0524)
! Previous day GPP [kgC/m2/year], partitioned by size x pft
!real(r8),allocatable :: gpp_prev_scpf(:)


contains

Expand Down Expand Up @@ -464,6 +476,11 @@ subroutine ZeroFluxDiags(this)
this%cwd_bg_input(:) = 0._r8
this%leaf_litter_input(:) = 0._r8
this%root_litter_input(:) = 0._r8

! We don't zero gpp_prev_scpf because this is not
! incremented like others, it is assigned at the end
! of the daily history write process


return
end subroutine ZeroFluxDiags
Expand Down
Loading

0 comments on commit b8e4eee

Please sign in to comment.