Oceananigans.jl: An example with stable mixed layer depth?

Created on 15 May 2020  ·  21Comments  ·  Source: CliMA/Oceananigans.jl

It would be good to have an example with stable mixed layer depth for biogeochemical people who would like to see a steady state of simulations. @ali-ramadhan @glwagner

abstractions 🎨 feature 🌟 science 🌊

Most helpful comment

Ah sorry about that!

@gaelforget I haven't tried setting up anything like this but would it work to have the cooling at the surface balanced by heating below a certain depth? That way you can get buoyancy-driven and wind-driven turbulence in the boundary layer plus stable stratification throughout.

@zhenwu0728 Were you able to set up a simulation with a stable mixed layer depth?

EDIT: Ah lol @glwagner replied first.

All 21 comments

A sinusoidal time-varying heating/cooling cycle Ali mentioned is a great representation for dile cycle.

Thats a neat idea!

Tell me if I interpret what you're saying correctly: you think it'd be nice to have an example which is stratified at the bottom of the domain, forced at the surface, and also forced in the interior near the surface. You would like the surface forcing at the surface to generate mixing (through convection or mechanical stress), while the forcing in the interior restores the stratification. This creates the possibility that the boundary layer depth can stabilize at some middle depth in the domain. Is this correct? We would probably also need a sponge layer at the bottom.

The sinusoidal variation in time of the surface boundary condition or interior forcing does not seem like a necessary ingredient to produce a statistically steady boundary layer depth, but perhaps you are saying that would be a nice additional feature of the example?

It would also be nice to add a simple biogeochemical model to this set up. @zhenwu0728, can you recommend a system of reactive tracers that would be nice to include, along with their boundary conditions?

That's right. My primary goal is just to have a stable mixed layer. But it would be even greater to implement diel cycle.

I have an individual-based plankton model that uses Oceananigans.jl to provide velocities. But I can also setup a simple biogeochemical model just in Oceananigans.jl like the example in documentation.

To me it seems that the easiest way of maintaining a stable mixed layer (sinusoidal heat flux at the surface) should also produce a diel vertical migration cycle too.

Adding a few reactive tracers would make for a super cool example!

Agreed. I can help with the biogeochemical part.

using Random, Printf
using Oceananigans, Oceananigans.Utils

Nx = 25       # Number of grid points in x and y
Nz = 50       # Number of grid points in z
Δz = 4.0      # Grid spacing in x, y, z (meters)
Qᵀ = 1e-5     # Temperature flux at surface
∂T∂z = 0.005  # Initial vertical temperature gradient
f = 1e-4      # Coriolis parameter
α = 2e-4      # Thermal expansion coefficient
β = 8e-4      # Haline contraction coefficient

grid = RegularCartesianGrid(size=(Nx, Nx, Nz), extent=(Δz*Nx, Δz*Nx, Δz*Nz))
T_bcs = TracerBoundaryConditions(grid, top = BoundaryCondition(Flux, Qᵀ), bottom = BoundaryCondition(Gradient, ∂T∂z))

model = IncompressibleModel(
                 architecture = CPU(),
                         grid = grid,
                     coriolis = FPlane(f=f),
                     buoyancy = SeawaterBuoyancy(equation_of_state=LinearEquationOfState(α=α, β=β)),
                      closure = AnisotropicMinimumDissipation(),
          boundary_conditions = (T=T_bcs,)
)

## Random noise damped at top and bottom
Ξ(z) = randn() * z / model.grid.Lz * (1 + z / model.grid.Lz) # noise

## Temperature initial condition: a stable density tradient with random noise superposed.
T₀(x, y, z) = 20 + ∂T∂z * z + ∂T∂z * model.grid.Lz * 1e-6 * Ξ(z)

set!(model, T=T₀)

That's the setup I'm using now. Should we start from this one?

This looks like a good start!

I think we should use multiples of 2 and 3 for the resolution in x and z (24, 48, 64, etc). This has some minor advantages for FFT performance, but more importantly is something of a convention that I think is nice to stick to.

We may want to write a simple abstraction for specifying systems of reactions. I will think about that.

What would be a good biochemical system to consider that involves a handful of reactive tracers?

@ali-ramadhan just to be clear, the diel vertical migration cycle is something that's computed offline? In other words, we are not modeling the vertical motion of individual plankton in this model.

