armi.nuclearDataIO.cccc.nhflux module

NHFLUX is a CCCC interface file that handles nodal hexagonal flux moments.

Examples

>>> nhfluxData = NfluxStream.readBinary("NHFLUX")
>>> NhfluxStream.writeAscii(nhfluxData, "nhflux.ascii")
class armi.nuclearDataIO.cccc.nhflux.NHFLUX(fName='NHFLUX', variant=False, numDataSetsToRead=1)[source]

Bases: armi.nuclearDataIO.cccc.cccc.DataContainer

An abstraction of a NHFLUX file.

Important Note: DIF3D outputs NHFLUX at every time node, but REBUS outputs NHFLUX only at every cycle.

This format is defined in DIF3D manual.

See also [VARIANT-95] and [VARIANT-2014].

VARIANT-95

G. Palmiotti, E. E. Lewis, and C. B. Carrico, VARIANT: VARIational Anisotropic Nodal Transport for Multidimensional Cartesian and Hexagonal Geometry Calculation, ANL-95/40, Argonne National Laboratory, Argonne, IL (October 1995).

VARIANT-2014

Smith, M. A., Lewis, E. E., and Shemon, E. R. DIF3D-VARIANT 11.0: A Decade of Updates. United States: N. p., 2014. Web. doi:10.2172/1127298. https://publications.anl.gov/anlpubs/2014/04/78313.pdf

self._metadata

The NHFLUX file control info (sort of global for this library).

Type

file control

self.geodstCoordMap

This is an index map between DIF3D “four color” nodal and DIF3D GEODST. It is absolutely necessary for interpreting that data read by nuclearDataIO.NHFLUX.readHexPartialCurrents4D.

Type

list of int

self.externalCurrentPointers

This is an index map for the “external hex surfaces” between DIF3D “four color” nodal indexing and DIF3D GEODST indexing. “External surfaces” are important, because they contain the INCOMING partial currents from the outer reactor boundary. This uses the same hex ordering as geodstCoordMap, except that each hex now has 6 subsequent indices. If hex of index n (0 to N-1) has a surface of index k (0 to 5) that lies on the vacuum boundary, then the index of that surface is N*6 + k + 1.

Type

list of int

self.fluxMoments

This contains all the flux moments for all core assemblies at ONE axial position. The jth planar flux moment of assembly i is fluxMoments[i][j]. The hex assemblies are ordered according to self.geodstCoordMap.

Type

2-D list of float

self.partialCurrentsHex

This contains all the OUTGOING partial currents for each assembly in the given axial plane. The OUTGOING partial current on surface j in assembly i is surfCurrents[i][j]. The hex assemblies are ordered according to self.geodstCoordMap.

Type

2-D list of float

self.partialCurrentsHex_ext

This contains all the INCOMING partial currents on “external hex surfaces”, which are adjacent to the reactor outer boundary (usually vacuum). Internal reflective surfaces are NOT included in this! These “external hex surfaces” are ordered according to self.externalCurrentPointers.

Type

1-D list of floats

self.partialCurrentsZ

This contains all the upward and downward partial currents in all assemblies on ONE whole-core axial slice. The hex assemblies are ordered according to self.geodstCoordMap.

Type

2-D list of float

Initialize the NHFLUX or NAFLUX reader object.

Parameters
  • fName (str, optional) – The file name of the NHFLUX binary file to be read.

  • variant (bool, optional) – Whether or not this NHFLUX/NAFLUX file has the VARIANT output format, which is a bit different than the DIF3D nodal format.

class armi.nuclearDataIO.cccc.nhflux.NhfluxStream(data: armi.nuclearDataIO.cccc.cccc.DataContainer, fileName: str, fileMode: str)[source]

Bases: armi.nuclearDataIO.cccc.cccc.StreamWithDataContainer

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.

static _getDataContainer() → armi.nuclearDataIO.cccc.nhflux.NHFLUX[source]
readWrite()[source]

Read everything from the DIF3D binary file NHFLUX that is necessary for pin flux and power reconstruction.

Read all surface-averaged partial currents, all planar moments, and the DIF3D “four color” nodal coordinate mapping system.

Notes

This method should be private but conflicts with _readWrite so we need a better name.

Parameters

numDataSetsToRead (int, optional) – The number of whole-core flux data sets included in this NHFLUX/NAFLUX file that one wishes to be read. Some NHFLUX/NAFLUX files, such as NAFLUX files written by SASSYS/DIF3D-K, contain more than one flux data set. Each data set overwrites the previous one on the NHFLUX class object, which will contain only the numDataSetsToRead-th data set. The first numDataSetsToRead-1 data sets are essentially skipped over.

_getNumExtSurfaces(nSurf=6)[source]
_rwFileID()[source]

Read/write file id record.

Notes

The username, version, etc are embedded in this string but it’s usually blank.

_rwBasicFileData1D()[source]

Read basic data parameters (number of energy groups, assemblies, axial nodes, etc.)

_rwGeodstCoordMap2D()[source]

Read/write core geometry indexing from the NHFLUX 2D block (file control).

This reads the 2-D (x,y) indexing for hex assemblies. geodstCoordMap maps DIF3D “four color” nodal hex indexing to DIF3D GEODST hex indexing. This DIF3D GEODST indexing is different than (but similar to) the MCNP GEODST hex ordering. See TP1-1.9.31-RPT-0010 for more details on hex ordering.

Let N be the number of assemblies. Let M be the number of “external hex surfaces” exposed to the outer reactor boundary (usually vacuum). M does NOT include reflective surfaces!

