diff --git a/src/Diagnostics/diagnostics_kernels.jl b/src/Diagnostics/diagnostics_kernels.jl index 75cf9cc1..e539f2dc 100644 --- a/src/Diagnostics/diagnostics_kernels.jl +++ b/src/Diagnostics/diagnostics_kernels.jl @@ -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 diff --git a/src/Plankton/CarbonMode/consume_loss.jl b/src/Plankton/CarbonMode/consume_loss.jl index c5962f2f..8cbd3ae2 100644 --- a/src/Plankton/CarbonMode/consume_loss.jl +++ b/src/Plankton/CarbonMode/consume_loss.jl @@ -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 @@ -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] diff --git a/src/Plankton/MacroMolecularMode/consume_loss.jl b/src/Plankton/MacroMolecularMode/consume_loss.jl index 9f589fdc..28d5b4bb 100644 --- a/src/Plankton/MacroMolecularMode/consume_loss.jl +++ b/src/Plankton/MacroMolecularMode/consume_loss.jl @@ -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] @@ -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] diff --git a/src/Plankton/QuotaMode/consume_loss.jl b/src/Plankton/QuotaMode/consume_loss.jl index 6d33bc33..15251d40 100644 --- a/src/Plankton/QuotaMode/consume_loss.jl +++ b/src/Plankton/QuotaMode/consume_loss.jl @@ -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] @@ -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] diff --git a/src/Plankton/utils.jl b/src/Plankton/utils.jl index d43de649..1822c2d2 100644 --- a/src/Plankton/utils.jl +++ b/src/Plankton/utils.jl @@ -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]