Skip to content

Commit

Permalink
Merge branch 'bbye/lnd/cropmodel-bugfixes' into next (PR #966)
Browse files Browse the repository at this point in the history
Fixes bugs introduced into crop model
Contains:
	* Harvest of phosphorus
        * Add grain phosphorus to allometry
	* Remove retranslocation during harvest
	* Fixes allocation when peak lai is reached
        * Remove unnecessary print statements

This commit fixes various bugs that are in the crop model from
the phosphorus code, dynamic nutrients, and some misc others.
First, harvest of the phosphorus is added including a 1-yr
product pool. Also, the grain phosphorus demand is included
in the calculation of phosphorus allometry. Retranslocation
terms are removed from the offset litterfall since crops are
annual and completely harvested. Finally, the allocation when
crops reach peak lai is modified to prevent unrealistic
biomass partitioning in roots and stems.

[Non-BFB] - Non Bit-For-Bit

Conflicts:
	cime/scripts-acme/update_acme_tests.py
	components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml
	components/clm/src/biogeochem/CNPhenologyMod.F90
  • Loading branch information
Gautam Bisht committed Aug 9, 2016
2 parents 3c84316 + 2063686 commit df38c71
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 107 deletions.
1 change: 1 addition & 0 deletions cime/scripts-acme/update_acme_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
("ERS.f19_f19.I1850CLM45CN",
"ERS.f09_g16.I1850CLM45CN",
"SMS.hcru_hcru.I1850CRUCLM45CN",
("SMS_Ly3.1x1_smallvilleIA.ICLM45BGCCROP", "force_netcdf_pio"),
"ERS.ne11_qu240.I20TRCLM45",
"ERS.f09_g16.IMCLM45BC")
),
Expand Down
14 changes: 9 additions & 5 deletions components/clm/src/biogeochem/CNAllocationMod.F90
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,10 @@ subroutine CNAllocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soi
if (peaklai(p) == 1) then ! lai at maximum allowed
arepr(p) = 0._r8
aleaf(p) = 1.e-5_r8
astem(p) = 0._r8
aroot(p) = 1._r8 - arepr(p) - aleaf(p) - astem(p)
aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - &
(arooti(ivt(p)) - arootf(ivt(p))) * &
min(1._r8, hui(p)/gddmaturity(p))))
astem(p) = 1._r8 - arepr(p) - aleaf(p) - aroot(p)
else
arepr(p) = 0._r8
aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - &
Expand Down Expand Up @@ -894,7 +896,7 @@ subroutine CNAllocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soi
!would be bypassed altogether, not the intended outcome. I checked several of my output files and
!they all seemed to be going through the retranslocation loop for soybean - good news.

if (ivt(p) /= nsoybean .or. astem(p) == astemf(ivt(p))) then
if (ivt(p) /= nsoybean .or. astem(p) == astemf(ivt(p)) .or. peaklai(p) == 1._r8) then
if (grain_flag(p) == 0._r8) then
t1 = 1 / dt
leafn_to_retransn(p) = t1 * ((leafc(p) / leafcn(ivt(p))) - (leafc(p) / &
Expand Down Expand Up @@ -945,10 +947,11 @@ subroutine CNAllocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soi

else if (ivt(p) >= npcropmin) then ! skip generic crops
cng = graincn(ivt(p))
cpg = graincp(ivt(p))
c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2))
n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + &
(f3*(1._r8-f4)*(1._r8+f2))/cndw
p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + &
p_allometry(p) = 1._r8/cpl + f1/cpfr + f5/cpg + (f3*f4*(1._r8+f2))/cplw + &
(f3*(1._r8-f4)*(1._r8+f2))/cpdw

else
Expand Down Expand Up @@ -3466,10 +3469,11 @@ subroutine CNAllocation3_PlantCNPAlloc (bounds , &

else if (ivt(p) >= npcropmin) then ! skip generic crops
cng = graincn(ivt(p))
cpg = graincp(ivt(p))
c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2))
n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + &
(f3*(1._r8-f4)*(1._r8+f2))/cndw
p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + &
p_allometry(p) = 1._r8/cpl + f1/cpfr + f5/cpg + (f3*f4*(1._r8+f2))/cplw + &
(f3*(1._r8-f4)*(1._r8+f2))/cpdw

