Closed jbisits closed 3 months ago
I think the math here is correct.
One issue (which I think was also relevant for https://github.com/tomchor/Oceanostics.jl/pull/164 but I didn't catch it then), is that this calculation assumes that gravity_unity_vector==NegativeZDirection()
. That's fine, I don't think we need to expand this for an arbitrary gravity_unity_vector
(although that'd probably be easy), but I think we should test for that and throw a helpful error otherwise.
Currently
PotentialEnergy
only works if theBuoyancyModel
has aBoussinesqEquationOfState
. This PR extendsPotentialEnergy
to have methods for bothBuoyancyTracer
andSeawaterBuoyancy{<:LinearEquationOfState}
. It does so by dispatching on theBuoyancyModel
.To calculate the potential energy per unit volume for
BuoyancyTracer
andSeawaterBuoyancy{<:LinearEquationOfState}
I have used$$ E_{p} = bz $$
where $b$ is buoyancy (I think this is what it should be but let me know if not!). In the case of
BuoyancyTracer
$b$ is exactly the buoyancy tracer and in the case ofSeawaterBuoyancy{<:LinearEquationOfState}
I compute the buoyancy viahttps://github.com/tomchor/Oceanostics.jl/blob/68007f19e61f13152e8a6efd9a568eb933d941b2/src/PotentialEnergyEquationTerms.jl#L22-L23
I am not sure if this is the optimal way to do things so please let me know if you know of better ways to do this!
Once the calculation of $E_{p}$ is confirmed I will add some calculation tests to check things are doing what they should similar to what is currently there for when
SeawaterBuoyancy{<:BoussinesqEquationOfState}
https://github.com/tomchor/Oceanostics.jl/blob/68007f19e61f13152e8a6efd9a568eb933d941b2/test/runtests.jl#L345-L358