Merge pull request #1424 from PullRequestOpen/pullrequest-cosmetic-fixes

PullRequest Cosmetic Fixes [2019-12-05]
This commit is contained in:
Paul Romano 2019-12-09 17:07:49 -06:00 committed by GitHub
commit 4013675cde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 239 additions and 215 deletions

View file

@ -30,7 +30,7 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \
# Clone and install OpenMC
RUN git clone https://github.com/openmc-dev/openmc.git /opt/openmc && \
cd /opt/openmc && mkdir -p build && cd build && \
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
make && make install && \
cd .. && pip install -e .[test]

View file

@ -1,6 +1,6 @@
def clean_indentation(element, level=0, spaces_per_level=2):
"""
copy and paste from http://effbot.org/zone/elementent-lib.htm#prettyprint
copy and paste from http://effbot.org/zone/element-lib.htm#prettyprint
it basically walks your tree and adds spaces and newlines so the tree is
printed in a nice way
"""

View file

@ -2,7 +2,7 @@ from collections import OrderedDict
from collections.abc import Iterable
from copy import deepcopy
from math import cos, sin, pi
from numbers import Real, Integral
from numbers import Real
from xml.etree import ElementTree as ET
import sys
import warnings
@ -442,7 +442,7 @@ class Cell(IDManagerMixin):
if memo is None:
memo = {}
# If no nemoize'd clone exists, instantiate one
# If no memoize'd clone exists, instantiate one
if self not in memo:
# Temporarily remove paths
paths = self._paths

View file

@ -90,7 +90,7 @@ def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
# Get a string representation of the current index in case we raise an
# exception.
form = '[' + '{:d}, '*(len(index)-1) + '{:d}]'
form = '[' + '{:d}, ' * (len(index)-1) + '{:d}]'
ind_str = form.format(*index)
# What is the current item we are looking at?
@ -109,7 +109,7 @@ def check_iterable_type(name, value, expected_type, min_depth=1, max_depth=1):
index[-1] += 1
# If this item is not of the expected type, then it's either an error or
# another level of the tree that we need to pursue deeper.
# on a deeper level of the tree.
else:
if isinstance(current_item, Iterable):
# The tree goes deeper here, let's explore it.

View file