We can, however, model other tracers directly in Oceananigans, such as nutrient concentrations, CO2, and carbonates that contribute to dissolved inorganic carbon.

Currently, I'm just using Oceananigans.jl as the provider of velocities. Nutrients and plankton individuals are all computed in PlanktonIndividuals.jl.

But I'm happy to set up a simplified biogeochemical module just in Oceananigans.jl. I'd like to start with one kind of phytoplankton and one kind of nutrient( e.g. Nitrogen) cycle first.

But I'm happy to set up a simplified biogeochemical module just in Oceananigans.jl.

Rather than setting up a module, all we need to do is write a script that implements a system of chemical reactions. This is relatively easy to do without modifying Oceananigans.jl source code.

However, to do this, we need to know the equations that govern the reactions, along with with the reaction rate parameters.

Rather than setting up a module, all we need to do is write a script that implements a system of chemical reactions. This is relatively easy to do without modifying Oceananigans.jl source code.

Yes, that's exactly what I want to do. I don't want to modify the source code of Oceananigans.jl

However, to do this, we need to know the equations that govern the reactions, along with the reaction rate parameters.

I'll start this part right now. And then we can discuss how to implement these equations.

Awesome!

forcing at the surface to generate mixing (through convection or mechanical stress), while the forcing in the interior restores the stratification.

Hi there

Talked briefly about this with @zhenwu0728 earlier and was suggesting something along those lines for the physics too. I could imagine additional applications for configs like these and am willing to help with e.g. exploring the parameter space a bit if needed.

Maybe the simplest, yet rather tunable, approach I could think of would be something like:

  • at the top: warming (e.g. via relaxation to SST0) + wind stress to mechanically generate turbulence
  • below a certain depth z1: cooling (e.g. via relaxation to T1

I feel that this simple approach should lead to a statistically steady stratification within an appropriate ranges of [SST0 T1 z1] and piston velocities.

With this basic config in place, which maybe is not far from your examples/ocean_wind_mixing_and_convection.jl, my guess is that adding a diel or seasonal mixed layer deepening is straightforward -- e.g. via a time variation in SST0.

Does that make sense? Am I missing something obvious?

@zhenwu0728 @gaelforget Closing this issue since it's kind of old but please feel free to reopen.

No worries. I was hoping to get some sort of response to what I thought were my potentially good suggestions / contributions but my guess is that you guys must have had other priorities than mixed layer related topics. Thanks for the heads up anyway

@gaelforget actually the opposite! We got bogged down with implementing the chemistry and never finished this example.

Your suggestions are great. I'm not sure why I didn't respond; I don't remember seeing them. One comment is that, in addition to cooling / restoration of stratification at the bottom of the domain throughout the simulation, I think it would be nice to have cooling at the surface (eg modeling outgoing long wave radiation at night) that produces convection and turbulence.

It isn't too hard to implement this example now, though it will get a bit easier once #897 is resolved.

Ah sorry about that!

@gaelforget I haven't tried setting up anything like this but would it work to have the cooling at the surface balanced by heating below a certain depth? That way you can get buoyancy-driven and wind-driven turbulence in the boundary layer plus stable stratification throughout.

@zhenwu0728 Were you able to set up a simulation with a stable mixed layer depth?

EDIT: Ah lol @glwagner replied first.

Thanks for the responses @ali-ramadhan and @glwagner

I guess when I interact with massively funded groups like CLIMA maybe I expect too much in the way of user support. But like I said, no worries

As a side note, in case you are interested in consolidating an air-sea flux package with the broader community there is https://github.com/JuliaOcean/AirSeaFluxes.jl which contains some of the basics and was mentioned to a CLIMA collaborator at JuliaCon this year (that was fun!)

ps. congrats on your joss paper being now accepted

@zhenwu0728 Were you able to set up a simulation with a stable mixed layer depth?

Yes! @glwagner help me with it.

We got bogged down with implementing the chemistry and never finished this example.

Sorry I got stuck on another project... but will return to this soon when I have time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ali-ramadhan picture ali-ramadhan  ·  8Comments

ali-ramadhan picture ali-ramadhan  ·  7Comments

francispoulin picture francispoulin  ·  6Comments

glwagner picture glwagner  ·  4Comments

freemin7 picture freemin7  ·  5Comments