armi.utils.densityTools module
Assorted utilities to help with basic density calculations.
- armi.utils.densityTools.getNDensFromMasses(rho, massFracs, normalize=False)[source]
Convert density (g/cc) and massFracs vector into a number densities vector (#/bn-cm).
Loops over all provided nuclides (given as keys in the
massFracs
vector) and calculates number densities of each, at a given materialdensity
. Mass fractions can be provided either as normalized to 1, or as unnormalized with subsequent normalization callingnormalizeNuclideList
via thenormalize
flag.
- armi.utils.densityTools.getMassFractions(numberDensities)[source]
Convert number densities (#/bn-cm) into mass fractions.
- armi.utils.densityTools.calculateNumberDensity(nucName, mass, volume)[source]
Calculates the number density.
- Parameters:
mass (float)
volume (volume)
nucName (armi nuclide name -- e.g. 'U235')
- Returns:
number density – number density (#/bn-cm)
- Return type:
See also
armi.reactor.blocks.Block.setMass
- armi.utils.densityTools.getMassInGrams(nucName, volume, numberDensity=None)[source]
Gets mass of a nuclide of a known volume and know number density.
- armi.utils.densityTools.formatMaterialCard(densities, matNum=0, minDens=1e-15, sigFigs=8, mcnp6Compatible=False, mcnpLibrary=None)[source]
Formats nuclides and densities into a MCNP material card.
Loops over a vector of nuclides (of type
nuclideBase
) provided indensities
and formats them into a list of strings consistent with MCNP material card syntax, skipping dummy nuclides and LFPs.A
matNum
may optionally be provided for the created material card: if not provided, it is left blank. The desired number of significant figures for the created card can be optionally provided bysigFigs
. Nuclides whose number density falls below a threshold (optionally specified byminDens
) are set to the threshold value.The boolean
mcnp6Compatible
may optionally be provided to include the nuclide library at the end of the vector of individual nuclides using the “nlib=” syntax leveraged by MCNP. If this boolean is turned on, the associated valuemcnpLibrary
should generally also be provided, as otherwise, the library will be left blank in the resulting material card string.
- armi.utils.densityTools.filterNuclideList(nuclideVector, nuclides)[source]
Filter out nuclides not in the nuclide vector.
- armi.utils.densityTools.normalizeNuclideList(nuclideVector, normalization=1.0)[source]
Normalize the nuclide vector.
- armi.utils.densityTools.expandElementalMassFracsToNuclides(massFracs: dict, elementExpansionPairs: Tuple[Element, List[NuclideBase]])[source]
Expand elemental mass fractions to natural nuclides.
Modifies the input
massFracs
in place to contain nuclides.Notes
This indirectly updates number densities through mass fractions.
Given a vector of elements and nuclides with associated mass fractions (
massFracs
), expands the elements in-place into a set of nuclides usingexpandElementalNuclideMassFracs
. Isotopes to expand into are provided for each element by specifying them withelementExpansionPairs
, which maps each element to a list of particular NuclideBases; if left unspecified, all naturally-occurring isotopes are included.Explicitly specifying the expansion isotopes provides a way for particular naturally-occurring isotopes to be excluded from the expansion, e.g. excluding O-18 from an expansion of elemental oxygen.
- Parameters:
massFracs (dict(str, float)) – dictionary of nuclide or element names with mass fractions. Elements will be expanded in place using natural isotopics.
elementExpansionPairs ((Element, [NuclideBase]) pairs) – element objects to expand (from nuclidBase.element) and list of NuclideBases to expand into (or None for all natural)
- armi.utils.densityTools.expandElementalNuclideMassFracs(element: Element, massFrac: float, isotopicSubset: List[NuclideBase] = None)[source]
Return a dictionary of nuclide names to isotopic mass fractions.
If an isotopic subset is passed in, the mass fractions get scaled up s.t. the total mass fraction remains constant.
- armi.utils.densityTools.getChemicals(nuclideInventory)[source]
Groups the inventories of nuclides by their elements.
- armi.utils.densityTools.applyIsotopicsMix(material, enrichedMassFracs: Dict[str, float], fertileMassFracs: Dict[str, float])[source]
Update material heavy metal mass fractions based on its enrichment and two nuclide feeds.
This will remix the heavy metal in a Material object based on the object’s
class1_wt_frac
parameter and the input nuclide information.This can be used for inputting mixtures of two external custom isotopic feeds as well as for fabricating assemblies from two closed-cycle collections of material.
See also