diff --git a/docs/source/publications.rst b/docs/source/publications.rst index e1c0f6de00..d554fe5a14 100644 --- a/docs/source/publications.rst +++ b/docs/source/publications.rst @@ -139,6 +139,18 @@ Miscellaneous `_," *Nucl. Sci. Tech.*, **30**: 63 (2019). +- M. Sajjad, Muhammad Rizwan Ali, M. Naveed Ashraf, Rustam Khan, Tasneem Fatima, + "`KANUPP Reactor Core Model and its Validation + `_," International Conference on + Power Generation Systems and Renewable Energy Technologies, Islamabad, + Pakistan, Sep. 10-12 (2018). + +- Muhammad Waqas Tariq, Muhammad Sohail, and Sikander Majid Mirza, "`Calculation + of Neutronic Parameters using OpenMC for Potential Dispersed Fuels of MNSR + `_," International Conference on + Power Generation Systems and Renewable Energy Technologies, Islamabad, + Pakistan, Sep. 10-12 (2018). + - Amanda L. Lund and Paul K. Romano, "`Implementation and Validation of Photon Transport in OpenMC `_", Argonne National Laboratory, Technical Report ANL/MCS-TM-381 (2018). diff --git a/openmc/data/_endf.pyx b/openmc/data/_endf.pyx new file mode 100644 index 0000000000..991ee015b2 --- /dev/null +++ b/openmc/data/_endf.pyx @@ -0,0 +1,8 @@ +# cython: c_string_type=str, c_string_encoding=ascii + +cdef extern from "endf.c": + double cfloat_endf(const char* buffer, int n) + +def float_endf(s): + cdef const char* c_string = s + return cfloat_endf(c_string, len(s)) diff --git a/openmc/data/endf.c b/openmc/data/endf.c new file mode 100644 index 0000000000..fee6af179e --- /dev/null +++ b/openmc/data/endf.c @@ -0,0 +1,39 @@ +#include + +double cfloat_endf(const char* buffer, int n) +{ + char arr[12]; // 11 characters plus a null terminator + int j = 0; // current position in arr + int found_significand = 0; + int found_exponent = 0; + for (int i = 0; i < n; ++i) { + // Skip whitespace characters + char c = buffer[i]; + if (c == ' ') continue; + + if (found_significand) { + if (!found_exponent) { + if (c == '+' || c == '-') { + // In the case that we encounter +/- and we haven't yet encountered + // e/E, we manually add it + arr[j++] = 'e'; + found_exponent = 1; + + } else if (c == 'e' || c == 'E' || c == 'd' || c == 'D') { + arr[j++] = 'e'; + found_exponent = 1; + continue; + } + } + } else if (c == '.' || (c >= '0' && c <= '9')) { + found_significand = 1; + } + + // Copy character + arr[j++] = c; + } + + // Done copying. Add null terminator and convert to double + arr[j] = '\0'; + return atof(arr); +} diff --git a/openmc/data/endf.py b/openmc/data/endf.py index 6131f3c6b9..92a558e217 100644 --- a/openmc/data/endf.py +++ b/openmc/data/endf.py @@ -20,6 +20,11 @@ from numpy.polynomial.polynomial import Polynomial from .data import ATOMIC_SYMBOL, gnd_name from .function import Tabulated1D, INTERPOLATION_SCHEME from openmc.stats.univariate import Uniform, Tabular, Legendre +try: + from ._endf import float_endf + _CYTHON = True +except ImportError: + _CYTHON = False _LIBRARY = {0: 'ENDF/B', 1: 'ENDF/A', 2: 'JEFF', 3: 'EFF', @@ -69,7 +74,7 @@ SUM_RULES = {1: [2, 3], ENDF_FLOAT_RE = re.compile(r'([\s\-\+]?\d*\.\d+)([\+\-]) ?(\d+)') -def float_endf(s): +def py_float_endf(s): """Convert string of floating point number in ENDF to float. The ENDF-6 format uses an 'e-less' floating point number format, @@ -92,6 +97,10 @@ def float_endf(s): return float(ENDF_FLOAT_RE.sub(r'\1e\2\3', s)) +if not _CYTHON: + float_endf = py_float_endf + + def int_endf(s): """Convert string of integer number in ENDF to int. diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index cd1e406047..7b340f0b0c 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -543,20 +543,6 @@ class IncidentNeutron(EqualityMixin): tgroup = group['total_nu'] rx.derived_products.append(Product.from_hdf5(tgroup)) - # Build redundant reactions. Start from the highest MT number because - # high MTs never depend on lower MTs. - for mt_sum in sorted(SUM_RULES, reverse=True): - if mt_sum not in data: - rxs = [data[mt] for mt in SUM_RULES[mt_sum] if mt in data] - if len(rxs) > 0: - data.reactions[mt_sum] = rx = Reaction(mt_sum) - rx.redundant = True - if rx.mt == 18 and 'total_nu' in group: - tgroup = group['total_nu'] - rx.derived_products.append(Product.from_hdf5(tgroup)) - for T in data.temperatures: - rx.xs[T] = Sum([rx_i.xs[T] for rx_i in rxs]) - # Read unresolved resonance probability tables if 'urr' in group: urr_group = group['urr'] diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 11b2b24ed7..01a03f6506 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3926,7 +3926,7 @@ class ScatterMatrixXS(MatrixMGXS): # to match scattering matrix shape for tally arithmetic energy_filter = copy.deepcopy(energy_filter) scatter_p1 = \ - scatter_p1.diagonalize_filter(energy_filter) + scatter_p1.diagonalize_filter(energy_filter, 1) self._rxn_rate_tally = scatter_p0 - scatter_p1 @@ -4022,7 +4022,7 @@ class ScatterMatrixXS(MatrixMGXS): # to match scattering matrix shape for tally arithmetic energy_filter = flux.find_filter(openmc.EnergyFilter) energy_filter = copy.deepcopy(energy_filter) - scatter_p1 = scatter_p1.diagonalize_filter(energy_filter) + scatter_p1 = scatter_p1.diagonalize_filter(energy_filter, 1) # Compute the trasnport correction term correction = scatter_p1 / flux diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index c172c7c64b..e61f216ef0 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -312,7 +312,7 @@ class Normal(Univariate): r"""Normally distributed sampling. The Normal Distribution is characterized by two parameters - :math:`\mu` and :math:`\sigma` and has density function + :math:`\mu` and :math:`\sigma` and has density function :math:`p(X) dX = 1/(\sqrt{2\pi}\sigma) e^{-(X-\mu)^2/(2\sigma^2)}` Parameters @@ -325,9 +325,9 @@ class Normal(Univariate): Attributes ---------- mean_value : float - Mean of the Normal distribution + Mean of the Normal distribution std_dev : float - Standard deviation of the Normal distribution + Standard deviation of the Normal distribution """ def __init__(self, mean_value, std_dev): @@ -380,17 +380,17 @@ class Normal(Univariate): class Muir(Univariate): """Muir energy spectrum. - The Muir energy spectrum is a Gaussian spectrum, but for + The Muir energy spectrum is a Gaussian spectrum, but for convenience reasons allows the user 3 parameters to define the distribution, e0 the mean energy of particles, the mass - of reactants m_rat, and the ion temperature kt. + of reactants m_rat, and the ion temperature kt. Parameters ---------- e0 : float Mean of the Muir distribution in units of eV m_rat : float - Ratio of the sum of the masses of the reaction inputs to an + Ratio of the sum of the masses of the reaction inputs to an AMU kt : float Ion temperature for the Muir distribution in units of eV @@ -400,7 +400,7 @@ class Muir(Univariate): e0 : float Mean of the Muir distribution in units of eV m_rat : float - Ratio of the sum of the masses of the reaction inputs to an + Ratio of the sum of the masses of the reaction inputs to an AMU kt : float Ion temperature for the Muir distribution in units of eV @@ -582,26 +582,27 @@ class Legendre(Univariate): def __init__(self, coefficients): self.coefficients = coefficients + self._legendre_poly = None def __call__(self, x): - return self._legendre_polynomial(x) + # Create Legendre polynomial if we haven't yet + if self._legendre_poly is None: + l = np.arange(len(self._coefficients)) + coeffs = (2.*l + 1.)/2. * self._coefficients + self._legendre_poly = np.polynomial.Legendre(coeffs) + + return self._legendre_poly(x) def __len__(self): - return len(self._legendre_polynomial.coef) + return len(self._coefficients) @property def coefficients(self): - poly = self._legendre_polynomial - l = np.arange(poly.degree() + 1) - return 2./(2.*l + 1.) * poly.coef + return self._coefficients @coefficients.setter def coefficients(self, coefficients): - cv.check_type('Legendre expansion coefficients', coefficients, - Iterable, Real) - l = np.arange(len(coefficients)) - coeffs = (2.*l + 1.)/2. * np.array(coefficients) - self._legendre_polynomial = np.polynomial.Legendre(coeffs) + self._coefficients = np.asarray(coefficients) def to_xml_element(self, element_name): raise NotImplementedError diff --git a/openmc/tallies.py b/openmc/tallies.py index a5f3a17f32..18c359c466 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -2964,7 +2964,7 @@ class Tally(IDManagerMixin): tally_avg.sparse = self.sparse return tally_avg - def diagonalize_filter(self, new_filter): + def diagonalize_filter(self, new_filter, filter_position=-1): """Diagonalize the tally data array along a new axis of filter bins. This is a helper method for the tally arithmetic methods. This method @@ -2979,6 +2979,9 @@ class Tally(IDManagerMixin): ---------- new_filter : Filter The filter along which to diagonalize the data in the new + filter_position : int + Where to place the new filter in the Tally.filters list. Defaults + to last position. Returns ------- @@ -2988,6 +2991,7 @@ class Tally(IDManagerMixin): """ cv.check_type('new_filter', new_filter, _FILTER_CLASSES) + cv.check_type('filter_position', filter_position, Integral) if new_filter in self.filters: msg = 'Unable to diagonalize Tally ID="{0}" which already ' \ @@ -2996,7 +3000,7 @@ class Tally(IDManagerMixin): # Add the new filter to a copy of this Tally new_tally = copy.deepcopy(self) - new_tally.filters.append(new_filter) + new_tally.filters.insert(filter_position, new_filter) # Determine "base" indices along the new "diagonal", and the factor # by which the "base" indices should be repeated to account for all diff --git a/setup.py b/setup.py index 778df040c0..38ee57f716 100755 --- a/setup.py +++ b/setup.py @@ -68,10 +68,10 @@ kwargs = { }, } -# If Cython is present, add resonance reconstruction capability +# If Cython is present, add resonance reconstruction and fast float_endf if have_cython: kwargs.update({ - 'ext_modules': cythonize('openmc/data/reconstruct.pyx'), + 'ext_modules': cythonize('openmc/data/*.pyx'), 'include_dirs': [np.get_include()] }) diff --git a/src/material.cpp b/src/material.cpp index de0d7e5de5..7d12578449 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -356,8 +356,8 @@ void Material::finalize() void Material::normalize_density() { - bool percent_in_atom = (atom_density_(0) > 0.0); - bool density_in_atom = (density_ > 0.0); + bool percent_in_atom = (atom_density_(0) >= 0.0); + bool density_in_atom = (density_ >= 0.0); for (int i = 0; i < nuclide_.size(); ++i) { // determine atomic weight ratio diff --git a/tests/regression_tests/cmfd_feed/results_true.dat b/tests/regression_tests/cmfd_feed/results_true.dat index 03c61b4d80..4a2c6eea25 100644 --- a/tests/regression_tests/cmfd_feed/results_true.dat +++ b/tests/regression_tests/cmfd_feed/results_true.dat @@ -425,39 +425,39 @@ cmfd entropy 3.233193E+00 3.232564E+00 cmfd balance -4.009062E-03 -4.431773E-03 -3.152666E-03 -3.510383E-03 -2.052089E-03 -2.068651E-03 -1.502427E-03 -1.589825E-03 -1.566020E-03 -1.170009E-03 -9.507594E-04 -9.072590E-04 -1.009003E-03 -1.064703E-03 -1.163610E-03 -9.756308E-04 +4.00906E-03 +4.43177E-03 +3.15267E-03 +3.51038E-03 +2.05209E-03 +2.06865E-03 +1.50243E-03 +1.58983E-03 +1.56602E-03 +1.17001E-03 +9.50759E-04 +9.07259E-04 +1.00900E-03 +1.06470E-03 +1.16361E-03 +9.75631E-04 cmfd dominance ratio - 5.397E-01 - 5.425E-01 - 5.481E-01 - 5.473E-01 - 5.503E-01 - 5.502E-01 - 5.483E-01 - 5.520E-01 - 5.505E-01 - 3.216E-01 - 5.373E-01 - 5.517E-01 - 5.508E-01 - 5.524E-01 - 5.524E-01 - 5.523E-01 +5.397E-01 +5.425E-01 +5.481E-01 +5.473E-01 +5.503E-01 +5.502E-01 +5.483E-01 +5.520E-01 +5.505E-01 +3.216E-01 +5.373E-01 +5.517E-01 +5.508E-01 +5.524E-01 +5.524E-01 +5.523E-01 cmfd openmc source comparison 6.959834E-03 5.655657E-03 diff --git a/tests/regression_tests/cmfd_feed_2g/results_true.dat b/tests/regression_tests/cmfd_feed_2g/results_true.dat index 8a1c5d84b4..d0bafa5727 100644 --- a/tests/regression_tests/cmfd_feed_2g/results_true.dat +++ b/tests/regression_tests/cmfd_feed_2g/results_true.dat @@ -373,39 +373,39 @@ cmfd entropy 1.999998E+00 1.999984E+00 cmfd balance -3.993043E-04 -4.168559E-04 -6.384691E-04 -3.928215E-04 -3.789835E-04 -2.684860E-04 -4.849914E-04 -1.084019E-03 -1.091775E-03 -5.459767E-04 -4.455544E-04 -4.011468E-04 -3.710247E-04 -3.577152E-04 -3.845992E-04 -3.900672E-04 +3.99304E-04 +4.16856E-04 +6.38469E-04 +3.92822E-04 +3.78984E-04 +2.68486E-04 +4.84991E-04 +1.08402E-03 +1.09177E-03 +5.45977E-04 +4.45554E-04 +4.01147E-04 +3.71025E-04 +3.57715E-04 +3.84599E-04 +3.90067E-04 cmfd dominance ratio - 6.239E-03 - 6.303E-03 - 6.347E-03 - 6.388E-03 - 6.340E-03 - 6.334E-03 - 6.270E-03 - 6.173E-03 - 6.068E-03 - 6.061E-03 - 6.016E-03 - 6.108E-03 - 6.117E-03 - 6.074E-03 - 6.005E-03 - 5.996E-03 +6.239E-03 +6.303E-03 +6.347E-03 +6.388E-03 +6.340E-03 +6.334E-03 +6.270E-03 +6.173E-03 +6.068E-03 +6.061E-03 +6.016E-03 +6.108E-03 +6.117E-03 +6.074E-03 +6.005E-03 +5.996E-03 cmfd openmc source comparison 1.931386E-05 2.839161E-05 diff --git a/tests/regression_tests/cmfd_feed_ng/results_true.dat b/tests/regression_tests/cmfd_feed_ng/results_true.dat index ccae5d032c..986b0bb1a0 100644 --- a/tests/regression_tests/cmfd_feed_ng/results_true.dat +++ b/tests/regression_tests/cmfd_feed_ng/results_true.dat @@ -1,208 +1,208 @@ k-combined: -1.030507E+00 9.667655E-03 +1.029540E+00 1.765356E-02 tally 1: -1.159445E+02 -1.344573E+03 -1.159285E+02 -1.344429E+03 -1.161340E+02 -1.349209E+03 -1.160434E+02 -1.347427E+03 +1.144958E+02 +1.311468E+03 +1.156179E+02 +1.337279E+03 +1.150532E+02 +1.324445E+03 +1.151074E+02 +1.325687E+03 tally 2: -3.482032E+01 -7.610041E+01 -5.123532E+01 -1.648226E+02 -1.063498E+01 -7.110316E+00 -9.001212E+00 -5.085589E+00 -1.435947E+02 -1.322778E+03 -7.400822E+01 -3.425876E+02 -3.415144E+01 -7.318850E+01 -5.046314E+01 -1.597317E+02 -1.028893E+01 -6.661534E+00 -8.653997E+00 -4.698660E+00 -1.442064E+02 -1.338979E+03 -7.405073E+01 -3.428774E+02 -3.431740E+01 -7.390622E+01 -5.109288E+01 -1.639090E+02 -1.034894E+01 -6.746021E+00 -8.657005E+00 -4.712481E+00 -1.383790E+02 -1.200016E+03 -7.320761E+01 -3.351661E+02 -3.426169E+01 -7.373156E+01 -5.042174E+01 -1.596859E+02 -1.041331E+01 -6.828453E+00 -8.729287E+00 -4.779221E+00 -1.374766E+02 -1.182015E+03 -7.390660E+01 -3.416196E+02 +3.465741E+01 +7.535177E+01 +5.111161E+01 +1.637703E+02 +1.077835E+01 +7.306380E+00 +9.069631E+00 +5.159419E+00 +1.367406E+02 +1.170393E+03 +7.339832E+01 +3.371470E+02 +3.562570E+01 +7.967278E+01 +5.270792E+01 +1.745991E+02 +1.036807E+01 +6.781874E+00 +8.681747E+00 +4.745685E+00 +1.356820E+02 +1.151355E+03 +7.286142E+01 +3.320255E+02 +3.538463E+01 +7.862285E+01 +5.236063E+01 +1.723667E+02 +1.054863E+01 +7.042669E+00 +8.940285E+00 +5.055491E+00 +1.392130E+02 +1.214087E+03 +7.370365E+01 +3.397160E+02 +3.523551E+01 +7.794325E+01 +5.202347E+01 +1.700797E+02 +1.028117E+01 +6.655678E+00 +8.538920E+00 +4.585368E+00 +1.366887E+02 +1.169157E+03 +7.333804E+01 +3.363693E+02 tally 3: -4.842028E+01 -1.472522E+02 +4.838342E+01 +1.467669E+02 0.000000E+00 0.000000E+00 -1.766768E-02 -3.669087E-05 +9.528018E-03 +1.989268E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.489090E+00 -7.670426E-01 -2.522457E+00 -3.988419E-01 +3.248228E+00 +6.666986E-01 +2.521640E+00 +3.997992E-01 0.000000E+00 0.000000E+00 -6.323118E+00 -2.515554E+00 -0.000000E+00 -0.000000E+00 -1.000000E-03 -1.000000E-06 -9.772798E-02 -7.833336E-04 -3.020916E-01 -5.962947E-03 -0.000000E+00 -0.000000E+00 -2.669802E+00 -4.494602E-01 -0.000000E+00 -0.000000E+00 -6.995726E+01 -3.061105E+02 -6.245439E-01 -2.516241E-02 -4.767259E+01 -1.425559E+02 -0.000000E+00 -0.000000E+00 -1.511055E-02 -2.706989E-05 +6.409424E+00 +2.580559E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.359388E+00 -7.162206E-01 -2.420435E+00 -3.693966E-01 +1.132877E-01 +1.324578E-03 +2.859604E-01 +5.376390E-03 0.000000E+00 0.000000E+00 -6.097921E+00 -2.335376E+00 +2.639920E+00 +4.380416E-01 0.000000E+00 0.000000E+00 -2.973834E-03 -2.952905E-06 -9.585516E-02 -7.950754E-04 -3.306195E-01 -7.226156E-03 +6.939496E+01 +3.014077E+02 +6.294738E-01 +2.532146E-02 +4.991526E+01 +1.566280E+02 0.000000E+00 0.000000E+00 -2.606740E+00 -4.273433E-01 -0.000000E+00 -0.000000E+00 -7.004531E+01 -3.068103E+02 -5.609353E-01 -2.054700E-02 -4.844434E+01 -1.474236E+02 -0.000000E+00 -0.000000E+00 -6.909228E-03 -6.822381E-06 +2.046458E-02 +4.809372E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.337728E+00 -7.036827E-01 -2.418767E+00 -3.680337E-01 +3.463364E+00 +7.583727E-01 +2.430263E+00 +3.746875E-01 0.000000E+00 0.000000E+00 -6.114057E+00 -2.352184E+00 -0.000000E+00 -0.000000E+00 -1.000000E-03 -1.000000E-06 -1.057559E-01 -8.659764E-04 -3.268970E-01 -6.949165E-03 -0.000000E+00 -0.000000E+00 -2.538042E+00 -4.047397E-01 -0.000000E+00 -0.000000E+00 -6.922289E+01 -2.996756E+02 -6.190458E-01 -2.456695E-02 -4.757150E+01 -1.421640E+02 -0.000000E+00 -0.000000E+00 -8.765775E-03 -1.054666E-05 +6.122700E+00 +2.364648E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.436793E+00 -7.430145E-01 -2.473841E+00 -3.843375E-01 +8.905302E-02 +7.522016E-04 +3.093670E-01 +6.756039E-03 0.000000E+00 0.000000E+00 -6.104077E+00 -2.339598E+00 +2.632761E+00 +4.384843E-01 +0.000000E+00 +0.000000E+00 +6.885265E+01 +2.965191E+02 +6.537576E-01 +2.783733E-02 +4.958341E+01 +1.546656E+02 +0.000000E+00 +0.000000E+00 +1.104672E-02 +2.296190E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.061129E-01 -8.936114E-04 -3.092546E-01 -6.384841E-03 +3.430503E+00 +7.448601E-01 +2.530174E+00 +4.079173E-01 0.000000E+00 0.000000E+00 -2.539292E+00 -4.045561E-01 +6.274274E+00 +2.498200E+00 0.000000E+00 0.000000E+00 -6.994273E+01 -3.059846E+02 -5.887450E-01 -2.235244E-02 +0.000000E+00 +0.000000E+00 +9.479111E-02 +8.398250E-04 +3.294639E-01 +7.117117E-03 +0.000000E+00 +0.000000E+00 +2.509698E+00 +3.981073E-01 +0.000000E+00 +0.000000E+00 +6.980298E+01 +3.047163E+02 +5.942566E-01 +2.324911E-02 +4.923505E+01 +1.524105E+02 +0.000000E+00 +0.000000E+00 +8.227938E-03 +1.354400E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.469466E+00 +7.613187E-01 +2.362792E+00 +3.532280E-01 +0.000000E+00 +0.000000E+00 +6.039916E+00 +2.302934E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.082199E-01 +9.467141E-04 +3.168219E-01 +6.900253E-03 +0.000000E+00 +0.000000E+00 +2.552623E+00 +4.095459E-01 +0.000000E+00 +0.000000E+00 +6.925085E+01 +2.999309E+02 +6.137602E-01 +2.534680E-02 tally 4: 0.000000E+00 0.000000E+00 @@ -216,18 +216,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.109363E+00 -3.174618E+00 -2.099346E+00 -2.784777E-01 -2.785196E+01 -4.850659E+01 -7.069021E+00 -3.132588E+00 -2.149589E+00 -2.900131E-01 -2.768129E+01 -4.790811E+01 +7.242831E+00 +3.304033E+00 +2.049900E+00 +2.662637E-01 +2.719284E+01 +4.625227E+01 +7.106615E+00 +3.182962E+00 +2.092906E+00 +2.757959E-01 +2.714938E+01 +4.610188E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -240,18 +240,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.175941E+00 -3.224156E+00 -2.135542E+00 -2.863424E-01 -2.728334E+01 -4.655111E+01 -7.206774E+00 -3.256252E+00 -2.075924E+00 -2.712640E-01 -2.747967E+01 -4.722188E+01 +7.098381E+00 +3.169308E+00 +2.239283E+00 +3.166544E-01 +2.718623E+01 +4.622986E+01 +7.155181E+00 +3.223545E+00 +2.207036E+00 +3.075514E-01 +2.738538E+01 +4.691471E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -276,18 +276,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.069021E+00 -3.132588E+00 -2.149589E+00 -2.900131E-01 -2.768129E+01 -4.790811E+01 -7.109363E+00 -3.174618E+00 -2.099346E+00 -2.784777E-01 -2.785196E+01 -4.850659E+01 +7.106615E+00 +3.182962E+00 +2.092906E+00 +2.757959E-01 +2.714938E+01 +4.610188E+01 +7.242831E+00 +3.304033E+00 +2.049900E+00 +2.662637E-01 +2.719284E+01 +4.625227E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -312,18 +312,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.108601E+00 -3.175833E+00 -2.103259E+00 -2.783890E-01 -2.784173E+01 -4.846581E+01 -7.107753E+00 -3.173064E+00 -2.087728E+00 -2.737368E-01 -2.779197E+01 -4.828855E+01 +7.311265E+00 +3.366747E+00 +2.082480E+00 +2.748257E-01 +2.755422E+01 +4.749248E+01 +7.228075E+00 +3.276572E+00 +2.031308E+00 +2.619010E-01 +2.738542E+01 +4.691635E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -360,30 +360,30 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.148041E+00 -3.216417E+00 -2.124230E+00 -2.831606E-01 -2.743879E+01 -4.708424E+01 -7.081749E+00 -3.151711E+00 -2.062609E+00 -2.682691E-01 -2.761154E+01 -4.768316E+01 -7.206774E+00 -3.256252E+00 -2.075924E+00 -2.712640E-01 -2.747967E+01 -4.722188E+01 -7.175941E+00 -3.224156E+00 -2.135542E+00 -2.863424E-01 -2.728334E+01 -4.655111E+01 +7.340922E+00 +3.389303E+00 +2.057125E+00 +2.684644E-01 +2.738205E+01 +4.690167E+01 +7.315301E+00 +3.364365E+00 +2.170144E+00 +2.965160E-01 +2.757366E+01 +4.755684E+01 +7.155181E+00 +3.223545E+00 +2.207036E+00 +3.075514E-01 +2.738538E+01 +4.691471E+01 +7.098381E+00 +3.169308E+00 +2.239283E+00 +3.166544E-01 +2.718623E+01 +4.622986E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -420,18 +420,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.081749E+00 -3.151711E+00 -2.062609E+00 -2.682691E-01 -2.761154E+01 -4.768316E+01 -7.148041E+00 -3.216417E+00 -2.124230E+00 -2.831606E-01 -2.743879E+01 -4.708424E+01 +7.315301E+00 +3.364365E+00 +2.170144E+00 +2.965160E-01 +2.757366E+01 +4.755684E+01 +7.340922E+00 +3.389303E+00 +2.057125E+00 +2.684644E-01 +2.738205E+01 +4.690167E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -444,18 +444,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.107753E+00 -3.173064E+00 -2.087728E+00 -2.737368E-01 -2.779197E+01 -4.828855E+01 -7.108601E+00 -3.175833E+00 -2.103259E+00 -2.783890E-01 -2.784173E+01 -4.846581E+01 +7.228075E+00 +3.276572E+00 +2.031308E+00 +2.619010E-01 +2.738542E+01 +4.691635E+01 +7.311265E+00 +3.366747E+00 +2.082480E+00 +2.748257E-01 +2.755422E+01 +4.749248E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -493,124 +493,124 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -4.843795E+01 -1.473599E+02 -8.846575E+00 -4.912671E+00 -7.292412E+01 -3.326224E+02 -1.096673E+01 -7.549697E+00 -4.119614E+00 -1.064248E+00 -3.323487E+01 -6.913295E+01 -4.768770E+01 -1.426471E+02 -8.521329E+00 -4.554207E+00 -7.297983E+01 -3.330439E+02 -1.083867E+01 -7.393362E+00 -3.955093E+00 -9.810363E-01 -3.309790E+01 -6.852254E+01 -4.845125E+01 -1.474656E+02 -8.533824E+00 -4.579629E+00 -7.208076E+01 -3.249387E+02 -1.100395E+01 -7.627044E+00 -3.908798E+00 -9.610162E-01 -3.287630E+01 -6.763801E+01 -4.758027E+01 -1.422161E+02 -8.577918E+00 -4.614174E+00 -7.278634E+01 -3.313433E+02 -1.072190E+01 -7.216342E+00 -3.922303E+00 -9.640585E-01 -3.334768E+01 -6.955922E+01 +4.839295E+01 +1.468255E+02 +8.931064E+00 +5.003633E+00 +7.231756E+01 +3.273024E+02 +1.088865E+01 +7.436517E+00 +4.139343E+00 +1.078084E+00 +3.295902E+01 +6.798023E+01 +4.993572E+01 +1.567557E+02 +8.552963E+00 +4.606265E+00 +7.178811E+01 +3.223267E+02 +1.087522E+01 +7.441404E+00 +3.965469E+00 +9.946937E-01 +3.244312E+01 +6.588480E+01 +4.959446E+01 +1.547357E+02 +8.804447E+00 +4.904770E+00 +7.263395E+01 +3.299329E+02 +1.105711E+01 +7.709583E+00 +4.082202E+00 +1.057954E+00 +3.316528E+01 +6.882214E+01 +4.924327E+01 +1.524623E+02 +8.402708E+00 +4.441938E+00 +7.211875E+01 +3.252784E+02 +1.130536E+01 +8.069378E+00 +3.817575E+00 +9.236385E-01 +3.272602E+01 +6.700774E+01 cmfd indices 2.000000E+00 2.000000E+00 1.000000E+00 3.000000E+00 k cmfd -1.024488E+00 -1.022339E+00 -1.024720E+00 -1.025459E+00 -1.029180E+00 -1.022688E+00 -1.019305E+00 -1.020356E+00 -1.023384E+00 -1.023519E+00 -1.026360E+00 +1.029991E+00 +1.037713E+00 +1.038248E+00 +1.035411E+00 +1.039580E+00 +1.031827E+00 +1.026250E+00 +1.026011E+00 +1.026544E+00 +1.031482E+00 +1.031761E+00 cmfd entropy -1.999710E+00 -1.999709E+00 -1.999704E+00 -1.999747E+00 -1.999885E+00 -1.999911E+00 -1.999905E+00 -1.999936E+00 -1.999873E+00 -1.999826E+00 -1.999768E+00 +1.998652E+00 +1.999218E+00 +1.999186E+00 +1.999177E+00 +1.999248E+00 +1.999637E+00 +1.999721E+00 +1.999648E+00 +1.999631E+00 +1.999572E+00 +1.999693E+00 cmfd balance -3.179889E-04 -4.166064E-04 -2.746178E-04 -3.345927E-04 -5.129604E-04 -4.008510E-04 -3.628450E-04 -3.401726E-04 -3.166254E-04 -2.642675E-04 -2.482639E-04 +8.98944E-04 +4.45874E-04 +2.18562E-04 +2.83412E-04 +3.60924E-04 +2.53288E-04 +3.38843E-04 +3.17072E-04 +3.25867E-04 +2.27001E-04 +2.41723E-04 cmfd dominance ratio - 3.737E-03 - 3.786E-03 - 3.798E-03 - 3.789E-03 - 3.741E-03 - 3.772E-03 - 3.793E-03 - 3.684E-03 - 3.740E-03 - 3.764E-03 - 3.798E-03 +3.768E-03 +3.706E-03 +2.572E-03 +2.757E-03 +3.815E-03 +3.951E-03 +3.826E-03 +3.829E-03 +3.902E-03 +3.952E-03 +3.885E-03 cmfd openmc source comparison -3.559244E-05 -4.429506E-05 -2.739678E-05 -2.715447E-05 -5.105338E-05 -4.069204E-05 -4.033876E-05 -3.669732E-05 -3.540372E-05 -2.907246E-05 -2.734477E-05 +3.292759E-05 +2.585546E-05 +2.217204E-05 +2.121913E-05 +9.253928E-06 +2.940947E-05 +3.083596E-05 +2.547491E-05 +2.602691E-05 +2.561169E-05 +2.816825E-05 cmfd source -2.564687E-01 -2.445733E-01 -2.473769E-01 -2.515811E-01 +2.417661E-01 +2.547768E-01 +2.495653E-01 +2.538918E-01 0.000000E+00 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/cmfd_feed_ng/settings.xml b/tests/regression_tests/cmfd_feed_ng/settings.xml index 9e483e6a09..990160275c 100644 --- a/tests/regression_tests/cmfd_feed_ng/settings.xml +++ b/tests/regression_tests/cmfd_feed_ng/settings.xml @@ -5,7 +5,7 @@ eigenvalue 20 10 - 1000 + 600 diff --git a/tests/regression_tests/cmfd_nofeed/results_true.dat b/tests/regression_tests/cmfd_nofeed/results_true.dat index 33dff8811f..81907cba28 100644 --- a/tests/regression_tests/cmfd_nofeed/results_true.dat +++ b/tests/regression_tests/cmfd_nofeed/results_true.dat @@ -425,39 +425,39 @@ cmfd entropy 3.221580E+00 3.220523E+00 cmfd balance -4.009062E-03 -4.869661E-03 -2.997290E-03 -2.711191E-03 -1.688329E-03 -1.855396E-03 -1.403979E-03 -1.398429E-03 -1.818398E-03 -1.458254E-03 -1.437876E-03 -1.276844E-03 -1.289036E-03 -1.330300E-03 -1.139999E-03 -1.233647E-03 +4.00906E-03 +4.86966E-03 +2.99729E-03 +2.71119E-03 +1.68833E-03 +1.85540E-03 +1.40398E-03 +1.39843E-03 +1.81840E-03 +1.45825E-03 +1.43788E-03 +1.27684E-03 +1.28904E-03 +1.33030E-03 +1.14000E-03 +1.23365E-03 cmfd dominance ratio - 5.397E-01 - 5.405E-01 - 5.412E-01 - 5.428E-01 - 5.460E-01 - 4.530E-01 - 5.528E-01 - 5.531E-01 - 5.493E-01 - 5.468E-01 - 5.482E-01 - 5.487E-01 - 5.471E-01 - 5.465E-01 - 5.461E-01 - 5.443E-01 +5.397E-01 +5.405E-01 +5.412E-01 +5.428E-01 +5.460E-01 +4.530E-01 +5.528E-01 +5.531E-01 +5.493E-01 +5.468E-01 +5.482E-01 +5.487E-01 +5.471E-01 +5.465E-01 +5.461E-01 +5.443E-01 cmfd openmc source comparison 6.959834E-03 5.494667E-03 diff --git a/tests/regression_tests/quadric_surfaces/materials.xml b/tests/regression_tests/quadric_surfaces/materials.xml index f687683837..460406296b 100644 --- a/tests/regression_tests/quadric_surfaces/materials.xml +++ b/tests/regression_tests/quadric_surfaces/materials.xml @@ -5,6 +5,7 @@ + diff --git a/tests/regression_tests/quadric_surfaces/results_true.dat b/tests/regression_tests/quadric_surfaces/results_true.dat index a03c058dcc..587d302adb 100644 --- a/tests/regression_tests/quadric_surfaces/results_true.dat +++ b/tests/regression_tests/quadric_surfaces/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.005538E+00 3.374726E-03 +1.083927E+00 7.465752E-03 diff --git a/tests/regression_tests/quadric_surfaces/settings.xml b/tests/regression_tests/quadric_surfaces/settings.xml index 81e5ad1855..b04ecac4b9 100644 --- a/tests/regression_tests/quadric_surfaces/settings.xml +++ b/tests/regression_tests/quadric_surfaces/settings.xml @@ -2,8 +2,8 @@ eigenvalue - 10 - 5 + 4 + 0 1000 diff --git a/tests/regression_tests/quadric_surfaces/test.py b/tests/regression_tests/quadric_surfaces/test.py index 862ee9bf41..94540da040 100755 --- a/tests/regression_tests/quadric_surfaces/test.py +++ b/tests/regression_tests/quadric_surfaces/test.py @@ -2,5 +2,5 @@ from tests.testing_harness import TestHarness def test_quadric_surfaces(): - harness = TestHarness('statepoint.10.h5') + harness = TestHarness('statepoint.4.h5') harness.main() diff --git a/tests/regression_tests/triso/inputs_true.dat b/tests/regression_tests/triso/inputs_true.dat index 7e5007eca2..2ea049465c 100644 --- a/tests/regression_tests/triso/inputs_true.dat +++ b/tests/regression_tests/triso/inputs_true.dat @@ -432,7 +432,7 @@ eigenvalue 100 - 5 + 4 0 diff --git a/tests/regression_tests/triso/results_true.dat b/tests/regression_tests/triso/results_true.dat index dfc700c058..eb06a771c9 100644 --- a/tests/regression_tests/triso/results_true.dat +++ b/tests/regression_tests/triso/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.683226E+00 7.383559E-02 +1.707485E+00 9.795497E-02 diff --git a/tests/regression_tests/triso/test.py b/tests/regression_tests/triso/test.py index 3b858e6a71..aa1bf08289 100644 --- a/tests/regression_tests/triso/test.py +++ b/tests/regression_tests/triso/test.py @@ -82,7 +82,7 @@ class TRISOTestHarness(PyAPITestHarness): geom.export_to_xml() settings = openmc.Settings() - settings.batches = 5 + settings.batches = 4 settings.inactive = 0 settings.particles = 100 settings.source = openmc.Source(space=openmc.stats.Point()) @@ -93,5 +93,5 @@ class TRISOTestHarness(PyAPITestHarness): def test_triso(): - harness = TRISOTestHarness('statepoint.5.h5') + harness = TRISOTestHarness('statepoint.4.h5') harness.main() diff --git a/tests/testing_harness.py b/tests/testing_harness.py index d8baf32061..e341a3cf17 100644 --- a/tests/testing_harness.py +++ b/tests/testing_harness.py @@ -134,27 +134,27 @@ class CMFDTestHarness(TestHarness): """Specialized TestHarness for running OpenMC CMFD tests.""" def __init__(self, statepoint_name, cmfd_run): - self._sp_name = statepoint_name + super().__init__(statepoint_name) self._create_cmfd_result_str(cmfd_run) def _create_cmfd_result_str(self, cmfd_run): """Create CMFD result string from variables of CMFDRun instance""" outstr = 'cmfd indices\n' - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run.indices]) + outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfd_run.indices]) outstr += '\nk cmfd\n' - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run.k_cmfd]) + outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfd_run.k_cmfd]) outstr += '\ncmfd entropy\n' - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run.entropy]) + outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfd_run.entropy]) outstr += '\ncmfd balance\n' - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run.balance]) + outstr += '\n'.join(['{:.5E}'.format(x) for x in cmfd_run.balance]) outstr += '\ncmfd dominance ratio\n' - outstr += '\n'.join(['{0:10.3E}'.format(x) for x in cmfd_run.dom]) + outstr += '\n'.join(['{:.3E}'.format(x) for x in cmfd_run.dom]) outstr += '\ncmfd openmc source comparison\n' - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfd_run.src_cmp]) + outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfd_run.src_cmp]) outstr += '\ncmfd source\n' cmfdsrc = np.reshape(cmfd_run.cmfd_src, np.product(cmfd_run.indices), order='F') - outstr += '\n'.join(['{0:12.6E}'.format(x) for x in cmfdsrc]) + outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfdsrc]) outstr += '\n' self._cmfdrun_results = outstr diff --git a/tests/unit_tests/test_endf.py b/tests/unit_tests/test_endf.py index 147e2db873..11a8db4432 100644 --- a/tests/unit_tests/test_endf.py +++ b/tests/unit_tests/test_endf.py @@ -9,6 +9,19 @@ def test_float_endf(): assert endf.float_endf('6.022-23') == approx(6.022e-23) assert endf.float_endf(' +1.01+ 2') == approx(101.0) assert endf.float_endf(' -1.01- 2') == approx(-0.0101) + assert endf.float_endf('+ 2 . 3+ 1') == approx(23.0) + assert endf.float_endf('-7 .8 -1') == approx(-0.78) + assert endf.float_endf('3.14e0') == approx(3.14) + assert endf.float_endf('3.14E0') == approx(3.14) + assert endf.float_endf('3.14e-1') == approx(0.314) + assert endf.float_endf('3.14d0') == approx(3.14) + assert endf.float_endf('3.14D0') == approx(3.14) + assert endf.float_endf('3.14d-1') == approx(0.314) + assert endf.float_endf('1+2') == approx(100.0) + assert endf.float_endf('-1+2') == approx(-100.0) + assert endf.float_endf('1.+2') == approx(100.0) + assert endf.float_endf('-1.+2') == approx(-100.0) + assert endf.float_endf(' ') == 0.0 def test_int_endf():