armi.reactor.composites module

This module contains the basic composite pattern underlying the reactor package.

This follows the principles of the Composite Design Pattern to allow the construction of a part/whole hierarchy representing a physical nuclear reactor. The composite objects act somewhat like lists: they can be indexed, iterated over, appended, extended, inserted, etc. Each member of the hierarchy knows its children and its parent, so full access to the hierarchy is available from everywhere. This design was chosen because of the close analogy of the model to the physical nature of nuclear reactors.

These objects are mostly abstract and users should use their subclasses (e.g. armi.reactor.blocks.Block) in most cases.

Warning

Because each member of the hierarchy is linked to the entire tree, it is often unsafe to save references to individual members; it can cause large and unexpected memory inefficiencies.

See Also: Developer Guide.

class armi.reactor.composites.CompositeModelType[source]

Bases: armi.reactor.parameters.resolveCollections.ResolveParametersMeta

Metaclass for tracking subclasses of ArmiObject subclasses.

It is often useful to have an easily-accessible collection of all classes that participate in the ARMI composite reactor model. This metaclass maintains a collection of all defined subclasses, called TYPES.

TYPES = {'Alloy200': <class 'armi.materials.alloy200.Alloy200'>, 'ArmiObject': <class 'armi.reactor.composites.ArmiObject'>, 'Assembly': <class 'armi.reactor.assemblies.Assembly'>, 'AssemblyList': <class 'armi.reactor.assemblyLists.AssemblyList'>, 'B4C': <class 'armi.materials.b4c.B4C'>, 'Batch': <class 'armi.reactor.batch.Batch'>, 'Be9': <class 'armi.materials.be9.Be9'>, 'Block': <class 'armi.reactor.blocks.Block'>, 'CaH2': <class 'armi.materials.caH2.CaH2'>, 'Californium': <class 'armi.materials.californium.Californium'>, 'CartesianAssembly': <class 'armi.reactor.assemblies.CartesianAssembly'>, 'CartesianBlock': <class 'armi.reactor.blocks.CartesianBlock'>, 'ChargedFuelPool': <class 'armi.reactor.assemblyLists.ChargedFuelPool'>, 'Circle': <class 'armi.reactor.components.basicShapes.Circle'>, 'Component': <class 'armi.reactor.components.component.Component'>, 'Composite': <class 'armi.reactor.composites.Composite'>, 'Concrete': <class 'armi.materials.concrete.Concrete'>, 'Core': <class 'armi.reactor.reactors.Core'>, 'Cs': <class 'armi.materials.cs.Cs'>, 'Cu': <class 'armi.materials.copper.Cu'>, 'Cube': <class 'armi.reactor.components.volumetricShapes.Cube'>, 'Custom': <class 'armi.materials.custom.Custom'>, 'DerivedShape': <class 'armi.reactor.components.shapes.DerivedShape'>, 'DifferentialRadialSegment': <class 'armi.reactor.components.volumetricShapes.DifferentialRadialSegment'>, 'Fluid': <class 'armi.materials.material.Fluid'>, 'Graphite': <class 'armi.materials.graphite.Graphite'>, 'HT9': <class 'armi.materials.ht9.HT9'>, 'Hafnium': <class 'armi.materials.hafnium.Hafnium'>, 'HastelloyN': <class 'armi.materials.hastelloyN.HastelloyN'>, 'Helix': <class 'armi.reactor.components.basicShapes.Helix'>, 'HexAssembly': <class 'armi.reactor.assemblies.HexAssembly'>, 'HexBlock': <class 'armi.reactor.blocks.HexBlock'>, 'Hexagon': <class 'armi.reactor.components.basicShapes.Hexagon'>, 'Inconel': <class 'armi.materials.inconel.Inconel'>, 'Inconel600': <class 'armi.materials.inconel600.Inconel600'>, 'Inconel625': <class 'armi.materials.inconel625.Inconel625'>, 'Inconel800': <class 'armi.materials.inconel800.Inconel800'>, 'InconelPE16': <class 'armi.materials.inconelPE16.InconelPE16'>, 'InconelX750': <class 'armi.materials.inconelX750.InconelX750'>, 'Lead': <class 'armi.materials.lead.Lead'>, 'LeadBismuth': <class 'armi.materials.leadBismuth.LeadBismuth'>, 'Leaf': <class 'armi.reactor.composites.Leaf'>, 'Lithium': <class 'armi.materials.lithium.Lithium'>, 'MOX': <class 'armi.materials.mox.MOX'>, 'Magnesium': <class 'armi.materials.magnesium.Magnesium'>, 'Material': <class 'armi.materials.material.Material'>, 'MgO': <class 'armi.materials.mgO.MgO'>, 'Molybdenum': <class 'armi.materials.molybdenum.Molybdenum'>, 'NZ': <class 'armi.materials.nZ.NZ'>, 'NaCl': <class 'armi.materials.sodiumChloride.NaCl'>, 'NullComponent': <class 'armi.reactor.components.shapes.NullComponent'>, 'Point': <class 'armi.reactor.blocks.Point'>, 'PositiveOrNegativeVolumeComponent': <class 'armi.reactor.components.shapes.PositiveOrNegativeVolumeComponent'>, 'Potassium': <class 'armi.materials.potassium.Potassium'>, 'RZAssembly': <class 'armi.reactor.assemblies.RZAssembly'>, 'RadialSegment': <class 'armi.reactor.components.volumetricShapes.RadialSegment'>, 'Reactor': <class 'armi.reactor.reactors.Reactor'>, 'Rectangle': <class 'armi.reactor.components.basicShapes.Rectangle'>, 'SaturatedSteam': <class 'armi.materials.water.SaturatedSteam'>, 'SaturatedWater': <class 'armi.materials.water.SaturatedWater'>, 'Sc2O3': <class 'armi.materials.scandiumOxide.Sc2O3'>, 'ShapedComponent': <class 'armi.reactor.components.shapes.ShapedComponent'>, 'ShieldBlock': <class 'armi.reactor.components.basicShapes.ShieldBlock'>, 'SiC': <class 'armi.materials.siC.SiC'>, 'Sodium': <class 'armi.materials.sodium.Sodium'>, 'SolidRectangle': <class 'armi.reactor.components.basicShapes.SolidRectangle'>, 'SpentFuelPool': <class 'armi.reactor.assemblyLists.SpentFuelPool'>, 'Sphere': <class 'armi.reactor.components.volumetricShapes.Sphere'>, 'Square': <class 'armi.reactor.components.basicShapes.Square'>, 'Sulfur': <class 'armi.materials.sulfur.Sulfur'>, 'TZM': <class 'armi.materials.tZM.TZM'>, 'Tantalum': <class 'armi.materials.tantalum.Tantalum'>, 'ThRZAssembly': <class 'armi.reactor.assemblies.ThRZAssembly'>, 'ThRZBlock': <class 'armi.reactor.blocks.ThRZBlock'>, 'ThU': <class 'armi.materials.thU.ThU'>, 'Thorium': <class 'armi.materials.thorium.Thorium'>, 'ThoriumOxide': <class 'armi.materials.thoriumOxide.ThoriumOxide'>, 'Torus': <class 'armi.reactor.components.volumetricShapes.Torus'>, 'Triangle': <class 'armi.reactor.components.basicShapes.Triangle'>, 'UO2': <class 'armi.materials.uraniumOxide.UO2'>, 'UThZr': <class 'armi.materials.uThZr.UThZr'>, 'UZr': <class 'armi.materials.uZr.UZr'>, 'UnshapedComponent': <class 'armi.reactor.components.shapes.UnshapedComponent'>, 'UnshapedVolumetricComponent': <class 'armi.reactor.components.shapes.UnshapedVolumetricComponent'>, 'Uranium': <class 'armi.materials.uranium.Uranium'>, 'UraniumOxide': <class 'armi.materials.uraniumOxide.UraniumOxide'>, 'Void': <class 'armi.materials.void.Void'>, 'Water': <class 'armi.materials.water.Water'>, 'Y2O3': <class 'armi.materials.yttriumOxide.Y2O3'>, 'ZeroMassComponent': <class 'armi.reactor.components.shapes.ZeroMassComponent'>, 'ZnO': <class 'armi.materials.zincOxide.ZnO'>, 'Zr': <class 'armi.materials.zr.Zr'>}
class armi.reactor.composites.ArmiObject(name)[source]

