Skip to content

Commit

Permalink
add Bacteria in CarbonMode
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenwu0728 committed Oct 24, 2024
1 parent 5e53c53 commit 296d685
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Parameters/param_default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function phyt_params_default(N::Int64, mode::CarbonMode)
"grazFracC" => [0.7], # Fraction goes into dissolved organic pool
"mortFracC" => [0.5], # Fraction goes into dissolved organic pool
"thermal" => [1.0], # thermal damage, 1 for on, 0 for off
"is_bact" => [0.0], # is this specis bacteria or not, 1 for bacteria, 0 for phytoplankton
)

if N == 1
Expand Down
10 changes: 3 additions & 7 deletions src/Plankton/CarbonMode/growth_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ end
##### only functional when damaged biomass is greater than 0.0
##### use Bd/Bm as the allocation, more damaged biomass means more allocation to repair
@inline function gamma_alloc(Bm, Bd, p)
#γ = max(0.0, temp - p.Topt) / (p.Tmax - p.Topt) * isless(0.0, Bd)
γ = Bd / max(1.0f-30, Bm) * isless(0.0f0, Bd)
γ = min(1.0f0, γ) * isequal(1.0f0, p.thermal)
return γ
Expand All @@ -29,12 +28,9 @@ end
##### calculate photosynthesis rate (mmolC/individual/second)
@inline function calc_photosynthesis(par, temp, Chl, Bm, Bd, p)
αI = par * p.α * p.Φ
if p.thermal == 1.0f0
PCm = p.PCmax * tempFunc(temp, p)
else
PCm = p.PCmax * tempFunc_PS(temp, p)
end
PS = PCm * (1.0f0 - exp(-αI / max(1.0f-30, PCm) * Chl / max(1.0f-30, Bm))) * max(0.0f0, Bm - Bd)
PCm = p.PCmax * (tempFunc(temp, p) * p.thermal + tempFunc_PS(temp, p) * (1.0f0 - p.thermal))
light_limit = 1.0f0 - exp(-αI / max(1.0f-30, PCm) * Chl / max(1.0f-30, Bm))
PS = PCm * max(0.0f0, Bm - Bd) * (light_limit * (1.0f0 - p.is_bact) + p.is_bact)
return PS
end

Expand Down
3 changes: 2 additions & 1 deletion src/Plankton/CarbonMode/plankton_generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function construct_plankton(arch::Architecture, sp::Int, params::Dict, maxN::Int
data = replace_storage(array_type(arch), rawdata)

param_names=(:Nsuper, :Cquota, :mean, :var, , , :Topt, :Tmax, :Ea, :PCmax, :Chl2C, :respir, :f_T2B,
:grz_P, :dvid_type, :dvid_P, :dvid_reg, :dvid_reg2, :mort_P, :mort_reg, :grazFracC, :mortFracC, :thermal)
:grz_P, :dvid_type, :dvid_P, :dvid_reg, :dvid_reg2, :mort_P, :mort_reg, :grazFracC, :mortFracC,
:thermal, :is_bact)

pkeys = collect(keys(params))
tmp = zeros(length(param_names))
Expand Down

0 comments on commit 296d685

Please sign in to comment.