Allow default material cell offset generation to be turned off

This commit is contained in:
Paul Romano 2020-01-02 16:08:42 -06:00
parent acf4c182df
commit 4ed1d5f42f
8 changed files with 60 additions and 6 deletions

View file

@ -195,6 +195,18 @@ based on the recommended value in LA-UR-14-24530_.
.. _LA-UR-14-24530: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
---------------------------
``<material_cell_offsets>``
---------------------------
By default, OpenMC will count the number of instances of each cell filled with a
material and generate "offset tables" that are used for cell instance tallies.
The ``<material_cell_offsets>`` element allows a user to override this default
setting and turn off the generation of offset tables, if desired, by setting it
to false.
*Default*: true
---------------------------
``<max_order>`` Element
---------------------------
@ -423,11 +435,11 @@ attributes/sub-elements:
:type:
The type of spatial distribution. Valid options are "box", "fission",
"point", "cartesian", and "spherical". A "box" spatial distribution has
"point", "cartesian", and "spherical". A "box" spatial distribution has
coordinates sampled uniformly in a parallelepiped. A "fission" spatial
distribution samples locations from a "box" distribution but only
locations in fissionable materials are accepted. A "point" spatial
distribution has coordinates specified by a triplet. An "cartesian"
distribution samples locations from a "box" distribution but only
locations in fissionable materials are accepted. A "point" spatial
distribution has coordinates specified by a triplet. An "cartesian"
spatial distribution specifies independent distributions of x-, y-, and
z-coordinates. A "spherical" spatial distribution specifies independent
distributions of r-, theta-, and phi-coordinates where theta is the angle

View file

@ -31,6 +31,7 @@ extern "C" bool cmfd_run; //!< is a CMFD run?
extern "C" bool dagmc; //!< indicator of DAGMC geometry
extern "C" bool entropy_on; //!< calculate Shannon entropy?
extern bool legendre_to_tabular; //!< convert Legendre distributions to tabular?
extern bool material_cell_offsets; //!< create material cells offsets?
extern "C" bool output_summary; //!< write summary.h5?
extern bool output_tallies; //!< write tallies.out?
extern bool particle_restart_run; //!< particle restart run?

View file

@ -61,6 +61,9 @@ class Settings(object):
relative error used.
log_grid_bins : int
Number of bins for logarithmic energy grid search
material_cell_offsets : bool
Generate an "offset table" for material cells by default. These tables
are necessary when a particular instance of a cell needs to be tallied.
max_order : None or int
Maximum scattering order to apply globally when in multi-group mode.
no_reduce : bool
@ -216,6 +219,7 @@ class Settings(object):
VolumeCalculation, 'volume calculations')
self._create_fission_neutrons = None
self._material_cell_offsets = None
self._log_grid_bins = None
self._dagmc = False
@ -352,6 +356,10 @@ class Settings(object):
def create_fission_neutrons(self):
return self._create_fission_neutrons
@property
def material_cell_offsets(self):
return self._material_cell_offsets
@property
def log_grid_bins(self):
return self._log_grid_bins
@ -683,6 +691,11 @@ class Settings(object):
create_fission_neutrons, bool)
self._create_fission_neutrons = create_fission_neutrons
@material_cell_offsets.setter
def material_cell_offsets(self, value):
cv.check_type('material cell offsets', value, bool)
self._material_cell_offsets = value
@log_grid_bins.setter
def log_grid_bins(self, log_grid_bins):
cv.check_type('log grid bins', log_grid_bins, Real)
@ -917,6 +930,11 @@ class Settings(object):
elem = ET.SubElement(root, "create_fission_neutrons")
elem.text = str(self._create_fission_neutrons).lower()
def _create_material_cell_offsets_subelement(self, root):
if self._material_cell_offsets is not None:
elem = ET.SubElement(root, "material_cell_offsets")
elem.text = str(self._material_cell_offsets).lower()
def _create_log_grid_bins_subelement(self, root):
if self._log_grid_bins is not None:
elem = ET.SubElement(root, "log_grid_bins")
@ -1148,6 +1166,11 @@ class Settings(object):
if text is not None:
self.create_fission_neutrons = text in ('true', '1')
def _material_cell_offsets_from_xml_element(self, root):
text = get_text(root, 'material_cell_offsets')
if text is not None:
self.material_cell_offsets = text in ('true', '1')
def _log_grid_bins_from_xml_element(self, root):
text = get_text(root, 'log_grid_bins')
if text is not None:
@ -1202,6 +1225,7 @@ class Settings(object):
self._create_resonance_scattering_subelement(root_element)
self._create_volume_calcs_subelement(root_element)
self._create_create_fission_neutrons_subelement(root_element)
self._create_material_cell_offsets_subelement(root_element)
self._create_log_grid_bins_subelement(root_element)
self._create_dagmc_subelement(root_element)
@ -1267,6 +1291,7 @@ class Settings(object):
settings._ufs_mesh_from_xml_element(root)
settings._resonance_scattering_from_xml_element(root)
settings._create_fission_neutrons_from_xml_element(root)
settings._material_cell_offsets_from_xml_element(root)
settings._log_grid_bins_from_xml_element(root)
settings._dagmc_from_xml_element(root)

View file

@ -73,6 +73,7 @@ int openmc_finalize()
settings::gen_per_batch = 1;
settings::legendre_to_tabular = true;
settings::legendre_to_tabular_points = -1;
settings::material_cell_offsets = true;
settings::n_particles = -1;
settings::output_summary = true;
settings::output_tallies = true;

View file

@ -332,8 +332,10 @@ prepare_distribcell()
}
// By default, add material cells to the list of distributed cells
for (gsl::index i = 0; i < model::cells.size(); ++i) {
if (model::cells[i]->type_ == FILL_MATERIAL) distribcells.insert(i);
if (settings::material_cell_offsets) {
for (gsl::index i = 0; i < model::cells.size(); ++i) {
if (model::cells[i]->type_ == FILL_MATERIAL) distribcells.insert(i);
}
}
// Make sure that the number of materials/temperatures matches the number of

View file

@ -33,6 +33,8 @@ element settings {
element log_grid_bins { xsd:positiveInteger }? &
element material_cell_offsets { xsd:boolean }? &
element max_order { xsd:nonNegativeInteger }? &
element mesh {

View file

@ -156,6 +156,11 @@
<data type="positiveInteger"/>
</element>
</optional>
<optional>
<element name="material_cell_offsets">
<data type="boolean"/>
</element>
</optional>
<optional>
<element name="max_order">
<data type="nonNegativeInteger"/>

View file

@ -46,6 +46,7 @@ bool create_fission_neutrons {true};
bool dagmc {false};
bool entropy_on {false};
bool legendre_to_tabular {true};
bool material_cell_offsets {true};
bool output_summary {true};
bool output_tallies {true};
bool particle_restart_run {false};
@ -776,6 +777,11 @@ void read_settings_xml()
create_fission_neutrons = get_node_value_bool(root, "create_fission_neutrons");
}
}
// Check whether material cell offsets should be generated
if (check_for_node(root, "material_cell_offsets")) {
material_cell_offsets = get_node_value_bool(root, "material_cell_offsets");
}
}
void free_memory_settings() {