Bases: object

The abstract base class for all composites and leaves.

This: * declares the interface for objects in the composition * implements default behavior for the interface common to all

classes

  • Declares and interface for accessing and managing child objects

  • Defines an interface for accessing parents.

Called “component” in gang of four, this is an ArmiObject here because the word component was already taken in ARMI.

The armi.reactor.parameters.ResolveParametersMeta metaclass is used to automatically create ParameterCollection subclasses for storing parameters associated with any particular subclass of ArmiObject. Defining a pDefs class attribute in the definition of a subclass of ArmiObject will lead to the creation of a new subclass of py:class:armi.reactor.parameters.ParameterCollection, which will contain the definitions from that class’s pDefs as well as the definitions for all of its parents. A new paramCollectionType class attribute will be added to the ArmiObject subclass to reflect which type of parameter collection should be used.

paramCollectionType

alias of armi.reactor.parameters.parameterCollections.ArmiObjectParameterCollection

pDefs = <armi.reactor.parameters.parameterDefinitions.ParameterDefinitionCollection object>
__lt__(other)[source]

Implement the less-than operator.

Implementing this on the ArmiObject allows most objects, under most circumstances to be sorted. This is useful from the context of the Database classes, so that they can produce a stable layout of the serialized composite structure.

By default, this sorts using the spatial locator, in K, J, I order, which should give a relatively intuitive order. For safety, it makes sure that the objects being sorted live in the same grid, however, since it probably doesn’t make sense to sort things across containers or scopes. If this ends up being too restrictive, it can probably be relaxed or overridden on specific classes.

__getstate__()[source]

Python method for reducing data before pickling.

This removes links to parent objects, which allows one to, for example, pickle an assembly without pickling the entire reactor. Likewise, one could MPI_COMM.bcast an assembly without broadcasting the entire reactor.

Notes

Special treatment of parent is not enough, since the spatialGrid also contains a reference back to the armiObject. Consequently, the spatialGrid needs to be reassigned in __setstate__.

__setstate__(state)[source]

Sets the state of this ArmiObject.

