Skip to content
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

Option to retain boundary/guard cells #19

Closed
TomNicholas opened this issue Dec 8, 2018 · 4 comments
Closed

Option to retain boundary/guard cells #19

TomNicholas opened this issue Dec 8, 2018 · 4 comments
Labels
bug Something isn't working requires BOUT changes May require changes to BOUT++ upstream to implement requires xarray changes May require changes to xarray upstream to implement

Comments

@TomNicholas
Copy link
Collaborator

TomNicholas commented Dec 8, 2018

Currently open_boutdataset() will trim off all ghost cells, even at the outside edges of the domain. There should be an option to retain the guard cells at the edge of the domain.

This is not completely trivial because currently the trimming is done by a preprocess argument to open_boutdataset(), so the same function is applied to every dataset. In order to know when to leave the guard cells untouched, the preprocess function has to know the position of the dataset it is currently operating on within the grid. Right now this isn't possible, but there are two ways it could be done:

  1. Use the filename of the dataset to determine it's position, which would require a change upstream in xarray as discussed here .

  2. Get BOUT to write out the global position indexes to the dump files, which can then be used to work out the dataset's position in the grid.

Another option is to not use the preprocess function at all, and instead concatenate all the untrimmed data then cut out the unwanted chunks from the result. I don't think this is the best solution however because then you aren't doing the trimming in parallel, it's not as clean conceptually, and it could break a lot of the tests.

I think the best solution would be to use global indexes once BOUT actually writes them out.

@TomNicholas TomNicholas added bug Something isn't working requires BOUT changes May require changes to BOUT++ upstream to implement requires xarray changes May require changes to xarray upstream to implement labels Dec 8, 2018
@d7919
Copy link
Member

d7919 commented Dec 8, 2018

The outer guard cells are often really boundary cells and it's true that often you want to see these. Currently collect provides options to read the outer guard cells in any direction, it would be nice to maintain this functionality.

Option 2 relates to #3

@TomNicholas
Copy link
Collaborator Author

I just found this issue on the xarray repo describing how storing cell boundaries is an intended future addition to their data model. This would allow us to store the guard cells in this purpose-built way, so I'm writing this comment to point out that the guard cell handling should probably be changed once xarray does handle cell boundaries.

@TomNicholas
Copy link
Collaborator Author

@johnomotani will your work in #107 close this?

@johnomotani
Copy link
Collaborator

I think this was mostly fixed in #30 and #40. We could probably close this as done, and just note #113 as a bug in the current implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires BOUT changes May require changes to BOUT++ upstream to implement requires xarray changes May require changes to xarray upstream to implement
Projects
None yet
Development

No branches or pull requests

3 participants