mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Updating tests for eff
This commit is contained in:
parent
d88648634e
commit
2ef49a9c9b
4 changed files with 24 additions and 5 deletions
|
|
@ -1894,11 +1894,11 @@ class EnergyFunctionFilter(Filter):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, energy, y, filter_id=None):
|
||||
def __init__(self, energy, y, interpolation='linear-linear', filter_id=None):
|
||||
self.energy = energy
|
||||
self.y = y
|
||||
self.id = filter_id
|
||||
self.interpolation = 'linear-linear'
|
||||
self.interpolation = interpolation
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(self) is not type(other):
|
||||
|
|
@ -1936,12 +1936,14 @@ class EnergyFunctionFilter(Filter):
|
|||
string = type(self).__name__ + '\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tEnergy', self.energy)
|
||||
string += '{: <16}=\t{}\n'.format('\tInterpolant', self.y)
|
||||
string += '{: <16}=\t{}\n'.format('\tInterpolation', self.interpolation)
|
||||
return hash(string)
|
||||
|
||||
def __repr__(self):
|
||||
string = type(self).__name__ + '\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tEnergy', self.energy)
|
||||
string += '{: <16}=\t{}\n'.format('\tInterpolant', self.y)
|
||||
string += '{: <16}=\t{}\n'.format('\tInterpolation', self.interpolation)
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self.id)
|
||||
return string
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@
|
|||
<y>0.1 0.1 0.1333 0.158 0.18467 0.25618 0.4297 0.48 0.48</y>
|
||||
<interpolation>linear-linear</interpolation>
|
||||
</filter>
|
||||
<filter id="3" type="energyfunction">
|
||||
<energy>1e-05 0.369 1000.0 100000.0 600000.0 1000000.0 2000000.0 4000000.0 30000000.0</energy>
|
||||
<y>0.1 0.1 0.1333 0.158 0.18467 0.25618 0.4297 0.48 0.48</y>
|
||||
<interpolation>log-log</interpolation>
|
||||
</filter>
|
||||
<tally id="1">
|
||||
<nuclides>Am241</nuclides>
|
||||
<scores>(n,gamma)</scores>
|
||||
|
|
@ -33,4 +38,9 @@
|
|||
<nuclides>Am241</nuclides>
|
||||
<scores>(n,gamma)</scores>
|
||||
</tally>
|
||||
<tally id="3">
|
||||
<filters>3</filters>
|
||||
<nuclides>Am241</nuclides>
|
||||
<scores>(n,gamma)</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
energyfunction nuclide score mean std. dev.
|
||||
0 d2effa26cb3cf2 Am241 ((n,gamma) / (n,gamma)) 1.74e-01 6.83e-03
|
||||
0 448ee8dfd19c4f Am241 ((n,gamma) / (n,gamma)) 1.74e-01 6.83e-03
|
||||
|
|
|
|||
|
|
@ -39,14 +39,21 @@ def model():
|
|||
filt2 = openmc.EnergyFunctionFilter.from_tabulated1d(tab1d)
|
||||
assert filt1 == filt2, 'Error with the .from_tabulated1d constructor'
|
||||
|
||||
filt3 = openmc.EnergyFunctionFilter(x, y)
|
||||
filt3.interpolation = 'log-log'
|
||||
print(filt3)
|
||||
|
||||
# Make tallies
|
||||
tallies = [openmc.Tally(), openmc.Tally()]
|
||||
tallies = [openmc.Tally(), openmc.Tally(), openmc.Tally()]
|
||||
for t in tallies:
|
||||
t.scores = ['(n,gamma)']
|
||||
t.nuclides = ['Am241']
|
||||
tallies[1].filters = [filt1]
|
||||
tallies[2].filters = [filt3]
|
||||
model.tallies.extend(tallies)
|
||||
|
||||
|
||||
|
||||
return model
|
||||
|
||||
|
||||
|
|
@ -75,7 +82,7 @@ class FilterEnergyFunHarness(PyAPITestHarness):
|
|||
model_tally = self._model.tallies[1]
|
||||
model_filt = model_tally.find_filter(openmc.EnergyFunctionFilter)
|
||||
|
||||
assert sp_filt.interpolation == model_filt.interpolation
|
||||
assert sp_filt.interpolation == 'linear-linear'
|
||||
assert all(sp_filt.energy == model_filt.energy)
|
||||
assert all(sp_filt.y == model_filt.y)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue