Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Empty file.
58 changes: 58 additions & 0 deletions tests/regression_tests/dagmc/weight_windows/model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='utf-8'?>
<model>
<materials>
<material id="1" name="shell">
<density value="7.8" units="g/cc"/>
<nuclide name="W180" ao="0.0012"/>
<nuclide name="W182" ao="0.265"/>
<nuclide name="W183" ao="0.1431"/>
<nuclide name="W184" ao="0.3064"/>
<nuclide name="W186" ao="0.2843"/>
</material>
</materials>
<geometry>
<dagmc_universe id="1" filename="nested_shell_geometry.h5m"/>
</geometry>
<settings>
<run_mode>fixed source</run_mode>
<particles>500</particles>
<batches>2</batches>
<max_lost_particles>1</max_lost_particles>
<source type="independent" strength="1.0" particle="neutron">
<space type="point">
<parameters>0.0 0.0 0.0</parameters>
</space>
<angle type="isotropic"/>
<energy type="discrete">
<parameters>14100000.0 1.0</parameters>
</energy>
</source>
<output>
<tallies>false</tallies>
<summary>false</summary>
</output>
<survival_biasing>false</survival_biasing>
<weight_windows id="1">
<mesh>10003</mesh>
<particle_type>neutron</particle_type>
<energy_bounds>0.0 1.7976931348623157e+308</energy_bounds>
<lower_ww_bounds>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</lower_ww_bounds>
<upper_ww_bounds>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</upper_ww_bounds>
<survival_ratio>3.0</survival_ratio>
<max_lower_bound_ratio>1.0</max_lower_bound_ratio>
<max_split>10</max_split>
<weight_cutoff>1e-38</weight_cutoff>
</weight_windows>
<mesh id="10003" name="ww_mesh" type="rectilinear">
<x_grid>-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</x_grid>
<y_grid>-60.0 60.0</y_grid>
<z_grid>-60.0 60.0</z_grid>
</mesh>
<weight_windows_on>true</weight_windows_on>
<weight_window_checkpoints>
<collision>true</collision>
<surface>true</surface>
</weight_window_checkpoints>
<max_history_splits>10000000</max_history_splits>
</settings>
</model>
Binary file not shown.
40 changes: 40 additions & 0 deletions tests/regression_tests/dagmc/weight_windows/test.py
Original file line number Diff line number Diff line change
@@ -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()
Loading