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

a more detailed iron allocation #77

Merged
merged 7 commits into from
Sep 2, 2024
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
2 changes: 1 addition & 1 deletion src/Diagnostics/diagnostics_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function diags_spcs!(diags_sp, plank, ac, x, y, z, mode::AbstractMode, arch::Arc
elseif isa(mode, MacroMolecularMode)
diags = (:PS, :VDOC, :VHN4, :VNO3, :VPO4, :S_PRO, :S_DNA, :S_RNA, :resp, :ρChl, :CH, :NST, :PST, :PRO, :DNA, :RNA, :Chl)
elseif isa(mode, IronEnergyMode)
diags = (:PS, :CF, :ECF, :RS, :ERS, :NR, :ENR, :BS, :VNH4, :VNO3, :VPO4, :VFe, :Bm, :En, :CH, :qNO3, :qNH4, :qP, :qFe, :Chl)
diags = (:PS, :CF, :ECF, :RS, :ERS, :NR, :ENR, :BS, :VNH4, :VNO3, :VPO4, :VFe, :PS2ST, :ST2PS, :NR2ST, :ST2NR, :Bm, :En, :CH, :qNO3, :qNH4, :qP, :qFe, :qFePS, :qFeNR, :Chl)
end

for diag in keys(diags_sp)
Expand Down
2 changes: 1 addition & 1 deletion src/Diagnostics/diagnostics_struct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function plank_avail_diags(mode::AbstractMode)
elseif isa(mode, MacroMolecularMode)
plank_avail = (:num, :graz, :mort, :dvid, :PS, :VDOC, :VNH4, :VNO3, :VPO4, :resp, :ρChl, :S_PRO, :S_DNA, :S_RNA, :exu, :CH, :NST, :PST, :PRO, :DNA, :RNA, :Chl)
elseif isa(mode, IronEnergyMode)
plank_avail = (:num, :graz, :mort, :dvid, :PS, :CF, :ECF, :RS, :ERS, :NR, :ENR, :BS, :VNH4, :VNO3, :VPO4, :VFe, :Bm, :En, :CH, :qNO3, :qNH4, :qP, :qFe, :Chl)
plank_avail = (:num, :graz, :mort, :dvid, :PS, :CF, :ECF, :RS, :ERS, :NR, :ENR, :BS, :VNH4, :VNO3, :VPO4, :VFe, :PS2ST, :ST2PS, :NR2ST, :ST2NR, :Bm, :En, :CH, :qNO3, :qNH4, :qP, :qFe, :qFePS, :qFeNR, :Chl)
end
return plank_avail
end
58 changes: 35 additions & 23 deletions src/Model/time_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,29 @@ function TimeStep!(model::PlanktonModel, ΔT, diags::PlanktonDiagnostics)

#### calculate accumulated Chla quantity (not concentration) and population
find_inds!(model.individuals.phytos[sp].data, model.grid, model.arch)
acc_counts!(model.timestepper.Chl, model.timestepper.pop,
model.individuals.phytos[sp].data.Chl, model.individuals.phytos[sp].data.ac,
acc_chl!(model.timestepper.Chl, model.individuals.phytos[sp].data.Chl,
model.individuals.phytos[sp].data.ac, model.individuals.phytos[sp].data.xi,
model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi, model.arch)
acc_counts!(model.timestepper.pop, model.individuals.phytos[sp].data.ac,
model.individuals.phytos[sp].data.xi, model.individuals.phytos[sp].data.yi,
model.individuals.phytos[sp].data.zi, model.arch)
##### calculate PAR
for ki in 1:model.grid.Nz
calc_par!(model.timestepper.par, model.arch, model.timestepper.Chl, model.timestepper.PARF,
model.grid, model.bgc_params["kc"], model.bgc_params["kw"], ki)
end
end
for sp in keys(model.individuals.phytos)
find_NPT!(model.timestepper.nuts, model.individuals.phytos[sp].data.xi,
model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi,
model.individuals.phytos[sp].data.ac, model.nutrients.NH4.data,
model.nutrients.NO3.data, model.nutrients.PO4.data, model.nutrients.DOC.data,
model.nutrients.FeT.data, model.timestepper.par, model.timestepper.temp,
model.timestepper.pop, model.arch)

model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi,
model.individuals.phytos[sp].data.ac, model.nutrients.NH4.data,
model.nutrients.NO3.data, model.nutrients.PO4.data, model.nutrients.DOC.data,
model.nutrients.FeT.data, model.timestepper.par, model.timestepper.par₀,
model.timestepper.temp, model.timestepper.pop, model.arch)
plankton_update!(model.individuals.phytos[sp].data, model.timestepper.nuts,
model.timestepper.rnd, model.individuals.phytos[sp].p,
model.timestepper.plk, diags.plankton[sp], ΔT, model.t, model.arch, model.mode)
model.timestepper.rnd, model.individuals.phytos[sp].p,
model.timestepper.plk, diags.plankton[sp], ΔT, model.t, model.arch, model.mode)
end
else # model.bgc_params["shared_graz"] ≠ 1.0 - species-specific grazing
for sp in keys(model.individuals.phytos)
Expand All @@ -61,17 +68,26 @@ function TimeStep!(model::PlanktonModel, ΔT, diags::PlanktonDiagnostics)

