Cleaned up automatic binning code for mu filters and updated documentation/rng files

This commit is contained in:
Adam Nelson 2015-08-25 20:03:19 -04:00
parent ec788085b3
commit a64255bdc8
5 changed files with 26 additions and 7 deletions

View file

@ -1251,6 +1251,21 @@ The ``<tally>`` 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:
``<filter type="mu" bins="-1.0 -0.6 -0.2 0.2 0.6 1.0" />``
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:
``<filter type="mu" bins="5" />``.
:mesh:
The ``id`` of a structured mesh to be tallied over.

View file

@ -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)) // ".")

View file

@ -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 {

View file

@ -151,6 +151,7 @@
<value>mesh</value>
<value>energy</value>
<value>energyout</value>
<value>mu</value>
</choice>
</element>
<attribute name="type">
@ -164,6 +165,7 @@
<value>mesh</value>
<value>energy</value>
<value>energyout</value>
<value>mu</value>
</choice>
</attribute>
</choice>

View file

@ -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)