Add format spec for depletion chain XML file

This commit is contained in:
Paul Romano 2018-02-20 00:05:53 -06:00
parent c9f8daa0ab
commit 236e7f8b9e
7 changed files with 166 additions and 63 deletions

View file

@ -1,23 +1,23 @@
<?xml version="1.0"?>
<depletion>
<nuclide_table name="I135" decay_modes="1" reactions="1" half_life="2.36520E+04">
<decay_type type="beta" target="Xe135" branching_ratio="1.0" />
<reaction_type type="(n,gamma)" Q="0.0" target="Xe136" /> <!-- Not precisely true, but whatever -->
</nuclide_table>
<nuclide_table name="Xe135" decay_modes="1" reactions="1" half_life="3.29040E+04">
<decay_type type=" beta" target="Cs135" branching_ratio="1.0" />
<reaction_type type="(n,gamma)" Q="0.0" target="Xe136" />
</nuclide_table>
<nuclide_table name="Xe136" decay_modes="0" reactions="0" />
<nuclide_table name="Cs135" decay_modes="0" reactions="0" />
<nuclide_table name="Gd157" decay_modes="0" reactions="1" >
<reaction_type type="(n,gamma)" Q="0.0" target="Nothing" />
</nuclide_table>
<nuclide_table name="Gd156" decay_modes="0" reactions="1">
<reaction_type type="(n,gamma)" Q="0.0" target="Gd157" />
</nuclide_table>
<nuclide_table name="U234" decay_modes="0" reactions="1">
<reaction_type type="fission" Q="191840000."/>
<depletion_chain>
<nuclide name="I135" decay_modes="1" reactions="1" half_life="2.36520E+04">
<decay type="beta" target="Xe135" branching_ratio="1.0" />
<reaction type="(n,gamma)" Q="0.0" target="Xe136" /> <!-- Not precisely true, but whatever -->
</nuclide>
<nuclide name="Xe135" decay_modes="1" reactions="1" half_life="3.29040E+04">
<decay type=" beta" target="Cs135" branching_ratio="1.0" />
<reaction type="(n,gamma)" Q="0.0" target="Xe136" />
</nuclide>
<nuclide name="Xe136" decay_modes="0" reactions="0" />
<nuclide name="Cs135" decay_modes="0" reactions="0" />
<nuclide name="Gd157" decay_modes="0" reactions="1" >
<reaction type="(n,gamma)" Q="0.0" target="Nothing" />
</nuclide>
<nuclide name="Gd156" decay_modes="0" reactions="1">
<reaction type="(n,gamma)" Q="0.0" target="Gd157" />
</nuclide>
<nuclide name="U234" decay_modes="0" reactions="1">
<reaction type="fission" Q="191840000."/>
<neutron_fission_yields>
<energies>2.53000e-02</energies>
<fission_yields energy="2.53000e-02">
@ -25,9 +25,9 @@
<data>1.093250e-04 2.087260e-04 2.780820e-02 6.759540e-03 2.392300e-02 4.356330e-05</data>
</fission_yields>
</neutron_fission_yields>
</nuclide_table>
<nuclide_table name="U235" decay_modes="0" reactions="1">
<reaction_type type="fission" Q="193410000."/>
</nuclide>
<nuclide name="U235" decay_modes="0" reactions="1">
<reaction type="fission" Q="193410000."/>
<neutron_fission_yields>
<energies>2.53000e-02</energies>
<fission_yields energy="2.53000e-02">
@ -35,9 +35,9 @@
<data>6.142710e-5 1.483250e-04 0.0292737 0.002566345 0.0219242 4.9097e-6</data>
</fission_yields>
</neutron_fission_yields>
</nuclide_table>
<nuclide_table name="U238" decay_modes="0" reactions="1">
<reaction_type type="fission" Q="197790000."/>
</nuclide>
<nuclide name="U238" decay_modes="0" reactions="1">
<reaction type="fission" Q="197790000."/>
<neutron_fission_yields>
<energies>2.53000e-02</energies>
<fission_yields energy="2.53000e-02">
@ -45,5 +45,5 @@
<data>4.141120e-04 7.605360e-04 0.0135457 0.00026864 0.0024432 3.7100E-07</data>
</fission_yields>
</neutron_fission_yields>
</nuclide_table>
</depletion>
</nuclide>
</depletion_chain>

View file

