From d4d8e63475ac95ddec2ba990bda82243818ab6e9 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Wed, 3 Feb 2016 23:10:44 -0500 Subject: [PATCH] Update multipole docs and add a test --- docs/source/usersguide/input.rst | 9 ++ docs/source/usersguide/output/summary.rst | 4 + src/relaxng/geometry.rnc | 2 + src/relaxng/geometry.rng | 18 +++ tests/test_multipole/inputs_true.dat | 1 + tests/test_multipole/results_true.dat | 12 ++ tests/test_multipole/test_multipole.py | 133 ++++++++++++++++++++++ 7 files changed, 179 insertions(+) create mode 100644 tests/test_multipole/inputs_true.dat create mode 100644 tests/test_multipole/results_true.dat create mode 100644 tests/test_multipole/test_multipole.py diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 30e9ed07b9..0f9a3be18a 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -987,6 +987,15 @@ Each ```` element can have the following attributes or sub-elements: *Default*: A region filling all space. + :temperature: + The temperature of the cell in Kelvin. If windowed-multipole data is + avalable, this temperature will be used to Doppler broaden some cross + sections in the resolved resonance region. A list of temperatures can be + specified for the "distributed temperature" feature. This will give each + unique instance of the cell its own temperature. + + *Default*: The temperature of the coldest nuclide in the cell's material(s) + :rotation: If the cell is filled with a universe, this element specifies the angles in degrees about the x, y, and z axes that the filled universe should be diff --git a/docs/source/usersguide/output/summary.rst b/docs/source/usersguide/output/summary.rst index 83602e5065..3be0cfdfe9 100644 --- a/docs/source/usersguide/output/summary.rst +++ b/docs/source/usersguide/output/summary.rst @@ -98,6 +98,10 @@ The current revision of the summary file format is 1. material. The data is an array if the cell uses distributed materials, otherwise it is a scalar. +**/geometry/cells/cell /temperature** (*double[]*) + + Temperature of the cell in Kelvin. + **/geometry/cells/cell /offset** (*int[]*) Offsets used for distribcell tally filter. This dataset is present only if diff --git a/src/relaxng/geometry.rnc b/src/relaxng/geometry.rnc index 8d25789f5a..1bca009a61 100644 --- a/src/relaxng/geometry.rnc +++ b/src/relaxng/geometry.rnc @@ -9,6 +9,8 @@ element geometry { (element material { ( xsd:int | "void" )+ } | attribute material { ( xsd:int | "void" )+ }) ) & + (element temperature { list { xsd:double+ } } | + attribute temperature { list { xsd:double+ } } )? & (element region { xsd:string } | attribute region { xsd:string })? & (element rotation { list { xsd:double+ } } | attribute rotation { list { xsd:double+ } })? & (element translation { list { xsd:double+ } } | attribute translation { list { xsd:double+ } })? diff --git a/src/relaxng/geometry.rng b/src/relaxng/geometry.rng index d40401b281..ba8eab73d3 100644 --- a/src/relaxng/geometry.rng +++ b/src/relaxng/geometry.rng @@ -64,6 +64,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/test_multipole/inputs_true.dat b/tests/test_multipole/inputs_true.dat new file mode 100644 index 0000000000..a429c9b8d0 --- /dev/null +++ b/tests/test_multipole/inputs_true.dat @@ -0,0 +1 @@ +5c1cec635da5c4c869bdf58f62924a4cb1648e4ddecf0ce71b823cf45178767ba7f2e089b76d36e8616b1b21ffa43b32ab1b17d20bb74120f900b9e3e9ab9bcc \ No newline at end of file diff --git a/tests/test_multipole/results_true.dat b/tests/test_multipole/results_true.dat new file mode 100644 index 0000000000..19dd4d26b7 --- /dev/null +++ b/tests/test_multipole/results_true.dat @@ -0,0 +1,12 @@ +k-combined: +1.445285E+00 9.521660E-03 +Cell + ID = 11 + Name = + Material = 2 + Region = -10000 + Temperature = [ 500. 0. 700. 800.] + Rotation = None + Translation = None + Offset = None + Distribcell index= 1 diff --git a/tests/test_multipole/test_multipole.py b/tests/test_multipole/test_multipole.py new file mode 100644 index 0000000000..a5437e433a --- /dev/null +++ b/tests/test_multipole/test_multipole.py @@ -0,0 +1,133 @@ +#!/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) + + mats_file = openmc.MaterialsFile() + mats_file.default_xs = '71c' + mats_file.add_materials([moderator, dense_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 + c11.temperature = [500, 0, 700, 800] + 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()