Notes

This ArmiObject may have lost a reference to its parent. If the parent was also pickled (serialized), then the parent should update the .parent attribute during its own __setstate__. That means within the context of __setstate__ one should not rely upon self.parent.

__bool__()[source]

Flag that says this is non-zero in a boolean context

Notes

The default behavior for not [obj] that has a __len__ defined is to see if the length is zero. However, for these composites, we’d like Assemblies, etc. to be considered non-zero even if they don’t have any blocks. This is important for parent resolution, etc. If one of these objects exists, it is non-zero, regardless of its contents.

__nonzero__()

Flag that says this is non-zero in a boolean context

Notes

The default behavior for not [obj] that has a __len__ defined is to see if the length is zero. However, for these composites, we’d like Assemblies, etc. to be considered non-zero even if they don’t have any blocks. This is important for parent resolution, etc. If one of these objects exists, it is non-zero, regardless of its contents.

__add__(other)[source]

Return a list of all children in this and another object.

duplicate()[source]

Make a clean copy of this object.

Warning

Be careful with inter-object dependencies. If one object contains a reference to another object which contains links to the entire hierarchical tree, memory can fill up rather rapidly. Weak references are designed to help with this problem.

clearCache()[source]

Clear the cache so all new values are recomputed.

copyParamsFrom(other)[source]

Overwrite this object’s params with other object’s

Parameters

other (ArmiObject) – The object to copy params from

updateParamsFrom(new)[source]

Update this object’s params with a new object’s.

Parameters

new (ArmiObject) – The object to copy params from

getChildren(deep=False, generationNum=1, includeMaterials=False)[source]

Return the children of this object.

getChildrenWithFlags(typeSpec, exactMatch=True)[source]

Get all children that have given flags.

doChildrenHaveFlags(typeSpec, deep=False)[source]

Generator that yields True if the next child has given flags.

Parameters

typeSpec (Flags or list of Flags) – Requested type of the child

containsAtLeastOneChildWithFlags(typeSpec)[source]

Return True if any of the children are of a given type.

Parameters

typeSpec (Flags or list of Flags) – Requested type of the children

See also

self.doChildrenHaveFlags(), self.containsOnlyChildrenWithFlags()

containsOnlyChildrenWithFlags(typeSpec)[source]

Return True if all of the children are of a given type.

Parameters

typeSpec (Flags or list of Flags) – Requested type of the children

See also

self.doChildrenHaveFlags(), self.containsAtLeastOneChildWithFlags()

copyParamsToChildren(paramNames)[source]

Copy param values in paramNames to all children.

Parameters

paramNames (list) – List of param names to copy to children

classmethod getParameterCollection()[source]

Return a new instance of the specific ParameterCollection type associated with this object.

This has the same effect as obj.paramCollectionType(). Getting a new instance through a class method like this is useful in situations where the paramCollectionType is not a top-level object and therefore cannot be trivially pickled. Since we know that by the time we want to make any instances of/unpickle a given ArmiObject, such a class attribute will have been created and associated. So, we use this top-level class method to dig dynamically down to the underlying parameter collection type.

getParamNames()[source]

Get a list of block-level parameters keys that are available on this block

Will not have any corner, edge, or timenode dependence.

nameContains(s)[source]

