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.
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
(0.91.14) Extend Lagrangian advection to immersed grids and add tests #3765
(0.91.14) Extend Lagrangian advection to immersed grids and add tests #3765
Changes from 14 commits
4b72263
2334603
25d02a6
c37be12
5e28d4b
9634e51
abff491
e858e54
97b197f
54b1dcf
8bcdef1
81ff38f
6ac566a
c786eaa
31bec4e
28171f6
1fd6833
17a5f89
9635d03
a06faf1
f590acb
65e76c0
0cfe076
2c53428
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 quite different from how it was written before.
For example it might be that:
xnode(i⁻, j, k, ibg, f, f, f) != node(i⁻, j⁻, k⁻, ibg, f, f, f)[1]
(not necessarily for a rectilinear grid but possibly for a curvilinear one)
Was there a bug in the previous implementation?
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.
Yes, there was a bug with the previous implementation and it needed re-writing. Specifically, it was failing for
Flat
dimensions iirc. I'm not familiar with how this is implemented in curvilinear coords, and I don't remember lagrangian tracking being done in them before. Can we keep the code as it currently is in the PR?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.
well, I understand why
node(i⁻+1, j⁻+1, k⁻+1, ibg, f, f, f)
would fail, butnode(i⁻, j⁻, k⁻, ibg, f, f, f)
should exist also forFlat
topologies. Can we do this:and keep the right boundaries as written in this PR?
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.
The previous code fails not because of the
+1
index in the flat dimension, but because it doesn't return anything for the flat dimension:So in these cases the statement
xᴸ, yᴸ, zᴸ = node(i⁻, j⁻, k⁻, ibg, f, f, f)
fails withThere 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.
So, if I understand your comment correctly, we can just replace
with
I think that should be equivalent. Note that
node()
is just a shorthand for(xnode, ynode, znode)
Oceananigans.jl/src/Grids/nodes_and_spacings.jl
Lines 35 to 37 in 0f52a6a
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 think it's better to use
ξnode
thannode[1]
which is a hack and not as easy to understand either.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.
To clarify, I think there are at least 2 separate issues being discussed here.
node(i⁻+1, j⁻+1, k⁻+1, ibg, f, f, f)
, which I believe should translate toξnode(i⁻+1, j⁻+1, k⁻+1, ibg, f, f, f)
and the same forη
andr
, with the same indices (that's how the PR actually is). @simone-silvestri seems to think that the correct call should be (as per a code suggestion below)or perhaps with
ξ
,η
andr
, but importantly here is that the indices are different. @simone-silvestri, could you elaborate?ξnode
(η
andr
) instead ofxnode
(andy
andz
). This is how it was in the code before this PR, but I think we actually wantxnode
andynode
since the advection is performed with velocities inlength/time
, 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.
I don't know what's correct. Seems like there is a missing test... but maybe @simone-silvestri can say. We did use this code on the sphere I thought.
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.
Ok, I am a bit confused which node should be the correct ``right'' node. I guess if there are tests now and the
i⁻+1, j⁻+1, k⁻+1, ibg, f, f, f
signature works, then the implementation is correctThere 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.
To be fair, tests works regardless of which of the two signatures we're considering here, so whatever the difference is, the tests don't pick up on it. I think I'll keep the algorithm as close to as it was before this PR as possible. This includes using the
i⁻+1, j⁻+1, k⁻+1, ibg, f, f, f
signature. As for thexnode
versusξnode
debate, I actually realized the existing code usedxnode
for the non-immersed part of the algorithm andξnode
for the immersed grid. Likely the latter was done in error, so I'll keep everything asxnode
for now. We can revisit this is the future if we find evidence that this isn't the proper way to do things.