Skip to content

Commit

Permalink
Revert "Do not allow jumping to cphase_grainfill without having enter…
Browse files Browse the repository at this point in the history
…ed cphase_leafemerge."

That change was to ensure that astemi and aleafi were never uninitialized in calc_crop_allocation_fractions(). The previous commit here (128ff8d) means this is no longer an issue.

This reverts commit 7761d1a.
  • Loading branch information
samsrabin committed Apr 18, 2023
1 parent 128ff8d commit 2646ead
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/biogeochem/CNPhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
offset_flag(p) = 0._r8 ! carbon and nitrogen transfers

if (croplive(p)) then
cphase(p) = cphase_planted

! call vernalization if winter temperate cereal planted, living, and the
! vernalization factor is not 1;
Expand Down Expand Up @@ -2318,11 +2319,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
! AgroIBIS uses a complex formula for lai decline.
! Use CN's simple formula at least as a place holder (slevis)

else if (hui(p) >= huigrain(p) .and. cphase(p) >= cphase_leafemerge) then
else if (hui(p) >= huigrain(p)) then
cphase(p) = cphase_grainfill
bglfr(p) = 1._r8/(leaf_long(ivt(p))*avg_dayspyr*secspday)
else
cphase(p) = cphase_planted
end if

! continue fertilizer application while in phase 2;
Expand Down Expand Up @@ -2401,15 +2400,16 @@ subroutine CropPhase(bounds, num_pcropp, filter_pcropp, &
p = filter_pcropp(fp)

if (croplive(p)) then
! Start with cphase_planted, but this might get changed in the later
! conditional blocks.
crop_phase(p) = cphase_planted
if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p)) then
crop_phase(p) = cphase_leafemerge
else if (hui(p) >= huigrain(p) .and. crop_inst%cphase_patch(p) >= cphase_leafemerge) then
else if (hui(p) >= huigrain(p)) then
! Since we know croplive is true, any hui greater than huigrain implies that
! we're in the grainfill stage: if we were passt gddmaturity then croplive
! would be false.
crop_phase(p) = cphase_grainfill
else
crop_phase(p) = cphase_planted
end if
end if
end do
Expand Down

0 comments on commit 2646ead

Please sign in to comment.