Merge pull request #877 from wbinventor/hotfix-openmoc-plane-side

Fix for OpenMOC compatibility for generic planar surfaces
This commit is contained in:
Paul Romano 2017-05-16 17:14:00 -05:00 committed by GitHub
commit 8edca24459
3 changed files with 11 additions and 8 deletions

View file

@ -56,11 +56,11 @@ class Lattice(object):
return False
elif self.name != other.name:
return False
elif self.pitch != other.pitch:
elif np.any(self.pitch != other.pitch):
return False
elif self.outer != other.outer:
return False
elif self.universes != other.universes:
elif np.any(self.universes != other.universes):
return False
else:
return True
@ -533,7 +533,7 @@ class RectLattice(Lattice):
return False
elif self.shape != other.shape:
return False
elif self.lower_left != other.lower_left:
elif np.any(self.lower_left != other.lower_left):
return False
else:
return True

View file

@ -172,7 +172,9 @@ def get_openmoc_surface(openmc_surface):
B = openmc_surface.b
C = openmc_surface.c
D = openmc_surface.d
openmoc_surface = openmoc.Plane(A, B, C, D, surface_id, name)
# OpenMOC uses the opposite sign on D
openmoc_surface = openmoc.Plane(A, B, C, -D, surface_id, name)
elif openmc_surface.type == 'x-plane':
x0 = openmc_surface.x0
@ -253,7 +255,9 @@ def get_openmc_surface(openmoc_surface):
B = openmoc_surface.getB()
C = openmoc_surface.getC()
D = openmoc_surface.getD()
openmc_surface = openmc.Plane(surface_id, boundary, A, B, C, D, name)
# OpenMOC uses the opposite sign on D
openmc_surface = openmc.Plane(surface_id, boundary, A, B, C, -D, name)
elif openmoc_surface.getSurfaceType() == openmoc.XPLANE:
openmoc_surface = openmoc.castSurfaceToXPlane(openmoc_surface)
@ -708,8 +712,7 @@ def get_openmc_lattice(openmoc_lattice):
universe_array[x][y][z] = \
unique_universes[universe_id]
universe_array = np.swapaxes(universe_array, 0, 1)
universe_array = universe_array[::-1, :, :]
universe_array = np.swapaxes(universe_array, 0, 2)
# Convert axially infinite 3D OpenMOC lattice to a 2D OpenMC lattice
if width[2] == np.finfo(np.float64).max:

View file

@ -76,7 +76,7 @@ class Universe(object):
return False
elif self.name != other.name:
return False
elif self.cells != other.cells:
elif dict.__ne__(self.cells, other.cells):
return False
else:
return True