Ejemplo n.º 1
0
def makeXsecTable(
    compositeName,
    xsType,
    mgFlux,
    isotxs,
    headerFormat="$ xsecs for {}",
    tableFormat="\n{mcnpId} {nG:.5e} {nF:.5e} {n2n:.5e} {n3n:.5e} {nA:.5e} {nP:.5e}",
):
    """
    Make a cross section table for depletion physics input decks.

    Parameters
    ----------
    armiObject: armiObject
        an armi object --  batch or block --
        with a .p.xsType and a getMgFlux method
    activeNuclides: list
        a list of the nucNames of active isotopes
    isotxs: isotxs object
    headerFormat: string (optional)
        this is the format in which the elements of the header with be returned
        -- i.e. if you use a .format() call with  the case name you'll return a
        formatted list of string elements
    tableFormat: string (optional)
        this is the format in which the elements of the table with be returned
        -- i.e. if you use a .format() call with mcnpId, nG, nF, n2n, n3n, nA,
        and nP you'll get the format you want. If you use a .format() call with  the case name you'll return a
        formatted list of string elements

    Results
    -------
    output: list
        a list of string elements that together make a xsec card

    See Also
    --------
    crossSectionTable.makeCrossSectionTable
        Makes a table for arbitrary ArmiObjects
    """
    xsTable = CrossSectionTable()

    if not xsType or not sum(mgFlux) > 0:
        return []
    xsTable.setName(compositeName)
    totalFlux = sum(mgFlux)

    for nucLabel, nuc in isotxs.items():
        if xsType != xsLibraries.getSuffixFromNuclideLabel(nucLabel):
            continue
        nucName = nuc.name
        nb = nuclideBases.byName[nucName]
        if isinstance(
            nb, (nuclideBases.LumpNuclideBase, nuclideBases.DummyNuclideBase)
        ):
            continue
        microMultiGroupXS = isotxs[nucLabel].micros
        if not isinstance(nb, nuclideBases.NaturalNuclideBase):
            xsTable.addMultiGroupXS(nucName, microMultiGroupXS, mgFlux, totalFlux)
    return xsTable.getXsecTable(headerFormat=headerFormat, tableFormat=tableFormat)
Ejemplo n.º 2
0
 def __init__(self, xsCollection, xsCollectionKey):
     nuclideBases.NuclideWrapper.__init__(self, xsCollection, xsCollectionKey)
     self.xsId = xsLibraries.getSuffixFromNuclideLabel(xsCollectionKey)
     self.source = 0.0
     # 2D record... nucNames
     # 4D record
     self.isotxsMetadata = nuclearFileMetadata.NuclideMetadata()
     self.gamisoMetadata = nuclearFileMetadata.NuclideMetadata()
     self.pmatrxMetadata = nuclearFileMetadata.NuclideMetadata()
     # 5D and 7D records
     self.micros = xsCollections.XSCollection(parent=self)
     self.gammaXS = xsCollections.XSCollection(parent=self)
     self.neutronHeating = None
     self.neutronDamage = None
     self.gammaHeating = None
     self.isotropicProduction = None
     self.linearAnisotropicProduction = None
     self.nOrderProductionMatrix = {}
     XSNuclide._ensuredBurnInfo = False