diff --git a/openmc/model/model.py b/openmc/model/model.py index 965fc79bd3..733503fb39 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -2701,8 +2701,8 @@ class Model: (fission treated as capture). If the resolved settings include a ``weight_windows_file`` (e.g., ``"weight_windows.h5"``), the ``"material_wise"`` method loads and applies those weight - windows during the continuous energy generation simulation - (``weight_windows_on`` is enabled automatically). Applying + windows during the continuous energy generation simulation. + Applying weight windows allows the simulation to obtain tallies -- and thus nonzero cross sections -- for materials located far from the source, for example behind a thick shield, which an analog @@ -2792,24 +2792,23 @@ class Model: settings.run_mode = 'fixed source' # A weight windows file on the generation settings is loaded and - # applied during the "material_wise" method's continuous energy - # simulation of the original geometry, allowing materials far from - # the source -- which an analog simulation may struggle to reach -- - # to still be tallied, and thus obtain nonzero cross sections. The + # applied (specifying a file turns weight windows on) during the + # "material_wise" method's continuous energy simulation of the + # original geometry, allowing materials far from the source -- + # which an analog simulation may struggle to reach -- to still be + # tallied, and thus obtain nonzero cross sections. The # "stochastic_slab" and "infinite_medium" methods use simplified # surrogate geometries for which weight windows defined over the # original geometry are neither applicable nor needed. - if settings.weight_windows_file is not None: - if method == "material_wise": - settings.weight_windows_on = True - else: - warnings.warn( - 'The weight windows file set on the generation settings ' - 'is only applicable to the "material_wise" MGXS ' - f'generation method and will be ignored for the ' - f'"{method}" method.' - ) - settings.weight_windows_file = None + if settings.weight_windows_file is not None and \ + method != "material_wise": + warnings.warn( + 'The weight windows file set on the generation settings ' + 'is only applicable to the "material_wise" MGXS ' + f'generation method and will be ignored for the ' + f'"{method}" method.' + ) + settings.weight_windows_file = None # Do all work (including MGXS generation) in a temporary directory # to avoid polluting the working directory with residual XML files diff --git a/tests/regression_tests/random_ray_auto_convert_bootstrap/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert_bootstrap/inputs_true.dat index 87043f116d..825e8dbdb9 100644 --- a/tests/regression_tests/random_ray_auto_convert_bootstrap/inputs_true.dat +++ b/tests/regression_tests/random_ray_auto_convert_bootstrap/inputs_true.dat @@ -61,7 +61,6 @@ 1 - true weight_windows.h5 true diff --git a/tests/regression_tests/random_ray_auto_convert_bootstrap/test.py b/tests/regression_tests/random_ray_auto_convert_bootstrap/test.py index 89b734def3..12636c2942 100644 --- a/tests/regression_tests/random_ray_auto_convert_bootstrap/test.py +++ b/tests/regression_tests/random_ray_auto_convert_bootstrap/test.py @@ -91,7 +91,6 @@ def test_random_ray_auto_convert_bootstrap(): # Run the continuous energy model with the improved weight windows, # tallying the flux in every region model.settings.weight_windows_file = 'weight_windows.h5' - model.settings.weight_windows_on = True model.settings.particles = 20 model.settings.batches = 10 tally = openmc.Tally(name='flux') diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index 53a5b25251..47a5214cc3 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -1169,13 +1169,12 @@ def test_convert_to_multigroup_settings_weight_windows(run_in_tmpdir, monkeypatc gen = _capture_generation_settings( monkeypatch, model, method='material_wise', settings=user) - # A weight windows file on the generation settings is applied to the - # "material_wise" generation run with weight windows turned on + # A weight windows file on the generation settings is passed through to + # the "material_wise" generation run (specifying a file turns weight + # windows on at run time) assert gen.weight_windows_file == ww_path - assert gen.weight_windows_on is True # The caller's object is never mutated assert user.weight_windows_file == ww_path - assert user.weight_windows_on is None # The surrogate-geometry methods ignore the file with a warning with pytest.warns(UserWarning, match='material_wise'):