fix restart file writing when grid has no y-guard cells#333
fix restart file writing when grid has no y-guard cells#333
Conversation
Use boutdata (which includes guard cells) to create new restart files even when the original grid file lacks y-guard cells.
|
Hi @Vandoo, thanks for this! I'm not sure if I understand the changes in the PR. I don't see |
|
It's a quick fix on line 327 in xbout/utils.py. When writing new restart files from a full dataset that includes y_guard cells, |
|
The question is why is |
The dataset with extra guard cells are obtained with
to open the file. However, the loaded data contains And because it is not compatible with the grid resolution, I could not use something like:
|
What do you mean when you say this is not compatible with the grid resolution? Is it something to do with greater computational cost in 3D simulations? |
kinda. To reduce the computional cost in 3D, we could start with a small-resolution case (e.g. ny=28, with only 4 cells in the outer divertor leg on the MAST-U grid provided by Ben). But it is very challenge to grid such a small mesh with y guard cells in hypnotoad, thus the gridfile does not have it. However, if you then use |
|
If this issue is being that much of a problem in xbout, an alternative approach could be to duplicate the BOUT++ extrapolation in hypnotoad as an option, so that boundary cells could be created without actually using the equilibrium in them. This would need to be implemented in a sort of 'post-processing' step after generating the grid but before writing output. It probably shouldn't be too hard to implement, as I think there is a single function that converts 2D arrays to output format, and that should be the only place that needs to be modified. |
|
@Vandoo I'm still very confused, I don't think I understand your issue. Could you explain in a different way from scratch? Is the simulation you reading into xHermes/xBOUT with or without guard cells? |
The grid file itself has no guard cells. Hermes-3 reconstructs them at runtime as you know. When loading into xBOUT, I can choose whether to keep guard cells or not, which is just post-processing. Then
|
Use boutdata (which includes guard cells) to create new restart files even when the original grid file lacks y-guard cells.