diff --git a/docs/source/pythonapi/deplete/index.rst b/docs/source/pythonapi/deplete/index.rst index 55380c7a1..30d2d4261 100644 --- a/docs/source/pythonapi/deplete/index.rst +++ b/docs/source/pythonapi/deplete/index.rst @@ -17,7 +17,7 @@ Integrator Helper Functions --------------------------- .. toctree:: :maxdepth: 2 - + integrator.CRAM16 integrator.CRAM48 integrator.save_results @@ -29,8 +29,8 @@ Metaclasses :toctree: generated :nosignatures: - opendeplete.Settings - opendeplete.Operator + openmc.deplete.Settings + openmc.deplete.Operator OpenMC Classes -------------- @@ -39,18 +39,18 @@ OpenMC Classes :toctree: generated :nosignatures: - opendeplete.OpenMCSettings - opendeplete.Materials - opendeplete.OpenMCOperator + openmc.deplete.OpenMCSettings + openmc.deplete.Materials + openmc.deplete.OpenMCOperator Data Classes ------------ .. autosummary:: :toctree: generated :nosignatures: - - opendeplete.AtomNumber - opendeplete.DepletionChain - opendeplete.Nuclide - opendeplete.ReactionRates - opendeplete.Results + + openmc.deplete.AtomNumber + openmc.deplete.Chain + openmc.deplete.Nuclide + openmc.deplete.ReactionRates + openmc.deplete.Results diff --git a/docs/source/pythonapi/deplete/integrator.CRAM16.rst b/docs/source/pythonapi/deplete/integrator.CRAM16.rst index f9eba273e..a0dc64805 100644 --- a/docs/source/pythonapi/deplete/integrator.CRAM16.rst +++ b/docs/source/pythonapi/deplete/integrator.CRAM16.rst @@ -1,6 +1,6 @@ integrator\.CRAM16 ================== -.. currentmodule:: opendeplete.integrator +.. currentmodule:: openmc.deplete.integrator .. autofunction:: CRAM16 diff --git a/docs/source/pythonapi/deplete/integrator.CRAM48.rst b/docs/source/pythonapi/deplete/integrator.CRAM48.rst index d7467a418..f9720f7ad 100644 --- a/docs/source/pythonapi/deplete/integrator.CRAM48.rst +++ b/docs/source/pythonapi/deplete/integrator.CRAM48.rst @@ -1,6 +1,6 @@ integrator\.CRAM48 ================== -.. currentmodule:: opendeplete.integrator +.. currentmodule:: openmc.deplete.integrator .. autofunction:: CRAM48 diff --git a/docs/source/pythonapi/deplete/integrator.cecm.rst b/docs/source/pythonapi/deplete/integrator.cecm.rst index 507a638f6..4851b20b3 100644 --- a/docs/source/pythonapi/deplete/integrator.cecm.rst +++ b/docs/source/pythonapi/deplete/integrator.cecm.rst @@ -1,6 +1,6 @@ integrator\.cecm ================= -.. currentmodule:: opendeplete.integrator +.. currentmodule:: openmc.deplete.integrator .. autofunction:: cecm diff --git a/docs/source/pythonapi/deplete/integrator.predictor.rst b/docs/source/pythonapi/deplete/integrator.predictor.rst index d6c0fd827..2243e77f7 100644 --- a/docs/source/pythonapi/deplete/integrator.predictor.rst +++ b/docs/source/pythonapi/deplete/integrator.predictor.rst @@ -1,6 +1,6 @@ integrator\.predictor ===================== -.. currentmodule:: opendeplete.integrator +.. currentmodule:: openmc.deplete.integrator .. autofunction:: predictor diff --git a/docs/source/pythonapi/deplete/integrator.save_results.rst b/docs/source/pythonapi/deplete/integrator.save_results.rst index 5c21dcb66..f9c830cd5 100644 --- a/docs/source/pythonapi/deplete/integrator.save_results.rst +++ b/docs/source/pythonapi/deplete/integrator.save_results.rst @@ -1,6 +1,6 @@ integrator\.save_results ======================== -.. currentmodule:: opendeplete.integrator +.. currentmodule:: openmc.deplete.integrator .. autofunction:: save_results diff --git a/docs/source/pythonapi/deplete/opendeplete.Concentrations.rst b/docs/source/pythonapi/deplete/opendeplete.Concentrations.rst deleted file mode 100644 index 6fa07a970..000000000 --- a/docs/source/pythonapi/deplete/opendeplete.Concentrations.rst +++ /dev/null @@ -1,30 +0,0 @@ -opendeplete.Concentrations -========================== - -.. currentmodule:: opendeplete - -.. autoclass:: Concentrations - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Concentrations.__init__ - ~Concentrations.convert_nested_dict - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~Concentrations.n_cell - ~Concentrations.n_nuc - - \ No newline at end of file diff --git a/docs/source/pythonapi/deplete/opendeplete.ReactionRates.rst b/docs/source/pythonapi/deplete/opendeplete.ReactionRates.rst deleted file mode 100644 index 99e048b56..000000000 --- a/docs/source/pythonapi/deplete/opendeplete.ReactionRates.rst +++ /dev/null @@ -1,30 +0,0 @@ -opendeplete.ReactionRates -========================= - -.. currentmodule:: opendeplete - -.. autoclass:: ReactionRates - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~ReactionRates.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~ReactionRates.n_cell - ~ReactionRates.n_nuc - ~ReactionRates.n_react - - \ No newline at end of file diff --git a/docs/source/pythonapi/deplete/opendeplete.Results.rst b/docs/source/pythonapi/deplete/opendeplete.Results.rst deleted file mode 100644 index 0ab8a1f71..000000000 --- a/docs/source/pythonapi/deplete/opendeplete.Results.rst +++ /dev/null @@ -1,22 +0,0 @@ -opendeplete.Results -=================== - -.. currentmodule:: opendeplete - -.. autoclass:: Results - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Results.__init__ - - - - - - \ No newline at end of file diff --git a/openmc/data/data.py b/openmc/data/data.py index a7c0e536f..523ac9769 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -319,8 +319,9 @@ def water_density(temperature, pressure=0.1013): # The value of the Boltzman constant in units of eV / K K_BOLTZMANN = 8.6173303e-5 -# Used for converting units in ACE data +# Unit conversions EV_PER_MEV = 1.0e6 +JOULE_PER_EV = 1.6021766208e-19 # Avogadro's constant AVOGADRO = 6.022140857e23 diff --git a/openmc/deplete/__init__.py b/openmc/deplete/__init__.py index 4bdde3935..19d1d1320 100644 --- a/openmc/deplete/__init__.py +++ b/openmc/deplete/__init__.py @@ -15,7 +15,7 @@ except ImportError: have_mpi = False from .nuclide import * -from .depletion_chain import * +from .chain import * from .openmc_wrapper import * from .reaction_rates import * from .function import * diff --git a/openmc/deplete/depletion_chain.py b/openmc/deplete/chain.py similarity index 99% rename from openmc/deplete/depletion_chain.py rename to openmc/deplete/chain.py index 9f6b7cfed..03decb72a 100644 --- a/openmc/deplete/depletion_chain.py +++ b/openmc/deplete/chain.py @@ -1,4 +1,4 @@ -"""depletion_chain module. +"""chain module. This module contains information about a depletion chain. A depletion chain is loaded from an .xml file and all the nuclides are linked together. @@ -108,10 +108,8 @@ def replace_missing(product, decay_data): return product -class DepletionChain(object): - """The DepletionChain class. - - This class contains a full representation of a depletion chain. +class Chain(object): + """Full representation of a depletion chain. Attributes ---------- diff --git a/openmc/deplete/openmc_wrapper.py b/openmc/deplete/openmc_wrapper.py index 88b497122..5c7a1aeba 100644 --- a/openmc/deplete/openmc_wrapper.py +++ b/openmc/deplete/openmc_wrapper.py @@ -21,14 +21,14 @@ import numpy as np import openmc import openmc.capi +from openmc.data import JOULE_PER_EV from . import comm from .atom_number import AtomNumber -from .depletion_chain import DepletionChain +from .chain import Chain from .reaction_rates import ReactionRates from .function import Settings, Operator -_JOULE_PER_EV = 1.6021766208e-19 def chunks(items, n): @@ -149,13 +149,13 @@ class OpenMCOperator(Operator): Materials to be used for this simulation. seed : int The RNG seed used in last OpenMC run. - number : AtomNumber + number : openmc.deplete.AtomNumber Total number of atoms in simulation. participating_nuclides : set of str A set listing all unique nuclides available from cross_sections.xml. - chain : DepletionChain + chain : openmc.deplete.Chain The depletion chain information necessary to form matrices and tallies. - reaction_rates : ReactionRates + reaction_rates : openmc.deplete.ReactionRates Reaction rates from the last operator step. power : OrderedDict of str to float Material-by-Material power. Indexed by material ID. @@ -186,7 +186,7 @@ class OpenMCOperator(Operator): self.burn_nuc_to_ind = None # Read depletion chain - self.chain = DepletionChain.from_xml(settings.chain_file) + self.chain = Chain.from_xml(settings.chain_file) # Clear out OpenMC, create task lists, distribute if comm.rank == 0: @@ -390,7 +390,7 @@ class OpenMCOperator(Operator): Matrices for the next step. k : float Eigenvalue of the problem. - rates : ReactionRates + rates : openmc.deplete.ReactionRates Reaction rates from this simulation. seed : int Seed for this simulation. @@ -602,11 +602,11 @@ class OpenMCOperator(Operator): def generate_tallies(self): """Generates depletion tallies. - Using information from self.depletion_chain as well as the nuclides + Using information from the depletion chain as well as the nuclides currently in the problem, this function automatically generates a tally.xml for the simulation. - """ + """ # Create tallies for depleting regions materials = [openmc.capi.materials[int(i)] for i in self.mat_tally_ind] @@ -742,7 +742,7 @@ class OpenMCOperator(Operator): energy = comm.allreduce(energy) # Determine power in eV/s - power = self.settings.power / _JOULE_PER_EV + power = self.settings.power / JOULE_PER_EV # Scale reaction rates to obtain units of reactions/sec rates[:, :, :] *= power / energy diff --git a/scripts/make_chain.py b/scripts/make_chain.py index e2b0a2340..6d64f34b3 100644 --- a/scripts/make_chain.py +++ b/scripts/make_chain.py @@ -52,7 +52,7 @@ def main(): nfy_files = glob.glob(os.path.join('nfy', '*.endf')) neutron_files = glob.glob(os.path.join('neutrons', '*.endf')) - chain = openmc.deplete.DepletionChain.from_endf(decay_files, nfy_files, neutron_files) + chain = openmc.deplete.Chain.from_endf(decay_files, nfy_files, neutron_files) chain.export_to_xml('chain_endfb71.xml') diff --git a/tests/unit_tests/test_depletion_chain.py b/tests/unit_tests/test_deplete_chain.py similarity index 92% rename from tests/unit_tests/test_depletion_chain.py rename to tests/unit_tests/test_deplete_chain.py index ba9e32db4..6166f1561 100644 --- a/tests/unit_tests/test_depletion_chain.py +++ b/tests/unit_tests/test_deplete_chain.py @@ -1,4 +1,4 @@ -""" Tests for depletion_chain.py""" +"""Tests for depletion chains""" from collections import OrderedDict import os @@ -6,18 +6,18 @@ import unittest from pathlib import Path import numpy as np -from openmc.deplete import comm, depletion_chain, reaction_rates, nuclide +from openmc.deplete import comm, Chain, reaction_rates, nuclide _test_filename = str(Path(__file__).parents[2] / 'chains' / 'chain_test.xml') -class TestDepletionChain(unittest.TestCase): - """ Tests for DepletionChain class.""" +class TestChain(unittest.TestCase): + """ Tests for Chain class.""" def test__init__(self): """ Test depletion chain initialization.""" - dep = depletion_chain.DepletionChain() + dep = Chain() self.assertIsInstance(dep.nuclides, list) self.assertIsInstance(dep.nuclide_dict, OrderedDict) @@ -25,7 +25,7 @@ class TestDepletionChain(unittest.TestCase): def test_n_nuclides(self): """ Test depletion chain n_nuclides parameter. """ - dep = depletion_chain.DepletionChain() + dep = Chain() dep.nuclides = ["NucA", "NucB", "NucC"] @@ -42,7 +42,7 @@ class TestDepletionChain(unittest.TestCase): # the components external to depletion_chain.py are simple storage # types. - dep = depletion_chain.DepletionChain.from_xml(_test_filename) + dep = Chain.from_xml(_test_filename) # Basic checks self.assertEqual(dep.n_nuclides, 3) @@ -124,7 +124,7 @@ class TestDepletionChain(unittest.TestCase): C.yield_energies = [0.0253] C.yield_data = {0.0253: [("A", 0.0292737), ("B", 0.002566345)]} - chain = depletion_chain.DepletionChain() + chain = Chain() chain.nuclides = [A, B, C] chain.export_to_xml(filename) @@ -138,7 +138,7 @@ class TestDepletionChain(unittest.TestCase): """ Using chain_test, and a dummy reaction rate, compute the matrix. """ # Relies on test_from_xml passing. - dep = depletion_chain.DepletionChain.from_xml(_test_filename) + dep = Chain.from_xml(_test_filename) cell_ind = {"10000": 0, "10001": 1} nuc_ind = {"A": 0, "B": 1, "C": 2} @@ -187,7 +187,7 @@ class TestDepletionChain(unittest.TestCase): def test_nuc_by_ind(self): """ Test nuc_by_ind converter function. """ - dep = depletion_chain.DepletionChain() + dep = Chain() dep.nuclides = ["NucA", "NucB", "NucC"] dep.nuclide_dict = {"NucA" : 0, "NucB" : 1, "NucC" : 2}