mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Rename DepletionChain -> Chain
This commit is contained in:
parent
43147b70eb
commit
1ee27edc8c
15 changed files with 44 additions and 127 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
integrator\.CRAM16
|
||||
==================
|
||||
|
||||
.. currentmodule:: opendeplete.integrator
|
||||
.. currentmodule:: openmc.deplete.integrator
|
||||
|
||||
.. autofunction:: CRAM16
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
integrator\.CRAM48
|
||||
==================
|
||||
|
||||
.. currentmodule:: opendeplete.integrator
|
||||
.. currentmodule:: openmc.deplete.integrator
|
||||
|
||||
.. autofunction:: CRAM48
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
integrator\.cecm
|
||||
=================
|
||||
|
||||
.. currentmodule:: opendeplete.integrator
|
||||
.. currentmodule:: openmc.deplete.integrator
|
||||
|
||||
.. autofunction:: cecm
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
integrator\.predictor
|
||||
=====================
|
||||
|
||||
.. currentmodule:: opendeplete.integrator
|
||||
.. currentmodule:: openmc.deplete.integrator
|
||||
|
||||
.. autofunction:: predictor
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
integrator\.save_results
|
||||
========================
|
||||
|
||||
.. currentmodule:: opendeplete.integrator
|
||||
.. currentmodule:: openmc.deplete.integrator
|
||||
|
||||
.. autofunction:: save_results
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
opendeplete.Results
|
||||
===================
|
||||
|
||||
.. currentmodule:: opendeplete
|
||||
|
||||
.. autoclass:: Results
|
||||
|
||||
|
||||
.. automethod:: __init__
|
||||
|
||||
|
||||
.. rubric:: Methods
|
||||
|
||||
.. autosummary::
|
||||
|
||||
~Results.__init__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 *
|
||||
|
|
|
|||
|
|
@ -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
|
||||
----------
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
Loading…
Add table
Add a link
Reference in a new issue