From 5906c98cad0e3f0b54c57a2a7b028b6c1e25d0c0 Mon Sep 17 00:00:00 2001 From: Michel Bechtold Date: Wed, 4 Feb 2026 21:03:22 +0100 Subject: [PATCH 1/2] BUG: Changed HarvestIndexDay --- src/global.f90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/global.f90 b/src/global.f90 index abb27f46..9e5b1a1e 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -5590,6 +5590,7 @@ real(dp) function HarvestIndexDay(DAP, DaysToFlower, HImax, dHIdt, CCi, & integer(int32), parameter :: HIo = 1 real(dp) :: HIGC, HIday, HIGClinear, dHIdt_local integer(int32) :: t, tMax, tSwitch + real(dp) :: CCthreshold dHIdt_local = dHIdt t = DAP - GetSimulation_DelayedDays() - DaysToFlower @@ -5647,13 +5648,18 @@ real(dp) function HarvestIndexDay(DAP, DaysToFlower, HImax, dHIdt, CCi, & ! adjust HIfinal if required for inadequate photosynthesis (unsufficient green canopy) tMax = roundc(HImax/dHIdt_local, mold=1) - if ((HIfinal == HImax) .and. (t <= tmax) & - .and. ((CCi+epsilon(0._dp)) <= (PercCCxHIfinal/100._dp)) & + if ((GetCrop_subkind() /= subkind_Vegetative) & + .and. (GetCrop_subkind() /= subkind_Forage)) then + CCthreshold = PercCCxHIfinal + if ((100* GetCrop_CCo()) > PercCCxHIfinal) then + CCthreshold = (100* (1.1*GetCrop_CCo())) + end if + if ((HIfinal == HImax) .and. (t <= tmax) & + .and. ((CCi+epsilon(0._dp)) <= (CCthreshold/100._dp)) & .and. (TheCCxWithered > epsilon(0._dp)) & - .and. (CCi < TheCCxWithered) & - .and. (GetCrop_subkind() /= subkind_Vegetative) & - .and. (GetCrop_subkind() /= subkind_Forage)) then - HIfinal = roundc(HIday, mold=1) + .and. (CCi < TheCCxWithered)) then + HIfinal = roundc(HIday, mold=1) + end if end if if (HIday > HIfinal) then HIday = HIfinal From 1ba5026ac9e8e8b6d86df0cd5a9ef235cbfdb7dd Mon Sep 17 00:00:00 2001 From: Michel Bechtold Date: Thu, 5 Feb 2026 09:26:10 +0100 Subject: [PATCH 2/2] BUG: dp safety --- src/global.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/global.f90 b/src/global.f90 index 9e5b1a1e..e18a8fca 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -5651,8 +5651,8 @@ real(dp) function HarvestIndexDay(DAP, DaysToFlower, HImax, dHIdt, CCi, & if ((GetCrop_subkind() /= subkind_Vegetative) & .and. (GetCrop_subkind() /= subkind_Forage)) then CCthreshold = PercCCxHIfinal - if ((100* GetCrop_CCo()) > PercCCxHIfinal) then - CCthreshold = (100* (1.1*GetCrop_CCo())) + if ((100._dp* GetCrop_CCo()) > PercCCxHIfinal) then + CCthreshold = (100._dp* (1.1*GetCrop_CCo())) end if if ((HIfinal == HImax) .and. (t <= tmax) & .and. ((CCi+epsilon(0._dp)) <= (CCthreshold/100._dp)) &