armi.reactor.reactors module¶
Reactor objects represent the highest level in the hierarchy of structures that compose the system to be modeled. Core objects represent collections of assemblies.
Core is a high-level object in the data model in ARMI. They contain assemblies which in turn contain more refinement in representing the physical reactor. The reactor is the owner of many of the plant-wide state variables such as keff, cycle, and node.
The Reactor contains a Core, which contains a heirachical collection of Assemblies, which in turn each contain a collection of Blocks. |
- class armi.reactor.reactors.Reactor(name, blueprints)[source]¶
Bases:
armi.reactor.composites.Composite
Top level of the composite structure, potentially representing all components in a reactor.
This class contains the core and any ex-core structures that are to be represented in the ARMI model. Historically, the Reactor contained only the core. To support better representation of ex-core structures, the old Reactor functionality was moved to the newer Core class, which has a Reactor parent.
- pDefs = <armi.reactor.parameters.parameterDefinitions.ParameterDefinitionCollection object>¶
- paramCollectionType¶
alias of
armi.reactor.parameters.parameterCollections.ReactorParameterCollection
- armi.reactor.reactors.factory(cs, bp, geom: Optional[armi.reactor.systemLayoutInput.SystemLayoutInput] = None)[source]¶
Build a reactor from input settings, blueprints and geometry.
- class armi.reactor.reactors.Core(name)[source]¶
Bases:
armi.reactor.composites.Composite
Reactor structure made up of assemblies. Could be a Core, spent fuel pool, reactor head, etc.
This has the bulk of the data management operations.
- Variables
Initialize the reactor object.
- Parameters
name (str) – Name of the object. Flags will inherit from this.
- pDefs = <armi.reactor.parameters.parameterDefinitions.ParameterDefinitionCollection object>¶
- property r¶
- property symmetry: armi.reactor.geometry.SymmetryType¶
- property geomType: armi.reactor.geometry.GeomType¶
- property powerMultiplier¶
Symmetry factor for this model. 1 for full core, 3 for 1/3 core, etc.
Notes
This should not be a state variable because it just reflects the current geometry. It changes automatically if the symmetry changes (e.g. from a geometry conversion).
- property lib: Optional[armi.nuclearDataIO.xsLibraries.IsotxsLibrary]¶
Return the microscopic cross section library if one exists.
If there is a library currently associated with the core, it will be returned
Otherwise, an
ISOTXS
file will be searched for in the working directory, opened asISOTXS
object and returned.Finally, if no
ISOTXS
file exists in the working directory, a None will be returned.
- property isFullCore¶
Return True if reactor is full core, otherwise False.
- property refAssem¶
Return the “reference” assembly for this Core.
The reference assembly is defined as the center-most assembly with a FUEL flag, if any are present, or the center-most of any assembly otherwise.
Warning
The convenience of this property should be weighed against it’s somewhat arbitrary nature for any particular client. The center-most fueled assembly is not particularly representative of the state of the core as a whole.
- summarizeReactorStats()[source]¶
Writes a summary of the reactor to check the mass and volume of all of the blocks.
- locateAllAssemblies()[source]¶
Store the current location of all assemblies.
This is required for shuffle printouts, repeat shuffling, and MCNP shuffling.
- removeAssembly(a1, discharge=True)[source]¶
Takes an assembly and puts it out of core.
- Parameters
a1 (assembly) – The assembly to remove
discharge (bool, optional) – Discharge the assembly, including adding it to the SFP. Default: True
Notes
Please expect this method will delete your assembly (instead of moving it to a Spent Fuel Pool) unless you set the
trackAssems
to True in your settings file.Originally, this held onto all assemblies in the spend fuel pool. However, having this sitting in memory becomes constraining for large simulations. It is more memory-efficient to only save the assemblies that are required for detailed history tracking. In fact, there’s no need to save the assembly object at all, just have the history interface save the relevant parameters.
See also
add
adds an assembly
- removeAssembliesInRing(ringNum, overrideCircularRingMode=False)[source]¶
Removes all of the assemblies in a given ring
- Parameters
See also
getAssembliesInRing
definition of a ring
- removeAllAssemblies(discharge=True)[source]¶
Clears the core.
Notes
must clear auxiliary bookkeeping lists as well or else a regeneration step will auto-add assemblies back in.
- add(a, spatialLocator=None)[source]¶
Adds an assembly to the reactor.
An object must be added before it is placed in a particular cell in the reactor’s spatialGrid. When an object is added to a reactor it get placed in a generic location at the center of the reactor unless a spatialLocator is passed in as well.
- Parameters
a (ArmiObject) – The object to add to the reactor
spatialLocator (SpatialLocator object, optional) – The location in the reactor to add the new object to. Must be unoccupied.
See also
removeAssembly
removes an assembly
- genAssembliesAddedThisCycle()[source]¶
Yield the assemblies that have been added in the current cycle.
This uses the reactor’s cycle parameter and the assemblies’ chargeCycle parameters.
- getNumRings(indexBased=False)[source]¶
Returns the number of rings in this reactor. Based on location so indexing will start at 1.
WARNING: If you loop through range(maxRing) then ring+1 is the one you want!!
- Parameters
indexBased (bool, optional) – If true, will force location-index interpretation, even if “circular shuffling” is enabled.
activated (When circular ring shuffling is) –
interpretation. (Developers plan on making this another method for the secondary) –
interpretation. –
- getNumHexRings()[source]¶
Returns the number of hex rings in this reactor. Based on location so indexing will start at 1.
- getNumAssembliesWithAllRingsFilledOut(nRings)[source]¶
Returns nAssmWithBlanks (see description immediately below).
- getNumEnergyGroups()[source]¶
Return the number of energy groups used in the problem
See also
armi.nuclearDataIO.ISOTXS.read1D
reads the number of energy groups off the ISOTXS library.
- countBlocksWithFlags(blockTypeSpec, assemTypeSpec=None)[source]¶
Return the total number of blocks in an assembly in the reactor that meets the specified type
- Parameters
blockTypeSpec (Flags or list of Flags) – The types of blocks to be counted in a single assembly
assemTypeSpec (Flags or list of Flags) – The types of assemblies that are to be examine for the blockTypes of interest. None is every assembly
- Returns
maxBlocks – The maximum number of blocks of the specified types in a single assembly in the entire core
- Return type
- countFuelAxialBlocks()[source]¶
return the maximum number of fuel type blocks in any assembly in the reactor
See also
- getFirstFuelBlockAxialNode()[source]¶
Determine the offset of the fuel from the grid plate in the assembly with the lowest fuel block.
This assembly will dictate at what block level the SASSYS reactivity coefficients will start to be generated
- getAssembliesInRing(ring, typeSpec=None, exactType=False, exclusions=None, overrideCircularRingMode=False)[source]¶
Returns the assemblies in a specified ring. Definitions of rings can change with problem parameters.
This function acts as a switch between two separate functions that define what a ring is based on a cs setting ‘circularRingMode’
- Parameters
ring (int) – The ring number
typeSpec (str, list) – a string or list of assembly types of interest
exactType (bool) – flag to match the assembly type exactly
exclusions (list of assemblies) – list of assemblies that are not to be considered
overrideCircularRingMode (bool, optional) – False ~ default: use circular/square/hex rings, just as the reactor defines them True ~ If you know you don’t want to use the circular ring mode, and instead want square or hex.
- Returns
aList – A list of assemblies that match the criteria within the ring
- Return type
list of assemblies
- getMaxAssembliesInHexRing(ring, fullCore=False)[source]¶
Returns the maximum number of assemblies possible for a given Hexagonal ring.
ring - The ring of interest to calculate the maximum number of assemblies. numEdgeAssems - The number of edge assemblies in the reactor model (1/3 core).
Notes
Assumes that odd rings do not have an edge assembly in third core geometry. These should be removed in: self._modifyGeometryAfterLoad during importGeom
- getAssembliesInSquareOrHexRing(ring, typeSpec=None, exactType=False, exclusions=None)[source]¶
Returns the assemblies in a specified ring. Definitions of rings can change with problem parameters
- Parameters
- Returns
assems – A list of assemblies that match the criteria within the ring
- Return type
list of assemblies
- getAssembliesInCircularRing(ring, typeSpec=None, exactType=False, exclusions=None)[source]¶
Gets an assemblies within a circular range of the center of the core. This function allows for more circular styled assembly shuffling instead of the current hex approach.
- Parameters
- Returns
assems – A list of assemblies that match the criteria within the ring
- Return type
list of assemblies
- buildCircularRingDictionary(ringPitch=1.0)[source]¶
Builds a dictionary of all circular rings in the core. This is required information for getAssembliesInCircularRing.
The purpose of this function is to allow for more circular core shuffling in the hex design.
- Parameters
ringPitch (float, optional) – The relative pitch that should be used to define the spacing between each ring.
- getAssemblyByName(name)[source]¶
Find the assembly that has this name.
- Parameters
name (str) – the assembly name e.g. ‘A0001’
- Return type
assembly
See also
getAssembly
more general version of this method
- getAssemblies(typeSpec=None, sortKey=None, includeBolAssems=False, includeSFP=False, includeAll=False, zones=None, exact=False)[source]¶
Return a list of all the assemblies in the reactor.
Assemblies from the Core itself are sorted based on the Assemblies’ comparison operators (location-based). This is done so that two reactors with physically identical properties are more likely to behave similarly when their assemblies may have been added in different orders. In the future this will likely be replaced by sorting the _children list itself internally, as there is still opportunity for inconsistencies.
- Parameters
typeSpec (Flags or iterable of Flags, optional) – List of assembly types that will be returned
sortKey (callable, optional) – Sort predicate to use when sorting the assemblies.
includeBolAssems (bool, optional) – Include the BOL assemblies as well as the ones that are in the core. Default: False
includeSFP (bool, optional) – Include assemblies in the SFP
includeAll (bool, optional) – Will include ALL assemblies.
zones (str or iterable, optional) – Only include assemblies that are in this zone/these zones
Notes
Attempts have been made to make this a generator but there were some Cython incompatibilities that we could not get around and so we are sticking with a list.
- getNozzleTypes()[source]¶
Get a dictionary of all of the assembly ``nozzleType``s in the core.
- Returns
nozzles – A dictionary of
{nozzleType: nozzleID}
pairs, where the nozzleIDs are numbers corresponding to the alphabetical order of thenozzleType
names.- Return type
Notes
Getting the
nozzleID
by alphabetical order could cause a problem if a newnozzleType
is added during a run. This problem should not occur with theincludeBolAssems=True
argument provided.
- getBlockByName(name)[source]¶
Finds a block based on its name.
- Parameters
name (str) – Block name e.g. A0001A
- Returns
Block
- Return type
the block with the name
Notes
The blocksByName structure must be up to date for this to work properly.
- genBlocksByLocName()[source]¶
If self.blocksByLocName is deleted, then this will regenerate it or update it if things change
- getBlocks(bType=None, **kwargs)[source]¶
Returns an iterator over all blocks in the reactor in order
- Parameters
bType (list or Flags, optional) – Restrict results to a specific block type such as Flags.FUEL, Flags.SHIELD, etc.
includeBolAssems (bool, optional) – Include the BOL-Assembly blocks as well. These blocks are created at BOL and used to create new assemblies, etc. If true, the blocks in these assemblies will be returned as well as the ones in the reactor.
kwargs (dict) – Any keyword argument from R.getAssemblies()
- Returns
blocks – all blocks in the reactor (or of type requested)
- Return type
iterator
See also
getAssemblies
locates the assemblies in the search
- getFirstBlock(blockType=None, exact=False)[source]¶
Return the first block of the requested type in the reactor, or return first block. exact=True will only match fuel, not testfuel, for example.
- Parameters
blockType (Flags, optional) – The type of block to return
exact (bool, optional) – Requires an exact match on blockType
- Returns
b
- Return type
Block object (or None if no such block exists)
- getFirstAssembly(typeSpec=None, exact=False)[source]¶
Gets the first assembly in the reactor.
Warning
This function should be used with great care. There are very few circumstances in which one wants the “first” of a given sort of assembly, whichever that may happen to be. Precisely which assembly is returned is sensitive to all sorts of implementation details in Grids, etc., which make the concept of “first” rather slippery. Prefer using some sort of precise logic to pick a specific assembly from the Core.
- Parameters
typeSpec (Flags or iterable of Flags, optional) –
- regenAssemblyLists()[source]¶
If the attribute lists which contain assemblies are deleted (such as by reactors.detachAllAssemblies), then this function will call the other functions to regrow them.
- getNuclideCategories()[source]¶
Categorize nuclides as coolant, fuel and structure.
Notes
This is used to categorize nuclides for Doppler broadening. Control nuclides are treated as structure.
The categories are defined in the following way:
Add nuclides from coolant components to coolantNuclides
Add nuclides from fuel components to fuelNuclides (this may be incomplete, e.g. at BOL there are no fission products)
Add nuclides from all other components to structureNuclides
Since fuelNuclides may be incomplete, add anything else the user wants to model that isn’t already listed in coolantNuclides or structureNuclides.
- Returns
coolantNuclides (set) – set of nuclide names
fuelNuclides (set) – set of nuclide names
structureNuclides (set) – set of nuclide names
- summarizeNuclideCategories()[source]¶
Write summary table of the various nuclide categories within the reactor.
- getLocationContents(locs, assemblyLevel=False, locContents=None)[source]¶
Given a list of locations, this goes through and finds the blocks or assemblies.
- Parameters
locs (list of location objects or strings) – The locations you’d like to find assemblies in
assemblyLevel (bool, optional) – If True, will find assemblies rather than blocks
locContents (dict, optional) – A lookup table with location string keys and block/assembly values useful if you want to call this function many times and would like a speedup.
- Returns
blockList – List of blocks or assemblies that correspond to the locations passed in
- Return type
iterable
Notes
Useful in reading the db.
See also
makeLocationLookup
allows caching to speed this up if you call it a lot.
- makeLocationLookup(assemblyLevel=False)[source]¶
Build a location-keyed lookup table to figure out which block (or assembly, if assemblyLevel=True) is in which location. Used within getLocationContents, but can also be used to pre-build a cache for that function, speeding the lookup with a cache.
See also
getLocationContents
can use this lookup table to go faster.
- getFluxVector(energyOrder=0, adjoint=False, extSrc=False, volumeIntegrated=True)[source]¶
Return the multigroup real or adjoint flux of the entire reactor as a vector
Order of meshes is based on getBlocks
- Parameters
energyOrder (int, optional) –
A value of 0 implies that the flux will have all energy groups for the first mesh point, and then all energy groups for the next mesh point, etc.
A value of 1 implies that the flux will have values for all mesh points of the first energy group first, followed by all mesh points for the second energy group, etc.
adjoint (bool, optional) – If True, will return adjoint flux instead of real flux.
extSrc (bool, optional) – If True, will return external source instead of real flux.
volumeIntegrated (bool, optional) – If true (default), flux units will be #-cm/s. If false, they will be #-cm^2/s
- Returns
vals – The values you requested. length is NxG.
- Return type
- getAssembliesOfType(typeSpec, exactMatch=False)[source]¶
Return a list of assemblies in the core that are of type assemType.
- getAssembly(assemNum=None, locationString=None, assemblyName=None, *args, **kwargs)[source]¶
Finds an assembly in the core.
- Parameters
- Returns
a – The assembly that matches, or None if nothing is found
- Return type
Assembly
See also
getAssemblyByName
,getAssemblyWithStringLocation
getLocationContents
a much more efficient way to look up assemblies in a list of locations
- getAssemblyWithAssemNum(assemNum)[source]¶
Retrieve assembly with a particular assembly number from the core.
- Parameters
assemNum (int) – The assembly number of interest
- Returns
foundAssembly – The assembly found, or None
- Return type
Assembly object or None
- getAssemblyWithStringLocation(locationString)[source]¶
Returns an assembly or none if given a location string like ‘B0014’.
- getAssemblyPitch()[source]¶
Find the assembly pitch for the whole core.
This returns the pitch according to the spatialGrid. To capture any thermal/hydraulic feedback of the core pitch, T/H modules will need to modify the grid pitch directly based on the relevant mechanical assumptions.
- Returns
pitch – The assembly pitch.
- Return type
- findNeighbors(a, showBlanks=True, duplicateAssembliesOnReflectiveBoundary=False)[source]¶
Find assemblies that are next this assembly.
Return a list of neighboring assemblies from the 30 degree point (point 1) then counterclockwise around.
- Parameters
a (Assembly object) – The assembly to find neighbors of.
showBlanks (Boolean, optional) –
If True, the returned array of 6 neighbors will return “None” for neighbors that do not explicitly exist in the 1/3 core model (including many that WOULD exist in a full core model).
If False, the returned array will not include the “None” neighbors. If one or more neighbors does not explicitly exist in the 1/3 core model, the returned array will have a length of less than 6.
duplicateAssembliesOnReflectiveBoundary (Boolean, optional) –
If True, findNeighbors duplicates neighbor assemblies into their “symmetric identicals” so that even assemblies that border symmetry lines will have 6 neighbors. The only assemblies that will have fewer than 6 neighbors are those that border the outer core boundary (usually vacuum).
If False, findNeighbors returns None for assemblies that do not exist in a 1/3 core model (but WOULD exist in a full core model).
For example, applying findNeighbors for the central assembly (ring, pos) = (1, 1) in 1/3 core symmetry (with duplicateAssembliesOnReflectiveBoundary = True) would return a list of 6 assemblies, but those 6 would really only be assemblies (2, 1) and (2, 2) repeated 3 times each.
Note that the value of duplicateAssembliesOnReflectiveBoundary only really if showBlanks = True. This will have no effect if the model is full core since asymmetric models could find many duplicates in the other thirds
Notes
This only works for 1/3 or full core symmetry.
This uses the ‘mcnp’ index map (MCNP GEODST hex coordinates) instead of the standard (ring, pos) map. because neighbors have consistent indices this way. We then convert over to (ring, pos) using the lookup table that a reactor has.
- Returns
neighbors – This is a list of “nearest neighbors” to assembly a.
If showBlanks = False, it will return fewer than 6 neighbors if not all 6 neighbors explicitly exist in the core model.
If showBlanks = True and duplicateAssembliesOnReflectiveBoundary = False, it will have a “None” for assemblies that do not exist in the 1/3 model.
If showBlanks = True and duplicateAssembliesOnReflectiveBoundary = True, it will return the existing “symmetric identical” assembly of a non-existing assembly. It will only return “None” for an assembly when that assembly is non-existing AND has no existing “symmetric identical”.
- Return type
list of assembly objects
See also
grids.Grid.getSymmetricEquivalents
- setMoveList(cycle, oldLoc, newLoc, enrichList, assemblyType, assemName)[source]¶
Tracks the movements in terms of locations and enrichments.
- createFreshFeed()[source]¶
Creates a new feed assembly.
See also
createAssemblyOfType
creates an assembly
Notes
createFreshFeed and createAssemblyOfType and this all need to be merged together somehow.
- createAssemblyOfType(assemType=None, enrichList=None, cs=None)[source]¶
Create an assembly of a specific type and apply enrichments if they are specified
- Parameters
- Returns
a – A new assembly
- Return type
Assembly
Notes
This and similar fuel shuffle-enabling functionality on the Core are responsible for coupling between the Core and Blueprints. Technically, it should not be required to involve Blueprints at all in the construction of a Reactor model. Therefore in some circumstances, this function will not work. Ultimately, this should be purely the domain of blueprints themselves, and may be migrated out of Core in the future.
See also
armi.fuelHandler.doRepeatShuffle
uses this to repeat shuffling
- getAssembliesOnSymmetryLine(symmetryLineID)[source]¶
Find assemblies that are on a symmetry line in a symmetric core.
- findAllMeshPoints(assems=None, applySubMesh=True)[source]¶
Return all mesh positions in core including both endpoints.
- Parameters
- Returns
meshVals – ((i-vals), (j-vals,), (k-vals,))
- Return type
See also
armi.reactor.assemblies.Assembly.getAxialMesh
get block mesh
Notes
These include all mesh points, not just block boundaries. There may be multiple mesh points per block.
If a large block with multiple mesh points is in the same core as arbitrarily-expanded fuel blocks from fuel performance, an imbalanced axial mesh may result.
There is a challenge with TRZ blocks because we need the mesh centroid in terms of RZT, not XYZ
- findAllAxialMeshPoints(assems=None, applySubMesh=True)[source]¶
Return a list of all z-mesh positions in the core including zero and the top.
- updateAxialMesh()[source]¶
Update axial mesh based on perturbed meshes of the assemblies that are linked to the ref assem.
Notes
While processLoading finds all axial mesh points, this method only updates the values of the known mesh with the current assembly heights. This does not change the number of mesh points.
If
detailedAxialExpansion
is active, the global axial mesh param still only tracks the refAssem. Otherwise, thousands upon thousands of mesh points would get created.See also
processLoading
sets up the primary mesh that this perturbs.
- findAxialMeshIndexOf(heightCm)[source]¶
Return the axial index of the axial node corresponding to this height.
If the height lies on the boundary between two nodes, the lower node index is returned.
- addMoreNodes(meshList)[source]¶
Add additional mesh points in the the meshList so that the ratio of mesh sizes does not vary too fast.
- findAllAziMeshPoints(extraAssems=None, applySubMesh=True)[source]¶
returns a list of all azimuthal (theta)-mesh positions in the core.
- findAllRadMeshPoints(extraAssems=None, applySubMesh=True)[source]¶
Return a list of all radial-mesh positions in the core.
- getMinimumPercentFluxInFuel(target=0.005)[source]¶
Goes through the entire reactor to determine what percentage of flux occures at each ring. Starting with the outer ring, this function helps determine the effective size of the core where additional assemblies will not help the breeding in the TWR.
- getAvgTemp(typeSpec, blockList=None, flux2Weight=False)[source]¶
get the volume-average fuel, cladding, coolant temperature in core
- Parameters
typeSpec (Flags or list of Flags) – Component types to consider. If typeSpec is a list, then you get the volume average temperature of all components. For instance, getAvgTemp([Flags.CLAD, Flags.WIRE, Flags.DUCT]) returns the avg. structure temperature.
blockList (list, optional) – Blocks to consider. If None, all blocks in core will be considered
flux2Weight (bool, optional) – If true, will weight temperature against flux**2
- Returns
avgTemp – The average temperature in C.
- Return type
- getAllNuclidesIn(mats)[source]¶
Find all nuclides that are present in these materials anywhere in the core.
- Parameters
mats (iterable or Material) – List (or single) of materials to scan the full core for, accumulating a nuclide list
- Returns
allNucNames – All nuclide names in this material anywhere in the reactor
- Return type
See also
getDominantMaterial
finds the most prevalent material in a certain type of blocks
Block.adjustDensity
modifies nuclides in a block
Notes
If you need to know the nuclides in a fuel pin, you can’t just use the sample returned from getDominantMaterial, because it may be a fresh fuel material (U and Zr) even though there are burned materials elsewhere (with U, Zr, Pu, LFP, etc.).
- growToFullCore(cs)[source]¶
copies symmetric assemblies to build a full core model out of a 1/3 core model
- Returns
converter – Geometry converter used to do the conversion.
- Return type
GeometryConverter
- calcBlockMaxes()[source]¶
searches all blocks for maximum values of key params
See also
armi.physics.optimize.OptimizationInterface.interactBOL
handles these maxes in optimization cases
- getFuelBottomHeight()[source]¶
Obtain the height of the lowest fuel in the core.
This is the “axial coordinate shift” between ARMI and SASSYS. While ARMI sets z=0 at the bottom of the lowest block (usually the grid plate), SASSYS sets z=0 at the bottom of the fuel.
- Returns
lowestFuelHeightInCm – The height (cm) of the lowest fuel in this core model.
- Return type
- paramCollectionType¶
alias of
armi.reactor.parameters.parameterCollections.CoreParameterCollection
- processLoading(cs, dbLoad: bool = False)[source]¶
After nuclide densities are loaded, this goes through and prepares the reactor.
Notes
- This does a few operations :
It process boosters,
sets axial snap lists,
checks the geometry,
sets up location tables ( tracks where the initial feeds were (for moderation or something)
See also
updateAxialMesh
Perturbs the axial mesh originally set up here.