bendudson / hermes-3

Multifluid drift reduced fluid model
GNU General Public License v3.0
36 stars 16 forks source link

Loadmetric incompatible with nonorthogonal grids, error verbosity unhelpful #249

Open mikekryjak opened 2 weeks ago

mikekryjak commented 2 weeks ago

If loadmetric.cxx is used to recalculate the metric coefficients, it will calculate g22 from hthe: https://github.com/bendudson/hermes-3/blob/784d62166755b12c97732193d753ff7e5ccdd9b3/src/loadmetric.cxx#L48

But if you create a nonorthogonal grid with Hypnotoad, hthe will not be saved and will be zero when read into Hermes-3: https://github.com/boutproject/hypnotoad/blob/d8e6be6086b9c27aa1e1011713e10d829e5dc6d2/hypnotoad/core/mesh.py#L3745-L3747

This means that if you load in a nonorthogonal grid, Hermes-3 will crash with the message:

====== Exception thrown ====== g22 is not finite at (0, 2)

I have to admit I don't know what we use loadmetric.cxx for. Is it when we don't have metric coefficients already, for example if someone defines the grid in the input file instead of reading it from Hypnotoad? If this is true, then I guess I shouldn't be using it.. and maybe it shouldn't be the default, or there should be some verbosity to prevent this issue happening in the future.

mikekryjak commented 2 weeks ago

Just mentioned this to @bendudson. Loadmetric is on by default because historically Hypnotoad didn't write metric coefficients to file.