BOUT-dev icon indicating copy to clipboard operation
BOUT-dev copied to clipboard

Prevent user set negative cell dimension

Open mikekryjak opened this issue 2 years ago • 3 comments

I'm running some 1D cases and setting the parallel cell width dy using an analytical expression in the input file. Through a typo in the expression I managed to get a region where dy was negative, and I was surprised that BOUT++ seems to have no issues with accepting this and running with it.

Does anyone know of any situation where a negative cell width would be beneficial? If not, then maybe there should be a check that raises an exception as this would help in debugging analytical grids.

mikekryjak avatar May 23 '23 10:05 mikekryjak

What check level did you run with?

dschwoerer avatar May 23 '23 10:05 dschwoerer

Not sure - I've never looked into check levels, so I guess the default value.

mikekryjak avatar May 23 '23 10:05 mikekryjak

The checks would only be needed at initialisation, so I think it would make sense to do them at any check level, like we do for metric components, etc. which use bout::checkFinite() which runs at any check level. https://github.com/boutproject/BOUT-dev/blob/3d6cb4b7da6605e2d39828f07ece36c8d3886bcd/include/bout/field.hxx#L233-L255

johnomotani avatar May 23 '23 10:05 johnomotani