@ -64,7 +64,7 @@ class CMFDMesh(object):
The lower-left corner of the structured mesh. If only two coordinates
are given, it is assumed that the mesh is an x-y mesh.
upper_right : Iterable of float
The upper-right corner of the structrued mesh. If only two coordinates
The upper-right corner of the structured mesh. If only two coordinates
are given, it is assumed that the mesh is an x-y mesh.
dimension : Iterable of int
The number of mesh cells in each direction.
@ -220,7 +220,7 @@ class CMFDRun(object):
Indicate whether an effective downscatter cross section should be used
when using 2-group CMFD.
feedback : bool
Indicate or not the CMFD diffusion result is used to adjust the weight
Indicate whether or not the CMFD diffusion result is used to adjust the weight
of fission source neutrons on the next OpenMC batch. Defaults to False.
cmfd_ktol : float
Tolerance on the eigenvalue when performing CMFD power iteration
@ -694,7 +694,7 @@ class CMFDRun(object):
def run(self, **kwargs):
"""Run OpenMC with coarse mesh finite difference acceleration
This method is called by user to run CMFD once instance variables of
This method is called by the user to run CMFD once instance variables of
CMFDRun class are set
Parameters

View file

@ -2,7 +2,7 @@ import numpy as np
def linearize(x, f, tolerance=0.001):
"""Return a tabulated representation of a function of one variable.
"""Return a tabulated representation of a one-variable function
Parameters
----------

View file

@ -4,9 +4,8 @@ from numbers import Real, Integral
import numpy as np
import openmc.checkvalue as cv
from openmc.stats import Tabular, Univariate, Discrete, Mixture
from openmc.stats import Tabular, Univariate, Discrete
from .angle_energy import AngleEnergy
from .function import INTERPOLATION_SCHEME
from .endf import get_tab2_record, get_tab1_record
@ -122,7 +121,7 @@ class LaboratoryAngleEnergy(AngleEnergy):
mu = []
energy_out = []
for i in range(ne):
params, tab2mu = get_tab2_record(file_obj)
params, _ = get_tab2_record(file_obj)
energy[i] = params[1]
n_mu = params[5]
mu_i = np.zeros(n_mu)

View file

@ -6,7 +6,6 @@ import h5py
from openmc.mixin import EqualityMixin
from openmc._xml import clean_indentation
from openmc.checkvalue import check_type
class DataLibrary(EqualityMixin):

View file

@ -85,7 +85,7 @@ class IncidentNeutron(EqualityMixin):
resonance_covariance : openmc.data.ResonanceCovariance or None
Covariance for resonance parameters
temperatures : list of str
List of string representations the temperatures of the target nuclide
List of string representations of the temperatures of the target nuclide
in the data set. The temperatures are strings of the temperature,
rounded to the nearest integer; e.g., '294K'
kTs : Iterable of float
@ -410,7 +410,7 @@ class IncidentNeutron(EqualityMixin):
----------
path : str
Path to write HDF5 file to
mode : {'r', r+', 'w', 'x', 'a'}
mode : {'r', 'r+', 'w', 'x', 'a'}
Mode that is used to open the HDF5 file. This is the second argument
to the :class:`h5py.File` constructor.
libver : {'earliest', 'latest'}

View file

@ -794,7 +794,7 @@ class IncidentPhoton(EqualityMixin):
----------
path : str
Path to write HDF5 file to
mode : {'r', r+', 'w', 'x', 'a'}
mode : {'r', 'r+', 'w', 'x', 'a'}
Mode that is used to open the HDF5 file. This is the second argument
to the :class:`h5py.File` constructor.
libver : {'earliest', 'latest'}

View file

@ -17,7 +17,7 @@ class Product(EqualityMixin):
Parameters
----------
particle : str, optional
What particle the reaction product is. Defaults to 'neutron'.
The particle type of the reaction product. Defaults to 'neutron'.
Attributes
----------

View file

@ -108,16 +108,37 @@ def replace_missing(product, decay_data):
_SECONDARY_PARTICLES = {
"(n,p)": ["H1"], "(n,d)": ["H2"], "(n,t)": ["H3"], "(n,3He)": ["He3"],
"(n,a)": ["He4"], "(n,2nd)": ["H2"], "(n,na)": ["He4"], "(n,3na)": ["He4"],
"(n,n3a)": ["He4"] * 3, "(n,2na)": ["He4"], "(n,np)": ["H1"],
"(n,n2a)": ["He4"] * 2, "(n,2n2a)": ["He4"] * 2, "(n,nd)": ["H2"],
"(n,nt)": ["H3"], "(n,nHe-3)": ["He3"], "(n,nd2a)": ["H2", "He4"],
"(n,nt2a)": ["H3", "He4", "He4"], "(n,2np)": ["H1"], "(n,3np)": ["H1"],
"(n,n2p)": ["H1"] * 2, "(n,2a)": ["He4"] * 2, "(n,3a)": ["He4"] * 3,
"(n,2p)": ["H1"] * 2, "(n,pa)": ["H1", "He4"],
"(n,t2a)": ["H3", "He4", "He4"], "(n,d2a)": ["H2", "He4", "He4"],
"(n,pd)": ["H1", "H2"], "(n,pt)": ["H1", "H3"], "(n,da)": ["H2", "He4"]}
'(n,p)': ['H1'],
'(n,d)': ['H2'],
'(n,t)': ['H3'],
'(n,3He)': ['He3'],
'(n,a)': ['He4'],
'(n,2nd)': ['H2'],
'(n,na)': ['He4'],
'(n,3na)': ['He4'],
'(n,n3a)': ['He4'] * 3,
'(n,2na)': ['He4'],
'(n,np)': ['H1'],
'(n,n2a)': ['He4'] * 2,
'(n,2n2a)': ['He4'] * 2,
'(n,nd)': ['H2'],
'(n,nt)': ['H3'],
'(n,nHe-3)': ['He3'],
'(n,nd2a)': ['H2', 'He4'],
'(n,nt2a)': ['H3', 'He4', 'He4'],
'(n,2np)': ['H1'],
'(n,3np)': ['H1'],
'(n,n2p)': ['H1'] * 2,
'(n,2a)': ['He4'] * 2,
'(n,3a)': ['He4'] * 3,
'(n,2p)': ['H1'] * 2,
'(n,pa)': ['H1', 'He4'],
'(n,t2a)': ['H3', 'He4', 'He4'],
'(n,d2a)': ['H2', 'He4', 'He4'],
'(n,pd)': ['H1', 'H2'],
'(n,pt)': ['H1', 'H3'],
'(n,da)': ['H2', 'He4']
}
class Chain(object):

View file

@ -26,7 +26,7 @@ class ReactionRates(np.ndarray):
reactions : list of str
Transmutation reactions being tracked
from_results : boolean
If the reaction rates are loaded from results, indexing dictionnaries
If the reaction rates are loaded from results, indexing dictionaries
need to be kept the same.
Attributes
@ -66,7 +66,7 @@ class ReactionRates(np.ndarray):
obj.index_rx = reactions
# Else, assumes that reaction rates are ordered the same way as
# the lists of local_mats, nuclides and reactions (or keys if these
# are dictionnaries)
# are dictionaries)
else:
obj.index_mat = {mat: i for i, mat in enumerate(local_mats)}
obj.index_nuc = {nuc: i for i, nuc in enumerate(nuclides)}

View file

@ -3,7 +3,6 @@ import re
import os
from xml.etree import ElementTree as ET
import openmc
import openmc.checkvalue as cv
from openmc.data import NATURAL_ABUNDANCE, atomic_mass

View file

@ -25,25 +25,25 @@ def pwr_pin_cell():
# Define materials.
fuel = openmc.Material(name='UO2 (2.4%)')
fuel.set_density('g/cm3', 10.29769)
fuel.add_nuclide("U234", 4.4843e-6)
fuel.add_nuclide("U235", 5.5815e-4)
fuel.add_nuclide("U238", 2.2408e-2)
fuel.add_nuclide("O16", 4.5829e-2)
fuel.add_nuclide('U234', 4.4843e-6)
fuel.add_nuclide('U235', 5.5815e-4)
fuel.add_nuclide('U238', 2.2408e-2)
fuel.add_nuclide('O16', 4.5829e-2)
clad = openmc.Material(name='Zircaloy')
clad.set_density('g/cm3', 6.55)
clad.add_nuclide("Zr90", 2.1827e-2)
clad.add_nuclide("Zr91", 4.7600e-3)
clad.add_nuclide("Zr92", 7.2758e-3)
clad.add_nuclide("Zr94", 7.3734e-3)
clad.add_nuclide("Zr96", 1.1879e-3)
clad.add_nuclide('Zr90', 2.1827e-2)
clad.add_nuclide('Zr91', 4.7600e-3)
clad.add_nuclide('Zr92', 7.2758e-3)
clad.add_nuclide('Zr94', 7.3734e-3)
clad.add_nuclide('Zr96', 1.1879e-3)
hot_water = openmc.Material(name='Hot borated water')
hot_water.set_density('g/cm3', 0.740582)
hot_water.add_nuclide("H1", 4.9457e-2)
hot_water.add_nuclide("O16", 2.4672e-2)
hot_water.add_nuclide("B10", 8.0042e-6)
hot_water.add_nuclide("B11", 3.2218e-5)
hot_water.add_nuclide('H1', 4.9457e-2)
hot_water.add_nuclide('O16', 2.4672e-2)
hot_water.add_nuclide('B10', 8.0042e-6)
hot_water.add_nuclide('B11', 3.2218e-5)
hot_water.add_s_alpha_beta('c_H_in_H2O')
# Define the materials file.
@ -106,148 +106,148 @@ def pwr_core():
# Define materials.
fuel = openmc.Material(1, name='UOX fuel')
fuel.set_density('g/cm3', 10.062)
fuel.add_nuclide("U234", 4.9476e-6)
fuel.add_nuclide("U235", 4.8218e-4)
fuel.add_nuclide("U238", 2.1504e-2)
fuel.add_nuclide("Xe135", 1.0801e-8)
fuel.add_nuclide("O16", 4.5737e-2)
fuel.add_nuclide('U234', 4.9476e-6)
fuel.add_nuclide('U235', 4.8218e-4)
fuel.add_nuclide('U238', 2.1504e-2)
fuel.add_nuclide('Xe135', 1.0801e-8)
fuel.add_nuclide('O16', 4.5737e-2)
clad = openmc.Material(2, name='Zircaloy')
clad.set_density('g/cm3', 5.77)
clad.add_nuclide("Zr90", 0.5145)
clad.add_nuclide("Zr91", 0.1122)
clad.add_nuclide("Zr92", 0.1715)
clad.add_nuclide("Zr94", 0.1738)
clad.add_nuclide("Zr96", 0.0280)
clad.add_nuclide('Zr90', 0.5145)
clad.add_nuclide('Zr91', 0.1122)
clad.add_nuclide('Zr92', 0.1715)
clad.add_nuclide('Zr94', 0.1738)
clad.add_nuclide('Zr96', 0.0280)
cold_water = openmc.Material(3, name='Cold borated water')
cold_water.set_density('atom/b-cm', 0.07416)
cold_water.add_nuclide("H1", 2.0)
cold_water.add_nuclide("O16", 1.0)
cold_water.add_nuclide("B10", 6.490e-4)
cold_water.add_nuclide("B11", 2.689e-3)
cold_water.add_nuclide('H1', 2.0)
cold_water.add_nuclide('O16', 1.0)
cold_water.add_nuclide('B10', 6.490e-4)
cold_water.add_nuclide('B11', 2.689e-3)
cold_water.add_s_alpha_beta('c_H_in_H2O')
hot_water = openmc.Material(4, name='Hot borated water')
hot_water.set_density('atom/b-cm', 0.06614)
hot_water.add_nuclide("H1", 2.0)
hot_water.add_nuclide("O16", 1.0)
hot_water.add_nuclide("B10", 6.490e-4)
hot_water.add_nuclide("B11", 2.689e-3)
hot_water.add_nuclide('H1', 2.0)
hot_water.add_nuclide('O16', 1.0)
hot_water.add_nuclide('B10', 6.490e-4)
hot_water.add_nuclide('B11', 2.689e-3)
hot_water.add_s_alpha_beta('c_H_in_H2O')
rpv_steel = openmc.Material(5, name='Reactor pressure vessel steel')
rpv_steel.set_density('g/cm3', 7.9)
rpv_steel.add_nuclide("Fe54", 0.05437098, 'wo')
rpv_steel.add_nuclide("Fe56", 0.88500663, 'wo')
rpv_steel.add_nuclide("Fe57", 0.0208008, 'wo')
rpv_steel.add_nuclide("Fe58", 0.00282159, 'wo')
rpv_steel.add_nuclide("Ni58", 0.0067198, 'wo')
rpv_steel.add_nuclide("Ni60", 0.0026776, 'wo')
rpv_steel.add_nuclide("Mn55", 0.01, 'wo')
rpv_steel.add_nuclide("Cr52", 0.002092475, 'wo')
rpv_steel.add_nuclide("C0", 0.0025, 'wo')
rpv_steel.add_nuclide("Cu63", 0.0013696, 'wo')
rpv_steel.add_nuclide('Fe54', 0.05437098, 'wo')
rpv_steel.add_nuclide('Fe56', 0.88500663, 'wo')
rpv_steel.add_nuclide('Fe57', 0.0208008, 'wo')
rpv_steel.add_nuclide('Fe58', 0.00282159, 'wo')
rpv_steel.add_nuclide('Ni58', 0.0067198, 'wo')
rpv_steel.add_nuclide('Ni60', 0.0026776, 'wo')
rpv_steel.add_nuclide('Mn55', 0.01, 'wo')
rpv_steel.add_nuclide('Cr52', 0.002092475, 'wo')
rpv_steel.add_nuclide('C0', 0.0025, 'wo')
rpv_steel.add_nuclide('Cu63', 0.0013696, 'wo')
lower_rad_ref = openmc.Material(6, name='Lower radial reflector')
lower_rad_ref.set_density('g/cm3', 4.32)
lower_rad_ref.add_nuclide("H1", 0.0095661, 'wo')
lower_rad_ref.add_nuclide("O16", 0.0759107, 'wo')
lower_rad_ref.add_nuclide("B10", 3.08409e-5, 'wo')
lower_rad_ref.add_nuclide("B11", 1.40499e-4, 'wo')
lower_rad_ref.add_nuclide("Fe54", 0.035620772088, 'wo')
lower_rad_ref.add_nuclide("Fe56", 0.579805982228, 'wo')
lower_rad_ref.add_nuclide("Fe57", 0.01362750048, 'wo')
lower_rad_ref.add_nuclide("Fe58", 0.001848545204, 'wo')
lower_rad_ref.add_nuclide("Ni58", 0.055298376566, 'wo')
lower_rad_ref.add_nuclide("Mn55", 0.0182870, 'wo')
lower_rad_ref.add_nuclide("Cr52", 0.145407678031, 'wo')
lower_rad_ref.add_nuclide('H1', 0.0095661, 'wo')
lower_rad_ref.add_nuclide('O16', 0.0759107, 'wo')
lower_rad_ref.add_nuclide('B10', 3.08409e-5, 'wo')
lower_rad_ref.add_nuclide('B11', 1.40499e-4, 'wo')
lower_rad_ref.add_nuclide('Fe54', 0.035620772088, 'wo')
lower_rad_ref.add_nuclide('Fe56', 0.579805982228, 'wo')
lower_rad_ref.add_nuclide('Fe57', 0.01362750048, 'wo')
lower_rad_ref.add_nuclide('Fe58', 0.001848545204, 'wo')
lower_rad_ref.add_nuclide('Ni58', 0.055298376566, 'wo')
lower_rad_ref.add_nuclide('Mn55', 0.0182870, 'wo')
lower_rad_ref.add_nuclide('Cr52', 0.145407678031, 'wo')
lower_rad_ref.add_s_alpha_beta('c_H_in_H2O')
upper_rad_ref = openmc.Material(7, name='Upper radial reflector / Top plate region')
upper_rad_ref.set_density('g/cm3', 4.28)
upper_rad_ref.add_nuclide("H1", 0.0086117, 'wo')
upper_rad_ref.add_nuclide("O16", 0.0683369, 'wo')
upper_rad_ref.add_nuclide("B10", 2.77638e-5, 'wo')
upper_rad_ref.add_nuclide("B11", 1.26481e-4, 'wo')
upper_rad_ref.add_nuclide("Fe54", 0.035953677186, 'wo')
upper_rad_ref.add_nuclide("Fe56", 0.585224740891, 'wo')
upper_rad_ref.add_nuclide("Fe57", 0.01375486056, 'wo')
upper_rad_ref.add_nuclide("Fe58", 0.001865821363, 'wo')
upper_rad_ref.add_nuclide("Ni58", 0.055815129186, 'wo')
upper_rad_ref.add_nuclide("Mn55", 0.0184579, 'wo')
upper_rad_ref.add_nuclide("Cr52", 0.146766614995, 'wo')
upper_rad_ref.add_nuclide('H1', 0.0086117, 'wo')
upper_rad_ref.add_nuclide('O16', 0.0683369, 'wo')
upper_rad_ref.add_nuclide('B10', 2.77638e-5, 'wo')
upper_rad_ref.add_nuclide('B11', 1.26481e-4, 'wo')
upper_rad_ref.add_nuclide('Fe54', 0.035953677186, 'wo')
upper_rad_ref.add_nuclide('Fe56', 0.585224740891, 'wo')
upper_rad_ref.add_nuclide('Fe57', 0.01375486056, 'wo')
upper_rad_ref.add_nuclide('Fe58', 0.001865821363, 'wo')
upper_rad_ref.add_nuclide('Ni58', 0.055815129186, 'wo')
upper_rad_ref.add_nuclide('Mn55', 0.0184579, 'wo')
upper_rad_ref.add_nuclide('Cr52', 0.146766614995, 'wo')
upper_rad_ref.add_s_alpha_beta('c_H_in_H2O')
bot_plate = openmc.Material(8, name='Bottom plate region')
bot_plate.set_density('g/cm3', 7.184)
bot_plate.add_nuclide("H1", 0.0011505, 'wo')
bot_plate.add_nuclide("O16", 0.0091296, 'wo')
bot_plate.add_nuclide("B10", 3.70915e-6, 'wo')
bot_plate.add_nuclide("B11", 1.68974e-5, 'wo')
bot_plate.add_nuclide("Fe54", 0.03855611055, 'wo')
bot_plate.add_nuclide("Fe56", 0.627585036425, 'wo')
bot_plate.add_nuclide("Fe57", 0.014750478, 'wo')
bot_plate.add_nuclide("Fe58", 0.002000875025, 'wo')
bot_plate.add_nuclide("Ni58", 0.059855207342, 'wo')
bot_plate.add_nuclide("Mn55", 0.0197940, 'wo')
bot_plate.add_nuclide("Cr52", 0.157390026871, 'wo')
bot_plate.add_nuclide('H1', 0.0011505, 'wo')
bot_plate.add_nuclide('O16', 0.0091296, 'wo')
bot_plate.add_nuclide('B10', 3.70915e-6, 'wo')
bot_plate.add_nuclide('B11', 1.68974e-5, 'wo')
bot_plate.add_nuclide('Fe54', 0.03855611055, 'wo')
bot_plate.add_nuclide('Fe56', 0.627585036425, 'wo')
bot_plate.add_nuclide('Fe57', 0.014750478, 'wo')
bot_plate.add_nuclide('Fe58', 0.002000875025, 'wo')
bot_plate.add_nuclide('Ni58', 0.059855207342, 'wo')
bot_plate.add_nuclide('Mn55', 0.0197940, 'wo')
bot_plate.add_nuclide('Cr52', 0.157390026871, 'wo')
bot_plate.add_s_alpha_beta('c_H_in_H2O')
bot_nozzle = openmc.Material(9, name='Bottom nozzle region')
bot_nozzle.set_density('g/cm3', 2.53)
bot_nozzle.add_nuclide("H1", 0.0245014, 'wo')
bot_nozzle.add_nuclide("O16", 0.1944274, 'wo')
bot_nozzle.add_nuclide("B10", 7.89917e-5, 'wo')
bot_nozzle.add_nuclide("B11", 3.59854e-4, 'wo')
bot_nozzle.add_nuclide("Fe54", 0.030411411144, 'wo')
bot_nozzle.add_nuclide("Fe56", 0.495012237964, 'wo')
bot_nozzle.add_nuclide("Fe57", 0.01163454624, 'wo')
bot_nozzle.add_nuclide("Fe58", 0.001578204652, 'wo')
bot_nozzle.add_nuclide("Ni58", 0.047211231662, 'wo')
bot_nozzle.add_nuclide("Mn55", 0.0156126, 'wo')
bot_nozzle.add_nuclide("Cr52", 0.124142524198, 'wo')
bot_nozzle.add_nuclide('H1', 0.0245014, 'wo')
bot_nozzle.add_nuclide('O16', 0.1944274, 'wo')
bot_nozzle.add_nuclide('B10', 7.89917e-5, 'wo')
bot_nozzle.add_nuclide('B11', 3.59854e-4, 'wo')
bot_nozzle.add_nuclide('Fe54', 0.030411411144, 'wo')
bot_nozzle.add_nuclide('Fe56', 0.495012237964, 'wo')
bot_nozzle.add_nuclide('Fe57', 0.01163454624, 'wo')
bot_nozzle.add_nuclide('Fe58', 0.001578204652, 'wo')
bot_nozzle.add_nuclide('Ni58', 0.047211231662, 'wo')
bot_nozzle.add_nuclide('Mn55', 0.0156126, 'wo')
bot_nozzle.add_nuclide('Cr52', 0.124142524198, 'wo')
bot_nozzle.add_s_alpha_beta('c_H_in_H2O')
top_nozzle = openmc.Material(10, name='Top nozzle region')
top_nozzle.set_density('g/cm3', 1.746)
top_nozzle.add_nuclide("H1", 0.0358870, 'wo')
top_nozzle.add_nuclide("O16", 0.2847761, 'wo')
top_nozzle.add_nuclide("B10", 1.15699e-4, 'wo')
top_nozzle.add_nuclide("B11", 5.27075e-4, 'wo')
top_nozzle.add_nuclide("Fe54", 0.02644016154, 'wo')
top_nozzle.add_nuclide("Fe56", 0.43037146399, 'wo')
top_nozzle.add_nuclide("Fe57", 0.0101152584, 'wo')
top_nozzle.add_nuclide("Fe58", 0.00137211607, 'wo')
top_nozzle.add_nuclide("Ni58", 0.04104621835, 'wo')
top_nozzle.add_nuclide("Mn55", 0.0135739, 'wo')
top_nozzle.add_nuclide("Cr52", 0.107931450781, 'wo')
top_nozzle.add_nuclide('H1', 0.0358870, 'wo')
top_nozzle.add_nuclide('O16', 0.2847761, 'wo')
top_nozzle.add_nuclide('B10', 1.15699e-4, 'wo')
top_nozzle.add_nuclide('B11', 5.27075e-4, 'wo')
top_nozzle.add_nuclide('Fe54', 0.02644016154, 'wo')
top_nozzle.add_nuclide('Fe56', 0.43037146399, 'wo')
top_nozzle.add_nuclide('Fe57', 0.0101152584, 'wo')
top_nozzle.add_nuclide('Fe58', 0.00137211607, 'wo')
top_nozzle.add_nuclide('Ni58', 0.04104621835, 'wo')
top_nozzle.add_nuclide('Mn55', 0.0135739, 'wo')
top_nozzle.add_nuclide('Cr52', 0.107931450781, 'wo')
top_nozzle.add_s_alpha_beta('c_H_in_H2O')
top_fa = openmc.Material(11, name='Top of fuel assemblies')
top_fa.set_density('g/cm3', 3.044)
top_fa.add_nuclide("H1", 0.0162913, 'wo')
top_fa.add_nuclide("O16", 0.1292776, 'wo')
top_fa.add_nuclide("B10", 5.25228e-5, 'wo')
top_fa.add_nuclide("B11", 2.39272e-4, 'wo')
top_fa.add_nuclide("Zr90", 0.43313403903, 'wo')
top_fa.add_nuclide("Zr91", 0.09549277374, 'wo')
top_fa.add_nuclide("Zr92", 0.14759527104, 'wo')
top_fa.add_nuclide("Zr94", 0.15280552077, 'wo')
top_fa.add_nuclide("Zr96", 0.02511169542, 'wo')
top_fa.add_nuclide('H1', 0.0162913, 'wo')
top_fa.add_nuclide('O16', 0.1292776, 'wo')
top_fa.add_nuclide('B10', 5.25228e-5, 'wo')
top_fa.add_nuclide('B11', 2.39272e-4, 'wo')
top_fa.add_nuclide('Zr90', 0.43313403903, 'wo')
top_fa.add_nuclide('Zr91', 0.09549277374, 'wo')
top_fa.add_nuclide('Zr92', 0.14759527104, 'wo')
top_fa.add_nuclide('Zr94', 0.15280552077, 'wo')
top_fa.add_nuclide('Zr96', 0.02511169542, 'wo')
top_fa.add_s_alpha_beta('c_H_in_H2O')
bot_fa = openmc.Material(12, name='Bottom of fuel assemblies')
bot_fa.set_density('g/cm3', 1.762)
bot_fa.add_nuclide("H1", 0.0292856, 'wo')
bot_fa.add_nuclide("O16", 0.2323919, 'wo')
bot_fa.add_nuclide("B10", 9.44159e-5, 'wo')
bot_fa.add_nuclide("B11", 4.30120e-4, 'wo')
bot_fa.add_nuclide("Zr90", 0.3741373658, 'wo')
bot_fa.add_nuclide("Zr91", 0.0824858164, 'wo')
bot_fa.add_nuclide("Zr92", 0.1274914944, 'wo')
bot_fa.add_nuclide("Zr94", 0.1319920622, 'wo')
bot_fa.add_nuclide("Zr96", 0.0216912612, 'wo')
bot_fa.add_nuclide('H1', 0.0292856, 'wo')
bot_fa.add_nuclide('O16', 0.2323919, 'wo')
bot_fa.add_nuclide('B10', 9.44159e-5, 'wo')
bot_fa.add_nuclide('B11', 4.30120e-4, 'wo')
bot_fa.add_nuclide('Zr90', 0.3741373658, 'wo')
bot_fa.add_nuclide('Zr91', 0.0824858164, 'wo')
bot_fa.add_nuclide('Zr92', 0.1274914944, 'wo')
bot_fa.add_nuclide('Zr94', 0.1319920622, 'wo')
bot_fa.add_nuclide('Zr96', 0.0216912612, 'wo')
bot_fa.add_s_alpha_beta('c_H_in_H2O')
# Define the materials file.
@ -448,25 +448,25 @@ def pwr_assembly():
# Define materials.
fuel = openmc.Material(name='Fuel')
fuel.set_density('g/cm3', 10.29769)
fuel.add_nuclide("U234", 4.4843e-6)
fuel.add_nuclide("U235", 5.5815e-4)
fuel.add_nuclide("U238", 2.2408e-2)
fuel.add_nuclide("O16", 4.5829e-2)
fuel.add_nuclide('U234', 4.4843e-6)
fuel.add_nuclide('U235', 5.5815e-4)
fuel.add_nuclide('U238', 2.2408e-2)
fuel.add_nuclide('O16', 4.5829e-2)
clad = openmc.Material(name='Cladding')
clad.set_density('g/cm3', 6.55)
clad.add_nuclide("Zr90", 2.1827e-2)
clad.add_nuclide("Zr91", 4.7600e-3)
clad.add_nuclide("Zr92", 7.2758e-3)
clad.add_nuclide("Zr94", 7.3734e-3)
clad.add_nuclide("Zr96", 1.1879e-3)
clad.add_nuclide('Zr90', 2.1827e-2)
clad.add_nuclide('Zr91', 4.7600e-3)
clad.add_nuclide('Zr92', 7.2758e-3)
clad.add_nuclide('Zr94', 7.3734e-3)
clad.add_nuclide('Zr96', 1.1879e-3)
hot_water = openmc.Material(name='Hot borated water')
hot_water.set_density('g/cm3', 0.740582)
hot_water.add_nuclide("H1", 4.9457e-2)
hot_water.add_nuclide("O16", 2.4672e-2)
hot_water.add_nuclide("B10", 8.0042e-6)
hot_water.add_nuclide("B11", 3.2218e-5)
hot_water.add_nuclide('H1', 4.9457e-2)
hot_water.add_nuclide('O16', 2.4672e-2)
hot_water.add_nuclide('B10', 8.0042e-6)
hot_water.add_nuclide('B11', 3.2218e-5)
hot_water.add_s_alpha_beta('c_H_in_H2O')
# Define the materials file.
@ -619,7 +619,7 @@ def slab_mg(num_regions=1, mat_names=None, mgxslib_name='2g.h5'):
# # Make Settings
# Instantiate a Settings object, set all runtime parameters
settings_file = openmc.Settings()
settings_file.energy_mode = "multi-group"
settings_file.energy_mode = 'multi-group'
settings_file.tabular_legendre = {'enable': False}
settings_file.batches = 10
settings_file.inactive = 5

View file

@ -3,7 +3,7 @@ from collections import OrderedDict
from collections.abc import Iterable
from copy import deepcopy
from math import sqrt, floor
from numbers import Real, Integral
from numbers import Real
from xml.etree import ElementTree as ET
import numpy as np
@ -242,7 +242,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta):
for i in range(r):
uarray[-1][-1].append(universe_ids[z, y, a])
a -= 1
y +=1
y += 1
# Climb up the top-left.
for i in range(r):
@ -352,7 +352,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta):
unique_universes = self.get_unique_universes()
for universe_id, universe in unique_universes.items():
for universe in unique_universes.values():
cells.update(universe.get_all_cells(memo))
return cells
@ -372,7 +372,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta):
# Append all Cells in each Cell in the Universe to the dictionary
cells = self.get_all_cells(memo)
for cell_id, cell in cells.items():
for cell in cells.values():
materials.update(cell.get_all_materials(memo))
return materials
@ -399,7 +399,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta):
all_universes.update(unique_universes)
# Append all Universes containing each cell to the dictionary
for universe_id, universe in unique_universes.items():
for universe in unique_universes.values():
all_universes.update(universe.get_all_universes())
return all_universes

View file

@ -984,7 +984,7 @@ class ChiDelayed(MDGXS):
is None unless the multi-group cross section has been computed.
num_subdomains : int
The number of subdomains is unity for 'material', 'cell' and 'universe'
domain types. When the This is equal to the number of cell instances
domain types. This is equal to the number of cell instances
for 'distribcell' domain types (it is equal to unity prior to loading
tally data from a statepoint file).
num_nuclides : int
@ -1496,7 +1496,7 @@ class DelayedNuFissionXS(MDGXS):
is None unless the multi-group cross section has been computed.
num_subdomains : int
The number of subdomains is unity for 'material', 'cell' and 'universe'
domain types. When the This is equal to the number of cell instances
domain types. This is equal to the number of cell instances
for 'distribcell' domain types (it is equal to unity prior to loading
tally data from a statepoint file).
num_nuclides : int
@ -1632,7 +1632,7 @@ class Beta(MDGXS):
is None unless the multi-group cross section has been computed.
num_subdomains : int
The number of subdomains is unity for 'material', 'cell' and 'universe'
domain types. When the This is equal to the number of cell instances
domain types. This is equal to the number of cell instances
for 'distribcell' domain types (it is equal to unity prior to loading
tally data from a statepoint file).
num_nuclides : int
@ -1817,7 +1817,7 @@ class DecayRate(MDGXS):
is None unless the multi-group cross section has been computed.
num_subdomains : int
The number of subdomains is unity for 'material', 'cell' and 'universe'
domain types. When the This is equal to the number of cell instances
domain types. This is equal to the number of cell instances
for 'distribcell' domain types (it is equal to unity prior to loading
tally data from a statepoint file).
num_nuclides : int
@ -2585,7 +2585,7 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
is None unless the multi-group cross section has been computed.
num_subdomains : int
The number of subdomains is unity for 'material', 'cell' and 'universe'
domain types. When the This is equal to the number of cell instances
domain types. This is equal to the number of cell instances
for 'distribcell' domain types (it is equal to unity prior to loading
tally data from a statepoint file).
num_nuclides : int

View file

@ -467,7 +467,7 @@ class Plot(IDManagerMixin):
Parameters
----------
geometry : openmc.Geometry
The geometry the base the plot off of
The geometry to base the plot off of
basis : {'xy', 'xz', 'yz'}
The basis directions for the plot
slice_coord : float

View file

@ -12,7 +12,7 @@ PLOT_TYPES = ['total', 'scatter', 'elastic', 'inelastic', 'fission',
'absorption', 'capture', 'nu-fission', 'nu-scatter', 'unity',
'slowing-down power', 'damage']
# Supported keywoards for multi-group cross section plotting
# Supported keywords for multi-group cross section plotting
PLOT_TYPES_MGXS = ['total', 'absorption', 'scatter', 'fission',
'kappa-fission', 'nu-fission', 'prompt-nu-fission',
'deleyed-nu-fission', 'chi', 'chi-prompt', 'chi-delayed',
@ -245,7 +245,7 @@ def calculate_cexs(this, data_type, types, temperature=294., sab_name=None,
----------
this : {str, openmc.Nuclide, openmc.Element, openmc.Material}
Object to source data from
data_type : {'nuclide', 'element', material'}
data_type : {'nuclide', 'element', 'material'}
Type of object to plot
types : Iterable of values of PLOT_TYPES
The type of cross sections to calculate
@ -619,7 +619,7 @@ def calculate_mgxs(this, data_type, types, orders=None, temperature=294.,
----------
this : str or openmc.Material
Object to source data from
data_type : {'nuclide', 'element', material', 'macroscopic'}
data_type : {'nuclide', 'element', 'material', 'macroscopic'}
Type of object to plot
types : Iterable of values of PLOT_TYPES_MGXS
The type of cross sections to calculate

View file

@ -674,7 +674,7 @@ class Tally(IDManagerMixin):
if equal_filters and equal_nuclides and equal_scores:
return True
# Variables to indicate matching filter bins, nuclides and scores
# Variables to indicate filter bins, nuclides, and scores that can be merged
merge_filters = self._can_merge_filters(other)
merge_nuclides = self._can_merge_nuclides(other)
merge_scores = self._can_merge_scores(other)

View file

@ -363,8 +363,7 @@ class Universe(IDManagerMixin):
raise TypeError(msg)
# If the Cell is in the Universe's list of Cells, delete it
if cell.id in self._cells:
del self._cells[cell.id]
self._cells.pop(cell.id, None)
def clear_cells(self):
"""Remove all cells from the universe."""

View file

@ -3,10 +3,10 @@
# for the VERA Depletion Benchmark Suite", CASL-U-2015-1014-000, Rev. 0,
# ORNL/TM-2016/53, 2016.
#
# Note 32 of the 255 nuclides appeare twice as they are both activation
# Note 32 of the 255 nuclides appear twice as they are both activation
# nuclides (category 1) and fission product nuclides (category 3).
# Te129 has been added due to it's link to I129 production.
# Te129 has been added due to its link to I129 production.
CASL_CHAIN = {
# Nuclide: (Stable, CAT, IFPY, Special yield treatment)

View file

@ -191,7 +191,7 @@ for filename in ace_libraries:
thermal = openmc.data.ThermalScattering.from_hdf5(
nuclides[name])
print('Converting {} (ACE) to {} (HDF5)'
.format(table.name,thermal.name))
.format(table.name, thermal.name))
thermal.add_temperature_from_ace(table)
thermal.export_to_hdf5(nuclides[name] + '_1', 'w',
libver=args.libver)

View file

@ -29,7 +29,7 @@ parser.add_argument('-c', '--cross-sections',
help='cross_sections.xml file to append libraries to')
args = parser.parse_args()
base_url = 'http://www.nndc.bnl.gov/endf/b7.1/zips/'
base_url = 'https://www.nndc.bnl.gov/endf/b7.1/zips/'
files = ['ENDF-B-VII.1-photoat.zip', 'ENDF-B-VII.1-atomic_relax.zip']
block_size = 16384
@ -63,7 +63,8 @@ for f in files:
with open(f, 'wb') as fh:
while True:
chunk = req.read(block_size)
if not chunk: break
if not chunk:
break
fh.write(chunk)
downloaded += len(chunk)
status = '{0:10} [{1:3.2f}%]'.format(

View file

@ -40,7 +40,8 @@ if download:
with open(filename, 'wb') as fh:
while True:
chunk = req.read(block_size)
if not chunk: break
if not chunk:
break
fh.write(chunk)
downloaded += len(chunk)
status = '{0:10} [{1:3.2f}%]'.format(

View file

@ -9,9 +9,9 @@ import openmc.deplete
URLS = [
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
]
def main():

View file

@ -24,9 +24,9 @@ from openmc._utils import download
from casl_chain import CASL_CHAIN
URLS = [
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'http://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-neutrons.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-decay.zip',
'https://www.nndc.bnl.gov/endf/b7.1/zips/ENDF-B-VII.1-nfy.zip'
]
def main():

View file

@ -18,8 +18,8 @@ import zipfile
import openmc.data
from openmc._utils import download
base_ace = 'http://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
base_endf = 'http://www.nndc.bnl.gov/endf/b7.1/zips/'
base_ace = 'https://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
base_endf = 'https://www.nndc.bnl.gov/endf/b7.1/zips/'
base_wmp = 'https://github.com/mit-crpg/WMP_Library/releases/download/v1.1/'
files = [
(base_ace, 'ENDF-B-VII.1-neutron-293.6K.tar.gz', '9729a17eb62b75f285d8a7628ace1449'),

View file

@ -26,10 +26,15 @@ class MeshPlotter(tk.Frame):
def __init__(self, parent, filename):
tk.Frame.__init__(self, parent)
self.labels = {'Cell': 'Cell:', 'Cellborn': 'Cell born:',
'Surface': 'Surface:', 'Material': 'Material:',
'Universe': 'Universe:', 'Energy': 'Energy in:',
'Energyout': 'Energy out:'}
self.labels = {
'Cell': 'Cell:',
'Cellborn': 'Cell born:',
'Surface': 'Surface:',
'Material': 'Material:',
'Universe': 'Universe:',
'Energy': 'Energy in:',
'Energyout': 'Energy out:'
}
self.filterBoxes = {}

View file

@ -243,8 +243,7 @@ def update_materials(root):
for material in root.findall('material'):
for nuclide in material.findall('nuclide'):
if 'name' in nuclide.attrib:
nucname = nuclide.attrib['name']
nucname = nucname.replace('-', '')
nucname = nuclide.attrib['name'].replace('-', '')
# If a nuclide name is in the ZAID notation (e.g., a number),
# convert it to the proper nuclide name.
if nucname.strip().isnumeric():

View file

@ -44,11 +44,10 @@ def get_data(element, entry):
value = element.find(entry)
if value is not None:
value = value.text.strip()
elif entry in element.attrib:
value = element.attrib[entry].strip()
else:
if entry in element.attrib:
value = element.attrib[entry].strip()
else:
value = None
value = None
return value

View file

@ -131,7 +131,7 @@ void read_cross_sections_xml()
"materials.xml or in the OPENMC_CROSS_SECTIONS"
" environment variable. OpenMC needs such a file to identify "
"where to find data libraries. Please consult the"
" user's guide at https://openmc.readthedocs.io for "
" user's guide at https://docs.openmc.org/ for "
"information on how to set up data libraries.");
}
settings::path_cross_sections = envvar;

View file

@ -191,8 +191,8 @@ double ContinuousTabular::sample(double E, uint64_t* seed) const
double E_i1_1 = distribution_[i+1].e_out[n_discrete];
double E_i1_K = distribution_[i+1].e_out[n_energy_out - 1];
double E_1 = E_i_1 + r*(E_i1_1 - E_i_1);
double E_K = E_i_K + r*(E_i1_K - E_i_K);
double E_1 = E_i_1 + r * (E_i1_1 - E_i_1);
double E_K = E_i_K + r * (E_i1_K - E_i_K);
// Determine outgoing energy bin
n_energy_out = distribution_[l].e_out.size();
@ -317,7 +317,7 @@ double Evaporation::sample(double E, uint64_t* seed) const
if (x <= y) break;
}
return x*theta;
return x * theta;
}
//==============================================================================

View file

@ -492,5 +492,4 @@ extern "C" int openmc_global_bounding_box(double* llc, double* urc) {
return 0;
}
} // namespace openmc

View file

@ -660,16 +660,16 @@ write_tallies()
const auto& deriv {model::tally_derivs[tally.deriv_]};
switch (deriv.variable) {
case DIFF_DENSITY:
tallies_out << " Density derivative Material "
tallies_out << " Density derivative Material "
<< std::to_string(deriv.diff_material) << "\n";
break;
case DIFF_NUCLIDE_DENSITY:
tallies_out << " Nuclide density derivative Material "
tallies_out << " Nuclide density derivative Material "
<< std::to_string(deriv.diff_material) << " Nuclide "
<< data::nuclides[deriv.diff_nuclide]->name_ << "\n";
break;
case DIFF_TEMPERATURE:
tallies_out << " Temperature derivative Material "
tallies_out << " Temperature derivative Material "
<< std::to_string(deriv.diff_material) << "\n";
break;
default:

View file

@ -76,7 +76,7 @@ Particle::Particle()
void
Particle::clear()
{
// reset any coordinate levels
// Reset any coordinate levels
for (auto& level : coord_) level.reset();
n_coord_ = 1;
}
@ -99,7 +99,7 @@ Particle::create_secondary(Direction u, double E, Type type)
void
Particle::from_source(const Bank* src)
{
// reset some attributes
// Reset some attributes
this->clear();
alive_ = true;
surface_ = 0;
@ -108,7 +108,7 @@ Particle::from_source(const Bank* src)
n_collision_ = 0;
fission_ = false;
// copy attributes from source bank site
// Copy attributes from source bank site
type_ = src->particle;
wgt_ = src->wgt;
wgt_last_ = src->wgt;
@ -183,7 +183,7 @@ Particle::transport()
return;
}
// set birth cell attribute
// Set birth cell attribute
if (cell_born_ == C_NONE) cell_born_ = coord_[n_coord_ - 1].cell;
}

View file

@ -617,6 +617,7 @@ void score_collision_derivative(const Particle* p)
{
// A void material cannot be perturbed so it will not affect flux derivatives.
if (p->material_ == MATERIAL_VOID) return;
const Material& material {*model::materials[p->material_]};
for (auto& deriv : model::tally_derivs) {

View file

@ -12,7 +12,7 @@ namespace openmc {
void
CellFilter::from_xml(pugi::xml_node node)
{
// Get cell IDs and convert into indices into the global cells vector
// Get cell IDs and convert to indices into the global cells vector
auto cells = get_node_array<int32_t>(node, "bins");
for (auto& c : cells) {
auto search = model::cell_map.find(c);

View file

@ -248,12 +248,15 @@ double get_nuclide_neutron_heating(const Particle* p, const Nuclide& nuc,
{
size_t mt = nuc.reaction_index_[rxn_index];
if (mt == C_NONE) return 0.0;
auto i_temp = p->neutron_xs_[i_nuclide].index_temp;
if (i_temp < 0) return 0.0; // Can be true due to multipole
const auto& rxn {*nuc.reactions_[mt]};
const auto& xs {rxn.xs_[i_temp]};
auto i_grid = p->neutron_xs_[i_nuclide].index_grid;
if (i_grid < xs.threshold) return 0.0;
auto f = p->neutron_xs_[i_nuclide].interp_factor;
return (1.0 - f) * xs.value[i_grid-xs.threshold]
+ f * xs.value[i_grid-xs.threshold+1];
@ -1316,7 +1319,7 @@ score_general_ce(Particle* p, int i_tally, int start_index,
}
}
// Add derivative information on score for differnetial tallies.
// Add derivative information on score for differential tallies.
if (tally.deriv_ != C_NONE)
apply_derivative_to_score(p, i_tally, i_nuclide, atom_density, score_bin,
score);

View file

@ -63,7 +63,6 @@ def main():
omp = (os.environ.get('OMP') == 'y')
mpi = (os.environ.get('MPI') == 'y')
phdf5 = (os.environ.get('PHDF5') == 'y')
dagmc = (os.environ.get('DAGMC') == 'y')
# Build and install