-
Notifications
You must be signed in to change notification settings - Fork 206
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
BoundsError
using WENO and stretched grids
#2717
Comments
The out-of-bounds error comes from the precomputation of stretched coefficients: The order is not preserved in Bounded directions, so halos larger than 1 are not necessary when time-stepping. This is why also with (1, 1, 1) would be fine if directions are not stretched. If the direction is stretched, the stretched coefficients are precomputed on every grid point. The error you see there comes from the coefficients near the boundary (which, indeed are not used) that require halo cells to be computed. We could remove the pre-computation of boundary coefficients in case of Bounded directions... |
As long as it doesn't make the code slower, I'm okay with that. I don't really know enough to have an informed opinion about how to fix it and will defer to whatever you guys think is best :) |
We need halos larger than 1 in |
Can't we use something like |
still an issue? |
Yes. I just tested this on |
I do not really like the idea to inflate the grid inside the advection scheme though, if you want you can issue an error message |
Agree --- the issue here is just that we would need halo (4, 4, 4)? |
yep |
Edit: this is wrong, high order halos are always required (also in Bounded directions) because we use |
Right so just to clarify we should throw an error in the WENO constructor when the halo isn't big enough. This is fine: using Oceananigans
H = 4
grid = RectilinearGrid(topology=(Bounded, Bounded, Bounded),
size = (10, 10, 10),
x = (0, 1),
y =(0, 1),
z = k -> k,
halo = (H, H, H))
advection = WENO(grid=grid, order=7) |
How do you calculate the required halo size for a given WENO order? I'll open a PR soon to fix this by just throwing an error when constructing the grid if everyone's okay with that. |
I think this has been solved already? |
I just tested yesterday on main and it hasn't. Same error. |
Doesn't the error have to come within the |
Yes sorry, I misspoke. That's what I meant. |
I get a
BoundsError
when running the following MWE using the latest version of Oceananigans:The error I get is:
Some useful notes:
z
direction the error disappears. Interestingly this code runs even withhalo=(1,1,4)
. (Is the WENO order decreasing as you approach the boundary? Should we throw a warning about this?)z
direction, as expected.z=(0,1)
) the error disappears, which seems to point to a bug.If this isn't a bug and is instead expected behavior, maybe a more useful error would be helpful here?
The text was updated successfully, but these errors were encountered: