mit-crpg/openmc — pull request #278 by nelsonag (2014-05-19 17:49:21+00:00)
Title: Fixes to support reading of older cross-section data sets

As discussed in Issue #209, 66c and other older data sets which shipped with MCNP RSICC releases were not being properly handled by OpenMC. The main issue identified was that OpenMC was not using the L(I) locators when finding energy distribution's length whereas the data assumed these were being used and sometimes would assign the same data to multiple incoming energies. This PR fixes this issue and a few others which were identified after the older data sets were fixed.

The fixes include:
1) L(I) is now used in determining the length of the energy distribution. Before this was not used and it was assumed that if there were N incoming energy points in the edist, then there were also N datasets (LDATs). This is not necessarily true, and it seems as if the older (.66c) sets used the same LDAT for multiple Ein points in some cases.
* I stated, or at least implied, in Issue #209 that the physics routines would have to be modified to fix this. I was wrong. Only length_energy_dist needed to be modified for this issue.

2) Next, if an angular distribution's first (i.e., for the lowest energy) distribution data was isotropic (and thus LC==0), then the data was not read in correctly.
* I'm not sure why this didn't show up in the newer data sets (70c, 71c), but perhaps it was always occurring just never resulted in attempting an out-of-bounds access, or we just have been `lucky` enough to not have compiled with the proper compiler bounds checking option in the cases it did occur?

3) A bug was present when sampling angular distributions which described the distribution as 32 Equiprobable Bine. This bug resulted in mu being calculated with an interpolant that was negative, thus implying mu was less than the mu of the lower bin boundary.
* I don't think this was seen very much with modern data because the equiprobable bin representation is being phased out and so shouldnt be all that common any more.
* Further, when xi (the random number) was > 1/32, the effect probably wouldn't be noticeable much at all as the randomly sampled PDF was just slightly adjusted but probably wouldn't matter in most problems.
* When xi is < 1/32 though, then the resultant mu became < -1. This is never checked and results in a particle being moved a further than expected since p % coord % uvw was no longer normalized. This is how I found it, an inelastic level reaction put a particle way out side my problem domain.
* The following figure shows what happens to the sampled distribution. You'll see that the corrected method now spans [-1,1].
![figure_1](https://cloud.githubusercontent.com/assets/1037107/3017722/336b757c-df7d-11e3-9c67-799100abe329.png)

Finally, these changes *could* help out with the issues discussed by @makeclean here: https://groups.google.com/forum/?fromgroups#!topic/openmc-users/Ai3dWBbF5M0 but I withhold judgment on that until I get there.