Skip to content

Buoyancy as sum of tracers #2970

Discussion options

You must be logged in to vote

Hi Raphael, an "easy" way to do this is to define your own BuoyancyModel following the BuoyancyTracer struct.
To do that you have to import and extend the functions that are found in src/BuoyancyModels/buoyancy_tracer.jl.
For example, if you want your buoyancy to be the sum of 3 tracers

using Oceananigans.Buoyancy: AbstractBuoyancyModel
import Oceananigans.Buoyancy: required_tracers, buoyancy_perturbation,  ∂x_b,  ∂y_b,  ∂z_b, top_buoyancy_flux, bottom_buoyancy_flux

struct MyBuoyancyTracer <: AbstractBuoyancyModel{Nothing} end

required_tracers(::MyBuoyancyTracer) = (:b1, :b2, :b3)

@inline buoyancy_perturbation(i, j, k, grid, ::MyBuoyancyTracer, C) = @inbounds C.b1[i, j, k] + C.b2[i, j,…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@glwagner
Comment options

@raphaelouillon
Comment options

@mkrapp
Comment options

@simone-silvestri
Comment options

@glwagner
Comment options

Answer selected by raphaelouillon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants