Skip to content

Commit

Permalink
Move initialization of crop allocation coefficients to PlantCrop().
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Apr 18, 2023
1 parent acce5d6 commit 128ff8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
13 changes: 1 addition & 12 deletions src/biogeochem/CNAllocationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,7 @@ subroutine calc_crop_allocation_fractions(bounds, num_pcropp, filter_pcropp, &
end do
arepr(p,nrepr) = 1._r8 - aroot(p) - astem(p) - aleaf(p)

else if (crop_phase(p) == cphase_planted) then
! pre emergence
! allocation coefficients should be irrelevant because crops have no
! live carbon pools
aleaf(p) = 1._r8
astem(p) = 0._r8
aroot(p) = 0._r8
do k = 1, nrepr
arepr(p,k) = 0._r8
end do

else
else if (crop_phase(p) /= cphase_planted)
write(iulog,*) "ERROR in " // subname // ": unexpected crop_phase: ", crop_phase(p)
call endrun(msg="ERROR: unexpected crop_phase "//errmsg(sourcefile, __LINE__))
end if
Expand Down
21 changes: 20 additions & 1 deletion src/biogeochem/CNPhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,13 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, &
gddmin => pftcon%gddmin , & ! Input:
gdd020 => temperature_inst%gdd020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd0
gdd820 => temperature_inst%gdd820_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd8
gdd1020 => temperature_inst%gdd1020_patch & ! Input: [real(r8) (:) ] 20 yr mean of gdd10
gdd1020 => temperature_inst%gdd1020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd10
aleafi => cnveg_state_inst%aleafi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2
astemi => cnveg_state_inst%astemi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2
aleaf => cnveg_state_inst%aleaf_patch , & ! Output: [real(r8) (:) ] leaf allocation coefficient
astem => cnveg_state_inst%astem_patch , & ! Output: [real(r8) (:) ] stem allocation coefficient
aroot => cnveg_state_inst%aroot_patch , & ! Output: [real(r8) (:) ] root allocation coefficient
arepr => cnveg_state_inst%arepr_patch & ! Output: [real(r8) (:,:) ] reproductive allocation coefficient(s)
)

! impose limit on growing season length needed
Expand Down Expand Up @@ -2646,6 +2652,19 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, &
gddmaturity(p) = min_gddmaturity
endif

! Initialize allocation coefficients.
! Because crops have no live carbon pools when planted but not emerged, this shouldn't
! matter unless they skip the vegetative phase (which only happens in very weird run
! setups).
aleaf(p) = 1._r8
aleafi(p) = 1._r8
astem(p) = 0._r8
astemi(p) = 0._r8
aroot(p) = 0._r8
do k = 1, nrepr
arepr(p,k) = 0._r8
end do

end associate

end subroutine PlantCrop
Expand Down

0 comments on commit 128ff8d

Please sign in to comment.