Merge pull request #1007 from smharper/distrib_order

Swap RectLattice distribcell ordering
This commit is contained in:
Paul Romano 2018-05-19 15:38:10 -05:00 committed by GitHub
commit e3f0bff0f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 35 deletions

View file

@ -43,8 +43,8 @@ class ResultsList(list):
Total number of atoms for specified nuclide
"""
time = np.empty_like(self)
concentration = np.empty_like(self)
time = np.empty_like(self, dtype=float)
concentration = np.empty_like(self, dtype=float)
# Evaluate value in each region
for i, result in enumerate(self):
@ -73,8 +73,8 @@ class ResultsList(list):
Array of reaction rates
"""
time = np.empty_like(self)
rate = np.empty_like(self)
time = np.empty_like(self, dtype=float)
rate = np.empty_like(self, dtype=float)
# Evaluate value in each region
for i, result in enumerate(self):
@ -94,8 +94,8 @@ class ResultsList(list):
k-eigenvalue at each time
"""
time = np.empty_like(self)
eigenvalue = np.empty_like(self)
time = np.empty_like(self, dtype=float)
eigenvalue = np.empty_like(self, dtype=float)
# Get time/eigenvalue at each point
for i, result in enumerate(self):

View file

@ -546,10 +546,15 @@ class RectLattice(Lattice):
"""
if self.ndim == 2:
nx, ny = self.shape
return np.broadcast(*np.ogrid[:nx, :ny])
for iy in range(ny):
for ix in range(nx):
yield (ix, iy)
else:
nx, ny, nz = self.shape
return np.broadcast(*np.ogrid[:nx, :ny, :nz])
for iz in range(nz):
for iy in range(ny):
for ix in range(nx):
yield (ix, iy, iz)
@property
def lower_left(self):

View file

@ -882,9 +882,9 @@ contains
type is (RectLattice)
! Loop over lattice coordinates
do j = 1, lat % n_cells(1)
do m = 1, lat % n_cells(3)
do k = 1, lat % n_cells(2)
do m = 1, lat % n_cells(3)
do j = 1, lat % n_cells(1)
lat % offset(map, j, k, m) = offset
next_univ => universes(lat % universes(j, k, m))
offset = offset + &
@ -999,9 +999,9 @@ contains
type is (RectLattice)
! Loop over lattice coordinates
do j = 1, lat % n_cells(1)
do m = 1, lat % n_cells(3)
do k = 1, lat % n_cells(2)
do m = 1, lat % n_cells(3)
do j = 1, lat % n_cells(1)
next_univ => universes(lat % universes(j, k, m))
! Found target - stop since target cannot contain itself
@ -1091,9 +1091,9 @@ contains
type is (RectLattice)
! Loop over lattice coordinates
do j = 1, lat % n_cells(1)
do m = 1, lat % n_cells(3)
do k = 1, lat % n_cells(2)
do m = 1, lat % n_cells(3)
do j = 1, lat % n_cells(1)
call count_instance(universes(lat % universes(j, k, m)))
end do
end do
@ -1166,9 +1166,9 @@ contains
type is (RectLattice)
! Loop over lattice coordinates
do j = 1, lat % n_cells(1)
do m = 1, lat % n_cells(3)
do k = 1, lat % n_cells(2)
do m = 1, lat % n_cells(3)
do j = 1, lat % n_cells(1)
next_univ => universes(lat % universes(j, k, m))
levels_below = max(levels_below, maximum_levels(next_univ))
end do

View file

@ -278,9 +278,9 @@ contains
old_k = 1
! Loop over lattice coordinates
do k = 1, n_x
do m = 1, n_z
do l = 1, n_y
do m = 1, n_z
do k = 1, n_x
if (target_offset >= lat % offset(map, k, l, m) + offset) then
if (k == n_x .and. l == n_y .and. m == n_z) then

View file

@ -1 +1 @@
3b76b468b9c0e7df6508189b75748a1b7b4f2b37486396749e1a15e536526336f70b60bb207095c39ecbd46822e8c8705ea81184a3c8546e7da09bb905d74637
bd3fd10177bc0c7b8542f15228decf8608de013872d201e6ae885cf9b5b6d7516ddb32044ee2f7fd5b207e7d37d5ce3f03e347a2e850953bba4fc26b150c89d2

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="1" material="1" universe="1" />
<cell id="11" material="2 3 void 2" region="-9" universe="11" />
<cell id="11" material="2 void 3 2" region="-9" universe="11" />
<cell id="12" material="1" region="9" universe="11" />
<cell fill="101" id="101" region="10 -11 12 -13" universe="0" />
<lattice id="101">

View file

