Skip to content
8 changes: 4 additions & 4 deletions src/biogeochem/CNAllocationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module CNAllocationMod
use clm_varcon , only : secspday
use clm_varctl , only : use_c13, use_c14, iulog
use PatchType , only : patch
use pftconMod , only : pftcon, npcropmin
use pftconMod , only : pftcon, is_prognostic_crop
use CropType , only : crop_type
use CropType , only : cphase_planted, cphase_leafemerge, cphase_grainfill
use PhotosynthesisMod , only : photosyns_type
Expand Down Expand Up @@ -191,7 +191,7 @@ subroutine calc_gpp_mr_availc(bounds, num_soilp, filter_soilp, &
mr = leaf_mr(p) + froot_mr(p)
if (woody(ivt(p)) == 1.0_r8) then
mr = mr + livestem_mr(p) + livecroot_mr(p)
else if (ivt(p) >= npcropmin) then
else if (is_prognostic_crop(ivt(p))) then
if (croplive(p)) then
reproductive_mr_tot = 0._r8
do k = 1, nrepr
Expand Down Expand Up @@ -500,7 +500,7 @@ subroutine calc_allometry(num_soilp, filter_soilp, &
end if

f4 = flivewd(ivt(p))
if (ivt(p) >= npcropmin) then
if (is_prognostic_crop(ivt(p))) then
g1 = 0.25_r8
else
g1 = grperc(ivt(p))
Expand All @@ -521,7 +521,7 @@ subroutine calc_allometry(num_soilp, filter_soilp, &
c_allometry(p) = (1._r8+g1a)*(1._r8+f1+f3*(1._r8+f2))
n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + &
(f3*(1._r8-f4)*(1._r8+f2))/cndw
else if (ivt(p) >= npcropmin) then ! skip generic crops
else if (is_prognostic_crop(ivt(p))) then ! skip generic crops
cng = graincn(ivt(p))
f1 = aroot(p) / aleaf(p)
f3 = astem(p) / aleaf(p)
Expand Down
9 changes: 2 additions & 7 deletions src/biogeochem/CNC14DecayMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module CNC14DecayMod
use clm_varctl , only : spinup_state
use CNSharedParamsMod , only : use_matrixcn
use decompMod , only : bounds_type
use pftconMod , only : npcropmin
use pftconMod , only : is_prognostic_crop
use CNVegCarbonStateType , only : cnveg_carbonstate_type
use CNVegCarbonFluxType , only : cnveg_carbonflux_type
use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con, use_soil_matrixcn
Expand Down Expand Up @@ -205,12 +205,7 @@ subroutine C14Decay( bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, &
gresp_xfer(p) = gresp_xfer(p) * (1._r8 - decay_const * dt)
pft_ctrunc(p) = pft_ctrunc(p) * (1._r8 - decay_const * dt)

! NOTE(wjs, 2017-02-02) This isn't a completely robust way to check if this is a
! prognostic crop patch (at the very least it should also check if <= npcropmax;
! ideally it should use a prognostic_crop flag that doesn't seem to exist
! currently). But I'm just being consistent with what's done elsewhere (e.g., in
! CStateUpdate1).
if (patch%itype(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(patch%itype(p))) then ! skip 2 generic crops
cropseedc_deficit(p) = cropseedc_deficit(p) * (1._r8 - decay_const * dt)
end if
end do
Expand Down
4 changes: 2 additions & 2 deletions src/biogeochem/CNCIsoFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ subroutine CNCIsoLitterToColumn (num_soilp, filter_soilp, &
!
! !USES:
!DML
use pftconMod , only : npcropmin
use pftconMod , only : is_prognostic_crop
use clm_varctl , only : use_grainproduct
!DML

Expand Down Expand Up @@ -1404,7 +1404,7 @@ subroutine CNCIsoLitterToColumn (num_soilp, filter_soilp, &
end do

!DML
if (ivt(p) >= npcropmin) then ! add livestemc to litter
if (is_prognostic_crop(ivt(p))) then ! add livestemc to litter
! stem litter carbon fluxes
do i = i_litr_min, i_litr_max
phenology_c_to_litr_c(c,j,i) = &
Expand Down
22 changes: 11 additions & 11 deletions src/biogeochem/CNCStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module CNCStateUpdate1Mod
use clm_time_manager , only : get_step_size_real
use clm_varpar , only : i_litr_min, i_litr_max, i_cwd
use clm_varpar , only : i_met_lit, i_str_lit, i_phys_som, i_chem_som
use pftconMod , only : npcropmin, nc3crop, pftcon
use pftconMod , only : is_prognostic_crop, nc3crop, pftcon
use abortutils , only : endrun
use decompMod , only : bounds_type
use CNVegCarbonStateType , only : cnveg_carbonstate_type
Expand Down Expand Up @@ -290,7 +290,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt
cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
! lines here for consistency; the transfer terms are zero
cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt
cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt
Expand All @@ -313,7 +313,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - cf_veg%livecrootc_to_deadcrootc_patch(p)*dt
cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%livecrootc_to_deadcrootc_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt
cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - &
(cf_veg%livestemc_to_biofuelc_patch(p) + cf_veg%livestemc_to_removedresiduec_patch(p))*dt
Expand All @@ -337,7 +337,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &

! This part below MUST match exactly the code for the non-matrix part
! above!
if (ivt(p) >= npcropmin) then
if (is_prognostic_crop(ivt(p))) then
cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) &
- cf_veg%crop_seedc_to_leaf_patch(p) * dt
do k = repr_grain_min, repr_grain_max
Expand All @@ -359,7 +359,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livecroot_curmr_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt
do k = 1, nrepr
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%reproductive_curmr_patch(p,k)*dt
Expand Down Expand Up @@ -432,7 +432,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
! NOTE: The equivalent changes for matrix code are in CNPhenology EBK (11/26/2019)
end if !not use_matrixcn
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
if (carbon_resp_opt == 1) then
cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p)
cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - &
Expand Down Expand Up @@ -468,7 +468,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_gr_patch(p)*dt
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_gr_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt
do k = 1, nrepr
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_reproductive_gr_patch(p,k)*dt
Expand All @@ -484,7 +484,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livecroot_gr_patch(p)*dt
cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadcroot_gr_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt
do k = 1, nrepr
cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_reproductive_gr_patch(p,k)*dt
Expand All @@ -501,7 +501,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_storage_gr_patch(p)*dt
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_storage_gr_patch(p)*dt
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt

do k = 1, nrepr
Expand Down Expand Up @@ -539,7 +539,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
! NOTE: The equivalent changes for matrix code are in CNPhenology EBK (11/26/2019)
end if !not use_matrixcn
end if
if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
! lines here for consistency; the transfer terms are zero
if(.not. use_matrixcn)then
! lines here for consistency; the transfer terms are zero
Expand All @@ -556,7 +556,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
end if !not use_matrixcn
end if

if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt
do k = 1, nrepr
cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%reproductive_xsmr_patch(p,k)*dt
Expand Down
6 changes: 3 additions & 3 deletions src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module CNFUNMod
use clm_varctl , only : iulog
use PatchType , only : patch
use ColumnType , only : col
use pftconMod , only : pftcon, npcropmin
use pftconMod , only : pftcon
use decompMod , only : bounds_type
use clm_varctl , only : use_nitrif_denitrif,use_flexiblecn
use CNSharedParamsMod , only : use_matrixcn
Expand Down Expand Up @@ -284,7 +284,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
use clm_varctl , only : use_nitrif_denitrif
use PatchType , only : patch
use subgridAveMod , only : p2c
use pftconMod , only : npcropmin
use pftconMod , only : is_prognostic_crop
use CNVegMatrixMod , only : matrix_update_phn
!
! !ARGUMENTS:
Expand Down Expand Up @@ -1271,7 +1271,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
! Calculate appropriate degree of retranslocation
!-------------------------------------------------------------------------------

if(leafc(p).gt.0.0_r8.and.litterfall_n_step(p,istp)* fixerfrac>0.0_r8.and.ivt(p) <npcropmin)then
if(leafc(p).gt.0.0_r8.and.litterfall_n_step(p,istp)* fixerfrac>0.0_r8.and. (.not. is_prognostic_crop(ivt(p))))then
Comment thread
samsrabin marked this conversation as resolved.
Outdated
call fun_retranslocation(p,dt,npp_to_spend,&
litterfall_c_step(p,istp)* fixerfrac,&
litterfall_n_step(p,istp)* fixerfrac,&
Expand Down
4 changes: 2 additions & 2 deletions src/biogeochem/CNFireEmissionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function vert_dist_top( veg_type ) result(ztop)
use pftconMod , only : nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub
use pftconMod , only : nc3_arctic_grass, nc3_nonarctic_grass
use pftconMod , only : nc3crop, nc3irrig
use pftconMod , only : npcropmin, npcropmax
use pftconMod , only : is_prognostic_crop
implicit none
integer, intent(in) :: veg_type

Expand Down Expand Up @@ -376,7 +376,7 @@ function vert_dist_top( veg_type ) result(ztop)
else if ( veg_type == nc3crop .or. veg_type <= nc3irrig ) then
ztop = 1.e3_r8 ! m
! Prognostic crops
else if ( veg_type >= npcropmin .and. veg_type <= npcropmax ) then
else if (is_prognostic_crop(veg_type)) then
ztop = 1.e3_r8 ! m
else
call endrun('ERROR:: undefined veg_type' )
Expand Down
4 changes: 2 additions & 2 deletions src/biogeochem/CNGRespMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module CNGRespMod
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use pftconMod , only : npcropmin, pftcon
use pftconMod , only : is_prognostic_crop, pftcon
use CNVegcarbonfluxType , only : cnveg_carbonflux_type
use PatchType , only : patch
use CanopyStateType , only : canopystate_type
Expand Down Expand Up @@ -145,7 +145,7 @@ subroutine CNGResp(num_soilp, filter_soilp, cnveg_carbonflux_inst, canopystate_i
respfact_livecroot_storage = 1.0_r8
respfact_livestem_storage = 1.0_r8

if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) * respfact_livestem

cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * &
Expand Down
4 changes: 2 additions & 2 deletions src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
use clm_varpar , only: nlevdecomp_full
use clm_varcon , only: secspday
use clm_varctl , only: use_cndv, spinup_state
use pftconMod , only: npcropmin
use pftconMod , only: is_prognostic_crop
!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
Expand Down Expand Up @@ -348,7 +348,7 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
end if !use_matrixcn
end if

if (ivt(p) < npcropmin) then
if (.not. is_prognostic_crop(ivt(p))) then
if(.not. use_matrixcn)then
cnveg_nitrogenflux_inst%m_retransn_to_litter_patch(p) = cnveg_nitrogenstate_inst%retransn_patch(p) * m
else
Expand Down
4 changes: 2 additions & 2 deletions src/biogeochem/CNMRespMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module CNMRespMod
use decompMod , only : bounds_type
use abortutils , only : endrun
use shr_log_mod , only : errMsg => shr_log_errMsg
use pftconMod , only : npcropmin, pftcon
use pftconMod , only : is_prognostic_crop, pftcon
use SoilStateType , only : soilstate_type
use CanopyStateType , only : canopystate_type
use TemperatureType , only : temperature_type
Expand Down Expand Up @@ -265,7 +265,7 @@ subroutine CNMResp(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, &
if (woody(ivt(p)) == 1) then
livestem_mr(p) = livestemn(p)*br*tc
livecroot_mr(p) = livecrootn(p)*br_root*tc
else if (ivt(p) >= npcropmin) then
else if (is_prognostic_crop(ivt(p))) then
livestem_mr(p) = livestemn(p)*br*tc
do k = 1, nrepr
reproductive_mr(p,k) = reproductiven(p,k)*br*tc
Expand Down
10 changes: 5 additions & 5 deletions src/biogeochem/CNNStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module CNNStateUpdate1Mod
use SoilBiogeochemDecompCascadeConType, only : decomp_method, mimics_decomp, use_soil_matrixcn
use CNSharedParamsMod , only : use_matrixcn
use clm_varcon , only : nitrif_n2o_loss_frac
use pftconMod , only : npcropmin, pftcon
use pftconMod , only : is_prognostic_crop, pftcon
use decompMod , only : bounds_type
use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type
use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type
Expand Down Expand Up @@ -228,7 +228,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &
ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) - nf_veg%deadcrootn_xfer_to_deadcrootn_patch(p)*dt
end if

if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
! lines here for consistency; the transfer terms are zero
ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) + nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt
ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) - nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt
Expand Down Expand Up @@ -287,7 +287,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &
! NOTE: The equivalent changes for matrix code are in CNPhenology EBK (11/26/2019)
end if !not use_matrixcn
end if
if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot
if (is_prognostic_crop(ivt(p))) then ! Beth adds retrans from froot
!
! State update without the matrix solution
!
Expand Down Expand Up @@ -391,7 +391,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &
end if ! not use_matrixcn
end if

if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_patch(p)*dt
ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_storage_patch(p)*dt
do k = 1, nrepr
Expand Down Expand Up @@ -452,7 +452,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &
! NOTE: The equivalent changes for matrix code are in CNPhenology EBK (11/26/2019)
end if ! not use_matrixcn

if (ivt(p) >= npcropmin) then ! skip 2 generic crops
if (is_prognostic_crop(ivt(p))) then ! skip 2 generic crops
! lines here for consistency; the transfer terms are zero

!
Expand Down
Loading