armi.nuclearDataIO.xsCollections module¶
Cross section collections contain cross sections for a single nuclide or region.
Specifically, they are used as attributes of XSNuclide
, which
then are combined as a XSLibrary
.
These may represent microscopic or macroscopic neutron or photon cross sections. When they are macroscopic, they generally represent a whole region with many nuclides, though this is not required.
See also
armi.nuclearDataIO.xsCollection.XSCollection
object that gets created.
Examples
# creating a MicroscopicXSCollection by loading one from ISOTXS. microLib = armi.nuclearDataIO.ISOTXS(‘ISOTXS’) micros = myLib.nuclides[‘U235AA’].micros
# creating macroscopic XS: mc = MacroscopicCrossSectionCreator() macroCollection = mc.createMacrosFromMicros(microLib, block) blocksWithMacros = mc.createMacrosOnBlocklist(microLib, blocks)
-
class
armi.nuclearDataIO.xsCollections.
XSCollection
(parent)[source]¶ Bases:
object
A cross section collection.
Construct a NuclideCollection.
- Parameters
parent (object) – The parent container, which may be a region, a nuclide, a block, etc.
-
_zeroes
= {33: array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])}¶ A dict of numpy arrays set to the size of XSLibrary.numGroups.
This is used to initialize cross sections which may not exist for the specific nuclide. Consequently, there should never be a situation where a cross section does not exist. In addition, they are all pointers to the same array, so we’re not generating too much unnecessary data.
Notes
This is a dict so that it can store multiple 0_g “matricies”, i.e. vectors. Realistically, during any given run there will only be a set of groups, e.g. 33.
-
__getitem__
(key)[source]¶ Access cross sections by key string (e.g. micros[‘fission’] = micros.fission.
Notes
These containers were originally dicts, but upgraded to objects with numpy values as specialization was needed. This access method could/should be phased out.
-
getAbsorptionXS
()[source]¶ Return total absorption XS, which is the sum of capture + fission + others.
-
getTotalScatterMatrix
()[source]¶ Sum up scatter matrices to produce total scatter matrix.
Multiply reaction-based n2n scatter matrix by 2.0 to convert to production-based.
Warning
Not all lattice codes store (n,2n) matrices consistently. Some are production-based and some are absorption-based. If you use an absorption-based one, your scatter matrix will be off, generally leading to about a percent error in your neutron balance.
Notes
The total scattering matrix is produced by summing the elastic, inelastic, and n2n scattering matrices. If a specific scattering matrix does not exist for a composition (nuclide or region) then it is skipped and a warning is displayed stating that the scattering reaction is not available and is not included in the total scattering matrix.
Example: When producing macroscopic cross sections in MC2-3 the code internally merges the elastic and inelastic scattering matrices into a single elastic scattering matrix.
-
static
collapseCrossSection
(crossSection, weights)[source]¶ Collapse a cross section into 1-group.
This is extremely useful for many analyses such as doing a shielding efficacy survey or computing one-group reaction rates.
\[\bar{\sigma} = \frac{\sum_g{\sigma_g \phi_g}}{\sum_g{\phi_g}}\]
-
compare
(other, flux, relativeTolerance=0, verbose=False)[source]¶ Compare the cross sections between two XSCollections objects.
-
merge
(other)[source]¶ Merge the cross sections of two collections.
Notes
This can only merge if one hasn’t been assigned at all, because it doesn’t try to figure out how to account for overlapping cross sections.
Update the current library (self) with values from the other library if all attributes in the library except ones in attributesToIgnore are None.
Libraries are already merged if all attributes in the other library are None (This is nothing to merge!).
-
class
armi.nuclearDataIO.xsCollections.
MacroscopicCrossSectionCreator
(buildScatterMatrix=True, buildOnlyCoolant=False)[source]¶ Bases:
object
Create macroscopic cross sections from micros and number density.
Object encapsulating all high-level methods related to the creation of macroscopic cross sections.
-
createMacrosFromMicros
(microLibrary, block, nucNames=None, libType='micros')[source]¶ Creates a macroscopic cross section set based on a microscopic XS library using a block object
Micro libraries have lots of nuclides, but macros only have 1.
- Parameters
microLibrary (xsCollection.XSCollection) – Input micros
block (Block) – Object whos number densities should be used to generate macros
nucNames (list, optional) – List of nuclides to include in the macros. Defaults to all in block.
libType (str, optional) – The block attribute containing the desired microscopic XS for this block: either “micros” for neutron XS or “gammaXS” for gamma XS.
- Returns
macros – A new XSCollection full of macroscopic cross sections
- Return type
xsCollection.XSCollection
-
_convertBasicXS
(libType='micros')[source]¶ Converts basic XS such as fission, nGamma, etc.
- Parameters
libType (str, optional) – The block attribute containing the desired microscopic XS for this block: either “micros” for neutron XS or “gammaXS” for gamma XS.
-
_convertScatterMatrices
(libType='micros')[source]¶ Build macroscopic scatter matrices.
- Parameters
libType (str, optional) – The block attribute containing the desired microscopic XS for this block: either “micros” for neutron XS or “gammaXS” for gamma XS.
-
_computeAbsorptionXS
()[source]¶ Absorption = sum of all absorption reactions.
Must be called after
_convertBasicXS()
.
-
_computeRemovalXS
()[source]¶ Compute removal cross section (things that remove a neutron from this phase space)
This includes all absorptions and outscattering. Outscattering is represented by columns of the total scatter matrix. Self-scattering (e.g. when g’ == g) is not be included. This can be handled by summing the columns and then subtracting the diagonal.
within-group n2n is accounted for by simply not including n2n in the removal xs.
-
-
armi.nuclearDataIO.xsCollections.
computeBlockAverageChi
(b, isotxsLib)[source]¶ Return the block average total chi vector based on isotope chi vectors.
This is defined by eq 3.4b in DIF3D manual [DIF3D], which corresponds to 1 in A.HMG4C card.
\[\chi_g = \frac{\sum_{n} \chi_{g,n} N_n V \sum_{g'}(\nu_{g'}*\sigma_{f,g'})}{\sum_n N_n V \sum_{g'}(\nu_{g'}*\sigma_{f,g'} )}\]To evaluate efficiently, assume that if \(\chi_{g,n}=0\), there will be no contributions
Volume is not used b/c it is already homogenized in the block.
Notes
This methodology is based on option 1 in the HMG4C utility (named total fission source weighting).
-
armi.nuclearDataIO.xsCollections.
computeNeutronEnergyDepositionConstants
(numberDensities, lib, microSuffix)[source]¶ Compute the macroscopic neutron energy deposition group constants.
These group constants can be multiplied by the flux to obtain energy deposition rates.
- Parameters
numberDensities (dict) – nucName keys, number density values (atoms/bn-cm) of all nuclides in the composite for which the macroscopic group constants are computed. See composite getNuclideNumberDensities method.
lib (library object) – Microscopic cross section library.
microSuffix (str) – Microscopic library suffix (e.g. ‘AB’) for this composite. See composite getMicroSuffix method.
- Returns
energyDepositionConsts – Neutron energy deposition group constants. (J/cm)
- Return type
numpy array
Notes
PMATRX documentation says units will be eV/s when multiplied by flux but it’s eV/s/cm^3. (eV/s/cm^3 = eV-bn * 1/cm^2/s * 1/bn-cm.)
Converted here to obtain J/cm (eV-bn * 1/bn-cm * J / eV)
-
armi.nuclearDataIO.xsCollections.
computeGammaEnergyDepositionConstants
(numberDensities, lib, microSuffix)[source]¶ Compute the macroscopic gamma energy deposition group constants.
These group constants can be multiplied by the flux to obtain energy deposition rates.
- Parameters
numberDensities (dict) – nucName keys, number density values (atoms/bn-cm) of all nuclides in the composite for which the macroscopic group constants are computed. See composite getNuclideNumberDensities method.
lib (library object) – Microscopic cross section library.
microSuffix (str) – Microscopic library suffix (e.g. ‘AB’) for this composite. See composite getMicroSuffix method.
- Returns
energyDepositionConsts – gamma energy deposition group constants. (J/cm)
- Return type
numpy array
Notes
PMATRX documentation says units will be eV/s when multiplied by flux but it’s eV/s/cm^3. (eV/s/cm^3 = eV-bn * 1/cm^2/s * 1/bn-cm.)
Convert here to obtain J/cm (eV-bn * 1/bn-cm * J / eV)
-
armi.nuclearDataIO.xsCollections.
computeFissionEnergyGenerationConstants
(numberDensities, lib, microSuffix)[source]¶ Get the fission energy generation group constant of a block
\[E_{generation_fission} = \kappa_f \Sigma_f\]Power comes from fission and capture reactions.
- Parameters
numberDensities (dict) – nucName keys, number density values (atoms/bn-cm) of all nuclides in the composite for which the macroscopic group constants are computed. See composite getNuclideNumberDensities method.
lib (library object) – Microscopic cross section library.
microSuffix (str) – Microscopic library suffix (e.g. ‘AB’) for this composite. See composite getMicroSuffix method.
- Returns
fissionEnergyFactor – Fission energy generation group constants (in Joules/cm)
- Return type
numpy.array
-
armi.nuclearDataIO.xsCollections.
computeCaptureEnergyGenerationConstants
(numberDensities, lib, microSuffix)[source]¶ Get the energy generation group constant of a block
\[E_{generation capture} = \kappa_c \Sigma_c\]Typically, one only cares about the flux* this XS (to find total power), but the XS itself is required in some sensitivity studies.
Power comes from fission and capture reactions.
- Parameters
numberDensities (dict) – nucName keys, number density values (atoms/bn-cm) of all nuclides in the composite for which the macroscopic group constants are computed. See composite getNumberDensities method.
lib (library object) – Microscopic cross section library.
microSuffix (str) – Microscopic library suffix (e.g. ‘AB’) for this composite. See composite getMicroSuffix method.
- Returns
captureEnergyFactor – Capture energy generation group constants (in Joules/cm)
- Return type
numpy.array
-
armi.nuclearDataIO.xsCollections.
computeMacroscopicGroupConstants
(constantName, numberDensities, lib, microSuffix, libType=None, multConstant=None, multLib=None)[source]¶ Compute any macroscopic group constants given number densities and a microscopic library.
- Parameters
constantName (str) – Name of the reaction for which to obtain the group constants. This name should match a cross section name or an attribute in the collection.
numberDensities (dict) – nucName keys, number density values (atoms/bn-cm) of all nuclides in the composite for which the macroscopic group constants are computed. See composite getNuclideNumberDensities method.
lib (library object) – Microscopic cross section library.
microSuffix (str) – Microscopic library suffix (e.g. ‘AB’) for this composite. See composite getMicroSuffix method.
libType (str, optional) – The block attribute containing the desired microscopic XS for this block: either “micros” for neutron XS or “gammaXS” for gamma XS.
multConstant (str, optional) – Name of constant by which the group constants will be multiplied. This name should match a cross section name or an attribute in the collection.
multLib (library object, optional) – Microscopic cross section nuclide library to obtain the multiplier from. If None, same library as base cross section is used.
- Returns
macroGroupConstant – Macroscopic group constants for the requested reaction.
- Return type
numpy array