Skip to content

Commit

Permalink
Fix NAN issues in rhizome turnover
Browse files Browse the repository at this point in the history
  • Loading branch information
bsulman authored and fmyuan committed Jul 30, 2024
1 parent 54dac66 commit 9e35244
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions components/elm/src/biogeochem/PhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3479,6 +3479,11 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp)

! only calculate these fluxes for woody types
if (woody(ivt(p)) > 0._r8) then
! These are only used for nonwoody rhizomes
livecrootc_to_litter(p) = 0.0_r8
livecrootn_to_litter(p) = 0.0_r8
livecrootp_to_litter(p) = 0.0_r8

if ( nu_com .eq. 'RD') then
! live stem to dead stem turnover

Expand Down Expand Up @@ -3533,14 +3538,20 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp)

else ! If not woody, do rhizome turnover
if ( nu_com .eq. 'RD') then
ctovr = livecrootc(p) / (rhizome_long(ivt(p))*dayspyr*secspday)
ntovr = ctovr / livewdcn(ivt(p))
ptovr = ctovr / livewdcp(ivt(p))

if(rhizome_long(ivt(p))>0.0_r8) then
ctovr = livecrootc(p) / (rhizome_long(ivt(p))*dayspyr*secspday)
ntovr = livecrootn(p) / (rhizome_long(ivt(p))*dayspyr*secspday)
ptovr = livecrootp(p) / (rhizome_long(ivt(p))*dayspyr*secspday)
else
ctovr = 0.0_r8
ntovr = 0.0_r8
ptovr = 0.0_r8
endif

livecrootc_to_litter(p) = ctovr
livecrootn_to_litter(p) = ntovr ! This assumes no retranslocation
livecrootn_to_retransn(p) = 0.0_r8

livecrootp_to_litter(p) = ptovr
livecrootp_to_retransp(p) = 0.0_r8

Expand Down Expand Up @@ -3682,15 +3693,16 @@ subroutine CNLitterToColumn (num_soilp, filter_soilp, &
phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) &
+ livecrootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * croot_prof(p,j)

! fine root litter nitrogen fluxes

! Rhizome litter nitrogen fluxes
phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) &
+ livecrootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * croot_prof(p,j)
phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) &
+ livecrootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * croot_prof(p,j)
phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) &
+ livecrootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * croot_prof(p,j)

! fine root litter phosphorus fluxes
! Rhizome litter phosphorus fluxes
phenology_p_to_litr_met_p(c,j) = phenology_p_to_litr_met_p(c,j) &
+ livecrootp_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * croot_prof(p,j)
phenology_p_to_litr_cel_p(c,j) = phenology_p_to_litr_cel_p(c,j) &
Expand All @@ -3699,7 +3711,6 @@ subroutine CNLitterToColumn (num_soilp, filter_soilp, &
+ livecrootp_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * croot_prof(p,j)



! agroibis puts crop stem litter together with leaf litter
! so I've used the leaf lf_f* parameters instead of making
! new ones for now (slevis)
Expand Down

0 comments on commit 9e35244

Please sign in to comment.