make changes from @paulromano's 3rd review

- syntax fixes and adjustments
- change name of FluxDepletionOperator to IndependentOperator
- flux_operator.py -> independent_operator.py
- new class, MicroXS, for creating (for now) one-group microscopic
  cross section DataFrames. This class takes the functionality that was
  previously in static functions in IndependentOperator
- Associated changes to the test suite and online docs
This commit is contained in:
yardasol 2022-07-28 15:55:07 -05:00
parent 4818a296d4
commit 3e827530ba
15 changed files with 437 additions and 319 deletions

View file

@ -97,7 +97,7 @@ Energy Deposition
-----------------
The default energy deposition mode, ``"fission-q"``, instructs the
:class:`openmc.deplete.Operator` to normalize reaction rates using the product
:class:`~openmc.deplete.Operator` to normalize reaction rates using the product
of fission reaction rates and fission Q values taken from the depletion chain.
This approach does not consider indirect contributions to energy deposition,
such as neutron heating and energy from secondary photons. In doing this, the
@ -113,7 +113,7 @@ should be, including indirect components. Some examples are provided below::
fission_q = {"U235": 202e+6} # energy in eV
# create a Model object
model = openmc.Model(geometry, settings)
model = openmc.Model(geometry, settings)
# create a modified chain and write it to a new file
chain = openmc.deplete.Chain.from_xml("chain.xml", fission_q)
@ -133,7 +133,7 @@ to normalize reaction rates instead of using the fission reaction rates with::
normalization_mode="energy-deposition")
These modified heating libraries can be generated by running the latest version
of :meth:`openmc.data.IncidentNeutron.from_njoy`, and will eventually be bundled
of :meth:`openmc.data.IncidentNeutron.from_njoy()`, and will eventually be bundled
into the distributed libraries.
Local Spectra and Repeated Materials
@ -188,31 +188,57 @@ Transport-independent depletion
possible and likely in the near future.
OpenMC supports running depletion calculations independent of the OpenMC
transport solver using the :class:`~openmc.deplete.FluxDepletionOperator` class.
transport solver using the :class:`~openmc.deplete.IndependentOperator` class.
This class supports both constant-flux (``source-rate`` normalization) and
constant-power depletion (``fission-q`` normalization).
.. important::
Make sure you set the correct parameter in the :class:`openmc.abc.Integrator` class. Use the ``source_rates`` parameter when ``normalization_mode == source-rate``, and use ``power`` or ``power_density`` when ``normalization_mode == fission-q``.
Make sure you set the correct parameter in the :class:`openmc.abc.Integrator`
class. Use the ``source_rates`` parameter when
``normalization_mode == source-rate``, and use ``power`` or ``power_density``
when ``normalization_mode == fission-q``.
.. warning::
The accuracy of results when using ``fission-q`` is entirely dependent on your depletion chain. Make sure it has sufficient data to resolve the dynamics of your particular scenario.
The accuracy of results when using ``fission-q`` is entirely dependent on
your depletion chain. Make sure it has sufficient data to resolve the
dynamics of your particular scenario.
This class has two ways to initialize it: the default constructor accepts an
:class:`openmc.Materials` object and one-group microscopic
cross sections as a :class:`pandas.DataFrame`, while the ``from_nuclides``
method accepts a volume and dictionary of nuclide concentrations in place of
the :class:`openmc.Materials` object in addition to the other parameters.
The class includes helper functions to construct the dataframe from a csv file
or from data arrays::
:class:`~openmc.deplete.IndependentOperator` class uses one-group microscopic cross sections to calculate reaction
rates. Users can generate one-group microscopic cross sections using the
:class:`~openmc.deplete.MicroXS` class::
import openmc
from openmc.deplete import MicroXS
model = openmc.Model.from_xml()
micro_xs = MicroXS.from_model(model, model.materials[0])
micro_xs.to_csv(micro_xs_path)
:class:`~openmc.deplete.MicroXS` also includes functions to read in cross
section data directly from a ``.csv`` file or from data arrays::
micro_xs = MicroXS.from_csv(micro_xs_path)
nuclides = ['U234', 'U235', 'U238']
reactions = ['fission', '(n,gamma)']
data = np.array([[0.1, 0.2],
[0.3, 0.4],
[0.01, 0.5]])
micro_xs = MicroXS.from_array(nuclides, reactions, data)
:class:`~openmc.deplete.IndependentOperator` has two ways to initialize it:
the default constructor accepts an :class:`openmc.Materials` object and
one-group microscopic cross sections as a :class:`~openmc.deplete.MicroXS`
object, while the :meth:`~openmc.deplete.IndependentOperator.from_nuclides`
method accepts a volume and dictionary of nuclide concentrations in place of the
:class:`openmc.Materials` object in addition to the other parameters::
...
# load in the microscopic cross sections
micro_xs = FluxDepletionOperator.create_micro_xs_from_csv(micro_xs_path)
flux = 1.16e15
op = FluxDepletionOperator(materials, micro_xs, chain_file)
op = IndependentOperator(materials, micro_xs, chain_file)
# alternate construtor
nuclides = {'U234': 8.92e18,
@ -222,8 +248,8 @@ or from data arrays::
'O16': 4.64e22,
'O17': 1.76e19}
volume = 0.5
op = FluxDepletionOperator.from_nuclides(volume, nuclides, 'atom/cm3',
micro_xs, flux, chain_file)
op = IndependentOperator.from_nuclides(volume, nuclides, micro_xs,
chain_file, nuc_units='atom/cm3')
A user can then define an integrator class as they would for a coupled
transport-depletion calculation and follow the same steps from there.