armi.utils.densityTools module

armi.utils.densityTools.getNDensFromMasses(rho, massFracs, normalize=False)[source]

Convert density (g/cc) and massFracs vector into a number densities vector (#/bn-cm).

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.

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[armi.nucDirectory.elements.Element, List[armi.nucDirectory.nuclideBases.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.

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: armi.nucDirectory.elements.Element, massFrac: dict, isotopicSubset: Optional[List[armi.nucDirectory.nuclideBases.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