diff --git a/docs/source/io_formats/settings.rst b/docs/source/io_formats/settings.rst index 9a339fb471d..01723f11210 100644 --- a/docs/source/io_formats/settings.rst +++ b/docs/source/io_formats/settings.rst @@ -285,10 +285,10 @@ then, OpenMC will only use up to the :math:`P_1` data. :ref:`energy_mode`. ------------------------ -```` Element +```` Element ------------------------ -The ```` element indicates the number of times a particle can split during a history. +The ```` element indicates the number of times a particle can split during a history. *Default*: 1000 diff --git a/include/openmc/settings.h b/include/openmc/settings.h index 5e60009bcd7..27cb0c04ada 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -120,7 +120,8 @@ extern std::unordered_set statepoint_batch; //!< Batches when state should be written extern std::unordered_set source_write_surf_id; //!< Surface ids where sources will be written -extern int max_splits; //!< maximum number of particle splits for weight windows +extern int + max_history_splits; //!< maximum number of particle splits for weight windows extern int64_t max_surface_particles; //!< maximum number of particles to be //!< banked on surfaces per process extern TemperatureMethod diff --git a/openmc/settings.py b/openmc/settings.py index 828d5aef44f..a5abf2f3439 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -115,7 +115,7 @@ class Settings: .. versionadded:: 0.14.1 max_order : None or int Maximum scattering order to apply globally when in multi-group mode. - max_splits : int + max_history_splits : int Maximum number of times a particle can split during a history .. versionadded:: 0.13 @@ -345,7 +345,7 @@ def __init__(self, **kwargs): self._weight_windows_on = None self._weight_windows_file = None self._weight_window_checkpoints = {} - self._max_splits = None + self._max_history_splits = None self._max_tracks = None for key, value in kwargs.items(): @@ -992,14 +992,18 @@ def weight_window_checkpoints(self, weight_window_checkpoints: dict): self._weight_window_checkpoints = weight_window_checkpoints @property - def max_splits(self) -> int: - return self._max_splits + def max_splits(self): + raise AttributeError('max_splits has been deprecated. Please use max_history_splits instead') - @max_splits.setter - def max_splits(self, value: int): + @property + def max_history_splits(self) -> int: + return self._max_history_splits + + @max_history_splits.setter + def max_history_splits(self, value: int): cv.check_type('maximum particle splits', value, Integral) cv.check_greater_than('max particle splits', value, 0) - self._max_splits = value + self._max_history_splits = value @property def max_tracks(self) -> int: @@ -1432,10 +1436,10 @@ def _create_weight_window_checkpoints_subelement(self, root): subelement = ET.SubElement(element, "surface") subelement.text = str(self._weight_window_checkpoints['surface']).lower() - def _create_max_splits_subelement(self, root): - if self._max_splits is not None: - elem = ET.SubElement(root, "max_splits") - elem.text = str(self._max_splits) + def _create_max_history_splits_subelement(self, root): + if self._max_history_splits is not None: + elem = ET.SubElement(root, "max_history_splits") + elem.text = str(self._max_history_splits) def _create_max_tracks_subelement(self, root): if self._max_tracks is not None: @@ -1783,10 +1787,10 @@ def _weight_window_checkpoints_from_xml_element(self, root): value = value in ('true', '1') self.weight_window_checkpoints[key] = value - def _max_splits_from_xml_element(self, root): - text = get_text(root, 'max_splits') + def _max_history_splits_from_xml_element(self, root): + text = get_text(root, 'max_history_splits') if text is not None: - self.max_splits = int(text) + self.max_history_splits = int(text) def _max_tracks_from_xml_element(self, root): text = get_text(root, 'max_tracks') @@ -1853,7 +1857,7 @@ def to_xml_element(self, mesh_memo=None): self._create_weight_window_generators_subelement(element, mesh_memo) self._create_weight_windows_file_element(element) self._create_weight_window_checkpoints_subelement(element) - self._create_max_splits_subelement(element) + self._create_max_history_splits_subelement(element) self._create_max_tracks_subelement(element) # Clean the indentation in the file to be user-readable @@ -1956,7 +1960,7 @@ def from_xml_element(cls, elem, meshes=None): settings._weight_windows_from_xml_element(elem, meshes) settings._weight_window_generators_from_xml_element(elem, meshes) settings._weight_window_checkpoints_from_xml_element(elem) - settings._max_splits_from_xml_element(elem) + settings._max_history_splits_from_xml_element(elem) settings._max_tracks_from_xml_element(elem) # TODO: Get volume calculations diff --git a/src/finalize.cpp b/src/finalize.cpp index 26efc9723a5..2bde0e3387c 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -91,8 +91,8 @@ int openmc_finalize() settings::max_lost_particles = 10; settings::max_order = 0; settings::max_particles_in_flight = 100000; - settings::max_particle_events = 1000000; - settings::max_splits = 1000; + settings::max_particle_events = 1'000'000; + settings::max_history_splits = 10'000'000; settings::max_tracks = 1000; settings::max_write_lost_particles = -1; settings::n_log_bins = 8000; diff --git a/src/settings.cpp b/src/settings.cpp index 9f183a6c167..236f47158d0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -106,7 +106,7 @@ int max_order {0}; int n_log_bins {8000}; int n_batches; int n_max_batches; -int max_splits {1000}; +int max_history_splits {10'000'000}; int max_tracks {1000}; ResScatMethod res_scat_method {ResScatMethod::rvs}; double res_scat_energy_min {0.01}; @@ -937,8 +937,9 @@ void read_settings_xml(pugi::xml_node root) weight_windows_on = get_node_value_bool(root, "weight_windows_on"); } - if (check_for_node(root, "max_splits")) { - settings::max_splits = std::stoi(get_node_value(root, "max_splits")); + if (check_for_node(root, "max_history_splits")) { + settings::max_history_splits = + std::stoi(get_node_value(root, "max_history_splits")); } if (check_for_node(root, "max_tracks")) { diff --git a/src/weight_windows.cpp b/src/weight_windows.cpp index 1ca83a2bd79..2eb930965b3 100644 --- a/src/weight_windows.cpp +++ b/src/weight_windows.cpp @@ -102,7 +102,7 @@ void apply_weight_windows(Particle& p) // the window if (weight > weight_window.upper_weight) { // do not further split the particle if above the limit - if (p.n_split() >= settings::max_splits) + if (p.n_split() >= settings::max_history_splits) return; double n_split = std::ceil(weight / weight_window.upper_weight); diff --git a/tests/regression_tests/weightwindows/generators/test.py b/tests/regression_tests/weightwindows/generators/test.py index 1d516db8dde..d6a40b44f01 100644 --- a/tests/regression_tests/weightwindows/generators/test.py +++ b/tests/regression_tests/weightwindows/generators/test.py @@ -22,7 +22,7 @@ def test_ww_generator(run_in_tmpdir): model.settings.particles = 500 model.settings.batches = 5 model.settings.run_mode = 'fixed source' - model.settings.max_splits = 100 + model.settings.max_history_splits = 100 mesh = openmc.RegularMesh.from_domain(model.geometry.root_universe) energy_bounds = np.linspace(0.0, 1e6, 70) diff --git a/tests/regression_tests/weightwindows/inputs_true.dat b/tests/regression_tests/weightwindows/inputs_true.dat index c40f4b7615e..dcc41ae8417 100644 --- a/tests/regression_tests/weightwindows/inputs_true.dat +++ b/tests/regression_tests/weightwindows/inputs_true.dat @@ -70,7 +70,7 @@ 10 1e-38 - 200 + 200 diff --git a/tests/regression_tests/weightwindows/test.py b/tests/regression_tests/weightwindows/test.py index 9ed8559760f..864f4f062dc 100644 --- a/tests/regression_tests/weightwindows/test.py +++ b/tests/regression_tests/weightwindows/test.py @@ -48,7 +48,7 @@ def model(): settings.run_mode = 'fixed source' settings.particles = 200 settings.batches = 2 - settings.max_splits = 200 + settings.max_history_splits = 200 settings.photon_transport = True space = Point((0.001, 0.001, 0.001)) energy = Discrete([14E6], [1.0]) diff --git a/tests/unit_tests/weightwindows/test.py b/tests/unit_tests/weightwindows/test.py index 8af843cbdc0..d3da0cd1176 100644 --- a/tests/unit_tests/weightwindows/test.py +++ b/tests/unit_tests/weightwindows/test.py @@ -94,7 +94,7 @@ def model(): settings.run_mode = 'fixed source' settings.particles = 500 settings.batches = 2 - settings.max_splits = 100 + settings.max_history_splits = 100 settings.photon_transport = True space = Point((0.001, 0.001, 0.001)) energy = Discrete([14E6], [1.0]) diff --git a/tests/unit_tests/weightwindows/test_ww_gen.py b/tests/unit_tests/weightwindows/test_ww_gen.py index 072e332cb75..6fc3747b1da 100644 --- a/tests/unit_tests/weightwindows/test_ww_gen.py +++ b/tests/unit_tests/weightwindows/test_ww_gen.py @@ -55,7 +55,7 @@ def model(): run_mode='fixed source', particles=100, batches=10, - max_splits=10, + max_history_splits=10, survival_biasing=False )