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 toopenmc.deplete.Operatoror through thedepletion_chainitem in theOPENMC_CROSS_SECTIONSenvironment 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}}, whereyieldis the fission product yield for isotopeparentproducing isotopeproduct. 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 forparentandproduct, andf_yieldas the respective fission yield
Returns: Sparse matrix representing depletion.
Return type: scipy.sparse.csr_matrix
See also
-
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:
-
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 See also
-
get_default_fission_yields()[source]¶ Return fission yields at lowest incident neutron energy
Used as the default set of fission yields for
form_matrix()iffission_yieldsare not providedReturns: fission_yields – Dictionary of {parent: {product: f_yield}}whereparentandproductare both string names of nuclides with yield data andf_yieldis a float for the fission yield.Return type: 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
Raises: IndexError– If no isotopes were found on the chain that have the requested reactionKeyError– Ifstrictevaluates toFalseand a parent isotope inbranch_ratiosdoes not exist on the chainAttributeError– Ifstrictevaluates toFalseand a parent isotope inbranch_ratiosdoes not have the requested reactionValueError– Ifstrictevalutes toFalseand the sum of one parents branch ratios is outside 1 +/-tolerance
See also
- branch_ratios (dict of {str: {str: float}}) – Capture branching ratios to be inserted.
First layer keys are names of parent nuclides, e.g.
-
validate(strict=True, quiet=False, tolerance=0.0001)[source]¶ Search for possible inconsistencies
The following checks are performed for all nuclides present:
- For all non-fission reactions, does the sum of branching ratios equal about one?
- 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
strictdoes not evaluate toTrue. - tolerance (float, optional) –
Absolute tolerance for comparisons. Used to compare computed value
xto intended valueyas:valid = (y - tolerance <= x <= y + tolerance)
Returns: valid – True if no inconsistencies were found
Return type: Raises: ValueError– Ifstrictevaluates toTrueand an inconistency was foundSee also