-
Notifications
You must be signed in to change notification settings - Fork 211
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
Topology-aware operators #3268
Topology-aware operators #3268
Conversation
How about δxUᶜᵃᵃ instead of δxᶜᵃᵃ_U so that the new operators keep the compact look of the current operators? I would also support a new notation that involves just one letter for all of them, ie something like δxTᶜᵃᵃ where |
@simone-silvestri what do you think about my notation suggestion? Personally I like keeping letters like "U" out of the operators so they are more physics agnostic |
I was thinking about it. The problem is that they do in fact encode some physical statements, like, for example, impenetrability for U (XFaceFields) and V (YFaceFields) and no flux for center-fields (C). δyᵃᶜᵃ_nopenetration
δxᶠᵃᵃ_noflux ? |
Two thoughts:
|
For the compact notation, the symbol |
How is no penetration enforced? Do we actually need that one? Presumably, for faces we need interpolation operators (but not differences) |
No penetration is enforced in this way: Oceananigans.jl/src/Operators/topology_aware_operators.jl Lines 47 to 48 in 5c7fafc
Probably these operators should not typically live in the operator module as they encore "more" than the actual topology, they assume a boundary conditions. It would probably better to call them boundary_aware_operators.jl and include them in the Field module?
|
is there another topology-aware operator of the form
? |
Thinking of revamping this, I think |
Hopefully we don't have to pass boundary conditions 🥺 Not all complexity is justified by the performance gains... |
Is this PR looking for an adopter? Happy to try to complete it since it seems like the first step towards open BCs for hydrostatic models.
Ah I'm actually not sure where the performance gains would come from, but I thought that the operators need to be aware of the boundary condition in order to correctly implement open BCs (at least based on @simone-silvestri's comments in #3628 (comment)). |
If you want to adopt this PR, that would be great. I would leave the boundary conditions outside the operator for the moment, then we can look at the influence of those in performance in another PR. To test the performance we should push PR #3596 that implements split explicit with fill halos at every substep. Using that implementation for split-explicit will make boundary conditions for barotropic variables quite trivial to implement, but probably extremely slow. However, we can use it as a benchmark |
I don't support putting boundary conditions inside operators. |
I am on the fence. In the cubed sphere aquaplanet (not even MPI but just on one GPU) the gain of performance is a factor 5 by using the efficient split explicit rather than filling the halos at each substep. We do not have to tackle this problem here or now, but we have keep in mind that fill halo is very inefficient and probably not the way to go. Maybe @ali-ramadhan finds a better way to have a gpu-compatible code that does not require adding boundary conditions in the operators. |
At least that is what @siddharthabishnu told me, I am not sure about the timings, can you confirm @siddharthabishnu? |
For example, if the boundary is fixed and not dependent on the interior variables, it might be possible just to fix the BC once before the sub stepping and just iterate without needing to use any update |
What does this have to do with putting boundary conditions in operators? |
To get this PR merged, it sounds like we just want to agree on a naming convention and move the topologically-aware operators to the I like the I also don't think operators should depend on boundary conditions. But I can write down some thoughts in a more appropriate issue. |
I notice that here we're dispatching on @inline δxᶜᵃᵃ(i, j, k, grid, f::F, args...) where F<:Function = f(i+1, j, k, grid, args...) - f(i, j, k, grid, args...) vs. @inline δxCᶠᵃᵃ(i, j, k, grid, c★::Function, args...) = δxᶠᵃᵃ(i, j, k, grid, c★, args...) |
Long ago it was argued that |
Did some refactoring and CPU and GPU hydrostatic regression tests pass locally so I think this PR is ready for review! @simone-silvestri Requesting a review from you on your own PR again lol but I won't approve unless you do. |
Just bumping my review request 🥺 |
I can't approve it, being the creator of the PR, but I approve here via text. I guess this PR does not introduce all the possible operators (for example, there are no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @simone-silvestri, approved! And yeah hopefully it'll be easy/straightforward to add any other operators we'll need in the future.
these operators encode impenetrability boundary conditions for face fields and no-flux boundary conditions for tracers on
Bounded
grids and periodic boundary conditions onPeriodic
grids, without requiring a fill_halo procedure.Previously only used for the split explicit free surface, we move them to the
Operators
module to allow more widespread use.