True if s is in this object’s name (eg. nameContains(‘fuel’)==True for ‘testfuel’

Notes

Case insensitive (all gets converted to lower)

getName()[source]
setName(name)[source]
hasFlags(typeID, exact=False)[source]

Determine if this object is of a certain type.

Parameters
  • typeID (Flags, list of Flags or None) – Flags specifying which types of objects are considered valid. If a list is provided, return True if any of the flags in the list match. None matches all objects if exact is false. If exact is true, then None matches no objects.

  • exact (bool, optional) – Require the type of the object to fully match the provided typeID(s)

Returns

hasFlags – True if this block is in the typeID list.

Return type

bool

Notes

Type comparisons use bitwise comparisons using valid flags.

If you have an ‘inner control’ assembly, then this will evaluate true for the INNER | CONTROL flag combination. If you just want all FUEL, simply use FUEL with no additional qualifiers. For more complex comparisons, use bitwise operations.

Always returns true if typeID is none and exact is False, allowing for default parameters to be passed in when the method does not care about the block type. If the typeID is none and exact is True, this will always return False.

Examples

If you have ‘inner driver fuel’, then

>>> obj.getType()
[some integer]
>>> obj.hasFlags(Flags.FUEL)
True
>>> obj.hasFlags(Flags.INNER | Flags.DRIVER | Flags.FUEL)
True
>>> obj.hasFlags(Flags.OUTER | Flags.DRIVER | Flags.FUEL)
False
>>> obj.hasFlags(Flags.INNER | Flags.FUEL)
True
getType()[source]

Return the object type.

setType(typeSpec)[source]

Set the object type.

getVolume()[source]
getVolumeFractions()[source]

Return volume fractions of each child.

Sets volume or area of missing piece (like coolant) if it exists. Caching would be nice here.

Returns

fracs – list of (component, volFrac) tuples

Return type

list

See also

test_block.Block_TestCase.test_consistentAreaWithOverlappingComponents()

Notes

void areas can be negative in gaps between fuel/clad/liner(s), but these negative areas are intended to account for overlapping positive areas to insure the total area of components inside the clad is accurate. see test_block.Block_TestCase.test_consistentAreaWithOverlappingComponents

getVolumeFraction()[source]

Return the volume fraction that this object takes up in its parent.

getMaxArea()[source]

” The maximum area of this object if it were totally full.

getMaxVolume()[source]

The maximum volume of this object if it were totally full.

Returns

vol – volume in cm^3.

Return type

float

getMass(nuclideNames=None)[source]

Determine the mass in grams of nuclide(s) and/or elements in this object.

Parameters

nuclideNames (str, optional) – The nuclide/element specifier to get the mass of in the object. If omitted, total mass is returned.

Returns

mass – The mass in grams.

Return type

float

getMassFrac(nucName)[source]

Get the mass fraction of a nuclide.

Notes

If you need multiple mass fractions, use getMassFracs.

getMicroSuffix()[source]
getMassFracs()[source]

Get mass fractions of all nuclides in object.

Ni [1/cm3] * Ai [g/mole] ~ mass

setMassFrac(nucName, val)[source]

Adjust the composition of this object so the mass fraction of nucName is val.

See also

setMassFracs()

efficiently set multiple mass fractions at the same time.

setMassFracs(massFracs)[source]

Apply one or more adjusted mass fractions.

This will adjust the total mass of the object, as the mass of everything designated will change, while anything else will not.

\[ \begin{align}\begin{aligned}m_i = \frac{M_i}{\sum_j(M_j)}\\(M_{j \ne i} + M_i) m_i = M_i\\\frac{m_i M_{j \ne i}}{1-m_i} = M_i\\\frac{m_i M_{j \ne i}}{V(1-m_i)} = M_i/V = m_i \rho\\N_i = \frac{m_i \rho N_A}{A_i}\\N_i = \frac{m_i M_{j \ne i} N_A}{V (1-m_i) {A_i}}\\\frac{M_{j \ne i}}{V} = m_{j \ne i} \rho\\m_{j \ne i} = 1 - m_i\end{aligned}\end{align} \]

Notes

You can’t just change one mass fraction though, you have scale all others to fill the remaining frac.

Parameters

massFracs (dict) – nucName : new mass fraction pairs.

adjustMassFrac(nuclideToAdjust=None, elementToAdjust=None, nuclideToHoldConstant=None, elementToHoldConstant=None, val=0.0)[source]

Set the initial Zr mass fraction while maintaining Uranium enrichment, but general purpose.

Parameters
  • nuclideToAdjust (str, optional) – The nuclide name to adjust

  • elementToAdjust (str, optional) – The element to adjust. All isotopes in this element will adjust

  • nuclideToHoldconstant (str, optional) – A nuclide to hold constant

  • elementToHoldConstant (str) – Same

  • val (float) – The value to set the adjust mass fraction to be.

Notes

If you use this for two elements one after the other, you will probably get something wrong. For instance, if you have U-10Zr and add Pu at 10% mass fraction, the Zr fraction will drop below 10% of the total. The U-Zr fractions will remain constant though. So this is mostly useful if you have U-10Zr and want to change it to U-5Zr.

Theory:

Mass fraction of each nuclide to be adjusted = Ai where A1+A2+A…+AI = A Mass fraction of nuclides to be held constant = Ci where sum = C Mass fraction of other nuclides is Oi, sum = O new value for A is v

A+C+O = 1.0 A’=v. If A>0, then A’=A*f1=v where f1 = v/A If A=0, then Ai’ = v/len(A), distributing the value evenly among isotopes

Now, to adjust the other nuclides, we know A’+C+O’ = 1.0 , or v+C+O’ = 1.0 So, O’= 1.0-v-C We can scale each Oi evenly by multiplying by the factor f2 Oi’ = Oi * (1-C-v)/O = Oi * f2 where f2= (1-C-v)

Since massFracs is not necessarily normalized, A+C+O actually = self.p.massFracNorm

adjustMassEnrichment(massFraction)[source]

Adjust the enrichment of this object.

If it’s Uranium, enrichment means U-235 fraction. If it’s Boron, enrichment means B-10 fraction, etc.

Parameters

newEnrich (float) – The new enrichment as a fraction.

getNumberDensity(nucName)[source]

Return the number density of a nuclide in atoms/barn-cm.

Notes

This can get called very frequently and has to do volume computations so should use some kind of caching that is invalidated by any temperature, composition, etc. changes. Even with caching the volume calls are still somewhat expensive so prefer the methods in see also.

See also

ArmiObject.getNuclideNumberDensities()

More efficient for >1 specific nuc density is needed.

ArmiObject.getNumberDensities()

More efficient for when all nucs in object is needed.

getNuclideNumberDensities(nucNames)[source]

Return a list of number densities in atoms/barn-cm for the nuc names requested.

getNumberDensities(expandFissionProducts=False)[source]

Retrieve the number densities in atoms/barn-cm of all nuclides (or those requested) in the object.

Parameters
  • expandFissionProducts (bool (optional)) – expand the fission product number densities

  • nuclideNames (iterable (optional)) – nuclide names to get number densities

Returns

numberDensities – nucName keys, number density values (atoms/bn-cm)

Return type

dict

getNeutronEnergyDepositionConstants()[source]

Get the neutron energy deposition group constants for a composite.

Returns

energyDepConstants – Neutron energy generation group constants (in Joules/cm)

Return type

numpy.array

Raises

RuntimeError: – Reports if a cross section library is not assigned to a reactor.

getGammaEnergyDepositionConstants()[source]

Get the gamma energy deposition group constants for a composite.

Returns

energyDepConstants – Energy generation group constants (in Joules/cm)

Return type

numpy.array

Raises

RuntimeError: – Reports if a cross section library is not assigned to a reactor.

getTotalEnergyGenerationConstants()[source]

Get the total energy generation group constants for a composite.

Gives the total energy generation rates when multiplied by the multigroup flux.

Returns

totalEnergyGenConstant – Total (fission + capture) energy generation group constants (Joules/cm)

Return type

numpy.array

getFissionEnergyGenerationConstants()[source]

Get the fission energy generation group constants for a composite.

Gives the fission energy generation rates when multiplied by the multigroup flux.

Returns

fissionEnergyGenConstant – Energy generation group constants (Joules/cm)

Return type

numpy.array

Raises

RuntimeError: – Reports if a cross section library is not assigned to a reactor.

getCaptureEnergyGenerationConstants()[source]

Get the capture energy generation group constants for a composite.

Gives the capture energy generation rates when multiplied by the multigroup flux.

Returns

fissionEnergyGenConstant – Energy generation group constants (Joules/cm)

Return type

numpy.array

Raises

RuntimeError: – Reports if a cross section library is not assigned to a reactor.

getChildrenWithNuclides(nucNames)[source]

Return children that contain any nuclides in nucNames.

getAncestor(fn)[source]

Return the first ancestor that satisfies the supplied predicate.

Parameters

fn (Function-like object) – The predicate used to test the validity of an ancestor. Should return true if the ancestor satisfies the caller’s requirements

getAncestorWithFlags(typeSpec, exactMatch=False)[source]

Return the first ancestor that matches the passed flags.

Parameters
  • typeSpec (Flags or [Flags]) – A collection of flags to match on candidate parents

  • exactMatch (bool) – Whether the flags match should be exact

Returns

the first ancestor up the chain of parents that matches the passed flags

Return type

armi.composites.ArmiObject

Notes

This will throw an error if no ancestor can be found that matches the typeSpec

getTotalNDens()[source]

Return the total number density of all atoms in this object.

Returns

nTot – Total ndens of all nuclides in atoms/bn-cm. Not homogenized.

Return type

float

setNumberDensity(nucName, val)[source]

Set the number density of this nuclide to this value.

This distributes atom density evenly across all children that contain nucName. If the nuclide doesn’t exist in any of the children, then that’s actually an error. This would only happen if some unnatural nuclide like Pu239 built up in fresh UZr. That should be anticipated and dealt with elsewhere.

setNumberDensities(numberDensities)[source]

Set one or more multiple number densities. Reset any non-listed nuclides to 0.0.

Parameters

numberDensities (dict) – nucName: ndens pairs.

Notes

We’d like to not have to call setNumberDensity for each nuclide because we don’t want to call getVolumeFractions for each nuclide (it’s inefficient).

updateNumberDensities(numberDensities)[source]

Set one or more multiple number densities. Leaves unlisted number densities alone.

This changes a nuclide number density only on children that already have that nuclide, thereby allowing, for example, actinides to stay in the fuel component when setting block-level values.

The complication is that various number densities are distributed among various components. This sets the number density for each nuclide evenly across all components that contain it.

Parameters

numberDensities (dict) – nucName: ndens pairs.

changeNDensByFactor(factor)[source]

Change the number density of all nuclides within the object by a multiplicative factor.

clearNumberDensities()[source]

Reset all the number densities to nearly zero.

Set to almost zero, so components remember which nuclides are where.

density()[source]

Returns the mass density of the object in g/cc.

getNumberOfAtoms(nucName)[source]

Return the number of atoms of nucName in this object.

getLumpedFissionProductCollection()[source]

Get collection of LFP objects. Will work for global or block-level LFP models.

Returns

lfps – lfpName keys , lfp object values

Return type

LumpedFissionProduct

setLumpedFissionProducts(lfpCollection)[source]
setChildrenLumpedFissionProducts(lfpCollection)[source]
getFissileMassEnrich()[source]

returns the fissile mass enrichment.

getBoronMassEnrich()[source]

Return B-10 mass fraction.

getUraniumMassEnrich()[source]

returns U-235 mass fraction assuming U-235 and U-238 only.

getUraniumNumEnrich()[source]

Returns U-235 number fraction.

getPuN()[source]

Returns total number density of Pu isotopes

calcTotalParam(param, objs=None, volumeIntegrated=False, addSymmetricPositions=False, typeSpec=None, generationNum=1, calcBasedOnFullObj=False)[source]

Sums up a parameter throughout the object’s children or list of objects.

Parameters
  • param (str) – Name of the block parameter to sum

  • objs (iterable, optional) – A list of objects to sum over. If none, all children in object will be used

  • volumeIntegrated (bool, optional) – Integrate over volume

  • addSymmetricPositions (bool, optional) – If True, will multiply by the symmetry factor of the core (3 for 1/3 models, 1 for full core models)

  • typeSpec (Flags or list of Flags, optional) – object types to restrict to

  • generationNum (int, optional) – Which generation to consider. 1 means direct children, 2 means children of children. Default: Just return direct children.

  • calcBasedOnFullObj (bool, optional) – Some assemblies or blocks, such as the center assembly in a third core model, are not modeled as full assemblies or blocks. In the third core model objects at these postions are modeled as having 1/3 the volume and thus 1/3 the power. Setting this argument to True will apply the full value of the parameter as if it was a full block or assembly.

calcAvgParam(param, typeSpec=None, weightingParam=None, volumeAveraged=True, absolute=True, generationNum=1)[source]

Calculate the child-wide average of a parameter.

Parameters
  • param (str) – The ARMI block parameter that you want the average from

  • typeSpec (Flags or iterable with Flags values) – The child types that should be included in the calculation. Restrict average to a certain child type with this parameter.

  • weightingParam (None or str, optional) – An optional block param that the average will be weighted against

  • volumeAveraged (bool, optional) – volume (or height, or area) average this param

  • absolute (bool, optional) – Returns the average of the absolute value of param

  • generationNum (int, optional) – Which generation to average over (1 for children, 2 for grandchildren)

  • weighted sum is (The) –

  • math:: (.) – left<text{x}right> = frac{sum_{i} x_i w_i}{sum_i w_i}

:param where \(i\) is each child, \(x_i\) is the param value of the i-th child,: :param and \(w_i\) is the weighting param value of the i-th child.:

Warning

If a param is unset/zero on any of the children, this will be included in the average and may significantly perturb results.

Returns

The average parameter value.

Return type

float

getMaxParam(param, typeSpec=None, absolute=True, generationNum=1, returnObj=False)[source]

Find the maximum value for the parameter in this container

Parameters
  • param (str) – block parameter that will be sought.

  • typeSpec (Flags or list of Flags, optional) – restricts the search to cover a variety of block types.

  • absolute (bool) – looks for the largest magnitude value, regardless of sign, default: true

  • returnObj (bool, optional) – If true, returns the child object as well as the value.

Returns

  • maxVal (float) – The maximum value of the parameter asked for

  • obj (child object) – The object that has the max (only returned if returnObj==True)

getMinParam(param, typeSpec=None, absolute=True, generationNum=1, returnObj=False)[source]

Find the minimum value for the parameter in this container.

See also

getMaxParam()

details

getChildParamValues(param)[source]

Get the child parameter values in a numpy array.

isFuel()[source]

True if this is a fuel block.

containsHeavyMetal()[source]

True if this has HM

getComponents(typeSpec=None, exact=False)[source]

Return all armi.reactor.component.Component within this Composite.

Parameters
  • typeSpec (flags.Flags, optional) – Component flags. Will restrict Components to specific ones matching the flags specified.

  • exact (bool, optional) – Only match exact component labels (names). If True, ‘coolant’ will not match ‘interCoolant’. This has no impact if compLabel is None.

Returns

items matching compLabel and exact criteria

Return type

list of Component

getComponentNames()[source]

Get all unique component names of this Composite.

Returns

A set of all unique component names found in this Composite.

Return type

set or str

iterComponents(typeSpec=None, exact=False)[source]

Return an iterator of armi.reactor.component.Component objects within this Composite.

Parameters
  • typeSpec (flags.Flags, optional) – Component flags. Will restrict Components to specific ones matching the flags specified.

  • exact (bool, optional) – Only match exact component labels (names). If True, ‘coolant’ will not match ‘interCoolant’. This has no impact if typeSpec is None.

Returns

items matching typeSpec and exact criteria

Return type

iterator of Component

getNuclides()[source]

Determine which nuclides are present in this armi object.

Returns

List of nuclide names that exist in this

Return type

list

isDepletable()[source]

Return True if itself or any child is depletable.

See also

armi.reactor.blueprints.componentBlueprint._insertDepletableNuclideKeys()

sets this flag

getFissileMass()[source]

Returns fissile mass in grams.

getHMMass()[source]

Returns heavy metal mass in grams

getHMMoles()[source]

Get the number of moles of heavy metal in this object in full symmetry.

Notes

If an object is on a symmetry line, the number of moles will be scaled up by the symmetry factor. This is done because this is typically used for tracking burnup, and BOL moles are computed in full objects too so there are no complications as things move on and off of symmetry lines.

Warning

getHMMoles is different than every other get mass call since it multiplies by symmetry factor but getVolume() on the block level divides by symmetry factor causing them to cancel out.

This was needed so that HM moles mass did not change based on if the block/assembly was on a symmetry line or not.

getHMDens()[source]

Compute the total heavy metal density of this object.

Returns

hmDens – The total heavy metal number (atom) density in atoms/bn-cm.

Return type

float

getPuMass()[source]

Get the mass of Pu in this object in grams.

getPuFrac()[source]

Compute the Pu/HM mass fraction in this object.

Returns

puFrac – The pu mass fraction in heavy metal in this assembly

Return type

float

getZrFrac()[source]

return the total zr/(hm+zr) fraction in this assembly

getMaxUraniumMassEnrich()[source]
getFPMass()[source]

Returns mass of fission products in this block in grams

getFuelMass()[source]

returns mass of fuel in grams.

constituentReport()[source]

A print out of some pertinent constituent information

getAtomicWeight()[source]

Calculate the atomic weight of this object in g/mole of atoms.

Warning

This is not the molecular weight, which is grams per mole of molecules (grams/gram-molecule). That requires knowledge of the chemical formula. Don’t be surprised when you run this on UO2 and find it to be 90; there are a lot of Oxygen atoms in UO2.

\[A = \frac{\sum_i N_i A_i }{\sum_i N_i}\]
getMasses()[source]

Return a dictionary of masses indexed by their nuclide names.

getIntegratedMgFlux(adjoint=False, gamma=False)[source]
getMgFlux(adjoint=False, average=False, volume=None, gamma=False)[source]

Return the multigroup neutron flux in [n/cm^2/s]

The first entry is the first energy group (fastest neutrons). Each additional group is the next energy group, as set in the ISOTXS library.

On blocks, it is stored integrated over volume on <block>.p.mgFlux

Parameters
  • adjoint (bool, optional) – Return adjoint flux instead of real

  • average (bool, optional) – If true, will return average flux between latest and previous. Doesn’t work for pin detailed yet

  • volume (float, optional) – If average=True, the volume-integrated flux is divided by volume before being returned. The user may specify a volume here, or the function will obtain the block volume directly.

  • gamma (bool, optional) – Whether to return the neutron flux or the gamma flux.

Returns

flux – multigroup neutron flux in [n/cm^2/s]

Return type

numpy.array

removeMass(nucName, mass)[source]
addMass(nucName, mass, density=None, lumpedFissionProducts=None)[source]
Parameters
  • - str (nucName) – nuclide name e.g. ‘U235’

  • - float (mass) – mass in grams of nuclide to be added to this armi Object

addMasses(masses, density=None, lumpedFissionProducts=None)[source]

Adds a vector of masses.

Parameters

masses (Dict) – a dictionary of masses (g) indexed by nucNames (string)

setMass(nucName, mass, density=None, lumpedFissionProducts=None)[source]

Set the mass of a defined nuclide to the defined mass.

Parameters
  • - string (nucName) – armi nuclide name (e.g. U235)

  • - float (mass) – this is a dictionary of masses in grams

setMasses(masses, density=None, lumpedFissionProducts=None)[source]

Sets a vector of masses.

Parameters

masses (Dict) – a dictionary of masses (g) indexed by nucNames (string)

getSymmetryFactor()[source]

Return a scaling factor due to symmetry on the area of the object or its children.

See also

armi.reactor.blocks.HexBlock.getSymmetryFactor()

concrete implementation

getBoundingIndices()[source]

Find the 3-D index bounds (min, max) of all children in the spatial grid of this object.

Returns

bounds – ((minI, maxI), (minJ, maxJ), (minK, maxK))

Return type

tuple

class armi.reactor.composites.Composite(name)[source]

Bases: armi.reactor.composites.ArmiObject

An ArmiObject that has children.

This is a fundamental ARMI state object that generally represents some piece of the nuclear reactor that is made up of other smaller pieces. This object can cache information about its children to help performance.

Spatial representation of a Composite is handled through a combination of the spatialLocator and spatialGrid parameters. The spatialLocator is a numpy triple representing either:

  1. Indices in the parent’s spatialGrid (for lattices, etc.), used when the dtype is int.

  2. Coordinates in the parent’s universe in cm, used when the dtype is float.

The top parent of any composite must have a coordinate-based spatialLocator. For example, a Reactor an a Pump should both have coordinates based on how far apart they are.

The traversal of indices and grids is recursive. The Reactor/Core/Assembly/Block model is handled by putting a 2-D grid (either Theta-R, Hex, or Cartesian) on the Core and individual 1-D Z-meshes on the assemblies. Then, Assemblies have 2-D spatialLocators (i,j,0) and Blocks have 1-D spatiaLocators (0,0,k). These get added to form the global indices. This way, if an assembly is moved, all the blocks immediately and naturally move with it. Individual children may have coordinate-based spatialLocators mixed with siblings in a grid. This allows mixing grid-representation with explicit representation, often useful in advanced assemblies and thermal reactors.

__contains__(item)[source]

Membership check.

This does not use quality checks for membership checking because equality operations can be fairly heavy. Rather, this only checks direct identity matches.

index(obj)[source]

Obtain the list index of a particular child.

append(obj)[source]

Append a child to this object.

extend(seq)[source]

Add a list of children to this object.

add(obj)[source]

Add one new child.

remove(obj)[source]

Remove a particular child.

moveTo(locator)[source]

Move to specific location in parent. Often in a grid.

insert(index, obj)[source]

Insert an object into the list of children at a particular index.

removeAll()[source]

Remove all children.

setChildren(items)[source]

Clear this container and fills it with new children.

getChildren(deep=False, generationNum=1, includeMaterials=False)[source]

Return the children objects of this composite.

Parameters
  • deep (boolean, optional) – Return all children of all levels.

  • generationNum (int, optional) – Which generation to return. 1 means direct children, 2 means children of children. setting this parameter will only return children of this generation, not their parents. Default: Just return direct children.

  • includeMaterials (bool, optional) – Include the material properties

Examples

>>> obj.getChildren()
[child1, child2, child3]

>>>obj.getChildren(generationNum=2) [grandchild1, grandchild2, grandchild3]

>>> obj.getChildren(deep=True)
[child1, child2, child3, grandchild1, grandchild2, grandchild3]
getChildrenWithFlags(typeSpec, exactMatch=False)[source]

Get all children of a specific type.

getChildrenOfType(typeName)[source]

Get children that have a specific input type name.

syncMpiState()[source]

Synchronize all parameters of this object and all children to all worker nodes over the network using MPI.

In parallelized runs, if each process has its own copy of the entire reactor hierarchy, this method synchronizes the state of all parameters on all objects.

Returns

number of parameters synchronized over all components

Return type

int

retainState(paramsToApply=None)[source]

Restores a state before and after some operation.

Parameters

paramsToApply (iterable) – Parameters that should be applied to the state after existing the state retainer. All others will be reverted to their values upon entering.

Notes

This should be used in a with statement.

backUp()[source]

Create and store a backup of the state.

This needed to be overridden due to linked components which actually have a parameter value of another ARMI component.

restoreBackup(paramsToApply)[source]

Restore the parameters from previously created backup.

Parameters

paramsToApply (list of ParmeterDefinitions) – restores the state of all parameters not in paramsToApply

getLumpedFissionProductsIfNecessary(nuclides=None)[source]

Return Lumped Fission Product objects that belong to this object or any of its children.

getLumpedFissionProductCollection()[source]

Get collection of LFP objects. Will work for global or block-level LFP models.

Returns

lfps – lfpName keys, lfp object values

Return type

object

requiresLumpedFissionProducts(nuclides=None)[source]

True if any of the nuclides in this object are Lumped nuclides.

getIntegratedMgFlux(adjoint=False, gamma=False)[source]

Returns the multigroup neutron tracklength in [n-cm/s].

The first entry is the first energy group (fastest neutrons). Each additional group is the next energy group, as set in the ISOTXS library.

Parameters
  • adjoint (bool, optional) – Return adjoint flux instead of real

  • gamma (bool, optional) – Whether to return the neutron flux or the gamma flux.

Returns

integratedFlux – multigroup neutron tracklength in [n-cm/s]

Return type

numpy.array

getReactionRates(nucName, nDensity=None)[source]

Get the reaction rates of a certain nuclide on this object.

Parameters
  • - str (nucName) – nuclide name – e.g. ‘U235’

  • - float (nDensity) – number Density

Returns

rxnRates – reaction rates (1/s) for nG, nF, n2n, nA and nP

Return type

dict

Notes

This is volume integrated NOT (1/cm3-s)

If you set nDensity to 1 this makes 1-group cross section generation easier

getCrossSectionTable(nuclides=None)[source]

Return self.crossSectionTable if it exists. Otherwise, generate the cross-section table for given nuclides (or the result of self.getNuclides() if nuclides is not specified).

Parameters

nuclides (list, optional) – list of nuclide names for which to generate the cross-section table. If absent, use all nuclides obtained by self.getNuclides().

Returns

self.crossSectionTable

Return type

armi.physics.neutronics.isotopicDepletion.crossSectionTable.CrossSectionTable

Notes

In an earlier implementation, self.getNuclides() was always called if no nuclides argument was passed, even if self.crossSectionTable had already been generated and, therefore, nuclides was not used. This has been modified so that self.getNuclides() is only called if its result is actually used.

makeCrossSectionTable(nuclides)[source]

See also

armi.physics.neutronics.isotopicDepletion.isotopicDepletionInterface.CrossSectionTable()

printContents(includeNuclides=True)[source]

Display information about all the comprising children in this object.

isOnWhichSymmetryLine()[source]
paramCollectionType

alias of armi.reactor.parameters.parameterCollections.ArmiObjectParameterCollection

class armi.reactor.composites.Leaf(name)[source]

Bases: armi.reactor.composites.Composite

Defines behavior for primitive objects in the composition.

getChildren(deep=False, generationNum=1, includeMaterials=False)[source]

Return empty list, representing that this object has no children.

getChildrenWithFlags(typeSpec, exactMatch=True)[source]

Return empty list, representing that this object has no children.

paramCollectionType

alias of armi.reactor.parameters.parameterCollections.ArmiObjectParameterCollection

class armi.reactor.composites.StateRetainer(composite, paramsToApply=None)[source]

Bases: object

Retains state during some operations.

This can be used to temporarily cache state, perform an operation, extract some info, and then revert back to the original state.

  • A state retainer is faster than restoring state from a database as it reduces the number of IO reads; however, it does use more memory.

  • This can be used on any object within the composite pattern via with [rabc].retainState([list], [of], [parameters], [to], [retain]):. Use on an object up in the hierarchy applies to all objects below as well.

  • This is intended to work across MPI, so that if you were to broadcast the reactor the state would be correct; however the exact implication on parameters may be unclear.

Create an instance of a StateRetainer

Parameters
  • composite (Composite) – composite object to retain state (recursively)

  • paramsToApply (iterable of parameters.Parameter) – Iterable of parameters.Parameter to retain updated values after __exit__. All other parameters are reverted to the original state, i.e. retained at the original value.