mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Added test for MG tallying
This commit is contained in:
parent
9141e2a00f
commit
da76c2c8ff
3 changed files with 3544 additions and 0 deletions
1
tests/test_mg_tallies/inputs_true.dat
Normal file
1
tests/test_mg_tallies/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
87d5adff4c8d53f020baa25db59d9ad6eada791ef010577e3586c543a9ee6cee6022d99e7a27911a94560acddba3602570c0748a0b4cba48f630b726221f14dc
|
||||
3482
tests/test_mg_tallies/results_true.dat
Normal file
3482
tests/test_mg_tallies/results_true.dat
Normal file
File diff suppressed because it is too large
Load diff
61
tests/test_mg_tallies/test_mg_tallies.py
Normal file
61
tests/test_mg_tallies/test_mg_tallies.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
|
||||
class MGTalliesTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.Mesh(mesh_id=1)
|
||||
mesh.type = 'regular'
|
||||
mesh.dimension = [17, 17, 1]
|
||||
mesh.lower_left = [0.0, 0.0, 0.0]
|
||||
mesh.upper_right = [21.42, 21.42, 100.0]
|
||||
|
||||
# Instantiate some tally filters
|
||||
energy_filter = openmc.Filter(type='energy',
|
||||
bins=[1E-11, 0.0635E-6, 10.0E-6, 1.0E-4,
|
||||
1.0E-3, 0.5, 1.0, 20.0])
|
||||
energyout_filter = openmc.Filter(type='energyout',
|
||||
bins=[1E-11, 0.0635E-6, 10.0E-6,
|
||||
1.0E-4, 1.0E-3, 0.5, 1.0, 20.0])
|
||||
mesh_filter = openmc.Filter()
|
||||
mesh_filter.mesh = mesh
|
||||
|
||||
mat_filter = openmc.Filter(type='material', bins=[1,2,3])
|
||||
|
||||
tally1 = openmc.Tally(tally_id=1)
|
||||
tally1.add_filter(mesh_filter)
|
||||
tally1.add_score('total')
|
||||
tally1.add_score('absorption')
|
||||
tally1.add_score('flux')
|
||||
tally1.add_score('fission')
|
||||
tally1.add_score('nu-fission')
|
||||
|
||||
tally2 = openmc.Tally(tally_id=2)
|
||||
tally2.add_filter(mat_filter)
|
||||
tally2.add_filter(energy_filter)
|
||||
tally2.add_filter(energyout_filter)
|
||||
tally2.add_score('scatter')
|
||||
tally2.add_score('nu-scatter')
|
||||
|
||||
self._input_set.tallies = openmc.TalliesFile()
|
||||
self._input_set.tallies.add_mesh(mesh)
|
||||
self._input_set.tallies.add_tally(tally1)
|
||||
self._input_set.tallies.add_tally(tally2)
|
||||
|
||||
super(MGTalliesTestHarness, self)._build_inputs()
|
||||
|
||||
def _cleanup(self):
|
||||
super(MGTalliesTestHarness, self)._cleanup()
|
||||
f = os.path.join(os.getcwd(), 'tallies.xml')
|
||||
if os.path.exists(f): os.remove(f)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = MGTalliesTestHarness('statepoint.10.*', True, mg=True)
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue