-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add SeawaterDensity
to Oceananigans.Models
#3329
Conversation
What to do with `LinearEquationOfState` which does not have a reference density?
Need to run the tests and look at some of my examples with a clean julia session before opening the PR
Still needs to be a `BoussinesqEquationOfState`.
I will fix these tests later today (Sydney time..)! |
Still not sure if `GPU()` tests will be fixed but I think array type should be correct. I ran `doctest` locally on the `Oceananigans.Models` module and there was no error
I do love tests but I think it might make sense to simplify / reduce the lines added for testing compared to what's in the PR now. Typically we find that maintaining tests is a significant fraction of developer time so it's best to make them as minimal and simple as possible. Awesome PR, thank you! |
Co-authored-by: Gregory L. Wagner <gregory.leclaire.wagner@gmail.com>
@glwagner I have simplified the test script (good idea as it was clunky for me to sieve through and I wrote it..) and the new tests pass on both This PR is already likely enough but one thing that could be done is to move # TODO: move to Models
buoyancy(model) = buoyancy(model.buoyancy, model.grid, model.tracers)
buoyancy(b, grid, tracers) = KernelFunctionOperation{Center, Center, Center}(buoyancy_perturbationᶜᶜᶜ, grid, b.model, tracers)
BuoyancyField(model) = Field(buoyancy(model)) to sewater_buoyancy_perturbation(model) = sewater_buoyancy_perturbation(model.buoyancy, model.grid, model.tracers)
sewater_buoyancy_perturbation(b, grid, tracers) = KernelFunctionOperation{Center, Center, Center}(buoyancy_perturbationᶜᶜᶜ, grid, b.model, tracers)
SewaterBuoyancyPerturbation(model) = sewater_buoyancy_perturbation(model) to match the behaviour of |
See #3316.
This PR adds
SeawaterDensity
which returns aKernelFunctionOperation
to compute either the in-situ seawater density or a potential density a some reference geopotential height. To calculate the seawater densitySeawaterPolynomials.ρ
is used. This means that at this stage you can only compute the seawater density if the equation of state is aBoussinesqEquationOfState
because a reference density is required. I was not sure how/if to do this for otherSeawaterBuoyancy
models so have not tried to implement yet.I made
density_model.jl
a new script so that all the new code could be easily viewed and moved to another location if necessary.