diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 0244b75fc..069d483e3 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1347,16 +1347,8 @@ The ```` element accepts the following sub-elements: then two energy bins will be created, one with energies between 0 and 1 MeV and the other with energies between 1 and 20 MeV. - In multi-group mode, however, the bounds of the filter are already - implied as being the same as the group boundaries of the problem. - Therefore no bins would be needed as they are implicitly applied by - the code. For example, the above filter example for continuous-energy - mode would look like the following for multi-group mode, but the - resultant tallies would still be done for every group in the library: - - .. code-block:: xml - - + In multi-group mode the bins provided must match group edges + defined in the multi-group library. :energyout: In continuous-energy mode, this filter should be provided as a @@ -1371,16 +1363,8 @@ The ```` element accepts the following sub-elements: energies between 0 and 1 MeV and the other with energies between 1 and 20 MeV. - In multi-group mode, however, the bounds of the filter are already - implied as being the same as the group boundaries of the problem. - Therefore no bins would be needed as they are implicitly applied by - the code. For example, the above filter example for continuous-energy - mode would look like the following for multi-group mode, but the - resultant tallies would still be done for every group in the library: - - .. code-block:: xml - - + In multi-group mode the bins provided must match group edges + defined in the multi-group library. :mu: A monotonically increasing list of bounding **post-collision** cosines diff --git a/examples/python/pincell_multigroup/build-xml.py b/examples/python/pincell_multigroup/build-xml.py index 300f36ce0..bb4c2db14 100644 --- a/examples/python/pincell_multigroup/build-xml.py +++ b/examples/python/pincell_multigroup/build-xml.py @@ -163,10 +163,9 @@ mesh.lower_left = [-0.63, -0.63, -1.e50] mesh.upper_right = [0.63, 0.63, 1.e50] # 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]) -energy_filter = openmc.Filter(type='energy') +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]) mesh_filter = openmc.Filter() mesh_filter.mesh = mesh diff --git a/examples/xml/pincell_multigroup/tallies.xml b/examples/xml/pincell_multigroup/tallies.xml index ed9763be5..df65b461d 100644 --- a/examples/xml/pincell_multigroup/tallies.xml +++ b/examples/xml/pincell_multigroup/tallies.xml @@ -6,7 +6,7 @@ 0.63 0.63 1e+50 - + flux fission nu-fission diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 2cc829454..8e3e8d8e9 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2623,25 +2623,10 @@ contains if (temp_str == 'energy' .or. temp_str == 'energyout' .or. & temp_str == 'mu' .or. temp_str == 'polar' .or. & temp_str == 'azimuthal') then - ! If in MG mode, fail if user provides bins, as we are only - ! allowing for all groups - if (.not. run_CE .and. (temp_str == 'energy' .or. & - temp_str == 'energyout')) then - call fatal_error("No energy or energyout bins needed on tally " & - &// trim(to_str(t % id))) - else - n_words = get_arraysize_double(node_filt, "bins") - end if + n_words = get_arraysize_double(node_filt, "bins") else n_words = get_arraysize_integer(node_filt, "bins") end if - else if (.not. run_CE .and. (temp_str == 'energy' .or. & - temp_str == 'energyout')) then - ! For MG calculations, dont require the user to put in all the - ! group boundaries, as there could be many. Assume that if no & - ! bins are entered that that means they want group-wise results. - n_words = -1 - else call fatal_error("Bins not set in filter on tally " & &// trim(to_str(t % id))) @@ -2752,48 +2737,38 @@ contains ! Set type of filter t % filters(j) % type = FILTER_ENERGYIN - if (n_words > 0) then - ! Set number of bins - t % filters(j) % n_bins = n_words - 1 + ! Set number of bins + t % filters(j) % n_bins = n_words - 1 - ! Allocate and store bins - allocate(t % filters(j) % real_bins(n_words)) - call get_node_array(node_filt, "bins", t % filters(j) % real_bins) + ! Allocate and store bins + allocate(t % filters(j) % real_bins(n_words)) + call get_node_array(node_filt, "bins", t % filters(j) % real_bins) - if (.not. run_CE) t % energy_matches_groups = .false. - else if (n_words == -1) then - ! Set number of bins - t % filters(j) % n_bins = energy_groups - - ! Allocate and store bins - allocate(t % filters(j) % real_bins(energy_groups)) - t % filters(j) % real_bins = energy_bins - - if (.not. run_CE) t % energy_matches_groups = .true. + if (.not. run_CE) then + if (n_words /= energy_groups + 1) then + t % energy_matches_groups = .false. + else if (all(t % filters(j) % real_bins == energy_bins)) then + t % energy_matches_groups = .false. + end if end if case ('energyout') ! Set type of filter t % filters(j) % type = FILTER_ENERGYOUT - if (n_words > 0) then - ! Set number of bins - t % filters(j) % n_bins = n_words - 1 + ! Set number of bins + t % filters(j) % n_bins = n_words - 1 - ! Allocate and store bins - allocate(t % filters(j) % real_bins(n_words)) - call get_node_array(node_filt, "bins", t % filters(j) % real_bins) + ! Allocate and store bins + allocate(t % filters(j) % real_bins(n_words)) + call get_node_array(node_filt, "bins", t % filters(j) % real_bins) - if (.not. run_CE) t % energyout_matches_groups = .false. - else if (n_words == -1) then - ! Set number of bins - t % filters(j) % n_bins = energy_groups - - ! Allocate and store bins - allocate(t % filters(j) % real_bins(energy_groups)) - t % filters(j) % real_bins = energy_bins - - if (.not. run_CE) t % energyout_matches_groups = .true. + if (.not. run_CE) then + if (n_words /= energy_groups + 1) then + t % energy_matches_groups = .false. + else if (all(t % filters(j) % real_bins == energy_bins)) then + t % energy_matches_groups = .false. + end if end if ! Set to analog estimator diff --git a/src/relaxng/tallies.rnc b/src/relaxng/tallies.rnc index 9efb6c4e2..75afb0f23 100644 --- a/src/relaxng/tallies.rnc +++ b/src/relaxng/tallies.rnc @@ -27,7 +27,7 @@ element tallies { "polar" | "azimuthal" | "delayedgroup") } | attribute type { ( "cell" | "cellborn" | "material" | "universe" | "surface" | "distribcell" | "mesh" | "energy" | "energyout" | "mu" | - "polar" | "azimuthal" | "delayedgroup") })? & + "polar" | "azimuthal" | "delayedgroup") }) & (element bins { list { xsd:double+ } } | attribute bins { list { xsd:double+ } }) }* & diff --git a/src/relaxng/tallies.rng b/src/relaxng/tallies.rng index 8798efca3..ef55d21e4 100644 --- a/src/relaxng/tallies.rng +++ b/src/relaxng/tallies.rng @@ -133,44 +133,42 @@ - - - - - cell - cellborn - material - universe - surface - distribcell - mesh - energy - energyout - mu - polar - azimuthal - delayedgroup - - - - - cell - cellborn - material - universe - surface - distribcell - mesh - energy - energyout - mu - polar - azimuthal - delayedgroup - - - - + + + + cell + cellborn + material + universe + surface + distribcell + mesh + energy + energyout + mu + polar + azimuthal + delayedgroup + + + + + cell + cellborn + material + universe + surface + distribcell + mesh + energy + energyout + mu + polar + azimuthal + delayedgroup + + +