Skip to content

Commit 973362e

Browse files
committed
bug fix
1 parent 9d9d64d commit 973362e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Plankton/QuotaMode/growth_kernels.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ end
1919
end
2020

2121
##### calculate nutrient uptake rate (mmolN/individual/second)
22-
@inline function calc_NP_uptake(NH4, temp, Cq, Nq, Pq, Bm, p)
22+
@inline function calc_NP_uptake(NH4, NO3, PO4, temp, Cq, Nq, Pq, Bm, p, ac)
2323
# regQ = max(0.0, min(1.0, (p.Nqmax - (Nq + Bm * p.R_NC) / max(1.0e-30, Bm + Cq)) / (p.Nqmax - p.Nqmin)))
2424
Qn = (Nq + Bm * p.R_NC)/max(1.0e-30, Bm + Cq)
2525
Qp = (Pq + Bm * p.R_PC)/max(1.0e-30, Bm + Cq)
2626
regQN = max(0.0, min(1.0, (1.0 - Qn / p.Nqmax) * (1.0/(0.01 + 1.0 - Qn / p.Nqmax))))
2727
regQP = max(0.0, min(1.0, (1.0 - Qp / p.Pqmax) * (1.0/(0.01 + 1.0 - Qp / p.Pqmax))))
28-
VNH4 = p.VNH4max * regQN * NH4/max(1.0e-30, NH4+p.KsatNH4) * tempFunc(temp, p) * Bm
29-
VNO3 = p.VNO3max * regQN * NO3/max(1.0e-30, NO3+p.KsatNO3) * tempFunc(temp, p) * Bm
30-
VPO4 = p.VPO4max * regQP * PO4/max(1.0e-30, PO4+p.KsatPO4) * tempFunc(temp, p) * Bm
28+
VNH4 = p.VNH4max * regQN * NH4/max(1.0e-30, NH4+p.KsatNH4) * tempFunc(temp, p) * Bm * ac
29+
VNO3 = p.VNO3max * regQN * NO3/max(1.0e-30, NO3+p.KsatNO3) * tempFunc(temp, p) * Bm * ac
30+
VPO4 = p.VPO4max * regQP * PO4/max(1.0e-30, PO4+p.KsatPO4) * tempFunc(temp, p) * Bm * ac
3131
return VNH4, VNO3, VPO4
3232
end
3333

@@ -44,8 +44,9 @@ end
4444
@inbounds plank.PS[i] = calc_PS(nuts.par[i], nuts.T[i], plank.Chl[i], plank.Bm[i], p) * plank.ac[i]
4545

4646
@inbounds plank.VNH4[i], plank.VNO3[i], plank.VPO4[i] =
47-
calc_NP_uptake(nuts.NH4[i], nuts.T[i], plank.Cq[i], plank.Nq[i], plank.Pq[i],
48-
plank.Bm[i], p) * plank.ac[i]
47+
calc_NP_uptake(nuts.NH4[i], nuts.NO3[i], nuts.PO4[i], nuts.T[i],
48+
plank.Cq[i], plank.Nq[i], plank.Pq[i],
49+
plank.Bm[i], p, plank.ac[i])
4950
end
5051
function calc_inorganic_uptake!(plank, nuts, p, arch::Architecture)
5152
kernel! = calc_inorganic_uptake_kernel!(device(arch), 256, (size(plank.ac,1)))

0 commit comments

Comments
 (0)