@ -1,17 +1,17 @@
<depletion>
<nuclide_table name="A" half_life="23652.0" decay_modes="2" decay_energy="0.0" reactions="1">
<decay_type type="beta1" target="B" branching_ratio="0.6"/>
<decay_type type="beta2" target="C" branching_ratio="0.4"/>
<reaction_type type="(n,gamma)" Q="0.0" target="C"/>
</nuclide_table>
<nuclide_table name="B" half_life="32904.0" decay_modes="1" decay_energy="0.0" reactions="1">
<decay_type type="beta" target="A" branching_ratio="1.0"/>
<reaction_type type="(n,gamma)" Q="0.0" target="C"/>
</nuclide_table>
<nuclide_table name="C" reactions="3">
<reaction_type type="fission" Q="200000000.0"/>
<reaction_type type="(n,gamma)" Q="0.0" target="A" branching_ratio="0.7"/>
<reaction_type type="(n,gamma)" Q="0.0" target="B" branching_ratio="0.3"/>
<depletion_chain>
<nuclide name="A" half_life="23652.0" decay_modes="2" decay_energy="0.0" reactions="1">
<decay type="beta1" target="B" branching_ratio="0.6"/>
<decay type="beta2" target="C" branching_ratio="0.4"/>
<reaction type="(n,gamma)" Q="0.0" target="C"/>
</nuclide>
<nuclide name="B" half_life="32904.0" decay_modes="1" decay_energy="0.0" reactions="1">
<decay type="beta" target="A" branching_ratio="1.0"/>
<reaction type="(n,gamma)" Q="0.0" target="C"/>
</nuclide>
<nuclide name="C" reactions="3">
<reaction type="fission" Q="200000000.0"/>
<reaction type="(n,gamma)" Q="0.0" target="A" branching_ratio="0.7"/>
<reaction type="(n,gamma)" Q="0.0" target="B" branching_ratio="0.3"/>
<neutron_fission_yields>
<energies>0.0253</energies>
<fission_yields energy="0.0253">
@ -19,5 +19,5 @@
<data>0.0292737 0.002566345</data>
</fission_yields>
</neutron_fission_yields>
</nuclide_table>
</depletion>
</nuclide>
</depletion_chain>

View file

@ -0,0 +1,102 @@
.. _io_chain:
============================
Depletion Chain -- chain.xml
============================
A depletion chain file has a ``<depletion_chain>`` root element with one or more
``<nuclide>`` child elements. The decay, reaction, and fission product data for
each nuclide appears as child elements of ``<nuclide>``.
---------------------
``<nuclide>`` Element
---------------------
The ``<nuclide>`` element contains information on the decay modes, reactions,
and fission product yields for a given nuclide in the depletion chain. This
element may have the following attributes:
:name:
Name of the nuclide
:half_life:
Half-life of the nuclide in [s]
:decay_modes:
Number of decay modes present
:decay_energy:
Decay energy released in [eV]
:reactions:
Number of reactions present
For each decay mode, a :ref:`io_chain_decay` appears as a child of
``<nuclide>``. For each reaction present, a :ref:`io_chain_reaction` appears as
a child of ``<nuclide>``. If the nuclide is fissionable, a :ref:`io_chain_nfy`
appears as well.
.. _io_chain_decay:
-------------------
``<decay>`` Element
-------------------
The ``<decay>`` element represents a single decay mode and has the following
attributes:
:type:
The type of the decay, e.g. 'ec/beta+'
:target:
The daughter nuclide produced from the decay
:branching_ratio:
The branching ratio for this decay mode
.. _io_chain_reaction:
----------------------
``<reaction>`` Element
----------------------
The ``<reaction>`` element represents a single transmutation reaction. This
element has the following attributes:
:type:
The type of the reaction, e.g., '(n,gamma)'
:Q:
The Q value of the reaction in [eV]
:target:
The nuclide produced in the reaction (absent if the type is 'fission')
:branching_ratio:
The branching ratio for the reaction
.. _io_chain_nfy:
------------------------------------
``<neutron_fission_yields>`` Element
------------------------------------
The ``<neutron_fission_yields>`` element provides yields of fission products for
fissionable nuclides. It has the follow sub-elements:
:energies:
Energies in [eV] at which yields for products are tabulated
:fission_yields:
Fission product yields for a single energy point. This element itself has a
number of attributes/sub-elements:
:energy:
Energy in [eV] at which yields are tabulated
:products:
Names of fission products
:data:
Independent yields for each fission product

View file

@ -30,6 +30,7 @@ Data Files
:maxdepth: 2
cross_sections
depletion_chain
nuclear_data
mgxs_library
data_wmp

View file

@ -327,7 +327,7 @@ class Chain(object):
# Load XML tree
root = ET.parse(str(filename))
for i, nuclide_elem in enumerate(root.findall('nuclide_table')):
for i, nuclide_elem in enumerate(root.findall('nuclide')):
nuc = Nuclide.from_xml(nuclide_elem)
chain.nuclide_dict[nuc.name] = i
@ -350,7 +350,7 @@ class Chain(object):
"""
root_elem = ET.Element('depletion')
root_elem = ET.Element('depletion_chain')
for nuclide in self.nuclides:
root_elem.append(nuclide.to_xml_element())

View file

@ -23,9 +23,9 @@ class Nuclide(object):
name : str
Name of nuclide.
half_life : float
Half life of nuclide in s^-1.
Half life of nuclide in [s].
decay_energy : float
Energy deposited from decay in eV.
Energy deposited from decay in [eV].
n_decay_modes : int
Number of decay pathways.
decay_modes : list of DecayTuple
@ -94,14 +94,14 @@ class Nuclide(object):
nuc.decay_energy = float(element.get('decay_energy', '0'))
# Check for decay paths
for decay_elem in element.iter('decay_type'):
for decay_elem in element.iter('decay'):
d_type = decay_elem.get('type')
target = decay_elem.get('target')
branching_ratio = float(decay_elem.get('branching_ratio'))
nuc.decay_modes.append(DecayTuple(d_type, target, branching_ratio))
# Check for reaction paths
for reaction_elem in element.iter('reaction_type'):
for reaction_elem in element.iter('reaction'):
r_type = reaction_elem.get('type')
Q = float(reaction_elem.get('Q', '0'))
branching_ratio = float(reaction_elem.get('branching_ratio', '1'))
@ -138,7 +138,7 @@ class Nuclide(object):
XML element to write nuclide data to
"""
elem = ET.Element('nuclide_table')
elem = ET.Element('nuclide')
elem.set('name', self.name)
if self.half_life is not None:
@ -146,14 +146,14 @@ class Nuclide(object):
elem.set('decay_modes', str(len(self.decay_modes)))
elem.set('decay_energy', str(self.decay_energy))
for mode, daughter, br in self.decay_modes:
mode_elem = ET.SubElement(elem, 'decay_type')
mode_elem = ET.SubElement(elem, 'decay')
mode_elem.set('type', mode)
mode_elem.set('target', daughter)
mode_elem.set('branching_ratio', str(br))
elem.set('reactions', str(len(self.reactions)))
for rx, daughter, Q, br in self.reactions:
rx_elem = ET.SubElement(elem, 'reaction_type')
rx_elem = ET.SubElement(elem, 'reaction')
rx_elem.set('type', rx)
rx_elem.set('Q', str(Q))
if rx != 'fission':

View file

@ -37,14 +37,14 @@ def test_from_xml():
"""Test reading nuclide data from an XML element."""
data = """
<nuclide_table name="U235" reactions="2">
<decay_type type="sf" target="U235" branching_ratio="7.2e-11"/>
<decay_type type="alpha" target="Th231" branching_ratio="0.999999999928"/>
<reaction_type type="(n,2n)" target="U234" Q="-5297781.0"/>
<reaction_type type="(n,3n)" target="U233" Q="-12142300.0"/>
<reaction_type type="(n,4n)" target="U232" Q="-17885600.0"/>
<reaction_type type="(n,gamma)" target="U236" Q="6545200.0"/>
<reaction_type type="fission" Q="193405400.0"/>
<nuclide name="U235" reactions="2">
<decay type="sf" target="U235" branching_ratio="7.2e-11"/>
<decay type="alpha" target="Th231" branching_ratio="0.999999999928"/>
<reaction type="(n,2n)" target="U234" Q="-5297781.0"/>
<reaction type="(n,3n)" target="U233" Q="-12142300.0"/>
<reaction type="(n,4n)" target="U232" Q="-17885600.0"/>
<reaction type="(n,gamma)" target="U236" Q="6545200.0"/>
<reaction type="fission" Q="193405400.0"/>
<neutron_fission_yields>
<energies>0.0253</energies>
<fission_yields energy="0.0253">
@ -52,7 +52,7 @@ def test_from_xml():
<data>0.062155 0.0497641 0.0481413</data>
</fission_yields>
</neutron_fission_yields>
</nuclide_table>
</nuclide>
"""
element = ET.fromstring(data)
@ -96,7 +96,7 @@ def test_to_xml_element():
assert element.get("half_life") == "0.123"
decay_elems = element.findall("decay_type")
decay_elems = element.findall("decay")
assert len(decay_elems) == 2
assert decay_elems[0].get("type") == "beta-"
assert decay_elems[0].get("target") == "B"
@ -105,7 +105,7 @@ def test_to_xml_element():
assert decay_elems[1].get("target") == "D"
assert decay_elems[1].get("branching_ratio") == "0.01"
rx_elems = element.findall("reaction_type")
rx_elems = element.findall("reaction")
assert len(rx_elems) == 2
assert rx_elems[0].get("type") == "fission"
assert float(rx_elems[0].get("Q")) == 2.0e8