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.CoupledOperator
oropenmc.deplete.IndependentOperator
, or through openmc.config[‘chain_file’].- 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 (dict 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}}
, whereyield
is the fission product yield for isotopeparent
producing 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.
- 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 forparent
andproduct
, andf_yield
as the respective fission yield
- Returns
Sparse matrix representing depletion.
- Return type
See also
- form_rr_term(tr_rates, mats)[source]¶
Function to form the transfer rate term matrices.
New in version 0.14.0.
- Parameters
tr_rates (openmc.deplete.TransferRates) – Instance of openmc.deplete.TransferRates
mats (string or two-tuple of strings) –
Two cases are possible:
1) Material ID as string: Nuclide transfer only. In this case the transfer rate terms will be subtracted from the respective depletion matrix
2) Two-tuple of material IDs as strings: Nuclide transfer from one material into another. The pair is assumed to be
(destination_material, source_material)
, wheredestination_material
andsource_material
are the nuclide receiving and losing materials, respectively. The transfer rate terms get placed in the final matrix with indexing position corresponding to the ID of the materials set.
- Returns
Sparse matrix representing transfer term.
- Return type
- 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
, andneutron_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
- Return type
Notes
When an actinide is missing fission product yield (FPY) data, yields will copied from a parent isotope, found according to:
If the nuclide is in a ground state and a metastable state exists with fission yields, copy the yields from the metastable
Find an isotone (same number of neutrons) and copy those yields
Copy the yields of U235 if the previous two checks fail
- 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
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_yields
are not provided- Returns
fission_yields – Dictionary of
{parent: {product: f_yield}}
whereparent
andproduct
are both string names of nuclides with yield data andf_yield
is a float for the fission yield.- Return type
- 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
- 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 toFalse
and a parent isotope inbranch_ratios
does not exist on the chainAttributeError – If
strict
evaluates toFalse
and a parent isotope inbranch_ratios
does not have the requested reactionValueError – If
strict
evalutes toFalse
and the sum of one parents branch ratios is outside 1 +/-tolerance
See also
- 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
strict
does not evaluate toTrue
.tolerance (float, optional) –
Absolute tolerance for comparisons. Used to compare computed value
x
to intended valuey
as:valid = (y - tolerance <= x <= y + tolerance)
- Returns
valid – True if no inconsistencies were found
- Return type
- Raises
ValueError – If
strict
evaluates toTrue
and an inconistency was found
See also