armi.physics.neutronics.latticePhysics.latticePhysicsInterface module

” Lattice Physics Interface

Parent classes for codes responsible for generating broad-group cross sections

armi.physics.neutronics.latticePhysics.latticePhysicsInterface.setBlockNeutronVelocities(r, neutronVelocities)[source]

Set the mgNeutronVelocity parameter for each block using the neutronVelocities dictionary data.

Parameters

neutronVelocities (dict) – Dictionary that is keyed with the representativeBlock XS IDs with values of multigroup neutron velocity data computed by MC2.

Raises

ValueError – Multi-group neutron velocities was not computed during the cross section calculation.

class armi.physics.neutronics.latticePhysics.latticePhysicsInterface.LatticePhysicsInterface(r, cs)[source]

Bases: armi.interfaces.Interface

Class for interacting with lattice physics codes.

Construct an interface.

The r and cs arguments are required, but may be None, where appropriate for the specific Interface implementation.

Parameters
  • r (Reactor) – A reactor to attach to

  • cs (Settings) – Settings object to use

Raises

RuntimeError – Interfaces derived from Interface must define their name

function = 'latticePhysics'
_getExecutablePath()[source]
interactBOC(**kwargs)
updateXSLibrary(cycle)[source]

Update the current XS library, either by creating or reloading one.

Parameters

cycle (int) – The cycle that is being processed. Used to name the library.

See also

computeCrossSections()

run lattice physics on the current reactor state no matter weather needed or not.

_renameExistingLibrariesForCycle(cycle)[source]

Copy the existing neutron and/or gamma libraries into cycle-dependent files.

_checkInputs()[source]
readExistingXSLibraries(cycle)[source]
makeCycleXSFilesAsBaseFiles(cycle)[source]
static _copyLibraryFilesForCycle(cycle, libFiles)[source]
_readGammaBinaries(lib, gamisoFileName, pmatrxFileName)[source]
_writeGammaBinaries(lib, gamisoFileName, pmatrxFileName)[source]
_getSuffix(cycle)[source]
interactCoupled(iteration)[source]

Runs on secondary coupled iterations.

After a coupled iteration, the cross sections need to be regenerated. This will bring in the spectral effects of changes in densities, as well as changes in Doppler.

Parameters

iteration (int) – This is unused since cross sections are generated on a per-cycle basis.

clearXS()[source]
interactEOC(cycle=None)[source]

Interact at the end of a cycle.

Force updating cross sections at the start of the next cycle.

computeCrossSections(baseList=None, forceSerial=False, xsLibrarySuffix='', blockList=None)[source]

Prepare a batch of inputs, execute them, and store results on reactor library.

Parameters
  • baseList (list) – a user-specified set of bases that will be run instead of calculating all of them

  • forceSerial (bool, optional) – Will run on 1 processor in sequence instead of on many in parallel Useful for optimization/batch runs where every processor is on a different branch

  • xsLibrarySuffix (str, optional) – A book-keeping suffix used in Doppler calculations

  • blockList (list, optional) – List of blocks for which to generate cross sections. If None, representative blocks will be determined

_generateXsLibrary(baseList, forceSerial, xsLibrarySuffix, blockList, writers=None, purgeFP=True)[source]
_executeLatticePhysicsCalculation(returnedFromWriters, forceSerial)[source]
generateLatticePhysicsInputs(baseList, xsLibrarySuffix, blockList, xsWriters=None)[source]

Write input files for the generation of cross section libraries.

Parameters
  • baseList (list) – A list of cross-section id strings (e.g. AA, BC) that will be generated. Default: all in reactor

  • xsLibrarySuffix (str) – A suffix added to the end of the XS file names such as ‘voided’ for voided XS. Default: Empty

  • blockList (list) – The blocks to write inputs for.

  • xsWriters (list, optional) – The specified writers to write the input files

Returns

returnedFromWriters – A list of what this specific writer instance returns for each representative block. It is the responsibility of the subclassed interface to implement. In many cases, it is the executing agent.

Return type

list

See also

terrapower.physics.neutronics.mc2.mc2Writers.Mc2V2Writer.write(), armi.physics.neutronics.latticePhysics.serpentWriters.SerpentWriter.write()

getWriters(representativeBlock, xsLibrarySuffix, writers=None)[source]

Return valid lattice physics writer subclass(es).

Parameters
  • representativeBlock (Block) – A representative block object that can be created from a block collection.

  • xsLibrarySuffix (str) – A suffix added to the end of the XS file names such as ‘voided’ for voided XS. Default: Empty

  • writers (list of lattice physics writer objects, optional) – If the writers are known, they can be provided and constructed.

Returns

writers – A list of writers for the provided representative block.

Return type

list

_getGeomDependentWriters(representativeBlock, xsID, geom, xsLibrarySuffix)[source]
getReader()[source]
_newLibraryShouldBeCreated(cycle, representativeBlockList, xsIDs)[source]

Determines whether the cross section generator should be executed at this cycle.

Criteria include:

  1. genXS setting is turned on

  2. We are beyond any requested skipCycles (restart cycles)

  3. The blocks have changed burnup beyond the burnup threshold

  4. Lattice physics kernel (e.g. MC2) hasn’t already been executed for this cycle (possible if it runs during fuel handling)

_checkBurnupThresholds(blockList)[source]

Check to see if burnup has changed meaningfully.

If there are, then the xs sets should be regenerated. Otherwise then go ahead and skip xs generation.

This is motivated by the idea that during very long explicit equilibrium runs, it might save time to turn off xs generation at a certain point.

Parameters

blockList (iterable) – List of all blocks to examine

Returns

idsChangedBurnup – flag regarding whether or not burnup changed substantially

Return type

bool

_getProcessesPerNode()[source]
getRepresentativeBlocks()[source]

Return a list of all blocks in the problem.

_getBlocksAndXsIds()[source]

Return blocks and their xsIds.

updatePhysicsCouplingControl()[source]

Disable XS update in equilibrium cases after a while.

Notes

This is only relevant for equilibrium cases. We have to turn off XS updates after several cyclics or else the number densities will never converge.