Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnose tracer budgets #158

Open
zhihua-zheng opened this issue Nov 15, 2023 · 1 comment
Open

Diagnose tracer budgets #158

zhihua-zheng opened this issue Nov 15, 2023 · 1 comment

Comments

@zhihua-zheng
Copy link
Collaborator

zhihua-zheng commented Nov 15, 2023

Here are some example codes that calculate buoyancy budget terms in Oceananigans. Starting from here, we can implement tracer budget diagnostics in the future.

using Oceananigans.TurbulenceClosures: ∇_dot_qᶜ
using Oceananigans.Models.NonhydrostaticModels: tracer_tendency
using Oceananigans.Utils: SumOfArrays

grid = model.grid
advection = model.advection
u, v, w = velocities = model.velocities
b = model.tracers.b
total_velocities = (u = SumOfArrays{2}(u, model.background_fields.velocities.u),
                    v = SumOfArrays{2}(v, model.background_fields.velocities.v),
                    w = SumOfArrays{2}(w, model.background_fields.velocities.w))
ADVb = -KernelFunctionOperation{Center, Center, Center}(div_Uc, grid, advection, total_velocities, b)
ADVB = -KernelFunctionOperation{Center, Center, Center}(div_Uc, grid, advection, velocities, model.background_fields.tracers.b)
DIFb = -KernelFunctionOperation{Center, Center, Center}(∇_dot_qᶜ, grid, model.closure, model.diffusivity_fields, Val(1), b,
                                                        model.clock, fields(model), model.buoyancy)
∂ₜb = KernelFunctionOperation{Center, Center, Center}(tracer_tendency, grid, Val(1), Val(:b), advection, model.closure,
                                                      b.boundary_conditions.immersed, model.buoyancy, model.biogeochemistry,
                                                      model.background_fields, velocities, model.tracers, model.auxiliary_fields,
                                                      model.diffusivity_fields, model.forcing.b, model.clock)
@tomchor
Copy link
Owner

tomchor commented Nov 15, 2023

Thanks, @zhihua-zheng, that's great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants