-
Notifications
You must be signed in to change notification settings - Fork 589
Reset DAGMC history when reviving from source. #3601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
paulromano
merged 8 commits into
openmc-dev:develop
from
pshriwise:reset-dagmc-history-from-source
Nov 12, 2025
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5c38b15
Reset DAGMC history when reviving from source.
pshriwise 676a073
Move history reset up
paulromano c951e1a
Adding simple test for ensuring particle splitting near a boundary do…
pshriwise 52bc499
Adding init file for pytest
pshriwise 2031255
Skip test if DAGMC is not enabled
pshriwise bcc27f5
Updating DAGMC model to avoid a point in volume issue with it. The cu…
pshriwise 825ba0c
Convert regression test to unit test
pshriwise f69c1d9
Test style/formatting fixes
pshriwise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 added
BIN
+57.3 KB
tests/regression_tests/dagmc/weight_windows/nested_shell_geometry.h5m
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.