# 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.
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 Sparse matrix representing depletion. scipy.sparse.csr_matrix
classmethod from_endf(decay_files, fpy_files, neutron_files)[source]

Create a depletion chain from ENDF files.

Parameters: decay_files (list of str) – List of ENDF decay sub-library files fpy_files (list of str) – List of ENDF neutron-induced fission product yield sub-library files neutron_files (list of str) – List of ENDF neutron reaction sub-library files
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)". 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}}  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. dict
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  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)  valid – True if no inconsistencies were found bool ValueError – If strict evaluates to True and an inconistency was found