Skip to content

Commit

Permalink
think I've fixed particles and sediment together
Browse files Browse the repository at this point in the history
  • Loading branch information
jagoosw committed Jul 13, 2023
1 parent 32ccb3c commit 1ec431a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/Boundaries/Sediments/Sediments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ using Oceananigans.Advection: div_Uc
using Oceananigans.Units: day
using Oceananigans.Fields: CenterField, Face
using Oceananigans.Biogeochemistry: biogeochemical_drift_velocity
using Oceananigans.Grids: zspacing

import Oceananigans.Biogeochemistry: update_tendencies!
import Adapt: adapt_structure, adapt

abstract type AbstractSediment end
abstract type FlatSediment <: AbstractSediment end

sediment_fields(::AbstractSediment) = ()

@inline update_tendencies!(bgc::ContinuousFormBiogeochemistry{<:Any, <:FlatSediment, <:Any}, model) = update_tendencies!(bgc, bgc.sediment_model, model)
@inline update_tendencies!(bgc, sediment, model) = nothing
@inline update_sediment_tendencies!(bgc, sediment, model) = nothing

function update_tendencies!(bgc, sediment::FlatSediment, model)
function update_sediment_tendencies!(bgc, sediment::FlatSediment, model)
arch = model.grid.architecture

for (i, tracer) in enumerate(sediment_tracers(sediment))
Expand Down
2 changes: 1 addition & 1 deletion src/Boundaries/Sediments/simple_multi_G.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function SimpleMultiG(; grid,
depth = depth)) where {FT, P1, P2, P3, P4}

@warn "Sediment models are an experimental feature and have not yet been validated"
@info "This sediment model is only compatible with models providing NH₄, NO₃, O₂ and DIC"
@info "This sediment model is currently only compatible with models providing NH₄, NO₃, O₂ and DIC"

tracer_names = (:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref)

Expand Down
2 changes: 1 addition & 1 deletion src/Models/Individuals/SLatissima.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using Oceananigans.Grids: AbstractGrid
using Oceananigans.Fields: fractional_indices, _interpolate, datatuple

import Adapt: adapt_structure, adapt
import Oceananigans.Biogeochemistry: update_tendencies!
import OceanBioME.Particles: update_particles_tendencies!
import Oceananigans.Models.LagrangianParticleTracking: update_lagrangian_particle_properties!, _advect_particles!

@inline no_dynamics(args...) = nothing
Expand Down
10 changes: 5 additions & 5 deletions src/Models/Models.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using OceanBioME.Particles: BiogeochemicalParticles
using OceanBioME.Boundaries.Sediments: AbstractSediment
using OceanBioME.Boundaries.Sediments: update_sediment_tendencies!
using OceanBioME.Particles: update_particles_tendencies!

import Oceananigans.Biogeochemistry: update_tendencies!

include("AdvectedPopulations/LOBSTER/LOBSTER.jl")
include("AdvectedPopulations/NPZD.jl")
include("Individuals/SLatissima.jl")

@inline function update_tendencies!(bgc::ContinuousFormBiogeochemistry{<:Any, <:AbstractSediment, <:BiogeochemicalParticles}, model)
update_tendencies!(bgc, bgc.sediment_model, model)
update_tendencies!(bgc, bgc.particles, model)
@inline function update_tendencies!(bgc::ContinuousFormBiogeochemistry, model)
update_sediment_tendencies!(bgc, bgc.sediment_model, model)
update_particles_tendencies!(bgc, bgc.particles, model)
return nothing
end
4 changes: 1 addition & 3 deletions src/Particles/Particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using OceanBioME: ContinuousFormBiogeochemistry
using Oceananigans: NonhydrostaticModel, HydrostaticFreeSurfaceModel

import Oceananigans.Models.LagrangianParticleTracking: update_lagrangian_particle_properties!, step_lagrangian_particles!
import Oceananigans.Biogeochemistry: update_tendencies!
import Oceananigans.OutputWriters: fetch_output
import Base: length, size, show, summary

Expand All @@ -27,8 +26,7 @@ abstract type BiogeochemicalParticles end
update_lagrangian_particle_properties!(bgc.particles, model, bgc, Δt)

update_lagrangian_particle_properties!(::BiogeochemicalParticles, model, bgc, Δt) = nothing
update_tendencies!(bgc::ContinuousFormBiogeochemistry{<:Any, <:Any, <:BiogeochemicalParticles}, model) = update_tendencies!(bgc, bgc.particles, model)
update_tendencies!(bgc, ::BiogeochemicalParticles, model) = nothing
update_particles_tendencies!(bgc, particles, model) = nothing

size(particles::BiogeochemicalParticles) = size(particles.x)
length(particles::BiogeochemicalParticles) = length(particles.x)
Expand Down

0 comments on commit 1ec431a

Please sign in to comment.