From 6446c36ecb676b0463dc40657cd1e7f83e873bbd Mon Sep 17 00:00:00 2001 From: Zhen Wu Date: Fri, 18 Oct 2024 23:35:58 -0400 Subject: [PATCH] bug fix in cell division again --- src/Plankton/CarbonMode/division_death.jl | 1 + src/Plankton/CarbonMode/plankton_update.jl | 1 - src/Plankton/IronEnergyMode/division_death.jl | 3 ++- src/Plankton/IronEnergyMode/plankton_update.jl | 1 - src/Plankton/MacroMolecularMode/division_death.jl | 1 + src/Plankton/MacroMolecularMode/plankton_update.jl | 1 - src/Plankton/QuotaMode/division_death.jl | 3 ++- src/Plankton/QuotaMode/plankton_update.jl | 1 - 8 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Plankton/CarbonMode/division_death.jl b/src/Plankton/CarbonMode/division_death.jl index 248ab285..b5c86f67 100644 --- a/src/Plankton/CarbonMode/division_death.jl +++ b/src/Plankton/CarbonMode/division_death.jl @@ -83,5 +83,6 @@ function divide!(plank, nuts, deactive_ind, arch::Architecture) get_tind!(plank.idx, plank.dvid, nuts.idc_int, deactive_ind, arch) copy_daughter_individuals!(plank, plank.dvid, plank.idx, arch) divide_to_half!(plank, arch) + plank.idx .= 0 return nothing end diff --git a/src/Plankton/CarbonMode/plankton_update.jl b/src/Plankton/CarbonMode/plankton_update.jl index c935d452..9d889e4b 100644 --- a/src/Plankton/CarbonMode/plankton_update.jl +++ b/src/Plankton/CarbonMode/plankton_update.jl @@ -30,7 +30,6 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days")) end divide!(plank, nuts, deactive_ind, arch) - nuts.idc .= 0 end ##### diagnostic for individual distribution diff --git a/src/Plankton/IronEnergyMode/division_death.jl b/src/Plankton/IronEnergyMode/division_death.jl index c006bd4d..4c3b4cfa 100644 --- a/src/Plankton/IronEnergyMode/division_death.jl +++ b/src/Plankton/IronEnergyMode/division_death.jl @@ -96,6 +96,7 @@ function divide!(plank, nuts, deactive_ind, arch::Architecture) nuts.idc_int .= unsafe_trunc.(Int, nuts.idc) get_tind!(plank.idx, plank.dvid, nuts.idc_int, deactive_ind, arch) copy_daughter_individuals!(plank, plank.dvid, plank.idx, arch) - divide_to_half!(plank, arch) + divide_to_half!(plank, arch) + plank.idx .= 0 return nothing end diff --git a/src/Plankton/IronEnergyMode/plankton_update.jl b/src/Plankton/IronEnergyMode/plankton_update.jl index 8efa1ab1..71635d4b 100644 --- a/src/Plankton/IronEnergyMode/plankton_update.jl +++ b/src/Plankton/IronEnergyMode/plankton_update.jl @@ -31,7 +31,6 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days")) end divide!(plank, nuts, deactive_ind, arch) - nuts.idc .= 0 end ##### diagnostic for individual distribution diff --git a/src/Plankton/MacroMolecularMode/division_death.jl b/src/Plankton/MacroMolecularMode/division_death.jl index 7b81c7b0..56d1f403 100644 --- a/src/Plankton/MacroMolecularMode/division_death.jl +++ b/src/Plankton/MacroMolecularMode/division_death.jl @@ -92,5 +92,6 @@ function divide!(plank, nuts, deactive_ind, arch::Architecture) get_tind!(plank.idx, plank.dvid, nuts.idc_int, deactive_ind, arch) copy_daughter_individuals!(plank, plank.dvid, plank.idx, arch) divide_to_half!(plank, arch) + plank.idx .= 0 return nothing end diff --git a/src/Plankton/MacroMolecularMode/plankton_update.jl b/src/Plankton/MacroMolecularMode/plankton_update.jl index 9bc66472..82edd7c3 100644 --- a/src/Plankton/MacroMolecularMode/plankton_update.jl +++ b/src/Plankton/MacroMolecularMode/plankton_update.jl @@ -31,7 +31,6 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days")) end divide!(plank, nuts, deactive_ind, arch) - nuts.idc .= 0 end ##### diagnostic for individual distribution diff --git a/src/Plankton/QuotaMode/division_death.jl b/src/Plankton/QuotaMode/division_death.jl index 894e404f..348d9a91 100644 --- a/src/Plankton/QuotaMode/division_death.jl +++ b/src/Plankton/QuotaMode/division_death.jl @@ -90,6 +90,7 @@ function divide!(plank, nuts, deactive_ind, arch::Architecture) nuts.idc_int .= unsafe_trunc.(Int, nuts.idc) get_tind!(plank.idx, plank.dvid, nuts.idc_int, deactive_ind, arch) copy_daughter_individuals!(plank, plank.dvid, plank.idx, arch) - divide_to_half!(plank, arch) + divide_to_half!(plank, arch) + plank.idx .= 0 return nothing end diff --git a/src/Plankton/QuotaMode/plankton_update.jl b/src/Plankton/QuotaMode/plankton_update.jl index 9bc66472..82edd7c3 100644 --- a/src/Plankton/QuotaMode/plankton_update.jl +++ b/src/Plankton/QuotaMode/plankton_update.jl @@ -31,7 +31,6 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days")) end divide!(plank, nuts, deactive_ind, arch) - nuts.idc .= 0 end ##### diagnostic for individual distribution