From 93b69e03d33b004f9e2354edcbd9e2b38c61587f Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 11 Nov 2022 12:21:38 -0700 Subject: [PATCH 1/3] Only error if zero harvests will actually be an issue. --- src/biogeochem/CNPhenologyMod.F90 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 0c5a36410e..d3de8d3d0e 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -3003,9 +3003,6 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! How many harvests have occurred? h = crop_inst%harvest_count(p) - if (h .le. 0) then - call endrun(msg="CNOffsetLitterfall(): Invalid harvest_count") - end if ! Replenish the seed deficits from grain, if there is enough available ! grain. (If there is not enough available grain, the seed deficits will @@ -3033,10 +3030,15 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & repr_grainc_to_food_thispool = cpool_to_reproductivec(p,k) - repr_grainc_to_seed(p,k) repr_grainc_to_food(p,k) = t1 * reproductivec(p,k) & + repr_grainc_to_food_thispool - repr_grainc_to_food_perharv(p,h,k) = reproductivec(p,k) & - + repr_grainc_to_food_thispool * dt - repr_grainc_to_food_thisyr(p,k) = repr_grainc_to_food_thisyr(p,k) & - + repr_grainc_to_food_perharv(p,h,k) + if (reproductivec(p,k) + repr_grainc_to_food_thispool * dt .gt. 0) then + if (h .le. 0) then + call endrun(msg="CNOffsetLitterfall(): Invalid harvest_count") + end if + repr_grainc_to_food_perharv(p,h,k) = reproductivec(p,k) & + + repr_grainc_to_food_thispool * dt + repr_grainc_to_food_thisyr(p,k) = repr_grainc_to_food_thisyr(p,k) & + + repr_grainc_to_food_perharv(p,h,k) + end if repr_grainn_to_food(p,k) = t1 * reproductiven(p,k) & + npool_to_reproductiven(p,k) - repr_grainn_to_seed(p,k) end do From 8a18ea895bbd09c2b477d2f5092392a7c1c314e7 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 2 Jan 2023 11:45:13 -0700 Subject: [PATCH 2/3] hrv_xsmrpool_to_atm_dribbler now considers allows_non_annual_delta. --- src/biogeochem/CNVegCarbonFluxType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 48dfef418b..3a0782ffe3 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -779,7 +779,7 @@ subroutine InitAllocate(this, bounds, carbon_type) bounds = bounds, & name = 'hrv_xsmrpool_to_atm_' // carbon_type_suffix, & units = 'gC/m^2', & - allows_non_annual_delta = .false.) + allows_non_annual_delta = allows_non_annual_delta) end subroutine InitAllocate From f78a19c645da6ba0e40fb33962fa727ab5593057 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 2 Jan 2023 19:21:11 -0700 Subject: [PATCH 3/3] use gddmin as minimum GDD requirement if generate_crop_gdds true. --- src/biogeochem/CNPhenologyMod.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index d3de8d3d0e..a77b3be1a2 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2610,6 +2610,10 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) end if + if (generate_crop_gdds) then + gddmaturity(p) = max(gddmaturity(p), gddmin(ivt(p))) + endif + endif end associate