diff --git a/src/particle.cpp b/src/particle.cpp index 0c6a33b78..7d30e26bd 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -557,9 +557,14 @@ void Particle::cross_surface(const Surface& surf) sqrtkT_last() = sqrtkT(); // set new cell value lowest_coord().cell = i_cell; + auto& cell = model::cells[i_cell]; + cell_instance() = 0; - material() = model::cells[i_cell]->material_[0]; - sqrtkT() = model::cells[i_cell]->sqrtkT_[0]; + if (cell->distribcell_index_ >= 0) + cell_instance() = cell_instance_at_level(*this, n_coord() - 1); + + material() = cell->material(cell_instance()); + sqrtkT() = cell->sqrtkT(cell_instance()); return; } #endif diff --git a/tests/regression_tests/dagmc/universes/inputs_true.dat b/tests/regression_tests/dagmc/universes/inputs_true.dat index babf43ff1..4b5be3612 100644 --- a/tests/regression_tests/dagmc/universes/inputs_true.dat +++ b/tests/regression_tests/dagmc/universes/inputs_true.dat @@ -47,9 +47,18 @@ eigenvalue 100 10 - 2 + 5 false - + + + 4 0 4 1 4 2 4 3 4 4 + + + 1 + scatter + + + diff --git a/tests/regression_tests/dagmc/universes/results_true.dat b/tests/regression_tests/dagmc/universes/results_true.dat index f7bd016c1..76cbc9db0 100644 --- a/tests/regression_tests/dagmc/universes/results_true.dat +++ b/tests/regression_tests/dagmc/universes/results_true.dat @@ -1,2 +1,13 @@ k-combined: -9.156561E-01 4.398617E-02 +9.887663E-01 1.510336E-02 +tally 1: +4.340758E+00 +4.265459E+00 +4.712319E+00 +4.654778E+00 +4.151897E+00 +3.588090E+00 +2.965925E+00 +1.852746E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/regression_tests/dagmc/universes/test.py b/tests/regression_tests/dagmc/universes/test.py index a318275cd..057a7b0d4 100644 --- a/tests/regression_tests/dagmc/universes/test.py +++ b/tests/regression_tests/dagmc/universes/test.py @@ -72,13 +72,20 @@ class DAGMCUniverseTest(PyAPITestHarness): self._model.geometry = openmc.Geometry([bounding_cell]) + # add a cell instance tally + tally = openmc.Tally(name='cell instance tally') + # using scattering + cell_instance_filter = openmc.CellInstanceFilter(((4, 0), (4, 1), (4, 2), (4, 3), (4, 4))) + tally.filters = [cell_instance_filter] + tally.scores = ['scatter'] + self._model.tallies = [tally] + # settings self._model.settings.particles = 100 self._model.settings.batches = 10 - self._model.settings.inactive = 2 + self._model.settings.inactive = 5 self._model.settings.output = {'summary' : False} - def test_univ(): harness = DAGMCUniverseTest('statepoint.10.h5', model=openmc.Model()) harness.main()