#### calculate accumulated Chla quantity (not concentration) and population
find_inds!(model.individuals.phytos[sp].data, model.grid, model.arch)
acc_counts!(model.timestepper.Chl, model.timestepper.pop,
model.individuals.phytos[sp].data.Chl, model.individuals.phytos[sp].data.ac,
acc_chl!(model.timestepper.Chl, model.individuals.phytos[sp].data.Chl,
model.individuals.phytos[sp].data.ac, model.individuals.phytos[sp].data.xi,
model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi, model.arch)
##### calculate PAR
for ki in 1:model.grid.Nz
calc_par!(model.timestepper.par, model.arch, model.timestepper.Chl, model.timestepper.PARF,
model.grid, model.bgc_params["kc"], model.bgc_params["kw"], ki)
end
end
for sp in keys(model.individuals.phytos)
acc_counts!(model.timestepper.pop, model.individuals.phytos[sp].data.ac,
model.individuals.phytos[sp].data.xi, model.individuals.phytos[sp].data.yi,
model.individuals.phytos[sp].data.zi, model.arch)

find_NPT!(model.timestepper.nuts, model.individuals.phytos[sp].data.xi,
model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi,
model.individuals.phytos[sp].data.ac, model.nutrients.NH4.data,
model.nutrients.NO3.data, model.nutrients.PO4.data, model.nutrients.DOC.data,
model.nutrients.FeT.data, model.timestepper.par, model.timestepper.temp,
model.timestepper.pop, model.arch)
find_NPT!(model.timestepper.nuts, model.individuals.phytos[sp].data.xi,
model.individuals.phytos[sp].data.yi, model.individuals.phytos[sp].data.zi,
model.individuals.phytos[sp].data.ac, model.nutrients.NH4.data,
model.nutrients.NO3.data, model.nutrients.PO4.data, model.nutrients.DOC.data,
model.nutrients.FeT.data, model.timestepper.par, model.timestepper.par₀,
model.timestepper.temp, model.timestepper.pop, model.arch)

plankton_update!(model.individuals.phytos[sp].data, model.timestepper.nuts,
model.timestepper.rnd, model.individuals.phytos[sp].p,
Expand All @@ -80,11 +96,6 @@ function TimeStep!(model::PlanktonModel, ΔT, diags::PlanktonDiagnostics)
end
end

##### calculate PAR
for ki in 1:model.grid.Nz
calc_par!(model.timestepper.par, model.arch, model.timestepper.Chl, model.timestepper.PARF,
model.grid, model.bgc_params["kc"], model.bgc_params["kw"], ki)
end
##### diagnostics for nutrients
@inbounds diags.tracer.PAR .+= model.timestepper.par
@inbounds diags.tracer.T .+= model.timestepper.temp
Expand All @@ -100,6 +111,7 @@ function TimeStep!(model::PlanktonModel, ΔT, diags::PlanktonDiagnostics)
@inbounds model.timestepper.vel₀.u.data .= model.timestepper.vel₁.u.data
@inbounds model.timestepper.vel₀.v.data .= model.timestepper.vel₁.v.data
@inbounds model.timestepper.vel₀.w.data .= model.timestepper.vel₁.w.data
@inbounds model.timestepper.par₀ .= model.timestepper.par

return nothing
end
8 changes: 5 additions & 3 deletions src/Model/timestepper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mutable struct timestepper
temp::AbstractArray # a (Cu)Array to store temperature field of each timestep
plk::NamedTuple # a NamedTuple same as nutrients to store interactions with individuals
par::AbstractArray # a (Cu)Array to store PAR field of each timestep
par₀::AbstractArray # a (Cu)Array to store PAR field of the previous timestep
Chl::AbstractArray # a (Cu)Array to store Chl field of each timestep
pop::AbstractArray # a (Cu)Array to store population field of each timestep
rnd::AbstractArray # a StructArray of random numbers for plankton diffusion or grazing, mortality and division.
Expand All @@ -25,6 +26,7 @@ function timestepper(arch::Architecture, FT::DataType, g::AbstractGrid, maxN)
plk = nutrients_init(arch, g, FT)

par = zeros(FT, g.Nx+g.Hx*2, g.Ny+g.Hy*2, g.Nz+g.Hz*2) |> array_type(arch)
par₀= zeros(FT, g.Nx+g.Hx*2, g.Ny+g.Hy*2, g.Nz+g.Hz*2) |> array_type(arch)
Chl = zeros(FT, g.Nx+g.Hx*2, g.Ny+g.Hy*2, g.Nz+g.Hz*2) |> array_type(arch)
pop = zeros(FT, g.Nx+g.Hx*2, g.Ny+g.Hy*2, g.Nz+g.Hz*2) |> array_type(arch)

Expand All @@ -42,11 +44,11 @@ function timestepper(arch::Architecture, FT::DataType, g::AbstractGrid, maxN)

nuts = StructArray(NH4 = zeros(FT, maxN), NO3 = zeros(FT, maxN), PO4 = zeros(FT, maxN),
DOC = zeros(FT, maxN), FeT = zeros(FT, maxN), par = zeros(FT, maxN),
T = zeros(FT, maxN), pop = zeros(FT, maxN), idc = zeros(FT, maxN),
idc_int = zeros(Int, maxN))
T = zeros(FT, maxN), pop = zeros(FT, maxN), dpar= zeros(FT, maxN),
idc = zeros(FT, maxN), idc_int = zeros(Int, maxN))
nuts_d = replace_storage(array_type(arch), nuts)

ts = timestepper(Gcs, nut_temp, vel₀, vel½, vel₁, PARF, temp, plk, par, Chl, pop, rnd_d, velos_d, nuts_d)
ts = timestepper(Gcs, nut_temp, vel₀, vel½, vel₁, PARF, temp, plk, par, par₀, Chl, pop, rnd_d, velos_d, nuts_d)

return ts
end
6 changes: 5 additions & 1 deletion src/Parameters/param_default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,17 @@ function phyt_params_default(N::Int64, mode::IronEnergyMode)
"Topt" => [27.0], # Optimal temperature for growth (C)
"Tmax" => [30.0], # Maximal temperature for growth (C)
"Ea" => [5.3e4], # Free energy
"Imax" => [2500.0], # Light regulation of iron allocation (μmol photon/m²/second)
"Imax" => [3000.0], # Light regulation of iron allocation (μmol photon/m²/second)
"PCmax" => [2.43e-5], # Maximum primary production rate (kJ/mmolC/second)
"k_cf" => [1.0e-5], # Carbon fixation rate (per second)
"e_cf" => [0.59], # Energy consumption rate of carbon fixation (kJ/mmolC)
"VNH4max" => [6.9e-6], # Maximum N uptake rate (mmolN/mmolC/second)
"VNO3max" => [6.9e-6], # Maximum N uptake rate (mmolN/mmolC/second)
"VPO4max" => [1.2e-6], # Maximum P uptake rate (mmolP/mmolC/second)
"k_Fe_ST2PS"=> [2.4e-5], # Allocation rate of Fe from storage to PS (per second)
"k_Fe_PS2ST"=> [1.2e-6], # Allocation rate of Fe from PS to storage (per second)
"k_Fe_ST2NR"=> [1.2e-5], # Allocation rate of Fe from storage to NR (per second)
"k_Fe_NR2ST"=> [1.2e-5], # Allocation rate of Fe from NR to storage (per second)
"KfePS" => [3.0e-6], # Haff-saturation coeff of iron quota for photosynthesis (mmolFe/mmolC)
"KfeNR" => [2.0e-6], # Haff-saturation coeff of iron quota for NO3 reduction (mmolFe/mmolC)
"KsatNH4" => [0.005], # Half-saturation coeff (mmolN/m³)
Expand Down
2 changes: 1 addition & 1 deletion src/Plankton/CarbonMode/plankton_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar
dvidnum = dot(plank.dvid, plank.ac)
deactive_ind = findall(x -> x == 0.0f0, plank.ac)
if dvidnum > length(deactive_ind)
throw(ArgumentError("number of individual exceeds the capacity"))
throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days"))
end
divide!(plank, nuts, deactive_ind, arch)
plank.idx .= 0
Expand Down
54 changes: 39 additions & 15 deletions src/Plankton/IronEnergyMode/growth_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@ end
return min(1.0f0, k/OGT_rate)
end

##### intracellular iron allocation to photosynthesis
@inline function iron_alloc_PS(par, p)
f = shape_func_dec(par, p.Imax, 1.0f-2)
return f
end

##### calculate light reaction (kJ/individual/second)
@inline function calc_PS(par, Bm, CH, Chl, qFe, p)
qFe_PS = iron_alloc_PS(par, p) * qFe
qFe_PS = qFe_PS / max(1.0f-30, Bm + CH)
@inline function calc_PS(par, Bm, CH, Chl, qFePS, p)
Qfe_ps = qFePS / max(1.0f-30, Bm + CH)
αI = par * p.α * Chl / max(1.0f-30, Bm)
PS = p.PCmax * (1.0f0 - exp(-αI)) * qFe_PS / max(1.0f-30, qFe_PS + p.KfePS) * Bm
PS = p.PCmax * (1.0f0 - exp(-αI)) * Qfe_ps / max(1.0f-30, Qfe_ps + p.KfePS) * Bm
return PS
end

Expand Down Expand Up @@ -161,11 +154,10 @@ function update_state_2!(plank, ΔT, arch::Architecture)
end

##### nitrate reduction (mmolN/individual/second)
@inline function calc_NO3_reduction(En, qNO3, qNH4, qFe, Bm, CH, par, p, ac, ΔT)
@inline function calc_NO3_reduction(En, qNO3, qNH4, qFeNR, Bm, CH, p, ac, ΔT)
reg = shape_func_dec(qNH4, p.qNH4max, 1.0f-4)
qFe_NR = max(1.0f-30, (1.0f0 - iron_alloc_PS(par, p)) * qFe)
qFe_NR = qFe_NR / max(1.0f-30, Bm + CH)
NR = p.k_nr * reg * qNO3 * qFe_NR / max(1.0f-30, qFe_NR + p.KfeNR) * ac
Qfe_NR = qFeNR / max(1.0f-30, Bm + CH)
NR = p.k_nr * reg * qNO3 * Qfe_NR / max(1.0f-30, Qfe_NR + p.KfeNR) * ac
NR = min(NR, qNO3/ΔT, En/p.e_nr/ΔT) # double check qNO3 and energy are not over consumed
ENR = NR * p.e_nr * ac
return NR, ENR
Expand All @@ -175,7 +167,7 @@ end
i = @index(Global)
@inbounds plank.NR[i], plank.ENR[i] = calc_NO3_reduction(plank.En[i], plank.qNO3[i], plank.qNH4[i],
plank.qFe[i], plank.Bm[i], plank.CH[i],
nuts.par[i], p, plank.ac[i], ΔT)
p, plank.ac[i], ΔT)
end
function calc_NO3_reduc!(plank, nuts, p, ΔT, arch::Architecture)
kernel! = calc_NO3_reduc_kernel!(device(arch), 256, (size(plank.ac,1)))
Expand Down Expand Up @@ -221,6 +213,34 @@ function calc_BS!(plank, p, arch::Architecture)
return nothing
end

