armi.nuclearDataIO.cccc.compxs module

COMPXS is a binary file that contains multigroup macroscopic cross sections for homogenized regions in a full core. The file format can be found in [DIF3D].

DIF3D

Derstine, K. L. DIF3D: A Code to Solve One-, Two-, and Three-Dimensional Finite-Difference Diffusion Theory Problems, report, April 1984; Argonne, Illinois. (https://digital.library.unt.edu/ark:/67531/metadc283553/: accessed October 17, 2019), University of North Texas Libraries, Digital Library, https://digital.library.unt.edu; crediting UNT Libraries Government Documents Department.

The file structure is listed here

      RECORD TYPE                           PRESENT IF
      ===================================   ==========
      SPECIFICATIONS                        ALWAYS
      COMPOSITION INDEPENDENT DATA          ALWAYS
********* (REPEAT FOR ALL COMPOSITIONS)
*     COMPOSITION SPECIFICATIONS            ALWAYS
*  ****** (REPEAT FOR ALL ENERGY GROUPS
*  *       IN THE ORDER OF DECREASING
*  *       ENERGY)
*  *  COMPOSITION MACROSCOPIC GROUP         ALWAYS
*  *  CROSS SECTIONS
*********
      POWER CONVERSION FACTORS              ALWAYS

Examples

::
>>> from armi.nuclearDataIO import compxs
>>> lib = compxs.readBinary('COMPXS')
>>> r0 = lib.regions[0]
>>> r0.macros.fission
# returns fission XS for this region
>>> r0.macros.higherOrderScatter[1]
# returns P1 scattering matrix
>>> r0.macros.higherOrderScatter[5] *= 0  # zero out P5 scattering matrix
>>> compxs.writeBinary(lib, 'COMPXS2')

Notes

Power conversion factors are used by some codes to determine how to scale the flux in a region to a desired power based on either fissions/watt-second or captures/watt-second. If the user does not plan on using these values, the COMPXS format indicates the values should be set to -1E+20.

The value of powerConvMult “times the group J integrated flux for the regions containing the current composition yields the total power in those regions and energy group J due to fissions and non-fission absorptions.”

The d<1,2,3>Multiplier values are the first, second, and third dimension directional diffusion coefficient multipliers, respectively. Similary, the d<1,2,3>Additive values are the first, second, and third dimension directional diffusion coefficient additive terms, respectively.

armi.nuclearDataIO.cccc.compxs._getRegionIO()[source]
armi.nuclearDataIO.cccc.compxs._flattenScatteringVector(colVector, group, numUpScatter, numDownScatter)[source]
armi.nuclearDataIO.cccc.compxs.compare(lib1, lib2, tolerance=0.0, verbose=False)[source]

Compare two COMPXS libraries and return True if equal, or False if not equal.

Parameters
  • lib1 (XSLibrary) – first library

  • lib2 (XSLibrary) – second library

  • tolerance (float) – Disregard errors that are less than tolerance.

  • verbose (bool) – show the macroscopic cross sections that are not equal

Returns

equals – True if libraries are equal, else false

Return type

bool

armi.nuclearDataIO.cccc.compxs._compareRegionXS(region1, region2, tolerance, verbose)[source]

Compare the macroscopic cross sections between two homogenized regions.

class armi.nuclearDataIO.cccc.compxs._CompxsIO(fileName, lib, fileMode, getRegionFunc)[source]

Bases: armi.nuclearDataIO.cccc.cccc.Stream

Semi-abstract stream used for reading to/writing from a COMPXS file.

Parameters
  • fileName (str) – path to compxs file

  • lib (armi.nuclearDataIO.xsLibrary.CompxsLibrary) – Compxs library that is being written to or read from fileName

  • fileMode (str) – string indicating if fileName is being read or written, and in ascii or binary format

  • getRegionFunc (function) – function that returns a CompxsRegion object given the name of the region.

Create an instance of a Stream.

Parameters
  • fileName (str) – name of the file to be read

  • fileMode (str) – the file mode, i.e. ‘w’ for writing ASCII, ‘r’ for reading ASCII, ‘wb’ for writing binary, and ‘rb’ for reading binary.

_METADATA_TAGS = ('numComps', 'numGroups', 'fileWideChiFlag', 'numFissComps', 'maxUpScatterGroups', 'maxDownScatterGroups', 'numDelayedFam', 'maxScatteringOrder')
_getFileMetadata()[source]
isReadingCompxs()[source]
fileMode()[source]
classmethod _read(fileName, fileMode)[source]
classmethod _write(lib, fileName, fileMode)[source]
classmethod _readWrite(lib, fileName, fileMode, getRegionFunc)[source]
readWrite()[source]

Read from or write to the COMPXS file.

See also

armi.nuclearDataIO.cccc.isotxs._IsotxsIO.readWrite()

reading/writing ISOTXS files

_rw1DRecord(regNames)[source]

Write the specifications block.

_rw2DRecord()[source]

Write the composition independent data block.

_rwLibraryEnergies(record)[source]
_rwDelayedProperties(record, numDelayedFam)[source]
_rw5DRecord()[source]

Write power conversion factors

class armi.nuclearDataIO.cccc.compxs._CompxsRegionIO(region, compxsIO, lib)[source]

Bases: object

Specific object assigned a single region to read/write composition information.

Used with _COMPXS object to read/write 3D and 4D records - composition specifications and compsosition macroscopic cross sections.

Cross sections are read/written in order of decreasing energy.

This differs from the _COMPXS object, as this object acts on a single region, but uses the file mode and file path from the _COMPXS region that instantiated this object.

_ORDERED_PRIMARY_XS = ('absorption', 'total', 'removal', 'transport')
_getRegionMetadata()[source]
_getFileMetadata()[source]
rwRegionData()[source]

Read/write the region specific information for this composition.

_rw3DRecord()[source]

Write the composition specifications block

_rw4DRecord()[source]

Write the composition macroscopic cross sections

_rwGroup4DRecord(record, group, macros)[source]
_rwPrimaryXS(record, group, macros)[source]
_rwScatteringMatrix(record, group, macros, order)[source]
class armi.nuclearDataIO.cccc.compxs._CompxsScatterMatrix(shape)[source]

Bases: object

When reading COMPXS scattering blocks, store the data here and then reconstruct after.

addColumnData(dataj, indicesj)[source]
makeSparse(sparseFunc=<class 'scipy.sparse.csc.csc_matrix'>)[source]
class armi.nuclearDataIO.cccc.compxs.CompxsRegion(lib, regionNumber)[source]

Bases: object

Class for creating/tracking homogenized region information.

Notes

Region objects are created from reading COMPXS files through readWrite() and connected to the resulting library, similar to instances of XSNuclide. This allows instances of CompxsLibrary to read from and write to COMPXS files, access region information by name, and plot macroscopic cross sections from the homogenized regions.

The main attributes for an instance of Region are the macroscopic cross sections, macros, and the metadata. The metadata deals primarily with delayed neutron information and use of the fileWideChi, if that option is set.

Examples

>>> lib = compxs.readBinary('COMPXS')
>>> lib.regions
    <Region REG00>
    <Region REG01>
    <Region REG02>
    ...
    <Region RegNN>
>>> r0 = lib.regions[0]
>>> r10 = lib.regions[10]
>>> r0.isFissile
    False
>>> r10.isFissile
    True
>>> r10.macros.fission
    array([0.01147095,  0.01006284,  0.0065597,  0.00660079,  0.005587,
           ...
           0.08920149,  0.13035864,  0.16192732]
_primaryXS = ('absorption', 'total', 'removal', 'transport', 'n2n')
_getFileMetadata()[source]
_getMetadata()[source]
initMetadata(groups)[source]

Initialize the metadata for this region.

property isFissile
allocateXS(numGroups)[source]

Allocate the cross section arrays.

When reading in the cross sections from a COMPXS file, the cross sections are read for each energy group, i.e. ..math:

\Sigma_{a,1},\Sigma_{t,1},\Sigma_{rem,1}, \cdots,
\Sigma_{a,2},\Sigma_{t,2},\Sigma_{rem,2}, \cdots,
\Sigma_{a,G},\Sigma_{t,G{,\Sigma_{rem,G}

Since the cross sections can not be read in with a single read command, the arrays are allocated here to be populated later.

Scattering matrices are read in as columns of a sparse scattering matrix and reconstructed after all energy groups have been read in.

makeScatteringMatrices()[source]

Create the sparse scattering matrix from components.

The scattering matrix \(S_{i,j}=\Sigma_{s,i\rightarrow j}\) is read in from the COMPXS as segments on each column in three parts: ..math:

XSCATU_J = \lbrace S_{g', J}\vert g'=J+NUP(J), J+NUP(J)-1, cdots, J+1\rbrace

XSCATJ_J = S_{J,J}

XSCATD_J = \lbrace S_{g', J}\vert g'=J-1, J-2, \cdots, J_NDN(J) \rbrace

where \(NUP(J)\) and \(NDN(J)\) are the number of group that upscatter and downscatter into energy group \(J\)

See also

scipy.sparse.csc_matrix

getXS(interaction)[source]

Get the macroscopic cross sections for a specific interaction.

See also

armi.nucDirectory.XSNuclide.getXS()

merge(other)[source]

Merge attributes of two homogenized Regions.