N = self._metadata[‘nintxy’] M = self._metadata[‘npcxy’] - self._metadata[‘nintxy’]*6 N*6 + M = self._metadata[‘npcxy’]

Examples

geodstCoordMap[fourColorNodalIndex] = geodstIndex

See also

nuclearDataIO.NHFLUX.__init__(), nuclearDataIO.NHFLUX.readHexPartialCurrents4D(), fluxRecon.computePinMGFluxAndPower(), nuclearDataIO.ISOTXS.read2D(), nuclearDataIO.SPECTR.read2D()

_rwFluxMoments3D(contents)[source]

Read/write multigroup flux moments from the NHFLUX 3D block (file control).

This reads/writes all 5 planar moments for each DIF3D node on ONE x,y plane. The planar moments for DIF3D nodes on different x,y planes (different axial slices) are in a different 3D record.

Format is ((FLUX(I,J),I=1,NMOM),J=1,NINTXY) so we must pass in NINTXY as the first item in the shape. However, the caller of this method wants the shape to be (nintxy, nMom) so we actually have to transpose it on the way in/out.

_rwHexPartialCurrents4D(surfCurrents, externalSurfCurrents)[source]

Read/write multigroup hexagonal/laterial partial currents from the NHFLUX 4D block (file control).

This reads all OUTGOING partial currents for all assembly block lateral surfaces at a fixed axial position. There are 6 surfaces per assembly axial block. The 2 axial surfaces of each block are in the 5D records.

Each 4D record contains all the hex surface (6 per assembly) partial currents on ONE x,y plane. The hex surface data on different x,y planes (different axial slices) are in a different 4D record.

NHFLUX contains only the 6 OUTGOING partial currents for each hex assembly. To obtain INCOMING partial currents and to construct NET currents, one must find the OUTGOING partial currents on the hex nearest neighbors (this is done in fluxRecon, not in nuclearDataIO.NHFLUX).

If the reactor contains N hex assemblies and M exterior hex surfaces (surfaces adjacent to vacuum boundary), this record will contain N*6 + M partial currents. The N*6 assembly OUTGOING partial currents are listed first, followed by the M INCOMING partial currents from the outer reactor edge.

N = self._metadata[‘nintxy’] M = self._metadata[‘npcxy’] - self._metadata[‘nintxy’]*6 N*6 + M = self._metadata[‘npcxy’]

Notes

These data are harder to read with rwMatrix, though it could be done if we discarded the unwanted data at another level if that is much faster.

_rwZPartialCurrents5D(surfCurrents)[source]

Read/write multigroup axial partial currents from the NHFLUX 5D block (file control).

All other NHFLUX data is indexed by DIF3D node (each axial core slice in its own record). HOWEVER, “top” and “bottom” surfaces of each DIF3D node are indexed by axial surface. If there are Z axial nodes, then there are Z+1 axial surfaces. Thus, there are Z+1 5D records, while there are only Z 3D and Z 4D records.

Each 5D record (each axial surface) contains two partial currents for each assembly position. The first is the UPWARD partial current, while the second is the DOWNWARD partial current. These are assigned to specific ARMI blocks in fluxRecon.computePinMGFluxAndPower.

Returns

surfCurrents – This contains all the upward and downward partial currents in all assemblies on ONE whole-core axial slice. The hex assemblies are ordered according to self.geodstCoordMap.

Return type

2-D list of float

See also

nuclearDataIO.NHFLUX.readBasicFileData1D(), nuclearDataIO.NHFLUX.readGeodstCoordMap2D(), fluxRecon.computePinMGFluxAndPower(), nuclearDataIO.ISOTXS.read5D()

_getEnergyGroupIndex(g)[source]

Real fluxes stored in NHFLUX have “normal” (or “forward”) energy groups. Also see the subclass method NAFLUX.getEnergyGroupIndex().

class armi.nuclearDataIO.cccc.nhflux.NafluxStream(data: armi.nuclearDataIO.cccc.cccc.DataContainer, fileName: str, fileMode: str)[source]

Bases: armi.nuclearDataIO.cccc.nhflux.NhfluxStream

NAFLUX is similar in format to the NHFLUX, but contains adjoint flux.

It has reversed energy group ordering.

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.

_getEnergyGroupIndex(g)[source]

Adjoint fluxes stored in NAFLUX have “reversed” (or “backward”) energy groups.

class armi.nuclearDataIO.cccc.nhflux.NhfluxStreamVariant(data: armi.nuclearDataIO.cccc.cccc.DataContainer, fileName: str, fileMode: str)[source]

Bases: armi.nuclearDataIO.cccc.nhflux.NhfluxStream

Stream for VARIANT version of NHFLUX.

Notes

Can be deleted after have the NHFLUX data container be the public interface

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.

static _getDataContainer() → armi.nuclearDataIO.cccc.nhflux.NHFLUX[source]
class armi.nuclearDataIO.cccc.nhflux.NafluxStreamVariant(data: armi.nuclearDataIO.cccc.cccc.DataContainer, fileName: str, fileMode: str)[source]

Bases: armi.nuclearDataIO.cccc.nhflux.NafluxStream

Stream for VARIANT version of NAFLUX.

Notes

Can be deleted after have the NHFLUX data container be the public interface

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.

static _getDataContainer() → armi.nuclearDataIO.cccc.nhflux.NHFLUX[source]
armi.nuclearDataIO.cccc.nhflux.getNhfluxReader(adjointFlag, variantFlag)[source]

Returns the appropriate DIF3D nodal flux binary file reader class, either NHFLUX (real) or NAFLUX (adjoint).