Skip to content

Commit 0e5a3b3

Browse files
committed
BOUT++ prefers mesh:file
if both grid and mesh:file is set, BOUT++ preferes the second. Thus xbout should also check both (and in the same order as BOUT++) to ensure we do not load the wrong mesh.
1 parent 31b9108 commit 0e5a3b3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

xbout/load.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,16 @@ def attrs_remove_section(obj, section):
338338
print("Applying {} geometry conventions".format(geometry))
339339

340340
if _is_dir(gridfilepath):
341-
if "grid" in ds.options:
342-
gridfilepath += "/" + ds.options["grid"]
343-
else:
344-
warn(
345-
"gridfilepath set to a directory, but no grid used in simulation. Continuing without grid."
346-
)
341+
try:
342+
gridfilepath += "/" + ds.options["mesh"]["file"]
343+
except KeyError:
344+
if "grid" in ds.options:
345+
gridfilepath += "/" + ds.options["grid"]
346+
else:
347+
warn(
348+
"gridfilepath set to a directory, but no grid used in simulation. Continuing without grid."
349+
)
350+
gridfilepath = None
347351
if gridfilepath is not None:
348352
grid_kw = grid_kw or dict()
349353
grid = _open_grid(

0 commit comments

Comments
 (0)