Skip to content

Commit

Permalink
renamed lobster variable redfield
Browse files Browse the repository at this point in the history
  • Loading branch information
jagoosw committed Sep 19, 2023
1 parent ba39a35 commit 5abb421
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ include("carbonate_chemistry.jl")
include("oxygen_chemistry.jl")
include("variable_redfield.jl")

const lobster_variable_redfield = Union{LOBSTER{<:Any, <:Val{(false, false, true)}, <:Any},
const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)}, <:Any},
LOBSTER{<:Any, <:Val{(true, false, true)}, <:Any},
LOBSTER{<:Any, <:Val{(false, true, true)}, <:Any},
LOBSTER{<:Any, <:Val{(true, true, true)}, <:Any}}
Expand All @@ -463,33 +463,33 @@ const lobster_variable_redfield = Union{LOBSTER{<:Any, <:Val{(false, false, true
@inline redfield(::Union{Val{:sPOM}, Val{:bPOM}, Val{:DOM}}, bgc::LOBSTER) = bgc.organic_redfield
@inline redfield(::Union{Val{:sPOC}, Val{:bPOC}, Val{:DOC}, Val{:DIC}}, bgc::LOBSTER) = 1

@inline redfield(i, j, k, ::Val{:sPON}, bgc::lobster_variable_redfield, tracers) = @inbounds tracers.sPOC[i, j, k] / tracers.sPON[i, j, k]
@inline redfield(i, j, k, ::Val{:bPON}, bgc::lobster_variable_redfield, tracers) = @inbounds tracers.bPOC[i, j, k] / tracers.bPON[i, j, k]
@inline redfield(i, j, k, ::Val{:DON}, bgc::lobster_variable_redfield, tracers) = @inbounds tracers.DOC[i, j, k] / tracers.DON[i, j, k]
@inline redfield(i, j, k, ::Val{:sPON}, bgc::VariableRedfieldLobster, tracers) = @inbounds tracers.sPOC[i, j, k] / tracers.sPON[i, j, k]
@inline redfield(i, j, k, ::Val{:bPON}, bgc::VariableRedfieldLobster, tracers) = @inbounds tracers.bPOC[i, j, k] / tracers.bPON[i, j, k]
@inline redfield(i, j, k, ::Val{:DON}, bgc::VariableRedfieldLobster, tracers) = @inbounds tracers.DOC[i, j, k] / tracers.DON[i, j, k]

@inline redfield(::Val{:sPON}, bgc::lobster_variable_redfield, tracers) = tracers.sPOC / tracers.sPON
@inline redfield(::Val{:bPON}, bgc::lobster_variable_redfield, tracers) = tracers.bPOC / tracers.bPON
@inline redfield(::Val{:DON}, bgc::lobster_variable_redfield, tracers) = tracers.DOC / tracers.DON
@inline redfield(::Val{:sPON}, bgc::VariableRedfieldLobster, tracers) = tracers.sPOC / tracers.sPON
@inline redfield(::Val{:bPON}, bgc::VariableRedfieldLobster, tracers) = tracers.bPOC / tracers.bPON
@inline redfield(::Val{:DON}, bgc::VariableRedfieldLobster, tracers) = tracers.DOC / tracers.DON

@inline nitrogen_flux(i, j, k, grid, advection, bgc::LOBSTER, tracers) =
sinking_flux(i, j, k, grid, advection, Val(:sPOM), bgc, tracers) +
sinking_flux(i, j, k, grid, advection, Val(:bPOM), bgc, tracers)

@inline carbon_flux(i, j, k, grid, advection, bgc::LOBSTER, tracers) = nitrogen_flux(i, j, k, grid, advection, bgc, tracers) * redfield(Val(:sPOM), bgc)

@inline nitrogen_flux(i, j, k, grid, advection, bgc::lobster_variable_redfield, tracers) =
@inline nitrogen_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) =
sinking_flux(i, j, k, grid, advection, Val(:sPON), bgc, tracers) +
sinking_flux(i, j, k, grid, advection, Val(:bPON), bgc, tracers)

@inline carbon_flux(i, j, k, grid, advection, bgc::lobster_variable_redfield, tracers) =
@inline carbon_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) =
sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) +
sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)

@inline remineralisation_receiver(::LOBSTER) = :NH₄

@inline conserved_tracers(::LOBSTER) = (:NO₃, :NH₄, :P, :Z, :sPOM, :bPOM, :DOM)
@inline conserved_tracers(::lobster_variable_redfield) = (:NO₃, :NH₄, :P, :Z, :sPON, :bPON, :DON)
@inline conserved_tracers(::VariableRedfieldLobster) = (:NO₃, :NH₄, :P, :Z, :sPON, :bPON, :DON)

@inline sinking_tracers(::LOBSTER) = (:sPOM, :bPOM)
@inline sinking_tracers(::lobster_variable_redfield) = (:sPON, :bPON, :sPOC, :bPOC)
@inline sinking_tracers(::VariableRedfieldLobster) = (:sPON, :bPON, :sPOC, :bPOC)
end # module
6 changes: 3 additions & 3 deletions test/test_sediments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using Oceananigans.Fields: TracerFields

using Oceananigans.Operators: volume, Azᶠᶜᶜ

using OceanBioME.LOBSTERModel: lobster_variable_redfield
using OceanBioME.LOBSTERModel: VariableRedfieldLobster

function intercept_tendencies!(model, intercepted_tendencies)
for tracer in keys(model.tracers)
Expand All @@ -34,7 +34,7 @@ set_defaults!(::LOBSTER, model) =
sPOM = 0.2299, bPOM = 0.0103)


set_defaults!(::lobster_variable_redfield, model) =
set_defaults!(::VariableRedfieldLobster, model) =
set!(model, P = 0.4686, Z = 0.5363,
NO₃ = 2.3103, NH₄ = 0.0010,
DIC = 2106.9, Alk = 2408.9,
Expand All @@ -59,7 +59,7 @@ total_nitrogen(::LOBSTER, model) = sum(Array(interior(model.tracers.NO₃))) +
sum(Array(interior(model.tracers.DOM))) +
sum(Array(interior(model.tracers.sPOM))) +
sum(Array(interior(model.tracers.bPOM)))
total_nitrogen(::lobster_variable_redfield, model) = sum(Array(interior(model.tracers.NO₃))) +
total_nitrogen(::VariableRedfieldLobster, model) = sum(Array(interior(model.tracers.NO₃))) +
sum(Array(interior(model.tracers.NH₄))) +
sum(Array(interior(model.tracers.P))) +
sum(Array(interior(model.tracers.Z))) +
Expand Down

0 comments on commit 5abb421

Please sign in to comment.