else
Expand Down
13 changes: 11 additions & 2 deletions components/clm/src/biogeochem/CNCropHarvestPoolsMod.F90
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module CNCropHarvestPoolsMod
use CNCarbonFluxType , only : carbonflux_type
use CNNitrogenStateType , only : nitrogenstate_type
use CNNitrogenFluxType , only : nitrogenflux_type
use PhosphorusStateType , only : phosphorusstate_type
use PhosphorusFluxType , only : phosphorusflux_type
!
implicit none
save
Expand All @@ -27,8 +29,8 @@ module CNCropHarvestPoolsMod

!-----------------------------------------------------------------------
subroutine CNCropHarvestPools(num_soilc, filter_soilc, &
carbonstate_vars, c13_carbonstate_vars, c14_carbonstate_vars, nitrogenstate_vars, &
carbonflux_vars, c13_carbonflux_vars, c14_carbonflux_vars, nitrogenflux_vars)
carbonstate_vars, c13_carbonstate_vars, c14_carbonstate_vars, nitrogenstate_vars, phosphorusstate_vars,&
carbonflux_vars, c13_carbonflux_vars, c14_carbonflux_vars, nitrogenflux_vars, phosphorusflux_vars)
!
! !DESCRIPTION:
! Update all loss fluxes from crop harvest pools, and update harvest pool state variables
Expand All @@ -42,10 +44,12 @@ subroutine CNCropHarvestPools(num_soilc, filter_soilc, &
type(carbonstate_type) , intent(in) :: c13_carbonstate_vars
type(carbonstate_type) , intent(in) :: c14_carbonstate_vars
type(nitrogenstate_type) , intent(in) :: nitrogenstate_vars
type(phosphorusstate_type), intent(in) :: phosphorusstate_vars
type(carbonflux_type) , intent(inout) :: carbonflux_vars
type(carbonflux_type) , intent(inout) :: c13_carbonflux_vars
type(carbonflux_type) , intent(inout) :: c14_carbonflux_vars
type(nitrogenflux_type) , intent(inout) :: nitrogenflux_vars
type(phosphorusflux_type), intent(inout) :: phosphorusflux_vars
!
! !LOCAL VARIABLES:
integer :: fc ! lake filter indices
Expand Down Expand Up @@ -75,6 +79,7 @@ subroutine CNCropHarvestPools(num_soilc, filter_soilc, &
endif

nitrogenflux_vars%prod1n_loss_col(c) = nitrogenstate_vars%prod1n_col(c) * kprod1
phosphorusflux_vars%prod1p_loss_col(c) = phosphorusstate_vars%prod1p_col(c) * kprod1
end do

! set time steps
Expand All @@ -100,6 +105,8 @@ subroutine CNCropHarvestPools(num_soilc, filter_soilc, &

nitrogenstate_vars%prod1n_col(c) = nitrogenstate_vars%prod1n_col(c) + &
nitrogenflux_vars%hrv_cropn_to_prod1n_col(c)*dt
phosphorusstate_vars%prod1p_col(c) = phosphorusstate_vars%prod1p_col(c) + &
phosphorusflux_vars%hrv_cropp_to_prod1p_col(c)*dt

! fluxes out of wood product pools, from decomposition
carbonstate_vars%prod1c_col(c) = carbonstate_vars%prod1c_col(c) - &
Expand All @@ -117,6 +124,8 @@ subroutine CNCropHarvestPools(num_soilc, filter_soilc, &

nitrogenstate_vars%prod1n_col(c) = nitrogenstate_vars%prod1n_col(c) - &
nitrogenflux_vars%prod1n_loss_col(c)*dt
phosphorusstate_vars%prod1p_col(c) = phosphorusstate_vars%prod1p_col(c) - &
phosphorusflux_vars%prod1p_loss_col(c)*dt

end do ! end of column loop

Expand Down
3 changes: 2 additions & 1 deletion components/clm/src/biogeochem/CNEcosystemDynMod.F90
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,8 @@ subroutine CNEcosystemDynNoLeaching2(bounds, &

call CNCropHarvestPools(num_soilc, filter_soilc, &
carbonstate_vars, c13_carbonstate_vars, c14_carbonstate_vars, nitrogenstate_vars, &
carbonflux_vars, c13_carbonflux_vars, c14_carbonflux_vars, nitrogenflux_vars)
phosphorusstate_vars, carbonflux_vars, c13_carbonflux_vars, c14_carbonflux_vars, &
nitrogenflux_vars, phosphorusflux_vars)

call CNFireArea(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, &
atm2lnd_vars, temperature_vars, energyflux_vars, soilhydrology_vars, waterstate_vars, &
Expand Down
Loading

0 comments on commit df38c71

Please sign in to comment.