##### iron allocation
@inline function iron_alloc(par, dpar, qFe, qFePS, qFeNR, p, ΔT)
reg = shape_func_dec(par, p.Imax, 1.0f-2; pow = 4.0f0)
f_ST2PS = p.k_Fe_ST2PS * reg * qFe * isless(0.0f0, dpar)
f_PS2ST = p.k_Fe_PS2ST * qFePS * (reg * isless(dpar, 0.0f0) + isequal(0.0f0, par))
f_ST2NR = p.k_Fe_ST2NR * qFe * isequal(0.0f0, par)
f_NR2ST = p.k_Fe_NR2ST * qFeNR * isless(0.0f0, par)

f_ST2PS = min(f_ST2PS, qFe/ΔT)
f_PS2ST = min(f_PS2ST, qFePS/ΔT)
f_ST2NR = min(f_ST2NR, qFe/ΔT - f_ST2PS) # photosynthesis has the highest priority
f_NR2ST = min(f_NR2ST, qFeNR/ΔT)

return f_ST2PS, f_PS2ST, f_ST2NR, f_NR2ST
end

@kernel function calc_iron_fluxes_kernel!(plank, nuts, p, ΔT)
i = @index(Global)
@inbounds plank.ST2PS[i], plank.PS2ST[i], plank.ST2NR[i], plank.NR2ST[i] =
iron_alloc(nuts.par[i], nuts.dpar[i], plank.qFe[i],
plank.qFePS[i], plank.qFeNR[i], p, ΔT)
end
function calc_iron_fluxes!(plank, nuts, p, ΔT, arch::Architecture)
kernel! = calc_iron_fluxes_kernel!(device(arch), 256, (size(plank.ac,1)))
kernel!(plank, nuts, p, ΔT)
return nothing
end

