mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Resolving @paulromano comments
This commit is contained in:
parent
906270b4fc
commit
6ba1f04631
6 changed files with 38 additions and 17 deletions
|
|
@ -36,7 +36,7 @@ scatter_matrix = np.array(
|
|||
[0.0000000, 0.0000000, 0.0000000, 0.0001253, 0.2714010, 0.0102550, 0.0000000],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0012968, 0.2658020, 0.0168090],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0085458, 0.2730800]]])
|
||||
scatter_matrix = np.swapaxes(np.swapaxes(scatter_matrix, 0, 1), 1, 2)
|
||||
scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
|
||||
uo2_xsdata.set_scatter_matrix(scatter_matrix)
|
||||
uo2_xsdata.set_fission([7.21206E-03, 8.19301E-04, 6.45320E-03,
|
||||
1.85648E-02, 1.78084E-02, 8.30348E-02,
|
||||
|
|
@ -62,7 +62,7 @@ scatter_matrix = np.array(
|
|||
[0.0000000, 0.0000000, 0.0000000, 0.0000714, 0.1391380, 0.5118200, 0.0612290],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0022157, 0.6999130, 0.5373200],
|
||||
[0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.1324400, 2.4807000]]])
|
||||
scatter_matrix = np.swapaxes(np.swapaxes(scatter_matrix, 0, 1), 1, 2)
|
||||
scatter_matrix = np.rollaxis(scatter_matrix, 0, 3)
|
||||
h2o_xsdata.set_scatter_matrix(scatter_matrix)
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
|
|
|||
|
|
@ -100,10 +100,13 @@ class Filter(object):
|
|||
@classmethod
|
||||
def _recursive_subclasses(cls):
|
||||
"""Return all subclasses and their subclasses, etc."""
|
||||
subs = cls.__subclasses__()
|
||||
subsubs = [grand for s in subs for grand in s.__subclasses__()]
|
||||
subsubsubs = [grand for s in subsubs for grand in s.__subclasses__()]
|
||||
return subs + subsubs + subsubsubs
|
||||
all_subclasses = []
|
||||
|
||||
for subclass in cls.__subclasses__():
|
||||
all_subclasses.append(subclass)
|
||||
all_subclasses.extend(subclass._recursive_subclasses())
|
||||
|
||||
return all_subclasses
|
||||
|
||||
@classmethod
|
||||
def from_hdf5(cls, group, **kwargs):
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Library(object):
|
|||
The spatial domain(s) for which MGXS in the Library are computed
|
||||
correction : {'P0', None}
|
||||
Apply the P0 correction to scattering matrices if set to 'P0'
|
||||
scatter_format : {'legendre', or 'histogram'}
|
||||
scatter_format : {'legendre', 'histogram'}
|
||||
Representation of the angular scattering distribution (default is
|
||||
'legendre')
|
||||
legendre_order : int
|
||||
|
|
|
|||
|
|
@ -1529,9 +1529,19 @@ class MGXS(object):
|
|||
else:
|
||||
df = df.drop('score', axis=1)
|
||||
|
||||
# Determine if change-in-angle bins are included in the MGXS to
|
||||
# properly tile the group boundaries
|
||||
if 'mu low' in df:
|
||||
# Find the length of the mu filters indirectly from the number
|
||||
# of times the mu bins repeats.
|
||||
num_mu = int(df.shape[0] /
|
||||
df[df['mu low'] == df['mu low'][0]].shape[0])
|
||||
else:
|
||||
num_mu = 1
|
||||
|
||||
# Override energy groups bounds with indices
|
||||
all_groups = np.arange(self.num_groups, 0, -1, dtype=np.int)
|
||||
all_groups = np.repeat(all_groups, len(query_nuclides))
|
||||
all_groups = np.repeat(all_groups, len(query_nuclides) * num_mu)
|
||||
if 'energy low [eV]' in df and 'energyout low [eV]' in df:
|
||||
df.rename(columns={'energy low [eV]': 'group in'},
|
||||
inplace=True)
|
||||
|
|
@ -3791,10 +3801,8 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
# than 1, so try each axis in axes one at a time, catching the
|
||||
# ValueError as needed.
|
||||
for axis in axes:
|
||||
try:
|
||||
if xs.shape[axis] == 1:
|
||||
xs = np.squeeze(xs, axis=axis)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return xs
|
||||
|
||||
|
|
@ -3874,9 +3882,12 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
df = df[df['moment'] == 'P{}'.format(moment)]
|
||||
|
||||
elif self.scatter_format == 'histogram':
|
||||
# Add a change-in-angle (mu) column to dataframe
|
||||
###TODO NOT SURE I NEED TO DO THIS
|
||||
pass
|
||||
# Replace the mu low and mu high columns with a single mu bin
|
||||
del df['mu high']
|
||||
df.rename(columns={'mu low': 'mu bins'}, inplace=True)
|
||||
bins = [i + 1 for i in range(self.histogram_bins)]
|
||||
bins = np.tile(bins, int(df.shape[0] / len(bins)))
|
||||
df['mu bins'] = bins
|
||||
|
||||
return df
|
||||
|
||||
|
|
|
|||
|
|
@ -1773,8 +1773,14 @@ class XSdata(object):
|
|||
np.sum(self._scatter_matrix[i][p, a, g_in, :, :],
|
||||
axis=1)
|
||||
nz = np.nonzero(matrix)
|
||||
g_out_bounds[p, a, g_in, 0] = nz[0][0]
|
||||
g_out_bounds[p, a, g_in, 1] = nz[0][-1]
|
||||
# It is possible that there only zeros in matrix
|
||||
# and therefore nz will be empty, in that case set
|
||||
# g_out_bounds to 0s
|
||||
if len(nz[0]) == 0:
|
||||
g_out_bounds[p, a, g_in, :] = 0
|
||||
else:
|
||||
g_out_bounds[p, a, g_in, 0] = nz[0][0]
|
||||
g_out_bounds[p, a, g_in, 1] = nz[0][-1]
|
||||
|
||||
# Now create the flattened scatter matrix array
|
||||
flat_scatt = []
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
import numpy as np
|
||||
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc.filter import *
|
||||
from openmc import Mesh, Tally, Tallies
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
||||
class TalliesTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
# Build default materials/geometry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue