diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index fad9574ab3..8df3bbc2ea 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1266,58 +1266,65 @@ The ```` element accepts the following sub-elements: :mu: A monotonically increasing list of bounding **post-collision** - cosines of the change in a particle's angle (i.e., :math:`\mu`), - which represents a portion of the possible values of :math:`\[-1,1\]`. - For example, spanning all of :math:`\[-1,1\]` with five equi-width + cosines of the change in a particle's angle (i.e., + :math:`\mu = \cos(\Omega \cdot \Omega')`), + which represents a portion of the possible values of :math:`[-1,1]`. + For example, spanning all of :math:`[-1,1]` with five equi-width bins can be specified as: - .. code-block :: xml - ```` + .. code-block:: xml + + Alternatively, if only one value is provided as a bin, OpenMC will - interpret this to mean the complete range of :math:`\[-1,1\]` should + interpret this to mean the complete range of :math:`[-1,1]` should be automatically subdivided in to the provided value for the bin. That is, the above example of five equi-width bins spanning - :math:`\[-1,1\]` can be instead written as: + :math:`[-1,1]` can be instead written as: - .. code-block :: xml - ````. + .. code-block:: xml + + :polar: A monotonically increasing list of bounding particle polar angles - which represents a portion of the possible values of :math:`\[0,\pi\]`. - For example, spanning all of :math:`\[0,\pi\]` with five equi-width + which represents a portion of the possible values of :math:`[0,\pi]`. + For example, spanning all of :math:`[0,\pi]` with five equi-width bins can be specified as: - .. code-block :: xml - ```` + .. code-block:: xml + + Alternatively, if only one value is provided as a bin, OpenMC will - interpret this to mean the complete range of :math:`\[0,\pi\]` should + interpret this to mean the complete range of :math:`[0,\pi]` should be automatically subdivided in to the provided value for the bin. That is, the above example of five equi-width bins spanning - :math:`\[0,\pi\]` can be instead written as: + :math:`[0,\pi]` can be instead written as: - .. code-block :: xml - ````. + .. code-block:: xml + + :azimuthal: A monotonically increasing list of bounding particle azimuthal angles - which represents a portion of the possible values of :math:`\[-\pi,\pi\)`. - For example, spanning all of :math:`\[-\pi,\pi\)` with two equi-width + which represents a portion of the possible values of :math:`[-\pi,\pi)`. + For example, spanning all of :math:`[-\pi,\pi)` with two equi-width bins can be specified as: - .. code-block :: xml - ```` + .. code-block:: xml + + Alternatively, if only one value is provided as a bin, OpenMC will - interpret this to mean the complete range of :math:`\[-\pi,\pi\)` should + interpret this to mean the complete range of :math:`[-\pi,\pi)` should be automatically subdivided in to the provided value for the bin. That is, the above example of five equi-width bins spanning - :math:`\[-\pi,\pi\)` can be instead written as: + :math:`[-\pi,\pi)` can be instead written as: - .. code-block :: xml - ````. + .. code-block:: xml + + :mesh: The ``id`` of a structured mesh to be tallied over. diff --git a/openmc/tallies.py b/openmc/tallies.py index 075125f4e6..a0f617d08c 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -1268,7 +1268,7 @@ class Tally(object): elif 'energy' in filter.type: bins = filter.bins - # Create strings for + # Create strings for dataFrame rows template = '{0:.1e} - {1:.1e}' filter_bins = [] for i in range(filter.num_bins): @@ -1284,13 +1284,13 @@ class Tally(object): elif filter.type in ['mu', 'polar', 'azimuthal']: bins = filter.bins - # Create strings for + # Create strings for dataFrame rows template = '{0:1.2f} - {1:1.2f}' filter_bins = [] for i in range(filter.num_bins): filter_bins.append(template.format(bins[i], bins[i+1])) - # Tile the mu bins into a DataFrame column + # Tile the bins into a DataFrame column filter_bins = np.repeat(filter_bins, filter.stride) tile_factor = data_size / len(filter_bins) filter_bins = np.tile(filter_bins, tile_factor) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 901123bf3f..14c2ea5c98 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2434,10 +2434,9 @@ contains ! Determine number of bins if (check_for_node(node_filt, "bins")) then - if ((temp_str == 'energy' .or. & - temp_str == 'energyout') .or. & - (temp_str == 'mu' .or. temp_str == 'polar') .or. & - (temp_str == 'azimuthal')) then + if (temp_str == 'energy' .or. temp_str == 'energyout' .or. & + temp_str == 'mu' .or. temp_str == 'polar' .or. & + temp_str == 'azimuthal') then n_words = get_arraysize_double(node_filt, "bins") else n_words = get_arraysize_integer(node_filt, "bins") @@ -2650,7 +2649,8 @@ contains call get_node_array(node_filt, "bins", t % filters(j) % real_bins) ! Allow a user to input a lone number which will mean that - ! you subivide [0,2pi] evenly with the input being the number of bins + ! you sub-divide [-pi,pi) evenly with the input being the number of + ! bins if (n_words == 1) then Nangle = int(t % filters(j) % real_bins(1)) if (Nangle > 1) then diff --git a/src/physics.F90 b/src/physics.F90 index da5763a034..889126d7d5 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -387,13 +387,6 @@ contains end if - ! ! Check p % mu to ensure it falls within the expected range - ! if (p % mu < -ONE) then - ! p % mu = -ONE - ! else if (p % mu > ONE) then - ! p % mu = ONE - ! end if - ! Set event component p % event = EVENT_SCATTER diff --git a/tests/test_filter_azimuthal/test_filter_azimuthal.py b/tests/test_filter_azimuthal/test_filter_azimuthal.py index f0fff52047..248ba00120 100644 --- a/tests/test_filter_azimuthal/test_filter_azimuthal.py +++ b/tests/test_filter_azimuthal/test_filter_azimuthal.py @@ -21,7 +21,7 @@ class FilterAzimuthalTestHarness(PyAPITestHarness): tally2.add_score('flux') tally2.estimator = 'analog' - filt3 = openmc.Filter(type='azimuthal', bins=(5)) + filt3 = openmc.Filter(type='azimuthal', bins=(5,)) tally3 = openmc.Tally(tally_id=3) tally3.add_filter(filt3) tally3.add_score('flux') @@ -31,7 +31,7 @@ class FilterAzimuthalTestHarness(PyAPITestHarness): mesh.lower_left = [-182.07, -182.07] mesh.upper_right = [182.07, 182.07] mesh.dimension = [2, 2] - filt_mesh = openmc.Filter(type='mesh', bins=(1)) + filt_mesh = openmc.Filter(type='mesh', bins=(1,)) tally4 = openmc.Tally(tally_id=4) tally4.add_filter(filt3) tally4.add_filter(filt_mesh) diff --git a/tests/test_filter_mu/test_filter_mu.py b/tests/test_filter_mu/test_filter_mu.py index cb9f9b86d8..f59f8c63fd 100644 --- a/tests/test_filter_mu/test_filter_mu.py +++ b/tests/test_filter_mu/test_filter_mu.py @@ -16,7 +16,7 @@ class FilterMuTestHarness(PyAPITestHarness): tally1.add_score('scatter') tally1.add_score('nu-scatter') - filt2 = openmc.Filter(type='mu', bins=(5)) + filt2 = openmc.Filter(type='mu', bins=(5,)) tally2 = openmc.Tally(tally_id=2) tally2.add_filter(filt2) tally2.add_score('scatter') @@ -26,7 +26,7 @@ class FilterMuTestHarness(PyAPITestHarness): mesh.lower_left = [-182.07, -182.07] mesh.upper_right = [182.07, 182.07] mesh.dimension = [2, 2] - filt_mesh = openmc.Filter(type='mesh', bins=(1)) + filt_mesh = openmc.Filter(type='mesh', bins=(1,)) tally3 = openmc.Tally(tally_id=3) tally3.add_filter(filt2) tally3.add_filter(filt_mesh) diff --git a/tests/test_filter_polar/test_filter_polar.py b/tests/test_filter_polar/test_filter_polar.py index 74489a3498..db7ed4f6d8 100644 --- a/tests/test_filter_polar/test_filter_polar.py +++ b/tests/test_filter_polar/test_filter_polar.py @@ -21,7 +21,7 @@ class FilterPolarTestHarness(PyAPITestHarness): tally2.add_score('flux') tally2.estimator = 'analog' - filt3 = openmc.Filter(type='polar', bins=(5)) + filt3 = openmc.Filter(type='polar', bins=(5,)) tally3 = openmc.Tally(tally_id=3) tally3.add_filter(filt3) tally3.add_score('flux') @@ -31,7 +31,7 @@ class FilterPolarTestHarness(PyAPITestHarness): mesh.lower_left = [-182.07, -182.07] mesh.upper_right = [182.07, 182.07] mesh.dimension = [2, 2] - filt_mesh = openmc.Filter(type='mesh', bins=(1)) + filt_mesh = openmc.Filter(type='mesh', bins=(1,)) tally4 = openmc.Tally(tally_id=4) tally4.add_filter(filt3) tally4.add_filter(filt_mesh)