##### update C, N, P quotas, biomass, Chla
@kernel function update_biomass_kernel!(plank, p, ΔT)
i = @index(Global)
Expand All @@ -230,6 +250,10 @@ end
@inbounds plank.qP[i] -= ΔT * plank.BS[i] * p.R_PC
@inbounds plank.Chl[i] += ΔT * plank.BS[i] * p.R_NC * plank.ρChl[i]
@inbounds plank.age[i] += ΔT / 3600.0f0 * plank.ac[i]
@inbounds plank.qFe[i] += ΔT * (plank.PS2ST[i] - plank.ST2PS[i] +
plank.NR2ST[i] - plank.ST2NR[i])
@inbounds plank.qFePS[i]+= ΔT * (plank.ST2PS[i] - plank.PS2ST[i])
@inbounds plank.qFeNR[i]+= ΔT * (plank.ST2NR[i] - plank.NR2ST[i])
end
function update_biomass!(plank, p, ΔT, arch::Architecture)
kernel! = update_biomass_kernel!(device(arch), 256, (size(plank.ac,1)))
Expand Down
12 changes: 9 additions & 3 deletions src/Plankton/IronEnergyMode/plankton_generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ function construct_plankton(arch::Architecture, sp::Int, params::Dict, maxN::Int
xi = zeros(Int,maxN), yi = zeros(Int,maxN), zi = zeros(Int,maxN),
Sz = zeros(FT, maxN), Bm = zeros(FT, maxN), En = zeros(FT, maxN),
CH = zeros(FT, maxN), qNH4 = zeros(FT, maxN), qNO3 = zeros(FT, maxN),
qFe = zeros(FT, maxN), qP = zeros(FT, maxN), Chl = zeros(FT, maxN),
gen = zeros(FT, maxN), age = zeros(FT, maxN), ac = zeros(FT, maxN),
idx = zeros(Int,maxN),
qFe = zeros(FT, maxN), qFePS= zeros(FT, maxN), qFeNR= zeros(FT, maxN),
qP = zeros(FT, maxN), Chl = zeros(FT, maxN), gen = zeros(FT, maxN),
age = zeros(FT, maxN), ac = zeros(FT, maxN), idx = zeros(Int,maxN),
PS = zeros(FT, maxN), CF = zeros(FT, maxN), ECF = zeros(FT, maxN),
VNH4 = zeros(FT, maxN), VNO3 = zeros(FT, maxN), VPO4 = zeros(FT, maxN),
VFe = zeros(FT, maxN), ρChl = zeros(FT, maxN),
PS2ST= zeros(FT, maxN), ST2PS= zeros(FT, maxN),
NR2ST= zeros(FT, maxN), ST2NR= zeros(FT, maxN),
RS = zeros(FT, maxN), ERS = zeros(FT, maxN),
BS = zeros(FT, maxN), NR = zeros(FT, maxN), ENR = zeros(FT, maxN),
graz = zeros(FT, maxN), mort = zeros(FT, maxN), dvid = zeros(FT, maxN)
Expand All @@ -18,6 +20,7 @@ function construct_plankton(arch::Architecture, sp::Int, params::Dict, maxN::Int
param_names=(:Nsuper, :Cquota, :SA, :mean, :var, :Chl2Cint,
:α, :Topt, :Tmax, :Ea, :Imax,
:PCmax, :k_cf, :e_cf, :VNO3max, :VNH4max, :VPO4max,
:k_Fe_ST2PS, :k_Fe_PS2ST, :k_Fe_ST2NR, :k_Fe_NR2ST,
:KfePS, :KfeNR, :KsatNH4, :KsatNO3, :KsatPO4, :KSAFe,
:CHmax, :qNH4max, :qNO3max, :qPmax, :qFemax,
:Chl2N, :R_NC, :R_PC, :k_mtb, :k_rs, :e_rs, :k_nr, :e_nr,
Expand Down Expand Up @@ -76,6 +79,9 @@ function generate_plankton!(plank, N::Int, g::AbstractGrid, arch::Architecture)
plank.data.qP .= plank.data.qP .* (pqmax .* (plank.data.Bm .+ plank.data.CH) .-
plank.data.Bm .* R_PC) # Pq
plank.data.qFe .= plank.data.qFe .* (feqmax .* (plank.data.Bm .+ plank.data.CH)) # Fe
plank.data.qFePS.= plank.data.qFe .* 0.4 # Fe
plank.data.qFeNR.= plank.data.qFe .* 0.3 # Fe
plank.data.qFe .= plank.data.qFe .* 0.3 # Fe
plank.data.Chl .= plank.data.Bm .* Chl2Cint # Chl

mask_individuals!(plank.data, g, N, arch)
Expand Down
1 change: 1 addition & 0 deletions src/Plankton/IronEnergyMode/plankton_growth.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function plankton_growth!(plank, nuts, rnd, p, ΔT, t, arch::Architecture)
update_state_3!(plank, ΔT, arch)
calc_ρChl!(plank, nuts.par, p, arch)
calc_BS!(plank, p, arch)
calc_iron_fluxes!(plank, nuts, p, ΔT, arch)
update_biomass!(plank, p, ΔT, arch)
update_cellsize!(plank, p, arch)

Expand Down
2 changes: 1 addition & 1 deletion src/Plankton/IronEnergyMode/plankton_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function plankton_update!(plank, nuts, rnd, p, plk, diags_spcs, ΔT, t, arch::Ar
dvidnum = dot(plank.dvid, plank.ac)
deactive_ind = findall(x -> x == 0.0f0, plank.ac)
if dvidnum > length(deactive_ind)
throw(ArgumentError("number of individual exceeds the capacity"))
throw(ArgumentError("number of individual exceeds the capacity at timestep $(t/86400.0) days"))
end
divide!(plank, nuts, deactive_ind, arch)
plank.idx .= 0
Expand Down
Loading
Loading