openmc.deplete.Chain

class openmc.deplete.Chain[source]

Full representation of a depletion chain.

A depletion chain can be created by using the from_endf() method which requires a list of ENDF incident neutron, decay, and neutron fission product yield sublibrary files. The depletion chain used during a depletion simulation is indicated by either an argument to openmc.deplete.Operator or through the depletion_chain item in the OPENMC_CROSS_SECTIONS environment variable.

Variables:
  • nuclides (list of openmc.deplete.Nuclide) – Nuclides present in the chain.
  • reactions (list of str) – Reactions that are tracked in the depletion chain
  • nuclide_dict (OrderedDict of str to int) – Maps a nuclide name to an index in nuclides.
  • fission_yields (None or iterable of dict) – List of effective fission yields for materials. Each dictionary should be of the form {parent: {product: yield}} with types {str: {str: float}}, where yield is the fission product yield for isotope parent producing isotope product. A single entry indicates yields are constant across all materials. Otherwise, an entry can be added for each material to be burned. Ordering should be identical to how the operator orders reaction rates for burnable materials.
add_nuclide(nuclide)[source]

Add a nuclide to the depletion chain

Parameters:nuclide (openmc.deplete.Nuclide) – Nuclide to add
export_to_xml(filename)[source]

Writes a depletion chain XML file.

Parameters:filename (str) – The path to the depletion chain XML file.
form_matrix(rates, fission_yields=None)[source]

Forms depletion matrix.

Parameters:
  • rates (numpy.ndarray) – 2D array indexed by (nuclide, reaction)
  • fission_yields (dict, optional) – Option to use a custom set of fission yields. Expected to be of the form {parent : {product : f_yield}} with string nuclide names for parent and product, and f_yield as the respective fission yield
Returns:

Sparse matrix representing depletion.

Return type:

scipy.sparse.csr_matrix

classmethod from_endf(decay_files, fpy_files, neutron_files, reactions=('(n, 2n)', '(n, 3n)', '(n, 4n)', '(n, gamma)', '(n, p)', '(n, a)'), progress=True)[source]

Create a depletion chain from ENDF files.

String arguments in decay_files, fpy_files, and neutron_files will be treated as file names to be read. Alternatively, openmc.data.endf.Evaluation instances can be included in these arguments.

Parameters:
  • decay_files (list of str or openmc.data.endf.Evaluation) – List of ENDF decay sub-library files
  • fpy_files (list of str or openmc.data.endf.Evaluation) – List of ENDF neutron-induced fission product yield sub-library files
  • neutron_files (list of str or openmc.data.endf.Evaluation) – List of ENDF neutron reaction sub-library files
  • reactions (iterable of str, optional) –

    Transmutation reactions to include in the depletion chain, e.g., [“(n,2n)”, “(n,gamma)”]. Note that fission is always included if it is present. A complete listing of transmutation reactions can be found in openmc.deplete.chain.REACTIONS.

    New in version 0.12.1.

  • progress (bool, optional) – Flag to print status messages during processing. Does not effect warning messages
Returns:

Return type:

Chain

Notes

When an actinide is missing fission product yield (FPY) data, yields will copied from a parent isotope, found according to:

  1. If the nuclide is in a ground state and a metastable state exists with fission yields, copy the yields from the metastable
  2. Find an isotone (same number of neutrons) and copy those yields
  3. Copy the yields of U235 if the previous two checks fail
classmethod from_xml(filename, fission_q=None)[source]

Reads a depletion chain XML file.

Parameters:
  • filename (str) – The path to the depletion chain XML file.
  • fission_q (dict, optional) – Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from filename
get_branch_ratios(reaction='(n, gamma)')[source]

Return a dictionary with reaction branching ratios

