fiss_q_values -> fission_q for passing q values

This commit is contained in:
Andrew Johnson 2019-06-28 10:21:57 -05:00
parent 0e125b2548
commit 1e6f15236a
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
6 changed files with 24 additions and 24 deletions

View file

@ -49,8 +49,8 @@ class TransportOperator(metaclass=ABCMeta):
Path to the depletion chain XML file. Defaults to the file
listed under ``depletion_chain`` in
:envvar:`OPENMC_CROSS_SECTIONS` environment variable.
fiss_q_values : dict, optional
Dictionary of nuclides and their fission q values [eV]. If not given,
fission_q : dict, optional
Dictionary of nuclides and their fission Q values [eV]. If not given,
values will be pulled from the ``chain_file``.
Attributes
@ -61,7 +61,7 @@ class TransportOperator(metaclass=ABCMeta):
nuclides with reaction rates. Defaults to 1.0e3.
"""
def __init__(self, chain_file=None, fiss_q_values=None):
def __init__(self, chain_file=None, fission_q=None):
self.dilute_initial = 1.0e3
self.output_dir = '.'
@ -84,7 +84,7 @@ class TransportOperator(metaclass=ABCMeta):
warn("Use of OPENMC_DEPLETE_CHAIN is deprecated in favor "
"of adding depletion_chain to OPENMC_CROSS_SECTIONS",
FutureWarning)
self.chain = Chain.from_xml(chain_file, fiss_q_values)
self.chain = Chain.from_xml(chain_file, fission_q)
@abstractmethod
def __call__(self, vec, print_out=True):

View file

@ -314,30 +314,30 @@ class Chain(object):
return chain
@classmethod
def from_xml(cls, filename, fiss_q_values=None):
def from_xml(cls, filename, fission_q=None):
"""Reads a depletion chain XML file.
Parameters
----------
filename : str
The path to the depletion chain XML file.
fiss_q_values : dict, optional
Dictionary of nuclides and their fission q values [eV].
fission_q : dict, optional
Dictionary of nuclides and their fission Q values [eV].
If not given, values will be pulled from ``filename``
"""
chain = cls()
if fiss_q_values is not None:
check_type("fiss_q_values", fiss_q_values, Mapping)
if fission_q is not None:
check_type("fission_q", fission_q, Mapping)
else:
fiss_q_values = {}
fission_q = {}
# Load XML tree
root = ET.parse(str(filename))
for i, nuclide_elem in enumerate(root.findall('nuclide')):
this_q = fiss_q_values.get(nuclide_elem.get("name"), None)
this_q = fission_q.get(nuclide_elem.get("name"))
nuc = Nuclide.from_xml(nuclide_elem, this_q)
chain.nuclide_dict[nuc.name] = i

View file

@ -112,14 +112,14 @@ class Nuclide(object):
return len(self.reactions)
@classmethod
def from_xml(cls, element, fiss_q=None):
def from_xml(cls, element, fission_q=None):
"""Read nuclide from an XML element.
Parameters
----------
element : xml.etree.ElementTree.Element
XML element to write nuclide data to
fiss_q : None or float
fission_q : None or float
User-supplied fission Q value [eV].
Will be read from the element if not given
@ -156,8 +156,8 @@ class Nuclide(object):
target = reaction_elem.get('target')
else:
target = None
if fiss_q is not None:
Q = fiss_q
if fission_q is not None:
Q = fission_q
# Append reaction
nuc.reactions.append(ReactionTuple(

View file

@ -73,8 +73,8 @@ class Operator(TransportOperator):
in the previous results.
diff_burnable_mats : bool, optional
Whether to differentiate burnable materials with multiple instances
fiss_q_values : dict, optional
Dictionary of nuclides and their fission q values [eV]. If not given,
fission_q : dict, optional
Dictionary of nuclides and their fission Q values [eV]. If not given,
values will be pulled from the ``chain_file``.
Attributes
@ -113,8 +113,8 @@ class Operator(TransportOperator):
"""
def __init__(self, geometry, settings, chain_file=None, prev_results=None,
diff_burnable_mats=False, fiss_q_values=None):
super().__init__(chain_file, fiss_q_values)
diff_burnable_mats=False, fission_q=None):
super().__init__(chain_file, fission_q)
self.round_number = False
self.settings = settings
self.geometry = geometry

View file

@ -124,7 +124,7 @@ class Model(object):
self._plots.append(plot)
def deplete(self, timesteps, chain_file=None, method='cecm',
fiss_q_values=None, **kwargs):
fission_q=None, **kwargs):
"""Deplete model using specified timesteps/power
Parameters
@ -138,8 +138,8 @@ class Model(object):
:envvar:`OPENMC_CROSS_SECTIONS` environment variable if it exists.
method : str
Integration method used for depletion (e.g., 'cecm', 'predictor')
fiss_q_values : dict, optional
Dictionary of nuclides and their fission q values [eV].
fission_q : dict, optional
Dictionary of nuclides and their fission Q values [eV].
If not given, values will be pulled from the ``chain_file``.
**kwargs
Keyword arguments passed to integration function (e.g.,
@ -154,7 +154,7 @@ class Model(object):
# Create OpenMC transport operator
op = dep.Operator(
self.geometry, self.settings, chain_file,
fiss_q_values=fiss_q_values,
fission_q=fission_q,
)
# Perform depletion

View file

@ -74,7 +74,7 @@ def test_operator_fiss_q():
"""Make sure fission q values can be set"""
new_q = {"U235": 2.0E8, "U238": 2.0E8, "U234": 5.0E7}
chain_file = Path(__file__).parents[1] / "chain_simple.xml"
operator = BareDepleteOperator(chain_file=chain_file, fiss_q_values=new_q)
operator = BareDepleteOperator(chain_file=chain_file, fission_q=new_q)
mod_chain = operator.chain
for name, q in new_q.items():
chain_nuc = mod_chain[name]