Skip to content

Commit

Permalink
update repair allocation in thermal damage
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenwu0728 committed Apr 25, 2024
1 parent 5f2c4da commit c4f58a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Plankton/CarbonMode/growth_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ end

##### allocation of functional biomass to repair
##### only functional when damaged biomass is greater than 0.0
@inline function gamma_alloc(temp, Bd, p)
γ = max(0.0, temp - p.Topt) / (p.Tmax - p.Topt) * isless(0.0, Bd)
##### use Bd/Bm as the allocation, more damaged biomass means more allocation to repair
@inline function gamma_alloc(Bm, Bd)
#γ = max(0.0, temp - p.Topt) / (p.Tmax - p.Topt) * isless(0.0, Bd)
γ = Bd / max(1.0e-30, Bm) * isless(0.0, Bd)
γ = min(1.0, γ)
return γ
end
Expand Down Expand Up @@ -48,7 +50,7 @@ end
##### calculate repair rate (mmolC/individual/second)
@kernel function calc_repair_kernel!(plank, T, p)
i = @index(Global)
@inbounds plank.RP[i] = plank.PS[i] * gamma_alloc(T[i], plank.Bd[i], p)
@inbounds plank.RP[i] = plank.PS[i] * gamma_alloc(plank.Bm[i], plank.Bd[i])
end
function calc_repair!(plank, T, p, arch)
kernel! = calc_repair_kernel!(device(arch), 256, (size(plank.ac,1)))
Expand All @@ -59,7 +61,7 @@ end
##### calculate biosynthesis rate (mmolC/individual/second)
@kernel function calc_BS_kernel!(plank, T, p)
i = @index(Global)
@inbounds plank.BS[i] = plank.PS[i] * (1.0 - gamma_alloc(T[i], plank.Bd[i], p))
@inbounds plank.BS[i] = plank.PS[i] * (1.0 - gamma_alloc(plank.Bm[i], plank.Bd[i]))
end
function calc_BS!(plank, T, p, arch)
kernel! = calc_BS_kernel!(device(arch), 256, (size(plank.ac,1)))
Expand Down

0 comments on commit c4f58a1

Please sign in to comment.