-
Notifications
You must be signed in to change notification settings - Fork 238
(0.94.0) Overhaul spacings functions to return KernelFunctionOperation
s
#3143
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
ecf8ea4
fix spacings methods for immersed boundary grids
tomchor 3d3caa1
Update src/ImmersedBoundaries/immersed_grid_metrics.jl
tomchor 6e85d30
Update src/ImmersedBoundaries/immersed_grid_metrics.jl
tomchor fcc1474
add tests for spacing(s) on IBG
navidcy b95582d
don't redefine x/y/zspacing methods
navidcy 8ea2b02
Merge branch 'main' into tc/immersed-metrics
tomchor 0961a8d
Merge branch 'main' into tc/immersed-metrics
tomchor 435858e
Merge branch 'main' into tc/immersed-metrics
tomchor e2b7dd5
Merge branch 'main' into tc/immersed-metrics
tomchor 06e8f70
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 0e8d685
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 2a3e87e
Correct merge `main`
ali-ramadhan 438e70e
Disambiguate `yspacings`
ali-ramadhan 1d816fc
Cleanup?
ali-ramadhan 0410e6f
Add `*spacing` functions that rely on `KernelFunctionOperation`s
ali-ramadhan db35026
Declutter `ImmersedBoundaries` module
ali-ramadhan 0ff460b
Changes needed to fix tests
ali-ramadhan 9f545f8
Fix tests
ali-ramadhan bcf3562
Bump v0.94.0
ali-ramadhan 51dc034
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 6fc107a
spacings functions now return a `KernelFunctionOperation`
ali-ramadhan 304c68a
Merge branch 'tc/immersed-metrics' of github.com:CliMA/Oceananigans.j…
ali-ramadhan 7ce022e
Address some review comments and fix OSSG tests
ali-ramadhan 4dd10b6
Address more review comments, update and fix tests
ali-ramadhan 680d535
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 00fb688
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan bf2ed33
Fix more tests
ali-ramadhan 1131ef4
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan b9dd039
Fix bug in Makie ext
glwagner 3e057cc
Update src/Grids/rectilinear_grid.jl
ali-ramadhan a271519
Update src/Grids/latitude_longitude_grid.jl
ali-ramadhan bbab356
Update src/Grids/orthogonal_spherical_shell_grid.jl
ali-ramadhan 8dd6c87
Update src/Grids/orthogonal_spherical_shell_grid.jl
ali-ramadhan b66cc3c
Update src/Grids/orthogonal_spherical_shell_grid.jl
ali-ramadhan 9f0c854
Use correct locations for OSSG spacings functions
ali-ramadhan ea7757b
Simpler `scatterlines` plotting for vertical grid spacing
ali-ramadhan d7374f9
Forgot to use `first`
ali-ramadhan 5bcc9fc
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 7e8b553
Define spacing functions for `::Nothing` using superscript `ᵃ`
ali-ramadhan 7fef957
Define methods only once
ali-ramadhan c1a5ade
Update some tests
ali-ramadhan 5074ce0
Need to define more spacing functions for `RectilinearGrid`
ali-ramadhan c748494
Also define `:ᵃ` derivative operators
ali-ramadhan 000473f
Need to export some derivatives
ali-ramadhan bbe6967
Also use `:ᵃ` for immersed grid metrics.
ali-ramadhan 3a29990
Update vertical grid plotting in ocean wind mixing example
ali-ramadhan 735a16f
Trying to define the complete set without duplicates
ali-ramadhan e00c419
Revert "Trying to define the complete set without duplicates"
ali-ramadhan 35f047a
Revert "Also use `:ᵃ` for immersed grid metrics."
ali-ramadhan 90a6b36
Revert "Need to export some derivatives"
ali-ramadhan 6800fd7
Revert "Also define `:ᵃ` derivative operators"
ali-ramadhan 2e5e3d6
Let's try this again
ali-ramadhan 2b38f5f
Merge branch 'main' into tc/immersed-metrics
ali-ramadhan 37b4975
Reorganize and define some specialized spacings
ali-ramadhan 0a0222d
Some more spacings
ali-ramadhan cd3369a
Fix doctests
ali-ramadhan 0e37314
Fix docs
ali-ramadhan 85483e5
Fix plotting examples in docs
ali-ramadhan 3bdef8b
Merge branch 'main' into tc/immersed-metrics
tomchor ddfd789
Merge branch 'main' into tc/immersed-metrics
tomchor 7c8f9a4
Merge branch 'main' into tc/immersed-metrics
glwagner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is wrong in general, are we sure we want this?
Except for the "GridFitted" immersed boundary methods, immersed boundaries in general may change the metrics of the underlying grid. I think we want this user-facing method to return the correct spacings, ie when using
PartialCellBottom
, and the in-developmentCutCellBottom
.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.
We can proceed by dispatching this method only when valid, ie for
GridFittedBoundary
andGridFittedBottom
. We'll need a different implementation forPartialCellBottom
.I think the right approach is to use
KernelFunctionOperation
forxspacing
. Then everyspacings
method can simply collect the output ofxspacing
. This is generically valid and would presumably reduce the amount of code we have to write by a bit.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.
oh good point!
so, for
PartialCellBottom
only thezspacings
is not correct, right? the horizontal spacings don't change.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.
Correct
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.
But it's possible to write code that works for all grids by referencing the kernel functions directly (rather than trying to extract the spacings from the grid properties). That's how we get spacings inside the code, so if we use the same method in the user interface then all is good.
Uh oh!
There was an error while loading. Please reload this page.
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.
Agree that
KernelFunctionOperation
s would reduce the amount of code. It would also return anAbstractOperation
instead of the current options (which are either a float or an array), which I think has extra computational costs, no? Also I think we'd lose a bit of the simplicity on the user side.For example the following line of code (taken from this doc example would become way less readable since
zspacings()
would now return anAbstractOperation
, which would need to be first converted into a 3DField
, computed, and transformed into a 1D Array before plotting:Finally, following the same logic, would
xnodes
etc. also becomeKernelFunctionOperation
s?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.
Just to clarify, I'm happy to make the changes once we agree on the way forward. I just wanna make sure we're all on the same page and also get an idea of the size of the PR.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hmm right I was a little confused.
zspacing
is actually the kernel function itself (not an operation or array).For
zspacings
we do either have to (1) represent it with an operation or (2) compute the metrics. There's no way around this in general: with partial cells, we compute the metrics on the fly (this computation seems to have no cost on the GPU). For cut cells, computing the metrics on the fly is required in fact, because precomputing all the metrics (3D arrays) would greatly increase our memory footprint, and also probably incur a big cost since we are memory-bound.We could implement optimized
zspacings
for non-immersed grids orGridFittedBottom
. But is there a point? I don't think the costs would be noticeable compared to, for example, the computational cost of displaying a plot.It also seems simpler to compute
zspacings
fromzspacing
, since more generic code might be implemented in that case. Note that for partial cells though,zspacings
has to return a 3D array. For many other grids its just a 1D array.I think it's a good idea to think carefully about the implementation before doing anything hasty.
Uh oh!
There was an error while loading. Please reload this page.
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.
We have 1D fields. Also operations like "tranforming a field into an array" are not expensive. For example, we might do something like this O(100) times in a single time step.
I suggest we put performance to the side right now and think first about a clean, simple implementation. We can optimize performance later if needed; these functions neede primarily for plotting aren't performance critical anyways
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm not suggesting to change the user API. I'm suggesting to change the source code.