Apply suggestions from code review

Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
This commit is contained in:
Rémi Delaporte-Mathurin 2022-11-21 09:39:01 -05:00 committed by GitHub
parent c5affa805e
commit 6d787d5fb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View file

@ -1322,7 +1322,7 @@ class CylindricalMesh(StructuredMesh):
pts_cartesian[:, 1] = r * np.sin(phi)
# offset with origin
if self.origin != [0.0, 0.0, 0.0]:
if any(self.origin != (0.0, 0.0, 0.0)):
pts_cartesian[:, 0] = pts_cartesian[:, 0] + self.origin[0]
pts_cartesian[:, 1] = pts_cartesian[:, 1] + self.origin[1]
pts_cartesian[:, 2] = pts_cartesian[:, 2] + self.origin[2]
@ -1375,7 +1375,7 @@ class SphericalMesh(StructuredMesh):
self._r_grid = None
self._theta_grid = [0, pi]
self._phi_grid = [0, 2*pi]
self._origin = [0., 0., 0.]
self._origin = (0., 0., 0.)
@property
def dimension(self):
@ -1577,7 +1577,7 @@ class SphericalMesh(StructuredMesh):
pts_cartesian[:, 2] = r * np.cos(phi)
# offset with origin
if self.origin != [0.0, 0.0, 0.0]:
if any(self.origin != (0.0, 0.0, 0.0)):
pts_cartesian[:, 0] = pts_cartesian[:, 0] + self.origin[0]
pts_cartesian[:, 1] = pts_cartesian[:, 1] + self.origin[1]
pts_cartesian[:, 2] = pts_cartesian[:, 2] + self.origin[2]

View file

@ -1213,9 +1213,7 @@ StructuredMesh::MeshIndex SphericalMesh::get_indices(
mapped_r[0] = r.norm();
mapped_r[0] += origin_[0];
mapped_r[1] += origin_[1];
mapped_r[2] += origin_[2];
mapped_r -= origin_;
if (mapped_r[0] < FP_PRECISION) {
mapped_r[1] = 0.0;

View file

@ -53,7 +53,6 @@ def test_activation(run_in_tmpdir, model, reaction_rate_mode, reaction_rate_opts
# Determine (n.gamma) reaction rate using initial run
sp = model.run()
with openmc.StatePoint(sp) as sp:
print(sp.tallies)
tally = sp.get_tally(name='activation tally')
capture_rate = tally.mean.flat[0]