Parameters:reaction (str, optional) – Reaction name like "(n,gamma)" [default], or "(n,alpha)".
Returns:branches – nested dict of parent nuclide keys with reaction targets and branching ratios. Consider the capture, "(n,gamma)", reaction for Am241:
{"Am241": {"Am242": 0.91, "Am242_m1": 0.09}}
Return type:dict
get_default_fission_yields()[source]

Return fission yields at lowest incident neutron energy

Used as the default set of fission yields for form_matrix() if fission_yields are not provided

Returns:fission_yields – Dictionary of {parent: {product: f_yield}} where parent and product are both string names of nuclides with yield data and f_yield is a float for the fission yield.
Return type:dict
reduce(initial_isotopes, level=None)[source]

Reduce the size of the chain by following transmutation paths

As an example, consider a simple chain with the following isotopes and transmutation paths:

U235 (n,gamma) U236
     (n,fission) (Xe135, I135, Cs135)
I135 (beta decay) Xe135 (beta decay) Cs135
Xe135 (n,gamma) Xe136

Calling chain.reduce(["I135"]) will produce a depletion chain that contains only isotopes that would originate from I135: I135, Xe135, Cs135, and Xe136. U235 and U236 will not be included, but multiple isotopes can be used to start the search.

The level value controls the depth of the search. chain.reduce(["U235"], level=1) would return a chain with all isotopes except Xe136, since it is two transmutations removed from U235 in this case.

While targets will not be included in the new chain, the total destruction rate and decay rate of included isotopes will be preserved.

Parameters:
  • initial_isotopes (iterable of str) – Start the search based on the contents of these isotopes
  • level (int, optional) – Depth of transmuation path to follow. Must be greater than or equal to zero. A value of zero returns a chain with initial_isotopes. The default value of None implies that all isotopes that appear in the transmutation paths of the initial isotopes and their progeny should be explored
Returns:

Depletion chain containing isotopes that would appear after following up to level reactions and decay paths

Return type:

Chain

set_branch_ratios(branch_ratios, reaction='(n, gamma)', strict=True, tolerance=1e-05)[source]

Set the branching ratios for a given reactions

Parameters:
  • branch_ratios (dict of {str: {str: float}}) – Capture branching ratios to be inserted. First layer keys are names of parent nuclides, e.g. "Am241". The branching ratios for these parents will be modified. Corresponding values are dictionaries of {target: branching_ratio}
  • reaction (str, optional) – Reaction name like "(n,gamma)" [default], or "(n, alpha)".
  • strict (bool, optional) – Error control. If this evalutes to True, then errors will be raised if inconsistencies are found. Otherwise, warnings will be raised for most issues.
  • tolerance (float, optional) –

    Tolerance on the sum of all branching ratios for a single parent. Will be checked with:

    1 - tol < sum_br < 1 + tol
    
Raises:
  • IndexError – If no isotopes were found on the chain that have the requested reaction
  • KeyError – If strict evaluates to False and a parent isotope in branch_ratios does not exist on the chain
  • AttributeError – If strict evaluates to False and a parent isotope in branch_ratios does not have the requested reaction
  • ValueError – If strict evalutes to False and the sum of one parents branch ratios is outside 1 +/- tolerance
validate(strict=True, quiet=False, tolerance=0.0001)[source]

Search for possible inconsistencies

The following checks are performed for all nuclides present:

  1. For all non-fission reactions, does the sum of branching ratios equal about one?
  2. For fission reactions, does the sum of fission yield fractions equal about two?
Parameters:
  • strict (bool, optional) – Raise exceptions at the first inconsistency if true. Otherwise mark a warning
  • quiet (bool, optional) – Flag to suppress warnings and return immediately at the first inconsistency. Used only if strict does not evaluate to True.
  • tolerance (float, optional) –

    Absolute tolerance for comparisons. Used to compare computed value x to intended value y as:

    valid = (y - tolerance <= x <= y + tolerance)
    
Returns:

valid – True if no inconsistencies were found

Return type:

bool

Raises:

ValueError – If strict evaluates to True and an inconistency was found