Skip to content

Commit

Permalink
Set DAGMC cell instances on surface crossing (#3052)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise authored Jun 21, 2024
1 parent 4bd0b09 commit 00faa7d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions tests/regression_tests/dagmc/universes/inputs_true.dat
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,18 @@
<run_mode>eigenvalue</run_mode>
<particles>100</particles>
<batches>10</batches>
<inactive>2</inactive>
<inactive>5</inactive>
<output>
<summary>false</summary>
</output>
</settings>
</model>
<tallies>
<filter id="1" type="cellinstance">
<bins>4 0 4 1 4 2 4 3 4 4</bins>
</filter>
<tally id="1" name="cell instance tally">
<filters>1</filters>
<scores>scatter</scores>
</tally>
</tallies>
</model>
13 changes: 12 additions & 1 deletion tests/regression_tests/dagmc/universes/results_true.dat
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions tests/regression_tests/dagmc/universes/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,20 @@ def __init__(self, *args, **kwargs):

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()

0 comments on commit 00faa7d

Please sign in to comment.