njoy / NJOY2016

Nuclear data processing with legacy NJOY
https://www.njoy21.io/NJOY2016
Other
96 stars 86 forks source link

nunx is PURR is ignored #178

Closed whaeck closed 3 years ago

whaeck commented 3 years ago

Bob MacFarlane sent us a few updates to the PURR module. One of these updates relates to the nunx value in the input file.

nunx allows a user to ask for all unresolved cross sections at each unresolved energy (nunx=0) or just nunx values. It would appear that this option is actually ignored in NJOY2016 (going back through the source code of NJOY2012 and NJOY99, it would appear that this has always been the case) since nunx is never used in any of the energy point loops.

The value of nunx is used to calculate an integer step value so that the points being calculated are spread out over the unresolved resonance range. E.g. if nunx=2, then nstep=nunr/(nunx-1)=nunr, which means only the lower and upper unresolved energy point will be calculated.

whaeck commented 3 years ago

Using test 35 as a template and setting nunx=2 in that input file, PURR crashes on the two do loops (do ie=1,nunr) on lines 435 and 485. This is due to the fact that since nunx=2, only 2 tables have been calculated (for the first and the last unresolved energy point) while these output loops still iterate over every unresolved resonance energy and assume that every energy point has a probability table.

One solution is to change the two do loops in do while loops like the one on line 286 and increment the ie index by the previously calculated nstep. We could have used nunx instead of nunr in these loops, but we actually must iterate over the unresolved resonance energy grid since the heating cross sections that will be included in the probability table are calculated on the complete unresolved resonance energy grid, before we even calculate the probability tables.

whaeck commented 3 years ago

Since nunx now controls the number of probability tables we calculate, we'll have to make sure that MF2 MT151 and MT153 are also of the right size so that this does not cause any downstream errors. Using the original nunx provided by Bob is incomplete in this respect. The number of unresolved probability tables is still equal to the number of unresolved resonance points, so all but the first nunx ones are all zero.

whaeck commented 3 years ago

We now have a working fix that appears to be accepted properly by ACER and VIEWR. See branch fix/purr-nunx