Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes for crop model #966

Merged
merged 2 commits into from
Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -40,6 +40,7 @@

"acme_land_developer" : ("acme_runoff_developer",
("SMS.f19_f19.I1850CLM45CN",
("SMS_Ly3.1x1_smallvilleIA.ICLM45BGCCROP", "force_netcdf_pio"),
"SMS.f09_g16.I1850CLM45CN",
"SMS.hcru_hcru.I1850CRUCLM45CN")
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- Plant function types (relative to {csmdata}) -->
<paramfile >lnd/clm2/paramdata/clm_params.c160128.nc</paramfile>
<paramfile use_ed=".true." >lnd/clm2/paramdata/clm_params.ED.c140115.nc</paramfile>
<paramfile use_crop=".true." >lnd/clm2/paramdata/clm_params.c151111.nc</paramfile>
<paramfile use_crop=".true." >lnd/clm2/paramdata/clm_params_c160303.nc</paramfile>

<!-- soil order related parameters (relative to {csmdata}) -->
<fsoilordercon >lnd/clm2/paramdata/CNP_parameters_c131108.nc</fsoilordercon>
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 @@ -856,8 +856,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 @@ -919,7 +921,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 @@ -970,10 +972,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 @@ -3299,10 +3302,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 @@ -808,7 +808,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