@ -3,7 +3,7 @@ k-combined:
Cell
ID = 11
Name =
Fill = [2, 3, None, 2]
Fill = [2, None, 3, 2]
Region = -9
Rotation = None
Translation = None

View file

@ -34,7 +34,7 @@ class DistribmatTestHarness(PyAPITestHarness):
r0 = openmc.ZCylinder(R=0.3)
c11 = openmc.Cell(cell_id=11, region=-r0)
c11.fill = [dense_fuel, light_fuel, None, dense_fuel]
c11.fill = [dense_fuel, None, light_fuel, dense_fuel]
c12 = openmc.Cell(cell_id=12, region=+r0, fill=moderator)
fuel_univ = openmc.Universe(universe_id=11, cells=[c11, c12])

View file

@ -3,10 +3,10 @@ k-combined:
tally 1:
1.548980E-02
2.399339E-04
1.278781E-02
1.635280E-04
1.426319E-02
2.034385E-04
1.278781E-02
1.635280E-04
1.018927E-02
1.038213E-04
tally 2:

View file

@ -1 +1 @@
386147796cf64c908002a81bc47af6763a14811ba6c457ca790653ceb8ef1c6b0376b94783f9746baf7389f18321b788c72758ec56ffd05fa3146139e6e53308
a1f6ccf0bef1075ffc12e7fa058a44c83360801ba6e2c76f00e1bd7e9543fe1832777b122321dcb1cfb5fc1165ce84f711a65ca83903dd57cd09652e003daf62

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="1" material="1" universe="1" />
<cell id="11" material="2" region="-1" temperature="500 0 700 800" universe="11" />
<cell id="11" material="2" region="-1" temperature="500 700 0 800" universe="11" />
<cell id="12" material="1" region="1" universe="11" />
<cell fill="101" id="101" region="2 -3 4 -5" universe="0" />
<lattice id="101">

View file

@ -37,5 +37,5 @@ Cell
Fill = Material 2
Region = -1
Rotation = None
Temperature = [ 500. 0. 700. 800.]
Temperature = [ 500. 700. 0. 800.]
Translation = None

View file

@ -29,7 +29,7 @@ def make_model():
r0 = openmc.ZCylinder(R=0.3)
c11 = openmc.Cell(cell_id=11, fill=dense_fuel, region=-r0)
c11.temperature = [500, 0, 700, 800]
c11.temperature = [500, 700, 0, 800]
c12 = openmc.Cell(cell_id=12, fill=moderator, region=+r0)
fuel_univ = openmc.Universe(universe_id=11, cells=(c11, c12))

View file

@ -1 +1 @@
eb2002dd2f3016154e7014501629227eb2e5b2a9655b5c0cb3b9d4d681f918fae4197bf4756fe9865c8d34f392b981b287a15e9b2fab5a46b2a5b8a33a8ae770
8294c7481b3433a4beb25541ae72c1ea915def0c0d0f393f7585371877187f4a2a25e70bb602232e2bc1e877e78db0e9384591e5c71575659f95abb10fae0af3

View file

@ -22,6 +22,7 @@ def test_full(run_in_tmpdir):
This test runs a complete OpenMC simulation and tests the outputs.
It will take a while.
"""
n_rings = 2

View file

@ -22,8 +22,8 @@ def test_get_atoms(res):
n_ref = [6.6747328233649218e+08, 3.5421791038348462e+14,
3.6208592242443462e+14, 3.3799758969347038e+14]
np.testing.assert_array_equal(t, t_ref)
np.testing.assert_array_equal(n, n_ref)
np.testing.assert_allclose(t, t_ref)
np.testing.assert_allclose(n, n_ref)
def test_get_reaction_rate(res):
"""Tests evaluating reaction rate."""
@ -35,8 +35,8 @@ def test_get_reaction_rate(res):
xs_ref = np.array([4.0594392323131994e-05, 3.9249546927524987e-05,
3.8394587728581798e-05, 4.1521845978371697e-05])
np.testing.assert_array_equal(t, t_ref)
np.testing.assert_array_equal(r, n_ref * xs_ref)
np.testing.assert_allclose(t, t_ref)
np.testing.assert_allclose(r, n_ref * xs_ref)
def test_get_eigenvalue(res):
@ -47,5 +47,5 @@ def test_get_eigenvalue(res):
k_ref = [1.181281798790367, 1.1798750921988739, 1.1965943696058159,
1.2207119847790813]
np.testing.assert_array_equal(t, t_ref)
np.testing.assert_array_equal(k, k_ref)
np.testing.assert_allclose(t, t_ref)
np.testing.assert_allclose(k, k_ref)