boutproject / xBOUT

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

error when loading xbout data #178

Closed amircogan closed 3 years ago

amircogan commented 3 years ago

Dear,

We installed latest BOUT with docker: sudo docker pull boutproject/bout-next:9f4c663-sundials-ubuntu

on host machine installed python 3.7 and xbout ran simulation of examples/conduction in docker, copied data files to host and ran xbout in host. When we run this line:

bd = open_boutdataset('./shared/BOUT.dmp.*.nc', inputfilepath='./shared/BOUT.inp')

We get this error:

Traceback (most recent call last): File "", line 1, in File "/home/nt-tao1/miniconda3/envs/xbout/lib/python3.7/site-packages/xbout/load.py", line 226, in open_boutdataset ds = _add_options(ds, inputfilepath) File "/home/nt-tao1/miniconda3/envs/xbout/lib/python3.7/site-packages/xbout/load.py", line 278, in _add_options nz=ds.metadata["nz"], KeyError: 'nz'

The BOUT.inp file is listed below. I do see a nz variable there. Please advise - what is wrong ? Many thanks and great new year , better than last one :) Amir

#

Input file for conduction case

#

nout = 100 # Number of output timesteps timestep = 0.1 # Time between outputs

MXG = 0 # No X communications

################################################## [mesh] # Geometry of the mesh

nx = 1 ny = 100 nz = 1

dy = 0.2

Puts the boundaries half a step outside the last gridpoints

symmetricGlobalY=true

These flags make the y-direction non-periodic

ixseps1 = -1 ixseps2 = -1

################################################## [conduction] # Settings for the conduction model

chi = 1.0

################################################## [T] # Settings for the T variable

scale = 1.0 # Size of the initial perturbation function = gauss(y-pi, 0.2) # The form of the initial perturbation. y from 0 to 2*pi

Set the value on the boundaries to 0 (4th order extrapolation to ghostpoint)

bndry_all = dirichlet_o4(0.0)

johnomotani commented 3 years ago

I think the problem is that the version of BOUT++ on the Docker images is rather old (from 2018), see https://github.com/boutproject/BOUT-dev/issues/2186. I suspect it only wrote mz for the number of points in the z-direction, and not nz, which xbout is trying to use.

I think mz may be removed entirely in future, for consistency, so I don't think we should add backward-compatibility support to get around this. Possible workarounds:

amircogan commented 3 years ago

Thank you so much, we will follow you suggestions and update soon. Thanks!!

bendudson commented 3 years ago

The docker images have now been updated: boutproject/bout-master:3b23201-arch is the latest BOUT-dev master branch, compiled with Sundials (2.7.0) and PETSc (3.14.2).

johnomotani commented 3 years ago

I think the original issue is fixed @amircogan. If not please reopen, or start a new issue for other problems/questions.