diff --git a/openmc/mesh.py b/openmc/mesh.py index 3c3c0a1ac5d..4129913d85c 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -268,10 +268,11 @@ def __repr__(self): return string def _volume_dim_check(self): - if self.n_dimension != 3 or \ - any([d == 0 for d in self.dimension]): - raise RuntimeError(f'Mesh {self.id} is not 3D. ' - 'Volumes cannot be provided.') + if any(d == 0 for d in self.dimension): + raise RuntimeError( + f'Mesh {self.id} has a zero-size dimension. ' + 'Volumes cannot be provided.' + ) @classmethod def from_hdf5(cls, group: h5py.Group):