Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenwu0728 committed May 6, 2024
1 parent dd6f592 commit 34ede2a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Diagnostics/diagnostics_kernels.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####
##### record diagnostics of plankton processes at each time step
#####
function diags_proc_kernel!(diags_proc, proc, ac, x, y, z)
@kernel function diags_proc_kernel!(diags_proc, proc, ac, x, y, z)
i = @index(Global)
@inbounds KernelAbstractions.@atomic diags_proc[x[i], y[i], z[i]] += proc[i] * ac[i]
end
Expand Down
4 changes: 2 additions & 2 deletions src/Plankton/CarbonMode/consume_loss.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##### deal with nutrients uptake
function calc_consume_kernel!(ctsdic, plank, ac, x, y, z, ΔT)
@kernel function calc_consume_kernel!(ctsdic, plank, ac, x, y, z, ΔT)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdic[x[i], y[i], z[i]] += (plank.RS[i] - plank.PS[i]) * ΔT * ac[i]
end
Expand All @@ -10,7 +10,7 @@ function calc_consume!(ctsdic, plank, ac, x, y, z, ΔT, arch)
end

##### deal with grazed or dead individuals
function calc_loss_kernel!(ctsdoc, ctspoc, plank, ac, x, y, z, loss, lossFracC)
@kernel function calc_loss_kernel!(ctsdoc, ctspoc, plank, ac, x, y, z, loss, lossFracC)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdoc[x[i], y[i], z[i]] += plank.Bm[i] * lossFracC * ac[i] * loss[i]
@inbounds KernelAbstractions.@atomic ctspoc[x[i], y[i], z[i]] += plank.Bm[i] * (1.0-lossFracC) * ac[i] * loss[i]
Expand Down
4 changes: 2 additions & 2 deletions src/Plankton/MacroMolecularMode/consume_loss.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##### deal with nutrients uptake
function calc_consume_kernel!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y, z, ΔT)
@kernel function calc_consume_kernel!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y, z, ΔT)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdic[x[i], y[i], z[i]] += (plank.resp[i] - plank.PS[i]) * ΔT * ac[i]
@inbounds KernelAbstractions.@atomic ctsdoc[x[i], y[i], z[i]] += (plank.exu[i] - plank.VDOC[i]) * ΔT * ac[i]
Expand All @@ -14,7 +14,7 @@ function calc_consume!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y,
end

##### deal with grazed or dead individuals
function calc_loss_kernel!(ctsdoc, ctspoc, ctsdon, ctspon, ctsdop, ctspop, plank, ac, x, y, z,
@kernel function calc_loss_kernel!(ctsdoc, ctspoc, ctsdon, ctspon, ctsdop, ctspop, plank, ac, x, y, z,
loss, lossFracC, lossFracN, lossFracP, p)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdoc[x[i], y[i], z[i]] += total_C_biomass(plank.PRO[i], plank.DNA[i], plank.RNA[i], plank.CH[i], plank.Chl[i]) * lossFracC * ac[i] * loss[i]
Expand Down
4 changes: 2 additions & 2 deletions src/Plankton/QuotaMode/consume_loss.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##### deal with nutrients uptake
function calc_consume_kernel!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y, z, ΔT)
@kernel function calc_consume_kernel!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y, z, ΔT)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdic[x[i], y[i], z[i]] += (plank.resp[i] - plank.PS[i]) * ΔT * ac[i]
@inbounds KernelAbstractions.@atomic ctsdoc[x[i], y[i], z[i]] += (plank.exu[i] - plank.VDOC[i]) * ΔT * ac[i]
Expand All @@ -14,7 +14,7 @@ function calc_consume!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, plank, ac, x, y,
end

##### deal with grazed or dead individuals
function calc_loss_kernel!(ctsdoc, ctspoc, ctsdon, ctspon, ctsdop, ctspop, plank, ac, x, y, z,
@kernel function calc_loss_kernel!(ctsdoc, ctspoc, ctsdon, ctspon, ctsdop, ctspop, plank, ac, x, y, z,
loss, lossFracC, lossFracN, lossFracP, R_NC, R_PC)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsdoc[x[i], y[i], z[i]] += (plank.Bm[i] + plank.Cq[i]) * lossFracC * ac[i] * loss[i]
Expand Down
2 changes: 1 addition & 1 deletion src/Plankton/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function find_NPT!(nuts, x, y, z, ac, NH4, NO3, PO4, DOC, par, temp, pop, arch::
end

##### calculate Chla and individual counts based on the status of plankton individuals
function acc_counts_kernel!(ctsChl, ctspop, Chl, ac, x, y, z)
@kernel function acc_counts_kernel!(ctsChl, ctspop, Chl, ac, x, y, z)
i = @index(Global)
@inbounds KernelAbstractions.@atomic ctsChl[x[i], y[i], z[i]] += Chl[i] * ac[i]
@inbounds KernelAbstractions.@atomic ctspop[x[i], y[i], z[i]] += ac[i]
Expand Down

0 comments on commit 34ede2a

Please sign in to comment.