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).

Implementation: Number densities are retrievable from masses. I_ARMI_UTIL_MASS2N_DENS
signature: getNDensFromMasses

Loops over all provided nuclides (given as keys in the massFracs vector) and calculates number densities of each, at a given material density. Mass fractions can be provided either as normalized to 1, or as unnormalized with subsequent normalization calling normalizeNuclideList via the normalize flag.

Parameters:
  • rho (float) – density in (g/cc)

  • massFracs (dict) – vector of mass fractions – normalized to 1 – keyed by their nuclide name

Returns:

numberDensities – vector of number densities (#/bn-cm) keyed by their nuclide name

Return type:

dict

armi.utils.densityTools.getMassFractions(numberDensities)[source]

Convert number densities (#/bn-cm) into mass fractions.

Parameters:

numberDensities (dict) – number densities (#/bn-cm) keyed by their nuclide name

Returns:

massFracs – mass fractions – normalized to 1 – keyed by their nuclide name

Return type:

dict

armi.utils.densityTools.calculateMassDensity(numberDensities)[source]

Calculates the mass density.

Parameters:

numberDensities (dict) – vector of number densities (atom/bn-cm) indexed by nuclides names

Returns:

rho – density in (g/cc)

Return type:

float

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:

float

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.

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

  • volume (float) – volume in (cm3)

  • numberDensity (float) – number density in (at/bn-cm)

Returns:

mass – mass of nuclide (g)

Return type:

float

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.

Implementation: Create MCNP material card. I_ARMI_UTIL_MCNP_MAT_CARD
signature: formatMaterialCard

Loops over a vector of nuclides (of type nuclideBase) provided in densities 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 by sigFigs. Nuclides whose number density falls below a threshold (optionally specified by minDens) 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 value mcnpLibrary should generally also be provided, as otherwise, the library will be left blank in the resulting material card string.

Parameters:
  • densities (dict) – number densities indexed by nuclideBase

  • matNum (int) – mcnp material number

  • minDens (float) – minimum density

  • sigFigs (int) – significant figures for the material card

Returns:

mCard – list of material card strings

Return type:

list

armi.utils.densityTools.filterNuclideList(nuclideVector, nuclides)[source]

Filter out nuclides not in the nuclide vector.

Parameters:
  • nuclideVector (dict) – dictionary of values indexed by nuclide identifiers – e.g. nucNames or nuclideBases

  • nuclides (list) – list of nuclide identifiers

Returns:

nuclideVector – dictionary of values indexed by nuclide identifiers – e.g. nucNames or nuclideBases

Return type:

dict

armi.utils.densityTools.normalizeNuclideList(nuclideVector, normalization=1.0)[source]

Normalize the nuclide vector.

Parameters:
  • nuclideVector (dict) – dictionary of values – e.g. floats, ints – indexed by nuclide identifiers – e.g. nucNames or nuclideBases

  • normalization (float)

Returns:

nuclideVector – dictionary of values indexed by nuclide identifiers – e.g. nucNames or nuclideBases

Return type:

dict

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.

Implementation: Expand mass fractions to nuclides. I_ARMI_UTIL_EXP_MASS_FRACS
signature: expandElementalMassFracsToNuclides

Given a vector of elements and nuclides with associated mass fractions (massFracs), expands the elements in-place into a set of nuclides using expandElementalNuclideMassFracs. Isotopes to expand into are provided for each element by specifying them with elementExpansionPairs, 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.

Parameters:
  • element (Element) – The element to expand to natural isotopics

  • massFrac (float) – Mass fraction of the initial element

  • isotopicSubset (list of NuclideBases) – Natural isotopes to include in the expansion. Useful e.g. for excluding O18 from an expansion of Oxygen.

armi.utils.densityTools.getChemicals(nuclideInventory)[source]

Groups the inventories of nuclides by their elements.

Parameters:

nuclideInventory (dict) – nuclide inventories indexed by nuc – either nucNames or nuclideBases

Returns:

chemicals – inventory of elements indexed by element symbol – e.g. ‘U’ or ‘PU’

Return type:

dict

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.

Parameters:
  • material (material.Material) – The object to modify. Must have a class1_wt_frac param set

  • enrichedMassFracs (dict) – Nuclide names and weight fractions of the class 1 nuclides

  • fertileMassFracs (dict) – Nuclide names and weight fractions of the class 2 nuclides