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.
- 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.
- class armi.physics.neutronics.crossSectionSettings.XSModelingOptions(xsID, geometry=None, xsFileLocation=None, fluxFileLocation=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.
- Variables
~XSModelingOptions.xsID (str) – Cross section ID that is two characters maximum (i.e., AA).
~XSModelingOptions.geometry (str) – The geometry modeling approximation for regions of the core with this assigned xsID. This is required if the
xsFileLocation
attribute is not provided. This cannot be set if thexsFileLocation
is provided.~XSModelingOptions.xsFileLocation (list of str or None) – 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.~XSModelingOptions.fluxFileLocation (str or None) – This should be a path where a pre-calculated flux solution for this xsID can be copied from. The
geometry
attribute must be provided with this input.~XSModelingOptions.validBlockTypes (str or None) – 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.~XSModelingOptions.blockRepresentation (str) – 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
.~XSModelingOptions.driverID (str) – 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.
~XSModelingOptions.criticalBuckling (bool) – This is a lattice physics configuration option used to enable or disable the critical buckling search option.
~XSModelingOptions.nuclideReactionDriver (str) – 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.~XSModelingOptions.externalDriver (bool) – 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).~XSModelingOptions.useHomogenizedBlockComposition (bool) – 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.
~XSModelingOptions.numInternalRings (int) – This is a lattice physics configuration option that is used to specify the number of grid-based rings for the representative block.
~XSModelingOptions.numExternalRings (int) – This is a lattice physics configuration option that is used to specify the number of grid-based rings for the driver block.
~XSModelingOptions.mergeIntoClad (list of str) – 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.
~XSModelingOptions.meshSubdivisionsPerCm (float) – This is a lattice physics configuration option that can be used to control subregion meshing of the representative block in 1D problems.
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 xsIsPregenerated¶
True if this points to a pre-generated XS file.
- property fluxIsPregenerated¶
True if this points to a pre-generated flux solution file.
- validate()[source]¶
Performs validation checks on the inputs and provides warnings for option inconsistencies.
- Raises
ValueError – When the mutually exclusive
xsFileLocation
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.
- 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.