boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
21 stars 8 forks source link

Inconsistency in reading cell dimension variables #285

Closed mikekryjak closed 1 year ago

mikekryjak commented 1 year ago

Something is causing xBOUT to switch between loading geometry parameters (at least dx, dy, dz and J) in a normalised vs. in an unnormalised form when reading a Hermes-3 dataset along with the grid and the geometry set to "toroidal". I have a little check printing the volume of each model I load and I see pretty unpredictable behaviour.

These variables are stored in the grid file in SI units while also being stored in Hermes-3 in normalised units, so I am guessing that there is an inconsistency in where they get loaded from.

I've not yet been able to make the time to try and pin down exactly what is going on here because it seems to happen pretty much at random and loading in models takes time. I am putting this up as an issue to make sure I get to it.

mikekryjak commented 1 year ago

Update: I managed to reproduce the issue consistently and have two Hermes-3 simulations, one of which has normalised and one which has unnormalised geometry parameters. I have dug into where the discrepancy could be coming from and I think I disproved my earlier theory that it's an issue with where the geometry parameters are loaded from (i.e. the dump files or the grid). I reproduced the issue even when using xbout.load.collect() which does not access the mesh file. I will keep the issue open until I find a fix in case there is something relevant to xBOUT after all.

mikekryjak commented 1 year ago

Pretty sure this is a Hermes-3 problem.