From d938fa0176329c5abf510b44040363dd0d90e18f Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 15 Mar 2017 11:25:24 -0400 Subject: [PATCH] Fix bugs discovered during CNL workshop --- openmc/cell.py | 7 ++++--- openmc/geometry.py | 25 ++++++++++++++++--------- openmc/stats/multivariate.py | 3 ++- openmc/tally_derivative.py | 2 +- openmc/volume.py | 6 +++--- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/openmc/cell.py b/openmc/cell.py index b578702bba..9993175efd 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -289,9 +289,10 @@ class Cell(object): c3, s3 = cos(phi), sin(phi) c2, s2 = cos(theta), sin(theta) c1, s1 = cos(psi), sin(psi) - return np.array([[c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2], - [c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3], - [-s2, c2*s3, c2*c3]]) + self._rotation_matrix = np.array([ + [c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2], + [c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3], + [-s2, c2*s3, c2*c3]]) @translation.setter def translation(self, translation): diff --git a/openmc/geometry.py b/openmc/geometry.py index 02bcbe180d..598aa43125 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -361,18 +361,25 @@ class Geometry(object): if not case_sensitive: name = name.lower() - all_cells = self.get_all_cells().values() cells = set() - for cell in all_cells: - cell_fill_name = cell.fill.name - if not case_sensitive: - cell_fill_name = cell_fill_name.lower() + for cell in self.get_all_cells().values(): + names = [] + if cell.fill_type in ('material', 'universe', 'lattice'): + names.append(cell.fill.name) + elif cell.fill_type == 'distribmat': + for mat in cell.fill: + if mat is not None: + names.append(mat.name) - if cell_fill_name == name: - cells.add(cell) - elif not matching and name in cell_fill_name: - cells.add(cell) + for fill_name in names: + if not case_sensitive: + fill_name = fill_name.lower() + + if fill_name == name: + cells.add(cell) + elif not matching and name in fill_name: + cells.add(cell) cells = list(cells) cells.sort(key=lambda x: x.id) diff --git a/openmc/stats/multivariate.py b/openmc/stats/multivariate.py index ca25cf5fb3..0ab11b7c54 100644 --- a/openmc/stats/multivariate.py +++ b/openmc/stats/multivariate.py @@ -54,7 +54,8 @@ class PolarAzimuthal(UnitSphere): """Angular distribution represented by polar and azimuthal angles This distribution allows one to specify the distribution of the cosine of - the polar angle and the azimuthal angle independently of once another. + the polar angle and the azimuthal angle independently of one another. The + polar angle is measured relative to the reference angle. Parameters ---------- diff --git a/openmc/tally_derivative.py b/openmc/tally_derivative.py index 24187df84e..185e7ab6ae 100644 --- a/openmc/tally_derivative.py +++ b/openmc/tally_derivative.py @@ -29,7 +29,7 @@ class TallyDerivative(EqualityMixin): variable : str, optional Accepted values are 'density', 'nuclide_density', and 'temperature' material : int, optional - The perturubed material ID + The perturbed material ID nuclide : str, optional The perturbed nuclide. Only needed for 'nuclide_density' derivatives. Ex: 'Xe135' diff --git a/openmc/volume.py b/openmc/volume.py index c9e1a5afa6..6c4b130f96 100644 --- a/openmc/volume.py +++ b/openmc/volume.py @@ -246,9 +246,9 @@ class VolumeCalculation(object): results = type(self).from_hdf5(filename) # Make sure properties match - assert self.domains == results.domains - assert self.lower_left == results.lower_left - assert self.upper_right == results.upper_right + assert self.ids == results.ids + assert np.all(self.lower_left == results.lower_left) + assert np.all(self.upper_right == results.upper_right) # Copy results self.volumes = results.volumes