diff --git a/src/particle.cpp b/src/particle.cpp index 402af2498a5..bf7d79d7db5 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -121,6 +121,9 @@ void Particle::from_source(const SourceSite* src) fission() = false; zero_flux_derivs(); lifetime() = 0.0; +#ifdef OPENMC_DAGMC_ENABLED + history().reset(); +#endif // Copy attributes from source bank site type() = src->particle; diff --git a/tests/regression_tests/dagmc/weight_windows/__init__.py b/tests/regression_tests/dagmc/weight_windows/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/regression_tests/dagmc/weight_windows/model.xml b/tests/regression_tests/dagmc/weight_windows/model.xml new file mode 100644 index 00000000000..2986a89a492 --- /dev/null +++ b/tests/regression_tests/dagmc/weight_windows/model.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + fixed source + 500 + 2 + 1 + + + 0.0 0.0 0.0 + + + + 14100000.0 1.0 + + + + false + false + + false + + 10003 + neutron + 0.0 1.7976931348623157e+308 + 0.030750733294361156 0.056110505674355333 0.08187875047968339 0.1101743496347699 0.13982370013053508 0.17443799246829372 0.21576286623367483 0.26416659508033646 0.318574932646899 0.3804031702117963 0.42899359749256355 0.4954283294279403 0.49999999999999994 0.43432341070872266 0.38302303850488206 0.32148375935490886 0.2637416945702018 0.21498369367288853 0.17163611765361744 0.13832102142074995 0.10717772257151495 0.07986176041282561 0.05499644859408233 0.03058023506703803 + 0.15375366647180577 0.2805525283717767 0.40939375239841697 0.5508717481738494 0.6991185006526754 0.8721899623414686 1.0788143311683742 1.3208329754016823 1.592874663234495 1.9020158510589815 2.1449679874628176 2.4771416471397014 2.4999999999999996 2.1716170535436135 1.9151151925244103 1.6074187967745444 1.318708472851009 1.0749184683644426 0.8581805882680872 0.6916051071037498 0.5358886128575747 0.39930880206412805 0.27498224297041163 0.15290117533519015 + 3.0 + 1.0 + 10 + 1e-38 + + + -60.0 -55.0 -50.0 -45.0 -40.0 -35.0 -30.0 -25.0 -20.0 -15.0 -10.0 -5.0 0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 + -60.0 60.0 + -60.0 60.0 + + true + + true + true + + 10000000 + + diff --git a/tests/regression_tests/dagmc/weight_windows/nested_shell_geometry.h5m b/tests/regression_tests/dagmc/weight_windows/nested_shell_geometry.h5m new file mode 100644 index 00000000000..ff6d67b4c77 Binary files /dev/null and b/tests/regression_tests/dagmc/weight_windows/nested_shell_geometry.h5m differ diff --git a/tests/regression_tests/dagmc/weight_windows/test.py b/tests/regression_tests/dagmc/weight_windows/test.py new file mode 100644 index 00000000000..7f2fe00b7ef --- /dev/null +++ b/tests/regression_tests/dagmc/weight_windows/test.py @@ -0,0 +1,40 @@ +from tests.testing_harness import TestHarness + +import openmc + +import pytest + +pytestmark = pytest.mark.skipif( + not openmc.lib._dagmc_enabled(), + reason="DAGMC CAD geometry is not enabled.") + + +class DagmcWeightWindowsTestHarness(TestHarness): + + def __init__(self): + super().__init__('') + + def execute_test(self): + # this test merely needs to run OpenMC without error + try: + self._run_openmc() + finally: + self._cleanup() + + +def test_dagmc_weight_windows_near_boundary(): + """A regression test that ensures particle splitting near a boundary does + not result in lost particles due to a stale DAGMC history on the particle + object""" + + # This DAGMC model consists of three nested cubes. The innermost cube + # contains a fusion neutron source. The two outer cubes are filled with + # tungsten. The entire model has weight windows defined on a mesh such that + # particles will be split as they move outward from the source. The + # outermost cubes are very similary in size, the outer cube is just slightly + # larger than the inner cube. This means that particles moving outward will + # frequently cross the boundary between the two cubes right after being + # split. This test ensures that no particles are lost due to a stale DAGMC + # history after splitting. + harness = DagmcWeightWindowsTestHarness() + harness.main()