diff --git a/docs/source/io_formats/settings.rst b/docs/source/io_formats/settings.rst index 82414f308..53376b04c 100644 --- a/docs/source/io_formats/settings.rst +++ b/docs/source/io_formats/settings.rst @@ -751,7 +751,7 @@ This element has the following attributes/sub-elements: *Default*: None - :max_surf_banks: + :max_particles: An integer indicating the maximum number of particles to be banked on specified surfaces per processor. The size of source bank in ``surface_source.h5`` is limited to this value times the number of diff --git a/include/openmc/settings.h b/include/openmc/settings.h index 109255e9f..7030803e9 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -88,7 +88,7 @@ extern RunMode run_mode; //!< Run mode (eigenvalue, fixed src, e extern std::unordered_set sourcepoint_batch; //!< Batches when source should be written 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 int64_t max_surf_banks; //!< maximum number of particles to be banked on surfaces per process +extern int64_t max_particles; //!< maximum number of particles to be banked on surfaces per process extern TemperatureMethod temperature_method; //!< method for choosing temperatures extern double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures extern double temperature_default; //!< Default T in [K] diff --git a/openmc/settings.py b/openmc/settings.py index e069453b7..dc6a799f5 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -152,7 +152,7 @@ class Settings: :surface_ids: List of surface ids at which crossing particles are to be banked (int) - :max_surf_banks: Maximum number of particles to be banked on surfaces + :max_particles: Maximum number of particles to be banked on surfaces per process (int) survival_biasing : bool Indicate whether survival biasing is to be used @@ -604,14 +604,14 @@ class Settings: cv.check_type('surface source writing options', surf_source_write, Mapping) for key, value in surf_source_write.items(): cv.check_value('surface source writing key', key, - ('surface_ids', 'max_surf_banks')) + ('surface_ids', 'max_particles')) if key == 'surface_ids': cv.check_type('surface ids for source banking', value, Iterable, Integral) for surf_id in value: cv.check_greater_than('surface id for source banking', surf_id, 0) - elif key == 'max_surf_banks': + elif key == 'max_particles': cv.check_type('maximum particle banks on surfaces per process', value, Integral) cv.check_greater_than('maximum particle banks on surfaces per process', @@ -954,9 +954,9 @@ class Settings: subelement = ET.SubElement(element, "surface_ids") subelement.text = ' '.join( str(x) for x in self._surf_source_write['surface_ids']) - if 'max_surf_banks' in self._surf_source_write: - subelement = ET.SubElement(element, "max_surf_banks") - subelement.text = str(self._surf_source_write['max_surf_banks']) + if 'max_particles' in self._surf_source_write: + subelement = ET.SubElement(element, "max_particles") + subelement.text = str(self._surf_source_write['max_particles']) def _create_confidence_intervals(self, root): if self._confidence_intervals is not None: @@ -1230,12 +1230,12 @@ class Settings: def _surf_source_write_from_xml_element(self, root): elem = root.find('surf_source_write') if elem is not None: - for key in ('surface_ids', 'max_surf_banks'): + for key in ('surface_ids', 'max_particles'): value = get_text(elem, key) if value is not None: if key == 'surface_ids': value = [int(x) for x in value.split()] - elif key in ('max_surf_banks'): + elif key in ('max_particles'): value = int(value) self.surf_source_write[key] = value diff --git a/src/relaxng/settings.rnc b/src/relaxng/settings.rnc index 03c420525..f9877a3f9 100644 --- a/src/relaxng/settings.rnc +++ b/src/relaxng/settings.rnc @@ -146,8 +146,8 @@ element settings { element surf_source_write { (element surface_ids { list { xsd:positiveInteger+ } } | attribute surface_ids { list { xsd:positiveInteger+ } }) & - (element max_surf_banks { xsd:positiveInteger } | - attribute max_surf_banks { xsd:positiveInteger }) + (element max_particles { xsd:positiveInteger } | + attribute max_particles { xsd:positiveInteger }) }? & element survival_biasing { xsd:boolean }? & diff --git a/src/relaxng/settings.rng b/src/relaxng/settings.rng index 7cc9eb153..07b8a6d1d 100644 --- a/src/relaxng/settings.rng +++ b/src/relaxng/settings.rng @@ -670,10 +670,10 @@ - + - + diff --git a/src/settings.cpp b/src/settings.cpp index 7c7e13b4a..9df3b8c46 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -101,7 +101,7 @@ RunMode run_mode {RunMode::UNSET}; std::unordered_set sourcepoint_batch; std::unordered_set statepoint_batch; std::unordered_set source_write_surf_id; -int64_t max_surf_banks; +int64_t max_particles; TemperatureMethod temperature_method {TemperatureMethod::NEAREST}; double temperature_tolerance {10.0}; double temperature_default {293.6}; @@ -655,8 +655,8 @@ void read_settings_xml() } // Get maximum number of particles to be banked per surface - if (check_for_node(node_ssw, "max_surf_banks")) { - max_surf_banks = std::stoi(get_node_value(node_ssw, "max_surf_banks")); + if (check_for_node(node_ssw, "max_particles")) { + max_particles = std::stoi(get_node_value(node_ssw, "max_particles")); } } diff --git a/src/simulation.cpp b/src/simulation.cpp index 02aac5537..303575130 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -289,7 +289,7 @@ void allocate_banks() if (settings::surf_source_write) { // Allocate surface source bank - simulation::surf_source_bank.reserve(settings::max_surf_banks); + simulation::surf_source_bank.reserve(settings::max_particles); } } diff --git a/tests/regression_tests/surface_source/inputs_true_write.dat b/tests/regression_tests/surface_source/inputs_true_write.dat index 858ee21c3..48dde9900 100644 --- a/tests/regression_tests/surface_source/inputs_true_write.dat +++ b/tests/regression_tests/surface_source/inputs_true_write.dat @@ -24,7 +24,7 @@ 1 - 1000 + 1000 1 diff --git a/tests/regression_tests/surface_source/test.py b/tests/regression_tests/surface_source/test.py index 1cf6641d4..341a58bdf 100644 --- a/tests/regression_tests/surface_source/test.py +++ b/tests/regression_tests/surface_source/test.py @@ -47,7 +47,7 @@ def model(request): openmc_model.settings.source = pt_src openmc_model.settings.surf_source_write = {'surface_ids': [1], - 'max_surf_banks': 1000} + 'max_particles': 1000} elif surf_src_op == 'read': openmc_model.settings.surf_src_read = {'path': 'surface_source_true.h5'} diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 0ecdb7125..7a3357d43 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -21,7 +21,7 @@ def test_export_to_xml(run_in_tmpdir): 'write': True, 'overwrite': True} s.statepoint = {'batches': [50, 150, 500, 1000]} s.surf_source_read = {'path': 'surface_source_1.h5'} - s.surf_source_write = {'surface_ids': [2], 'max_surf_banks': 200} + s.surf_source_write = {'surface_ids': [2], 'max_particles': 200} s.confidence_intervals = True s.ptables = True s.seed = 17 @@ -79,7 +79,7 @@ def test_export_to_xml(run_in_tmpdir): 'write': True, 'overwrite': True} assert s.statepoint == {'batches': [50, 150, 500, 1000]} assert s.surf_source_read == {'path': 'surface_source_1.h5'} - assert s.surf_source_write == {'surface_ids': [2], 'max_surf_banks': 200} + assert s.surf_source_write == {'surface_ids': [2], 'max_particles': 200} assert s.confidence_intervals assert s.ptables assert s.seed == 17