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'

The function performed by an Interface. This is not required be be defined by implementations of Interface, but is used to form categories of interfaces.

interactBOC(**kwargs)

Called at the beginning of each cycle.

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.

readExistingXSLibraries(cycle)[source]
makeCycleXSFilesAsBaseFiles(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

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

getReader()[source]
getRepresentativeBlocks()[source]

Return a list of all blocks in the problem.

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.