Oceananigans.jl icon indicating copy to clipboard operation
Oceananigans.jl copied to clipboard

(0.91.0) Make hydrostatic pressure anomaly optional in `NonhydrostaticModel`

Open glwagner opened this issue 1 year ago • 6 comments

This PR makes the separation computation of the hydrostatic pressure anomaly an optional feature of NonhydrostaticModel. It's also off by default, which hopefully means that triply periodic simulations should work by default (@johnryantaylor a while ago you wanted to do a triply periodic simulation, hopefully this PR makes that possible).

@tomchor ready to review, let me know what you think about the design.

This PR supercedes #3080, where there is an extended description of this change plus a discussion about its pros and cons.

Closes #3364 (I think...)

glwagner avatar May 01 '24 14:05 glwagner

This is looking pretty good! My only comment is that it's not intuitive for a given user to figure out how to opt for a hydrostatic pressure separation. A flag called separate_hydrostatic_pressure that takes true/false would be much more intuitive, although we'd need a little more code. Should we prioritize user-friendliness here?

tomchor avatar May 01 '24 15:05 tomchor

This is looking pretty good! My only comment is that it's not intuitive for a given user to figure out how to opt for a hydrostatic pressure separation. A flag called separate_hydrostatic_pressure that takes true/false would be much more intuitive, although we'd need a little more code. Should we prioritize user-friendliness here?

This is more flexible, because sometimes users want to have access to the pressure field prior to model construction. If we use a flag, then we either can't support that or have to put some annoying logic in the constructor. Since I feel it'll be rare that people want to change this kwarg, I think the trade-offs work out that its better to have a simpler constructor even if those rare users that want to separate hydrostatic pressure have to build CenterField.

glwagner avatar May 01 '24 15:05 glwagner

This is looking pretty good! My only comment is that it's not intuitive for a given user to figure out how to opt for a hydrostatic pressure separation. A flag called separate_hydrostatic_pressure that takes true/false would be much more intuitive, although we'd need a little more code. Should we prioritize user-friendliness here?

This is more flexible, because sometimes users want to have access to the pressure field prior to model construction. If we use a flag, then we either can't support that or have to put some annoying logic in the constructor. Since I feel it'll be rare that people want to change this kwarg, I think the trade-offs work out that its better to have a simpler constructor even if those rare users that want to separate hydrostatic pressure have to build CenterField.

Got it! Agreed. Should we test that hydrostatic_pressure_anomaly is either CenterField(grid) or nothing and throw a helpful error otherwise?

tomchor avatar May 01 '24 16:05 tomchor

CC @zhazorken

tomchor avatar May 01 '24 16:05 tomchor

This is looking pretty good! My only comment is that it's not intuitive for a given user to figure out how to opt for a hydrostatic pressure separation. A flag called separate_hydrostatic_pressure that takes true/false would be much more intuitive, although we'd need a little more code. Should we prioritize user-friendliness here?

This is more flexible, because sometimes users want to have access to the pressure field prior to model construction. If we use a flag, then we either can't support that or have to put some annoying logic in the constructor. Since I feel it'll be rare that people want to change this kwarg, I think the trade-offs work out that its better to have a simpler constructor even if those rare users that want to separate hydrostatic pressure have to build CenterField.

Got it! Agreed. Should we test that hydrostatic_pressure_anomaly is either CenterField(grid) or nothing and throw a helpful error otherwise?

Sure.

glwagner avatar May 01 '24 16:05 glwagner

@glwagner the distributed tests are broken :(

navidcy avatar May 05 '24 06:05 navidcy

@glwagner the distributed tests are broken :(

easy to fix

glwagner avatar May 05 '24 18:05 glwagner

nice job!!

navidcy avatar May 06 '24 07:05 navidcy