diff --git a/openmc/mesh.py b/openmc/mesh.py index fb59053aea..2489d5faa7 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -231,8 +231,9 @@ class Mesh(IDManagerMixin): element.set("id", str(self._id)) element.set("type", self._type) - subelement = ET.SubElement(element, "dimension") - subelement.text = ' '.join(map(str, self._dimension)) + if self._dimension is not None: + subelement = ET.SubElement(element, "dimension") + subelement.text = ' '.join(map(str, self._dimension)) subelement = ET.SubElement(element, "lower_left") subelement.text = ' '.join(map(str, self._lower_left)) @@ -264,7 +265,10 @@ class Mesh(IDManagerMixin): """ mesh_id = int(get_text(elem, 'id')) mesh = cls(mesh_id) - mesh.type = get_text(elem, 'type') + + mesh_type = get_text(elem, 'type') + if mesh_type is not None: + mesh.type = mesh_type dimension = get_text(elem, 'dimension') if dimension is not None: diff --git a/openmc/settings.py b/openmc/settings.py index 802046c4e2..0636775755 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -551,7 +551,8 @@ class Settings(object): @entropy_mesh.setter def entropy_mesh(self, entropy): cv.check_type('entropy mesh', entropy, Mesh) - cv.check_length('entropy mesh dimension', entropy.dimension, 3) + if entropy.dimension: + cv.check_length('entropy mesh dimension', entropy.dimension, 3) cv.check_length('entropy mesh lower-left corner', entropy.lower_left, 3) cv.check_length('entropy mesh upper-right corner', entropy.upper_right, 3) self._entropy_mesh = entropy