mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Merge remote-tracking branch 'upstream/develop' into diff_tally3
This commit is contained in:
commit
e2c2f8c939
157 changed files with 5941 additions and 3256 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import openmc
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
||||
class InputSet(object):
|
||||
|
|
@ -558,7 +560,8 @@ class InputSet(object):
|
|||
self.settings.batches = 10
|
||||
self.settings.inactive = 5
|
||||
self.settings.particles = 100
|
||||
self.settings.set_source_space('box', (-160, -160, -183, 160, 160, 183))
|
||||
self.settings.source = Source(space=Box(
|
||||
[-160, -160, -183], [160, 160, 183]))
|
||||
|
||||
def build_defualt_plots(self):
|
||||
plot = openmc.Plot()
|
||||
|
|
|
|||
1
tests/test_distribmat/inputs_true.dat
Normal file
1
tests/test_distribmat/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
401b8be1b296db7f21ccae089c7ac480044d953b7264ca0ae8e34bb79e24cbb57195bcb568deda6f2f7e07366bbfac408a92306351b9169edd04499723707e1b
|
||||
11
tests/test_distribmat/results_true.dat
Normal file
11
tests/test_distribmat/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.309285E+00 1.263629E-02
|
||||
Cell
|
||||
ID = 11
|
||||
Name =
|
||||
Material = [2, 3, void, 2]
|
||||
Region = -10000
|
||||
Rotation = None
|
||||
Translation = None
|
||||
Offset = None
|
||||
Distribcell index= 1
|
||||
136
tests/test_distribmat/test_distribmat.py
Normal file
136
tests/test_distribmat/test_distribmat.py
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
import openmc
|
||||
from openmc.stats import Box
|
||||
from openmc.source import Source
|
||||
|
||||
|
||||
class DistribmatTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
####################
|
||||
# Materials
|
||||
####################
|
||||
|
||||
moderator = openmc.Material(material_id=1)
|
||||
moderator.set_density('g/cc', 1.0)
|
||||
moderator.add_nuclide('H-1', 2.0)
|
||||
moderator.add_nuclide('O-16', 1.0)
|
||||
|
||||
dense_fuel = openmc.Material(material_id=2)
|
||||
dense_fuel.set_density('g/cc', 4.5)
|
||||
dense_fuel.add_nuclide('U-235', 1.0)
|
||||
|
||||
light_fuel = openmc.Material(material_id=3)
|
||||
light_fuel.set_density('g/cc', 2.0)
|
||||
light_fuel.add_nuclide('U-235', 1.0)
|
||||
|
||||
mats_file = openmc.MaterialsFile()
|
||||
mats_file.default_xs = '71c'
|
||||
mats_file.add_materials([moderator, dense_fuel, light_fuel])
|
||||
mats_file.export_to_xml()
|
||||
|
||||
|
||||
####################
|
||||
# Geometry
|
||||
####################
|
||||
|
||||
c1 = openmc.Cell(cell_id=1)
|
||||
c1.fill = moderator
|
||||
mod_univ = openmc.Universe(universe_id=1)
|
||||
mod_univ.add_cell(c1)
|
||||
|
||||
r0 = openmc.ZCylinder(R=0.3)
|
||||
c11 = openmc.Cell(cell_id=11)
|
||||
c11.region = -r0
|
||||
c11.fill = [dense_fuel, light_fuel, 'void', dense_fuel]
|
||||
c12 = openmc.Cell(cell_id=12)
|
||||
c12.region = +r0
|
||||
c12.fill = moderator
|
||||
fuel_univ = openmc.Universe(universe_id=11)
|
||||
fuel_univ.add_cells((c11, c12))
|
||||
|
||||
lat = openmc.RectLattice(lattice_id=101)
|
||||
lat.dimension = [2, 2]
|
||||
lat.lower_left = [-2.0, -2.0]
|
||||
lat.pitch = [2.0, 2.0]
|
||||
lat.universes = [[fuel_univ]*2]*2
|
||||
lat.outer = mod_univ
|
||||
|
||||
x0 = openmc.XPlane(x0=-3.0)
|
||||
x1 = openmc.XPlane(x0=3.0)
|
||||
y0 = openmc.YPlane(y0=-3.0)
|
||||
y1 = openmc.YPlane(y0=3.0)
|
||||
for s in [x0, x1, y0, y1]:
|
||||
s.boundary_type = 'reflective'
|
||||
c101 = openmc.Cell(cell_id=101)
|
||||
c101.region = +x0 & -x1 & +y0 & -y1
|
||||
c101.fill = lat
|
||||
root_univ = openmc.Universe(universe_id=0)
|
||||
root_univ.add_cell(c101)
|
||||
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root_univ
|
||||
geo_file = openmc.GeometryFile()
|
||||
geo_file.geometry = geometry
|
||||
geo_file.export_to_xml()
|
||||
|
||||
|
||||
####################
|
||||
# Settings
|
||||
####################
|
||||
|
||||
sets_file = openmc.SettingsFile()
|
||||
sets_file.batches = 5
|
||||
sets_file.inactive = 0
|
||||
sets_file.particles = 1000
|
||||
sets_file.source = Source(space=Box([-1, -1, -1], [1, 1, 1]))
|
||||
sets_file.output = {'summary': True}
|
||||
sets_file.export_to_xml()
|
||||
|
||||
|
||||
####################
|
||||
# Plots
|
||||
####################
|
||||
|
||||
plots_file = openmc.PlotsFile()
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.basis = 'xy'
|
||||
plot.color = 'cell'
|
||||
plot.filename = 'cellplot'
|
||||
plot.origin = (0, 0, 0)
|
||||
plot.width = (7, 7)
|
||||
plot.pixels = (400, 400)
|
||||
plots_file.add_plot(plot)
|
||||
|
||||
plot = openmc.Plot(plot_id=2)
|
||||
plot.basis = 'xy'
|
||||
plot.color = 'mat'
|
||||
plot.filename = 'matplot'
|
||||
plot.origin = (0, 0, 0)
|
||||
plot.width = (7, 7)
|
||||
plot.pixels = (400, 400)
|
||||
plots_file.add_plot(plot)
|
||||
|
||||
plots_file.export_to_xml()
|
||||
|
||||
def _get_results(self):
|
||||
outstr = super(DistribmatTestHarness, self)._get_results()
|
||||
su = openmc.Summary('summary.h5')
|
||||
outstr += str(su.get_cell_by_id(11))
|
||||
return outstr
|
||||
|
||||
def _cleanup(self):
|
||||
f = os.path.join(os.getcwd(), 'plots.xml')
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
super(DistribmatTestHarness, self)._cleanup()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = DistribmatTestHarness('statepoint.5.*')
|
||||
harness.main()
|
||||
|
|
@ -1 +1 @@
|
|||
1d5f81d12f607f4a8436dfb65167e2a2be55dbf86fbc2cc465cec274671be5eaff517d781a4d40e264bb695e3c66c7ff61a650217c99de2ca8c15ca747fe6b80
|
||||
57d6fd9cb5180c38efd2729a5dea0708cbd5fd0bf7dcf0c9d5c9cef5d818aeab5a926d03e70dedcf1b60d5740938fb3ba80e6ccdb09c661d159c0893da3bd593
|
||||
|
|
@ -1 +1 @@
|
|||
caae173f01f7073d634a68a5c4ce97177423e13596a863976e1c40303dc8c05afed457d5a1aa0ae73627ec953143e4f9c1f45bdbd3b0cca76433062467d59777
|
||||
f8359184c02fbab5dca5368689a84924066ab1fb09cae575588ceddd696d5461db577498df9959365d89fe933e9b338390e44e362c603c6f2aa5bcf4acc14b20
|
||||
|
|
@ -1 +1 @@
|
|||
2f24eb86cda981982a8db5bb110c72e9cef542c06e15b748c1c7e459f96b0d8ba0978b51dffc006e813cd2e2ae1fa0357336f8322ae263189841afde01f0327b
|
||||
8ae662f8881ce8cdec550069c6233c2c91e9a10f7200af6892cf6f2d77712ccfa17895dbd2eee02e6daf3d665c6ed84b29e17d89ff519e70c37b36d75a431d53
|
||||
|
|
@ -1 +1 @@
|
|||
e771470681d3b4af57a70d148f5eb728df57f1fd7bdb5d6f76ac556b69f10bf0cdd5645fe488f1e17f07cbb72e9fb34af2fd7ede95c8e39c5ffa6ea9b6c5810e
|
||||
a7c8ce7ffbc3a7b965d8a3077a4d9132130561afef19047b279b2d23198e248b09664856a092a32394894e19fef7708cebad99b3839d735c4e98ae0c9af58cb7
|
||||
|
|
@ -10,10 +10,7 @@ from testing_harness import *
|
|||
|
||||
class DistribcellTestHarness(TestHarness):
|
||||
def __init__(self):
|
||||
self._sp_name = None
|
||||
self._tallies = True
|
||||
self._opts = None
|
||||
self._args = None
|
||||
super(DistribcellTestHarness, self).__init__(None, True)
|
||||
|
||||
def execute_test(self):
|
||||
"""Run OpenMC with the appropriate arguments and check the outputs."""
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
49835200052ee1a4c9583a7bb4e9430de7d01a6d7a8d4f63ae37be9bbac4fd8c7ed9135ecbc4ab4cb075fd4d77b322265783463dd07c127decceee8c9fe25bfd
|
||||
51d3e2c43f36712a7b26c5fa26e0e2ca6fb9af205af04f0f8cd44c6b100e36382417c2c63d711e4677ce3c1958d15072727d5fd32424a3f6eb08d1f3b1c7db5a
|
||||
|
|
@ -1 +1 @@
|
|||
183b4a06cbd0930cfa4f28d0c385cf3ae93ab97c171580c2ba9eec0e4b716102ad83f510d62258ef6769c446e72e1d5ba9f630b171ee239ec04c9bbd1e56742e
|
||||
f0810606c5f947a9fe03bcfc87de3883ce46f59d8603e02ed30f853ebf301b2dc6bdcd109889801ada9e6e0b7be4932efeca97d4beea875af8c8e3ecb7511444
|
||||
|
|
@ -1 +1 @@
|
|||
461a6a4ec3b0b6dc7199c09fa8f527e51cc7a1ea4281a708f8b7bcdbb12f7162027928dfcef68a24eaf6c06037a68e151df9aac9eac6ce56617466f2f5270b71
|
||||
c4d4334d44956d6dc9abe854a5e9403d7f8a87ffb04a15a3d128e8d18eb4111f46ca277b751e1b0e836d69527502f9abba115a4b2fc64c38da63a9d57968d860
|
||||
|
|
@ -1 +1 @@
|
|||
2fbd0986abff08126680925284929cf67bdad0cd564775197b78065ce3b0e6ad8094f5ca4d14ea69347db69a6cdcc9796a095178ae9b14a927b101f32f3cd0ec
|
||||
7689b2c88391128377b7f9bfcda347a42f77d69d194186629fa965ecd3fc51be0bfd1ac92fb9d7551128d8b6ed5241ead4fb94b27ae29d80230863e78fbbcb68
|
||||
|
|
@ -1 +1 @@
|
|||
cd2aeb24baafe9a904e697955990f6cffb5f25618fdf8c972775715bfe6e92bc259e36fd2b5addff8181439de58ad6f530972ec391e827f46146a2aaace34358
|
||||
ecc649936e2cc364b079944f47e18fb81ec7290017b4bd5837e5aa1e24e1146df77897f44c7c2a88500e3f525566b51777cd9b84ec6a636f5883e411e4c1f75c
|
||||
|
|
@ -1 +1 @@
|
|||
2de29e0a083af0722039ebc246469f26e260d604ab8b76314b2ac472bbd23004e031aec7afe3dbfc4c6112428846cd0cf0c1430e878832b9dab36463d026dee6
|
||||
301824991a022884215609f39797a61933faf7ccacf81ad6bb883af08857563e8bd74ab946fc4fd072860168d77f76d0c76d1467375158072dce431fc6a1c449
|
||||
|
|
@ -1 +1 @@
|
|||
51fcaf0aa527d1fd1022e5f312d4d25cd9bacc5fc9792d9f7702ee97cac43700a31f25be767a2cff769c37b5e1cdf3f922467977a9958fa34561e2a102bf8537
|
||||
164804414f48a818c93e197f2901ce6ae375d88071a03e89c920dbc4462e7a2c8d2c85acf6560fcd6eb3d7c0c53d3b426ab1cc4b7721266fe8adec3e7231149e
|
||||
|
|
@ -11,18 +11,6 @@ tally 1:
|
|||
2.483728E+01
|
||||
5.102293E-01
|
||||
8.710841E-02
|
||||
8.628000E+00
|
||||
2.481430E+01
|
||||
9.329009E-01
|
||||
2.902534E-01
|
||||
5.102293E-01
|
||||
8.710841E-02
|
||||
5.087118E-01
|
||||
8.657086E-02
|
||||
8.632000E+00
|
||||
2.483728E+01
|
||||
9.328366E-01
|
||||
2.902108E-01
|
||||
5.087118E-01
|
||||
8.657086E-02
|
||||
9.212024E+00
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
<tally id="1">
|
||||
<filter type="cell" bins="21" />
|
||||
<scores>
|
||||
flux total scatter nu-scatter scatter-2 scatter-p2 nu-scatter-2
|
||||
nu-scatter-p2 transport n1n absorption nu-fission kappa-fission
|
||||
flux-y2 total-y2 scatter-y2 nu-scatter-y2 events delayed-nu-fission
|
||||
flux total scatter nu-scatter scatter-2 nu-scatter-2 transport n1n
|
||||
absorption nu-fission kappa-fission flux-y2 total-y2 scatter-y2
|
||||
nu-scatter-y2 events delayed-nu-fission
|
||||
</scores>
|
||||
</tally>
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
53b1740921b71e4ead909ab9e4c25f7d43990fe7d7051fde6f66c39c0a6082177385640244010e1b9dbeaf5f34adf1627e9603088af729fadd6b589c19102edc
|
||||
|
|
@ -1 +1 @@
|
|||
7c1deb8a54fbe1a1ce6ef27cea4a11995210ad3e5ecf32bd83d7c80041edf0793378a7325ffe7ebf9c537e9c278fd4545642fec6c1e46b9c5418118f035d5e95
|
||||
c6a2a1c707bc723fd38bafd18efcfb22beaac0bd5953d7524ced1d47866cc1e1ee4152e39234d32a06fe43aff446fb12f8c5b62a44075607f274778b49110762
|
||||
|
|
@ -1 +1 @@
|
|||
63295b9d510370e65e63a3db627d47d286f5479e53c8eabeda9a5cb25ffe35becb636835aadad11691e34c23292fe11b5f688daee76d76ceac4b5dfd2f9ede4c
|
||||
0e8ecbc5afb7fb5e521913f239849febadbc969bbf99159b42d6d7e7930dcdb34f0e778e00a6e7c48170d4dd176b5776455ba96b722ad9cb6f2438e6ac3ce406
|
||||
|
|
@ -7,10 +7,6 @@ tally 1:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.538090E-03
|
||||
1.381456E-06
|
||||
1.538090E-03
|
||||
1.381456E-06
|
||||
3.974412E-01
|
||||
|
|
@ -19,16 +15,12 @@ tally 1:
|
|||
3.796357E-01
|
||||
5.252455E-06
|
||||
2.290531E-11
|
||||
5.252455E-06
|
||||
2.290531E-11
|
||||
3.359792E-02
|
||||
2.267331E-04
|
||||
2.459115E-02
|
||||
1.233078E-04
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
7.004005E-05
|
||||
1.748739E-09
|
||||
8.104946E-02
|
||||
|
|
@ -42,18 +34,12 @@ tally 2:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
2.000000E-01
|
||||
9.000000E-03
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
2.000000E-02
|
||||
2.000000E-04
|
||||
0.000000E+00
|
||||
|
|
@ -64,8 +50,6 @@ tally 2:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
tally 3:
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
|
|
@ -73,10 +57,6 @@ tally 3:
|
|||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.408027E-03
|
||||
1.849607E-06
|
||||
1.408027E-03
|
||||
1.849607E-06
|
||||
3.946436E-01
|
||||
|
|
@ -85,16 +65,12 @@ tally 3:
|
|||
3.382059E-01
|
||||
2.179241E-05
|
||||
4.749090E-10
|
||||
2.179241E-05
|
||||
4.749090E-10
|
||||
3.146594E-02
|
||||
2.159308E-04
|
||||
4.278352E-02
|
||||
4.094478E-04
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
0.000000E+00
|
||||
1.736514E-04
|
||||
1.245171E-08
|
||||
7.989710E-02
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ class ScoreMTTestHarness(PyAPITestHarness):
|
|||
filt = openmc.Filter(type='cell', bins=(10, 21, 22, 23))
|
||||
tallies = [openmc.Tally(tally_id=i) for i in range(1, 4)]
|
||||
[t.add_filter(filt) for t in tallies]
|
||||
[t.add_score('n2n') for t in tallies]
|
||||
[t.add_score('16') for t in tallies]
|
||||
[t.add_score('51') for t in tallies]
|
||||
[t.add_score('102') for t in tallies]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
482760c362f56e453ce4b466083e77f84a461e636330d7cc2cb1cf7facced678a57a7c785ff9d039b3f575396cb435f99df05d6fa207f553c28ed3ce4f8151b3
|
||||
df0089700d7ca25e997d9e6da4aa7132575298feb14398b2e806961fdb2e1d9bfbd23beb7bbc2a71b2ce18abe324702c2ab654af32e826bba5571a068b00a848
|
||||
|
|
@ -1 +1 @@
|
|||
f3c246a1c83b1283163b22069f78231e3f6623fa3c2eb664ce400d0fff07105b6106d0fa8c6dfd49512a7eb676c80e4ee602e19063a9fc453394fe07a94a1bdd
|
||||
2fb062798cab618153187fe3d8aaee4c6fb61132ab8215742e5939633ab321fb937d4d33a85856271bdf465257aca9cbba1b52716f233c22202ecfbbb9c15b1f
|
||||
|
|
@ -1 +1 @@
|
|||
a97ae7049ac8c30b838987a3e87cbe5ff70b004ee0434e6204931def46c4c099bfef06e74658dab1114cc1035d3f404211a9bc94ef96e9cfb5b788da39d17bbd
|
||||
1e43a3ef68b15aededc0466c913d2f784d237adc88827a980a3dcdcfd64e9bb73679cc3114d69caf389f9c478c439a8771602c397461b90ae0db58a81bfb739a
|
||||
|
|
@ -1 +1 @@
|
|||
5a0461d03b0d9653ee35fded4be23e9b8316e3b7e21d352f822bc1f9763c03e9edab922bdc431f30d2a647c4216d45deba396bf56203027a328b7b28d970e0b8
|
||||
dc94fe38751001e3950450f8f6e7a865a42e699be76372ac7846da863283b6bb963c32b477ace4217be60e1f7a473e946d27238b3faf17d3b7426dbd1a34f9e6
|
||||
|
|
@ -1 +1 @@
|
|||
33b7b97f55a337d7001e7927517db6d36d512efec01fa5512c80bbc76b0b581f691a72a3810251aa97491b8cdf25a8ddcc9c9b3e3f54ccc6c315a84e715567d3
|
||||
bd5362b44190406434cdaa086b7e7397e8f6841b86ad61eda2c3f604df03746832dbcff0e8e96e355f5ba5b4333d6a336358379f8ced51f7a1721ceacb620daa
|
||||
|
|
@ -1 +1 @@
|
|||
b1a63345fc721f87c8fc25babb06741b585ee5dff5f29bb6debfbabb2ad57cb762d98c14e544df998a27bc725fb2704092fcdde54315ff832dff96c3641551d0
|
||||
7909822f2ad84443506129719c664b71ac0eac875a7c234be42c553564435794b6028078b096b21e9fb5dad650495b84f2b53decf73e277c84a3ea52799c008e
|
||||
|
|
@ -1 +1 @@
|
|||
ba1010f940c50314d61aae9f729b7bb476a6b35c5556fbc689ba3fde70ff50b0ba5dad0db3b38349a1562d67817047090ac450a64d895c8f3393163fe7914763
|
||||
4eee301ac8b984041ded725f1b031602e823edec1dd0883481fba794d6301eb5b83a0e87cf77b1298901de518c783ee5a017a91b5ac962ab0db8b37bb9918053
|
||||
|
|
@ -1 +1 @@
|
|||
57e4aa7550789aec0fcbc4a8917e9d28b1f1ae098a09cde95b757fd87d0dd3924c1bb9d4b23c59cd3793446fb6bbc8af4e1bb46323d70d5e5acd13db1167f545
|
||||
32c8c6625dbeecd8ed670871234a0aa9878a29cd86d93328151d90eda209bf70ee83901418cb29f7e8ef66d6f9bdc74a350f2340b285abc64d772baf02ed6377
|
||||
|
|
@ -1 +1 @@
|
|||
a42b2e165f59d3f499865d5db1e7db9b4cb25e48290f94080e569a9efc0b437d75cbb5773ac564f6cc95b19521fb7bc97a3eb641b491828c90cd086dc0c06a4b
|
||||
ef1c9dc1906068cb48427ffc8776d8b95810ca1aca4534692ab7f788d8dac84c5f4545c7edbd884b55fb3e2b35aa1f28b9277d359427fe89bed012b38bf6342e
|
||||
|
|
@ -1 +1 @@
|
|||
764d3ba6b1bc86b462d44151242bd18fa5f0200b831bb7537cf881b728622799eb95a457f88a503487bfd30095c1fa995818d50a6bc41dd182009772c010e82b
|
||||
2ec83c8c9175d4fccd6421ef736cced51f90bf01f7e20992a0d1b49db04221132d483032467c9dcda5f562f10a67f5fde1967a025230e4ea2bf9668816881d21
|
||||
|
|
@ -1 +1 @@
|
|||
17541e365f35ebd25134465a02d9a66e46536c4e3f5769da62137ec94ee7c8fb46ef38b9039aa6430261329a4e1b0ce677174323563e5be2f1368dc0c552e312
|
||||
b304e586966abb31fbe625a7a48547e51ea563061928c61bc8bbec01df94b4a61b8c874dd4b5cac86a74508e81dd3f7dd8d801fcc4fe75ded5eeb3f73cf113a2
|
||||
|
|
@ -1 +1 @@
|
|||
8ae1b048b90a049d9ed42336a0a2e8f7a250a14d889cc15e0c2831ed71617a78b92570480a15f936f2dd623c75f55693e38c69041c3cae24aba082409b51bc9f
|
||||
9c3d305ad2c4ac642db896100805c32ce0cf0bbf89958718a30afde7e1dd1329fb7946c35fc628355d29270760e5f1c3700890dfba1afe8d31f4deab63de86ff
|
||||
|
|
@ -1 +1 @@
|
|||
205e5cac8129797b815f0e79dad6c41a1876157ba69fcffecf67c3603dc36ded5f0168f9961d51fcb7dc7db6d732e7a3e8f82d04947aa0309df56bb8333d4bc9
|
||||
c483f62afa60f7390bbd82d7372a1f629f6783f8fb85857c63a3912e8d980118eff38f356b53312d067daa0f190634ac89bebac19cfe15325fb2b440473addae
|
||||
|
|
@ -1 +1 @@
|
|||
b5baba05419ce120bd22d935af9cdd6d206ad5dc5cae5991a9d160c70bb029f2d87040fa4e19f7190de64b908ac6a41a8b28db4a4f3883ec16e529b1449e983d
|
||||
b3e7dc8968d814e455866532c05702196bab7dbdaca3c6cd3eb4f22243efb67755b373a7c54de7d767c6f3e0c4b5db612c345832c8f07cd1f50bc08fc841b3b8
|
||||
|
|
@ -1 +1 @@
|
|||
a153add0502ff0fd4b0670f01679e104be1bb05941e73fb35e426c7f1e41a6144c7eb81fdba0d62ea3f39c7c6798028ff6d5df8c7a50b3e3f9e9bfe72fd48c2f
|
||||
fae463e84fbb166a9ec03390824e359d162fae9f8556d44681c76907c22a0d48e69281dcce6ffd7f3d6e4b19dad3d705c516328d902878288300f87c4a72a671
|
||||
|
|
@ -1 +1 @@
|
|||
fe56d58827d1803c1a49391711ad682be4a7cbc51519248812554f66e3e46266edc179f4254291a5f455751d3cdc13a17bbd103b9810c8818f36e4d283b503be
|
||||
2d2e8de66740bbed327dd926f59d75120b04d30ffb9d7c96876ba21c7768c367c63e3624c3ee40553dc40d9a5379fa0052a932a6c5f45d1ad4327c4ac83cdff2
|
||||
|
|
@ -1 +1 @@
|
|||
d80a9e8befab978bc84a231437a2b96c8f6dba81984c9e82a79360feb26bc9875b661131dbaa2deeb66b0aa50a39b2e738303bc40c5c65ee1995cf52f687ae46
|
||||
8dd146ebd2008801a4c83470e8d9fcc8d39fe5e687c65f980eca209dd5f7fb8d17bfadf3bf3d452eaa564ee5f35a8fc97adc3dda44160d6ad574b784f2dd0030
|
||||
|
|
@ -1 +1 @@
|
|||
8813917cab656135c4eebfdbe5f0d95e6a9409a2b36df1dfb483bdd193a3c0978727918a58399b259b82a7d51ae3f1801148bd978603fec11f27acdbf89520e2
|
||||
7bf8aa36c31ca8b34f7c410901cb96e1ba7d389c33c850591519b15753c1322b75e5051c960dbc2e254cf46cc9720dd5e348aac0acbb70d10c71165e2f5ab9e4
|
||||
|
|
@ -1 +1 @@
|
|||
4dbbd9cec921d2420e7567533c833afbe94335073aa760d1fd937adb695191b3ab7c070ec0d32721dddb4a46054e68322cf6a058420e20e439eb1d44f09f4be4
|
||||
3c05a49f78866eda267c9f8eab2669a3a1aeb4eabfade9697d551b13f482d9076190c63a52a8aade59c20d917cebdd3e9bedabda6bc5bfd549db43cc61d7466f
|
||||
1
tests/test_source/inputs_true.dat
Normal file
1
tests/test_source/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
5c2fdde85affcd44c1b02c07c300acb8e5c189c1adbf7aa079e37a68e8b8313678fc292bd7f6e0d0957f723e05b8146bd165cf3315dde5f6b2f88ebc954cd65e
|
||||
2
tests/test_source/results_true.dat
Normal file
2
tests/test_source/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
3.014392E-01 7.185055E-03
|
||||
73
tests/test_source/test_source.py
Normal file
73
tests/test_source/test_source.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from math import pi
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
import openmc.stats
|
||||
from openmc.source import Source
|
||||
|
||||
|
||||
class SourceTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
mat1 = openmc.Material(material_id=1)
|
||||
mat1.set_density('g/cm3', 4.5)
|
||||
mat1.add_nuclide(openmc.Nuclide('U-235', '71c'), 1.0)
|
||||
materials = openmc.MaterialsFile()
|
||||
materials.add_material(mat1)
|
||||
materials.export_to_xml()
|
||||
|
||||
sphere = openmc.Sphere(surface_id=1, R=10.0, boundary_type='vacuum')
|
||||
inside_sphere = openmc.Cell(cell_id=1)
|
||||
inside_sphere.region = -sphere
|
||||
inside_sphere.fill = mat1
|
||||
|
||||
root = openmc.Universe(universe_id=0)
|
||||
root.add_cell(inside_sphere)
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
geometry_xml = openmc.GeometryFile()
|
||||
geometry_xml.geometry = geometry
|
||||
geometry_xml.export_to_xml()
|
||||
|
||||
# Create an array of different sources
|
||||
x_dist = openmc.stats.Uniform(-3., 3.)
|
||||
y_dist = openmc.stats.Discrete([-4., -1., 3.], [0.2, 0.3, 0.5])
|
||||
z_dist = openmc.stats.Tabular([-2., 0., 2.], [0.2, 0.3, 0.2])
|
||||
spatial1 = openmc.stats.CartesianIndependent(x_dist, y_dist, z_dist)
|
||||
spatial2 = openmc.stats.Box([-4., -4., -4.], [4., 4., 4.])
|
||||
spatial3 = openmc.stats.Point([1.2, -2.3, 0.781])
|
||||
|
||||
mu_dist = openmc.stats.Discrete([-1., 0., 1.], [0.5, 0.25, 0.25])
|
||||
phi_dist = openmc.stats.Uniform(0., 6.28318530718)
|
||||
angle1 = openmc.stats.PolarAzimuthal(mu_dist, phi_dist)
|
||||
angle2 = openmc.stats.Monodirectional(reference_uvw=[0., 1., 0.])
|
||||
angle3 = openmc.stats.Isotropic()
|
||||
|
||||
E = np.logspace(-6, 1)
|
||||
p = np.sin(np.linspace(0., pi))
|
||||
p /= sum(np.diff(E)*p[:-1])
|
||||
energy1 = openmc.stats.Maxwell(1.2895)
|
||||
energy2 = openmc.stats.Watt(0.988, 2.249)
|
||||
energy3 = openmc.stats.Tabular(E, p, interpolation='histogram')
|
||||
|
||||
source1 = Source(spatial1, angle1, energy1, strength=0.5)
|
||||
source2 = Source(spatial2, angle2, energy2, strength=0.3)
|
||||
source3 = Source(spatial3, angle3, energy3, strength=0.2)
|
||||
|
||||
settings = openmc.SettingsFile()
|
||||
settings.batches = 10
|
||||
settings.inactive = 5
|
||||
settings.particles = 1000
|
||||
settings.source = [source1, source2, source3]
|
||||
settings.export_to_xml()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = SourceTestHarness('statepoint.10.h5')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
2.964943E-01 1.201478E-02
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<angle type="monodirectional" parameters="1 0 0" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
2.886671E-01 7.534631E-03
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<energy type="maxwell" parameters="1.2895" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
3.002731E-01 7.561170E-03
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="box" parameters="-4 -4 -4 4 4 4" />
|
||||
<energy type="monoenergetic" parameters="0.0253e-6" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<geometry>
|
||||
|
||||
<!-- Sphere with radius 10 -->
|
||||
<surface id="1" type="sphere" coeffs="0 0 0 10" boundary="vacuum"/>
|
||||
<cell id="1" material="1" region="-1" />
|
||||
|
||||
</geometry>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
|
||||
<material id="1">
|
||||
<density value="4.5" units="g/cc" />
|
||||
<nuclide name="U-235" xs="71c" ao="1.0" />
|
||||
</material>
|
||||
|
||||
</materials>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
3.041148E-01 4.558319E-03
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
|
||||
<eigenvalue>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<particles>1000</particles>
|
||||
</eigenvalue>
|
||||
|
||||
<source>
|
||||
<space type="point" parameters="1.2 -2.3 0.781" />
|
||||
</source>
|
||||
|
||||
</settings>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TestHarness('statepoint.10.*')
|
||||
harness.main()
|
||||
|
|
@ -8,10 +8,7 @@ from testing_harness import TestHarness
|
|||
|
||||
class StatepointTestHarness(TestHarness):
|
||||
def __init__(self):
|
||||
self._sp_name = None
|
||||
self._tallies = False
|
||||
self._opts = None
|
||||
self._args = None
|
||||
super(StatepointTestHarness, self).__init__(None, False)
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint files have been created."""
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ from testing_harness import TestHarness
|
|||
|
||||
class StatepointTestHarness(TestHarness):
|
||||
def __init__(self):
|
||||
self._sp_name = None
|
||||
self._tallies = False
|
||||
self._opts = None
|
||||
self._args = None
|
||||
super(StatepointTestHarness, self).__init__(None, False)
|
||||
|
||||
def _test_output_created(self):
|
||||
"""Make sure statepoint files have been created."""
|
||||
|
|
|
|||
1
tests/test_tally_aggregation/inputs_true.dat
Normal file
1
tests/test_tally_aggregation/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
530a5e969901e153531f74aed46246b1e8783a0e2f347e472f7554c9970152f45d85499f17d7df9c35c74fed6f78d449aa70bf0c1f8947cd34d3a829483a0055
|
||||
1
tests/test_tally_aggregation/results_true.dat
Normal file
1
tests/test_tally_aggregation/results_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
ba8bfe764fcc0484a4fdab8fdc4ff8ad0e4a98b1ff33e8687899c8cc6bf80cb28b3a59aeaec84bd74681b8b5f19f714292ccaa9c9d4ba852b2cc29872f612e10
|
||||
99
tests/test_tally_aggregation/test_tally_aggregation.py
Normal file
99
tests/test_tally_aggregation/test_tally_aggregation.py
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
|
||||
class TallyAggregationTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
||||
# The summary.h5 file needs to be created to read in the tallies
|
||||
self._input_set.settings.output = {'summary': True}
|
||||
|
||||
# Initialize the tallies file
|
||||
tallies_file = openmc.TalliesFile()
|
||||
|
||||
# Initialize the nuclides
|
||||
u235 = openmc.Nuclide('U-235')
|
||||
u238 = openmc.Nuclide('U-238')
|
||||
pu239 = openmc.Nuclide('Pu-239')
|
||||
|
||||
# Initialize the filters
|
||||
energy_filter = openmc.Filter(type='energy', bins=[0.0, 0.253e-6,
|
||||
1.0e-3, 1.0, 20.0])
|
||||
distrib_filter = openmc.Filter(type='distribcell', bins=[60])
|
||||
|
||||
# Initialized the tallies
|
||||
tally = openmc.Tally(name='distribcell tally')
|
||||
tally.add_filter(energy_filter)
|
||||
tally.add_filter(distrib_filter)
|
||||
tally.add_score('nu-fission')
|
||||
tally.add_score('total')
|
||||
tally.add_nuclide(u235)
|
||||
tally.add_nuclide(u238)
|
||||
tally.add_nuclide(pu239)
|
||||
tallies_file.add_tally(tally)
|
||||
|
||||
# Export tallies to file
|
||||
self._input_set.tallies = tallies_file
|
||||
super(TallyAggregationTestHarness, self)._build_inputs()
|
||||
|
||||
def _get_results(self, hash_output=True):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
|
||||
# Read the summary file.
|
||||
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
|
||||
su = openmc.Summary(summary)
|
||||
sp.link_with_summary(su)
|
||||
|
||||
# Extract the tally of interest
|
||||
tally = sp.get_tally(name='distribcell tally')
|
||||
|
||||
# Perform tally aggregations across filter bins, nuclides and scores
|
||||
outstr = ''
|
||||
|
||||
# Sum across all energy filter bins
|
||||
tally_sum = tally.summation(filter_type='energy')
|
||||
outstr += ', '.join(map(str, tally_sum.mean))
|
||||
outstr += ', '.join(map(str, tally_sum.std_dev))
|
||||
|
||||
# Sum across all distribcell filter bins
|
||||
tally_sum = tally.summation(filter_type='distribcell')
|
||||
outstr += ', '.join(map(str, tally_sum.mean))
|
||||
outstr += ', '.join(map(str, tally_sum.std_dev))
|
||||
|
||||
# Sum across all nuclides
|
||||
tally_sum = tally.summation(nuclides=['U-235', 'U-238', 'Pu-239'])
|
||||
outstr += ', '.join(map(str, tally_sum.mean))
|
||||
outstr += ', '.join(map(str, tally_sum.std_dev))
|
||||
|
||||
# Sum across all scores
|
||||
tally_sum = tally.summation(scores=['nu-fission', 'total'])
|
||||
outstr += ', '.join(map(str, tally_sum.mean))
|
||||
outstr += ', '.join(map(str, tally_sum.std_dev))
|
||||
|
||||
# Hash the results if necessary
|
||||
if hash_output:
|
||||
sha512 = hashlib.sha512()
|
||||
sha512.update(outstr.encode('utf-8'))
|
||||
outstr = sha512.hexdigest()
|
||||
|
||||
return outstr
|
||||
|
||||
def _cleanup(self):
|
||||
super(TallyAggregationTestHarness, self)._cleanup()
|
||||
f = os.path.join(os.getcwd(), 'tallies.xml')
|
||||
if os.path.exists(f): os.remove(f)
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TallyAggregationTestHarness('statepoint.10.h5', True)
|
||||
harness.main()
|
||||
1
tests/test_tally_arithmetic/inputs_true.dat
Normal file
1
tests/test_tally_arithmetic/inputs_true.dat
Normal file
|
|
@ -0,0 +1 @@
|
|||
57384883e37964076aa82c19fa542434331cdb09735d710485b5aa0ca3445d543729e40cb9c7b6a70e7101ef186923eb1ff6315c73b01ff257052838add68fc7
|
||||
134
tests/test_tally_arithmetic/results_true.dat
Normal file
134
tests/test_tally_arithmetic/results_true.dat
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
[[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
...,
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]][[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
[[ 8.90240785e-05 8.31464209e-11 4.41507090e-05 4.12357364e-11]
|
||||
[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 4.69276830e-05 4.38293656e-11 2.35903380e-05 2.20328275e-11]
|
||||
[ 3.84607356e-05 3.15690405e-05 1.93340411e-05 1.58696166e-05]]
|
||||
|
||||
...,
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]][[[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 7.29618709e-05 5.98879928e-05 3.61847984e-05 2.97009235e-05]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
...,
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00]]][[[ 0.00000000e+00 4.41507090e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 2.35903380e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 1.93340411e-05 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 4.41507090e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 2.35903380e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 1.93340411e-05 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 4.41507090e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 2.35903380e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 1.93340411e-05 0.00000000e+00]]
|
||||
|
||||
...,
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]][[[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 3.61847984e-05 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
...,
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]
|
||||
|
||||
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]]]
|
||||
118
tests/test_tally_arithmetic/test_tally_arithmetic.py
Normal file
118
tests/test_tally_arithmetic/test_tally_arithmetic.py
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import hashlib
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
import openmc
|
||||
|
||||
|
||||
class TallyArithmeticTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
|
||||
# The summary.h5 file needs to be created to read in the tallies
|
||||
self._input_set.settings.output = {'summary': True}
|
||||
|
||||
# Initialize the tallies file
|
||||
tallies_file = openmc.TalliesFile()
|
||||
|
||||
# Initialize the nuclides
|
||||
u235 = openmc.Nuclide('U-235')
|
||||
u238 = openmc.Nuclide('U-238')
|
||||
pu239 = openmc.Nuclide('Pu-239')
|
||||
|
||||
# Initialize Mesh
|
||||
mesh = openmc.Mesh(mesh_id=1)
|
||||
mesh.type = 'regular'
|
||||
mesh.dimension = [2, 2, 2]
|
||||
mesh.lower_left = [-160.0, -160.0, -183.0]
|
||||
mesh.upper_right = [160.0, 160.0, 183.0]
|
||||
|
||||
# Initialize the filters
|
||||
energy_filter = openmc.Filter(type='energy', bins=(0.0, 0.253e-6,
|
||||
1.0e-3, 1.0, 20.0))
|
||||
material_filter = openmc.Filter(type='material', bins=(1, 3))
|
||||
distrib_filter = openmc.Filter(type='distribcell', bins=(60))
|
||||
mesh_filter = openmc.Filter(type='mesh')
|
||||
mesh_filter.mesh = mesh
|
||||
|
||||
# Initialized the tallies
|
||||
tally = openmc.Tally(name='tally 1')
|
||||
tally.add_filter(material_filter)
|
||||
tally.add_filter(energy_filter)
|
||||
tally.add_filter(distrib_filter)
|
||||
tally.add_score('nu-fission')
|
||||
tally.add_score('total')
|
||||
tally.add_nuclide(u235)
|
||||
tally.add_nuclide(pu239)
|
||||
tallies_file.add_tally(tally)
|
||||
|
||||
tally = openmc.Tally(name='tally 2')
|
||||
tally.add_filter(energy_filter)
|
||||
tally.add_filter(mesh_filter)
|
||||
tally.add_score('total')
|
||||
tally.add_score('fission')
|
||||
tally.add_nuclide(u238)
|
||||
tally.add_nuclide(u235)
|
||||
tallies_file.add_tally(tally)
|
||||
tallies_file.add_mesh(mesh)
|
||||
|
||||
# Export tallies to file
|
||||
self._input_set.tallies = tallies_file
|
||||
super(TallyArithmeticTestHarness, self)._build_inputs()
|
||||
|
||||
def _get_results(self, hash_output=False):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
|
||||
# Read the statepoint file.
|
||||
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
|
||||
sp = openmc.StatePoint(statepoint)
|
||||
|
||||
# Read the summary file.
|
||||
summary = glob.glob(os.path.join(os.getcwd(), 'summary.h5'))[0]
|
||||
su = openmc.Summary(summary)
|
||||
sp.link_with_summary(su)
|
||||
|
||||
# Load the tallies
|
||||
tally_1 = sp.get_tally(name='tally 1')
|
||||
tally_2 = sp.get_tally(name='tally 2')
|
||||
|
||||
# Perform all the tally arithmetic operations and output results
|
||||
outstr = ''
|
||||
tally_3 = tally_1 * tally_2
|
||||
outstr += str(tally_3.mean)
|
||||
|
||||
tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'tensor',
|
||||
'tensor')
|
||||
outstr += str(tally_3.mean)
|
||||
|
||||
tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'entrywise',
|
||||
'tensor')
|
||||
outstr += str(tally_3.mean)
|
||||
|
||||
tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'tensor',
|
||||
'entrywise')
|
||||
outstr += str(tally_3.mean)
|
||||
|
||||
tally_3 = tally_1.hybrid_product(tally_2, '*', 'entrywise', 'entrywise',
|
||||
'entrywise')
|
||||
outstr += str(tally_3.mean)
|
||||
|
||||
# Hash the results if necessary
|
||||
if hash_output:
|
||||
sha512 = hashlib.sha512()
|
||||
sha512.update(outstr.encode('utf-8'))
|
||||
outstr = sha512.hexdigest()
|
||||
|
||||
return outstr
|
||||
|
||||
def _cleanup(self):
|
||||
super(TallyArithmeticTestHarness, self)._cleanup()
|
||||
f = os.path.join(os.getcwd(), 'tallies.xml')
|
||||
if os.path.exists(f): os.remove(f)
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = TallyArithmeticTestHarness('statepoint.10.h5', True)
|
||||
harness.main()
|
||||
|
|
@ -23,12 +23,18 @@ class TestHarness(object):
|
|||
def __init__(self, statepoint_name, tallies_present=False):
|
||||
self._sp_name = statepoint_name
|
||||
self._tallies = tallies_present
|
||||
self.parser = OptionParser()
|
||||
self.parser.add_option('--exe', dest='exe', default='openmc')
|
||||
self.parser.add_option('--mpi_exec', dest='mpi_exec', default=None)
|
||||
self.parser.add_option('--mpi_np', dest='mpi_np', type=int, default=3)
|
||||
self.parser.add_option('--update', dest='update', action='store_true',
|
||||
default=False)
|
||||
self._opts = None
|
||||
self._args = None
|
||||
|
||||
def main(self):
|
||||
"""Accept commandline arguments and either run or update tests."""
|
||||
self._parse_args()
|
||||
(self._opts, self._args) = self.parser.parse_args()
|
||||
if self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
|
|
@ -56,15 +62,6 @@ class TestHarness(object):
|
|||
finally:
|
||||
self._cleanup()
|
||||
|
||||
def _parse_args(self):
|
||||
parser = OptionParser()
|
||||
parser.add_option('--exe', dest='exe', default='openmc')
|
||||
parser.add_option('--mpi_exec', dest='mpi_exec', default=None)
|
||||
parser.add_option('--mpi_np', dest='mpi_np', type=int, default=3)
|
||||
parser.add_option('--update', dest='update', action='store_true',
|
||||
default=False)
|
||||
(self._opts, self._args) = parser.parse_args()
|
||||
|
||||
def _run_openmc(self):
|
||||
executor = Executor()
|
||||
|
||||
|
|
@ -152,15 +149,14 @@ class HashedTestHarness(TestHarness):
|
|||
"""Specialized TestHarness that hashes the results."""
|
||||
def _get_results(self):
|
||||
"""Digest info in the statepoint and return as a string."""
|
||||
return TestHarness._get_results(self, True)
|
||||
return super(HashedTestHarness, self)._get_results(True)
|
||||
|
||||
|
||||
class PlotTestHarness(TestHarness):
|
||||
"""Specialized TestHarness for running OpenMC plotting tests."""
|
||||
def __init__(self, plot_names):
|
||||
super(PlotTestHarness, self).__init__(None, False)
|
||||
self._plot_names = plot_names
|
||||
self._opts = None
|
||||
self._args = None
|
||||
|
||||
def _run_openmc(self):
|
||||
executor = Executor()
|
||||
|
|
@ -174,7 +170,7 @@ class PlotTestHarness(TestHarness):
|
|||
'Plot output file does not exist.'
|
||||
|
||||
def _cleanup(self):
|
||||
TestHarness._cleanup(self)
|
||||
super(PlotTestHarness, self)._cleanup()
|
||||
output = glob.glob(os.path.join(os.getcwd(), '*.ppm'))
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
|
|
@ -208,7 +204,7 @@ class CMFDTestHarness(TestHarness):
|
|||
sp = StatePoint(statepoint)
|
||||
|
||||
# Write out the eigenvalue and tallies.
|
||||
outstr = TestHarness._get_results(self)
|
||||
outstr = super(CMFDTestHarness, self)._get_results()
|
||||
|
||||
# Write out CMFD data.
|
||||
outstr += 'cmfd indices\n'
|
||||
|
|
@ -274,9 +270,21 @@ class ParticleRestartTestHarness(TestHarness):
|
|||
|
||||
class PyAPITestHarness(TestHarness):
|
||||
def __init__(self, statepoint_name, tallies_present=False):
|
||||
TestHarness.__init__(self, statepoint_name, tallies_present)
|
||||
super(PyAPITestHarness, self).__init__(statepoint_name, tallies_present)
|
||||
self.parser.add_option('--build-inputs', dest='build_only',
|
||||
action='store_true', default=False)
|
||||
self._input_set = InputSet()
|
||||
|
||||
def main(self):
|
||||
"""Accept commandline arguments and either run or update tests."""
|
||||
(self._opts, self._args) = self.parser.parse_args()
|
||||
if self._opts.build_only:
|
||||
self._build_inputs()
|
||||
elif self._opts.update:
|
||||
self.update_results()
|
||||
else:
|
||||
self.execute_test()
|
||||
|
||||
def execute_test(self):
|
||||
"""Build input XMLs, run OpenMC, and verify correct results."""
|
||||
try:
|
||||
|
|
@ -315,7 +323,8 @@ class PyAPITestHarness(TestHarness):
|
|||
|
||||
def _get_inputs(self):
|
||||
"""Return a hash digest of the input XML files."""
|
||||
xmls = ('geometry.xml', 'tallies.xml', 'materials.xml', 'settings.xml')
|
||||
xmls = ('geometry.xml', 'tallies.xml', 'materials.xml', 'settings.xml',
|
||||
'plots.xml')
|
||||
xmls = [os.path.join(os.getcwd(), fname) for fname in xmls]
|
||||
outstr = '\n'.join([open(fname).read() for fname in xmls
|
||||
if os.path.exists(fname)])
|
||||
|
|
@ -347,7 +356,7 @@ class PyAPITestHarness(TestHarness):
|
|||
|
||||
def _cleanup(self):
|
||||
"""Delete XMLs, statepoints, tally, and test files."""
|
||||
TestHarness._cleanup(self)
|
||||
super(PyAPITestHarness, self)._cleanup()
|
||||
output = [os.path.join(os.getcwd(), 'materials.xml')]
|
||||
output.append(os.path.join(os.getcwd(), 'geometry.xml'))
|
||||
output.append(os.path.join(os.getcwd(), 'settings.xml'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue