Skip to content

Commit

Permalink
Merge pull request #751 from rgknox/fix-decay-restarts
Browse files Browse the repository at this point in the history
Fix decay restarts
  • Loading branch information
rgknox authored Jun 24, 2021
2 parents 1758ffe + 6aaabe9 commit 64c557e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
1 change: 0 additions & 1 deletion biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,6 @@ subroutine TransLitterNewPatch(currentSite, &
curr_litt%seed_germ_decay(pft)*patch_site_areadis/newPatch%area

end do


! -----------------------------------------------------------------------------
! Distribute the existing litter that was already in place on the donor
Expand Down
14 changes: 7 additions & 7 deletions biogeochem/FatesSoilBGCFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -997,9 +997,9 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)

select case (element_list(el))
case (carbon12_element)
bc_out%litt_flux_cel_c_si(:) = 0._r8
bc_out%litt_flux_lig_c_si(:) = 0._r8
bc_out%litt_flux_lab_c_si(:) = 0._r8
bc_out%litt_flux_cel_c_si(:) = 0.0_r8
bc_out%litt_flux_lig_c_si(:) = 0.0_r8
bc_out%litt_flux_lab_c_si(:) = 0.0_r8
flux_cel_si => bc_out%litt_flux_cel_c_si(:)
flux_lab_si => bc_out%litt_flux_lab_c_si(:)
flux_lig_si => bc_out%litt_flux_lig_c_si(:)
Expand All @@ -1022,13 +1022,12 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)

end select


currentPatch => csite%oldest_patch
do while (associated(currentPatch))

! If there is any efflux (from stores overflowing)
! than pass that to the labile litter pool

currentCohort => currentPatch%tallest
do while(associated(currentCohort))
if(.not.currentCohort%isnew)then
Expand All @@ -1039,7 +1038,7 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)
elseif(element_list(el).eq.phosphorus_element) then
efflux_ptr => currentCohort%daily_p_efflux
end if

! Unit conversion
! kg/plant/day * plant/ha * ha/m2 -> kg/m2/day

Expand All @@ -1050,7 +1049,8 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)
end if
currentCohort => currentCohort%shorter
end do



! Set a pointer to the litter object
! for the current element on the current
! patch
Expand Down
17 changes: 17 additions & 0 deletions main/FatesRestartInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ module FatesRestartInterfaceMod
integer :: ir_fnrt_litt
integer :: ir_seed_litt
integer :: ir_seedgerm_litt
integer :: ir_seed_decay_litt
integer :: ir_seedgerm_decay_litt
integer :: ir_seed_prod_co
integer :: ir_livegrass_pa
integer :: ir_age_pa
Expand Down Expand Up @@ -944,6 +946,17 @@ subroutine define_restart_vars(this, initialize_variables)
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seedgerm_litt)


call this%RegisterCohortVector(symbol_base='fates_seed_frag', vtype=cohort_r8, &
long_name_base='seed bank fragmentation flux (non-germinated)', &
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seed_decay_litt)

call this%RegisterCohortVector(symbol_base='fates_seedgerm_frag', vtype=cohort_r8, &
long_name_base='seed bank fragmentation flux (germinated)', &
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seedgerm_decay_litt)

call this%RegisterCohortVector(symbol_base='fates_ag_cwd_frag', vtype=cohort_r8, &
long_name_base='above ground CWD frag flux', &
units='kg/m2/day', veclength=num_elements, flushval = flushzero, &
Expand Down Expand Up @@ -1940,6 +1953,8 @@ subroutine set_restart_vectors(this,nc,nsites,sites)
do i = 1,numpft
this%rvars(ir_seed_litt+el)%r81d(io_idx_pa_pft) = litt%seed(i)
this%rvars(ir_seedgerm_litt+el)%r81d(io_idx_pa_pft) = litt%seed_germ(i)
this%rvars(ir_seed_decay_litt+el)%r81d(io_idx_pa_pft) = litt%seed_decay(i)
this%rvars(ir_seedgerm_decay_litt+el)%r81d(io_idx_pa_pft) = litt%seed_germ_decay(i)
io_idx_pa_pft = io_idx_pa_pft + 1
end do

Expand Down Expand Up @@ -2705,6 +2720,8 @@ subroutine get_restart_vectors(this, nc, nsites, sites)
do i = 1,numpft
litt%seed(i) = this%rvars(ir_seed_litt+el)%r81d(io_idx_pa_pft)
litt%seed_germ(i) = this%rvars(ir_seedgerm_litt+el)%r81d(io_idx_pa_pft)
litt%seed_decay(i) = this%rvars(ir_seed_decay_litt+el)%r81d(io_idx_pa_pft)
litt%seed_germ_decay(i) = this%rvars(ir_seedgerm_decay_litt+el)%r81d(io_idx_pa_pft)
io_idx_pa_pft = io_idx_pa_pft + 1
end do

Expand Down

0 comments on commit 64c557e

Please sign in to comment.