From a64255bdc8d71e2d6118e5e2b55f22a155bb75b4 Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Tue, 25 Aug 2015 20:03:19 -0400 Subject: [PATCH] Cleaned up automatic binning code for mu filters and updated documentation/rng files --- docs/source/usersguide/input.rst | 15 +++++++++++++++ src/input_xml.F90 | 9 +++++---- src/relaxng/tallies.rnc | 6 +++--- src/relaxng/tallies.rng | 2 ++ src/tally.F90 | 1 + 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 93e8236ec1..6e244bc9b4 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1251,6 +1251,21 @@ The ```` element accepts the following sub-elements: two post-collision energy bins will be created, one with energies between 0 and 1 MeV and the other with energies between 1 and 20 MeV. + :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 + bins can be specified as: + ```` + + Alternatively, if only one value is provided as a bin, OpenMC will + 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: + ````. + :mesh: The ``id`` of a structured mesh to be tallied over. diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 22f991ab9e..b1cabb4cbb 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2508,13 +2508,14 @@ contains if (n_words == 1) then Nmu = abs(int(t % filters(j) % real_bins(1))) if (Nmu > 1) then - t % filters(j) % n_bins = Nmu - 1 - dmu = TWO / (real(Nmu,8) - ONE) + t % filters(j) % n_bins = Nmu + dmu = TWO / (real(Nmu,8)) deallocate(t % filters(j) % real_bins) - allocate(t % filters(j) % real_bins(Nmu)) - do imu = 1, Nmu + allocate(t % filters(j) % real_bins(Nmu + 1)) + do imu = 1, Nmu + 1 t % filters(j) % real_bins(imu) = -ONE + (imu - 1) * dmu end do + t % filters(j) % real_bins(Nmu + 1) = ONE else call fatal_error("Must have more than one bin for mu filter & & on tally " // trim(to_str(t % id)) // ".") diff --git a/src/relaxng/tallies.rnc b/src/relaxng/tallies.rnc index c2e0860b8e..d3e5e87e83 100644 --- a/src/relaxng/tallies.rnc +++ b/src/relaxng/tallies.rnc @@ -23,16 +23,16 @@ element tallies { attribute estimator { ( "analog" | "tracklength" ) })? & element filter { (element type { ( "cell" | "cellborn" | "material" | "universe" | - "surface" | "distribcell" | "mesh" | "energy" | "energyout" ) } | + "surface" | "distribcell" | "mesh" | "energy" | "energyout" | "mu") } | attribute type { ( "cell" | "cellborn" | "material" | "universe" | - "surface" | "distribcell" | "mesh" | "energy" | "energyout" ) }) & + "surface" | "distribcell" | "mesh" | "energy" | "energyout" | "mu") }) & (element bins { list { xsd:double+ } } | attribute bins { list { xsd:double+ } }) }* & element nuclides { list { xsd:string { maxLength = "12" }+ } }? & - element scores { + element scores { list { xsd:string { maxLength = "20" }+ } } & element trigger { diff --git a/src/relaxng/tallies.rng b/src/relaxng/tallies.rng index 9ea941feab..ce0d2d1bcd 100644 --- a/src/relaxng/tallies.rng +++ b/src/relaxng/tallies.rng @@ -151,6 +151,7 @@ mesh energy energyout + mu @@ -164,6 +165,7 @@ mesh energy energyout + mu diff --git a/src/tally.F90 b/src/tally.F90 index d3fce52905..fc05145db4 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -1247,6 +1247,7 @@ contains case (FILTER_MU) ! determine mu bin n = t % filters(i) % n_bins + ! search to find incoming energy bin matching_bins(i) = binary_search(t % filters(i) % real_bins, & n + 1, p % mu)