mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge pull request #1997 from eepeterson/energy_filter_from_group
adding helper method for EnergyFilter creation
This commit is contained in:
commit
2a95e09ad7
2 changed files with 20 additions and 0 deletions
|
|
@ -1324,6 +1324,20 @@ class EnergyFilter(RealFilter):
|
|||
cv.check_greater_than('filter value', v0, 0., equality=True)
|
||||
cv.check_greater_than('filter value', v1, 0., equality=True)
|
||||
|
||||
@classmethod
|
||||
def from_group_structure(cls, group_structure):
|
||||
"""Construct an EnergyFilter instance from a standard group structure.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
group_structure : str
|
||||
Name of the group structure. Must be a valid key of
|
||||
openmc.mgxs.GROUP_STRUCTURES dictionary.
|
||||
|
||||
"""
|
||||
|
||||
return cls(openmc.mgxs.GROUP_STRUCTURES[group_structure.upper()])
|
||||
|
||||
|
||||
class EnergyoutFilter(EnergyFilter):
|
||||
"""Bins tally events based on outgoing particle energy.
|
||||
|
|
|
|||
|
|
@ -240,3 +240,9 @@ def test_first_moment(run_in_tmpdir, box_model):
|
|||
assert first_score(sph_scat_tally) == scatter
|
||||
assert first_score(sph_flux_tally) == approx(flux)
|
||||
assert first_score(zernike_tally) == approx(scatter)
|
||||
|
||||
|
||||
def test_energy():
|
||||
f = openmc.EnergyFilter.from_group_structure('CCFE-709')
|
||||
assert f.bins.shape == (709, 2)
|
||||
assert len(f.values) == 710
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue