armi.physics.neutronics.crossSectionSettings module¶
The data structures and schema of the cross section modeling options.
These are advanced/compound settings that are carried along in the normal cs object but aren’t simple key/value pairs.
The cs object could either hold the base data (dicts) and create instances of these data structure objects as needed, or the settings system could actually hold instances of these data structures. It is most convenient to let the cs object hold actual instances of these data.
See detailed docs in :doc: Lattice Physics <reference/physics/neutronics/latticePhysics/latticePhysics>.
-
class
armi.physics.neutronics.crossSectionSettings.
XSSettings
(*args, **kwargs)[source]¶ Bases:
dict
Container for holding multiple cross section settings based on their XSID.
This is intended to be stored as part of a case settings and to be used for cross section modeling within a run.
Notes
This is a specialized dictionary that functions in a similar manner as a defaultdict where if a key (i.e., XSID) is missing then a default will be set. If a missing key is being added before the
setDefaults
method is called then this will produce an error.This cannot just be a defaultdict because the creation of new cross section settings are dependent on user settings.
-
__getitem__
(xsID)[source]¶ Return the stored settings of the same xs type and the lowest burnup group if they exist.
Notes
If
AA
andAB
exist, butAC
is created, then the intended behavior is thatAC
settings will be set to the settings inAA
.If only
YZ
exists andYA
is created, then the intended behavior is thatYA
settings will NOT be set to the settings inYZ
Requirements for using the existing cross section settings:
The existing XS ID must match the current XS ID.
The current xs burnup group must be larger than the lowest burnup group for the existing XS ID
If 3a. and 3b. are not met, then the default cross section settings will be set for the current XS ID
-
setDefaults
(blockRepresentation, validBlockTypes)[source]¶ Set defaults for current and future xsIDs based user settings.
This must be delayed past read-time since the settings that effect this may not be loaded yet and could still be at their own defaults when this input is being processed. Thus, defaults are set at a later time.
- Parameters
blockRepresentation (str) – Valid options are provided in
CrossSectionGroupManager.BLOCK_COLLECTIONS
validBlockTypes (list of str or bool) – This configures which blocks (by their type) that the cross section group manager will merge together to create a representative block. If set to
None
orTrue
then all block types in the XS ID will be considered. If this is set toFalse
then a default of [“fuel”] will be used. If this is set to a list of strings then the specific list will be used. A typical input may be [“fuel”] to just consider the fuel blocks.
-
_getDefault
(xsID)[source]¶ Process the optional
crossSectionControl
setting.This input allows users to override global defaults for specific cross section IDs (xsID).
To simplify downstream handling of the various XS controls, we build a full data structure here that should fully define the settings for each individual cross section ID.
-
-
class
armi.physics.neutronics.crossSectionSettings.
XSModelingOptions
(xsID, geometry=None, fileLocation=None, validBlockTypes=None, blockRepresentation=None, driverID=None, criticalBuckling=None, nuclideReactionDriver=None, externalDriver=None, useHomogenizedBlockComposition=None, numInternalRings=None, numExternalRings=None, mergeIntoClad=None, meshSubdivisionsPerCm=None)[source]¶ Bases:
object
Cross section modeling options for a particular XS ID.
-
geometry
¶ The geometry modeling approximation for regions of the core with this assigned xsID. This is required if the
fileLocation
attribute is not provided. This cannot be set if thefileLocation
is provided.- Type
-
fileLocation
¶ This should be a list of paths where the cross sections for this xsID can be copied from. This is required if the
geometry
attribute is not provided. This cannot be set if thegeometry
is provided.- Type
list of str
-
validBlockTypes
¶ This is a configuration option for how the cross section group manager determines which blocks/regions to manage as part of the same collection for the current xsID. If this is set to
None
then all blocks/regions with the current xsID will be considered.
-
blockRepresentation
¶ This is a configuration option for how the cross section group manager will select how to create a representative block based on the collection within the same xsID. See:
crossSectionGroupManager.BLOCK_COLLECTIONS
.- Type
-
driverID
¶ This is a lattice physics configuration option used to determine which representative block can be used as a “fixed source” driver for another composition. This is particularly useful for non-fuel or highly subcritical regions.
- Type
-
criticalBuckling
¶ This is a lattice physics configuration option used to enable or disable the critical buckling search option.
- Type
-
nuclideReactionDriver
¶ This is a lattice physics configuration option that is similar to the
driverID
, but rather than applying the source from a specific representative block, the neutron source is taken from a single nuclides fission spectrum (i.e., U235). This is particularly useful for configuring SERPENT 2 lattice physics calculations.- Type
-
externalDriver
¶ This is a lattice physics configuration option that can be used to determine if the fixed source problem is internally driven or externally driven by the
driverID
region. Externally driven means that the region will be placed on the outside of the current xsID block/region. If this is False then the driver region will be “inside” (i.e., an inner ring in a cylindrical model).- Type
-
useHomogenizedBlockComposition
¶ This is a lattice physics configuration option that is useful for modeling spatially dependent problems (i.e., 1D/2D). If this is True then the representative block for the current xsID will be be a homogenized region. If this is False then the block will be represented in the geometry type selected. This is mainly used for 1D cylindrical problems.
- Type
-
numInternalRings
¶ This is a lattice physics configuration option that is used to specify the number of grid-based rings for the representative block.
- Type
-
numExternalRings
¶ This is a lattice physics configuration option that is used to specify the number of grid-based rings for the driver block.
- Type
-
mergeIntoClad
¶ This is a lattice physics configuration option that is a list of component names to merge into a “clad” component. This is highly-design specific and is sometimes used to merge a “gap” or low-density region into a “clad” region to avoid numerical issues.
- Type
list of str
-
meshSubdivisionsPerCm
¶ This is a lattice physics configuration option that can be used to control subregion meshing of the representative block in 1D problems.
- Type
Notes
Not all default attributes may be useful for your specific application and you may require other types of configuration options. These are provided as examples since the base
latticePhysicsInterface
does not implement models that use these. For additional options, consider subclassing the baseSetting
object and using this model as a template.-
property
xsType
¶ Return the single-char cross section type indicator.
-
property
buGroup
¶ Return the single-char burnup group indicator.
-
property
isPregenerated
¶ True if this points to a pre-generated XS file.
-
validate
()[source]¶ Performs validation checks on the inputs and provides warnings for option inconsistencies.
- Raises
ValueError – When the mutually exclusive
fileLocation
andgeometry
attributes are provided or when neither are provided.
-
setDefaults
(blockRepresentation, validBlockTypes)[source]¶ This sets the defaults based on some recommended values based on the geometry type.
- Parameters
blockRepresentation (str) – Valid options are provided in
CrossSectionGroupManager.BLOCK_COLLECTIONS
validBlockTypes (list of str or bool) – This configures which blocks (by their type) that the cross section group manager will merge together to create a representative block. If set to
None
orTrue
then all block types in the XS ID will be considered. If this is set toFalse
then a default of [“fuel”] will be used. If this is set to a list of strings then the specific list will be used. A typical input may be [“fuel”] to just consider the fuel blocks.
Notes
These defaults are application-specific and design specific. They are included to provide an example and are tuned to fit the internal needs of TerraPower. Consider a separate implementation/subclass if you would like different behavior.
-
-
armi.physics.neutronics.crossSectionSettings.
serializeXSSettings
(xsSettingsDict: Union[armi.physics.neutronics.crossSectionSettings.XSSettings, Dict]) → Dict[str, Dict][source]¶ Return a serialized form of the
XSSettings
as a dictionary.Notes
Attributes that are not set (i.e., set to None) will be skipped.
-
class
armi.physics.neutronics.crossSectionSettings.
XSSettingDef
(name)[source]¶ Bases:
armi.settings.setting.Setting
Custom setting object to manage the cross section dictionary-like inputs.
Notes
This uses the
xsSettingsValidator
schema to validate the inputs and will automatically coerce the value into aXSSettings
dictionary.Initialize a Setting object.
- Parameters
name (str) – the setting’s name
default (object) – The setting’s default value
description (str, optional) – The description of the setting
label (str, optional) – the shorter description used for the ARMI GUI
options (list, optional) – Legal values (useful in GUI drop-downs)
schema (callable, optional) – A function that gets called with the configuration VALUES that build this setting. The callable will either raise an exception, safely modify/update, or leave unchanged the value. If left blank, a type check will be performed against the default.
enforcedOptions (bool, optional) – Require that the value be one of the valid options.
subLabels (tuple, optional) – The names of the fields in each tuple for a setting that accepts a list of tuples. For example, if a setting is a list of (assembly name, file name) tuples, the sublabels would be (“assembly name”, “file name”). This is needed for building GUI widgets to input such data.
isEnvironment (bool, optional) – Whether this should be considered an “environment” setting. These can be used by the Case system to propagate environment options through command-line flags.
oldNames (list of tuple, optional) – List of previous names that this setting used to have, along with optional expiration dates. These can aid in automatic migration of old inputs. When provided, if it is appears that the expiration date has passed, old names will result in errors, requiring to user to update their input by hand to use more current settings.
-
armi.physics.neutronics.crossSectionSettings.
xsSettingsValidator
(xsSettingsDict: Dict[str, Dict]) → armi.physics.neutronics.crossSectionSettings.XSSettings[source]¶ Returns a
XSSettings
object if validation is successful.Notes
This provides two levels of checks. The first check is that the attributes provided as user input contains the correct key/values and the values are of the correct type. The second check uses the
XSModelingOptions.validate
method to check for input inconsistencies and provides warnings if there are any issues.