Order of Lattice Indices

Hello,

I’ve searched but found no answer.

I’m filling a lattice and my Y indices are inverted or flipped with respect to what I would expect.

In MCNP on the lattice line I can change the order of the surfaces to ‘switch’ the direction of the indexing. And I can do this for only Y.

Is there a way I can do this in OpenMC?
My only other solution is to go back to my lattice and use a script to re-order it.
Rotations won’t work as the geometry is now ‘reflected’.

For reference:
https://mcnp.lanl.gov/pdf_files/la-ur-09-0380.pdf
Figure 5-5 PDF page 74

I am using OpenMC version 0.13.0-dev.
I can not share the input.

Regards,
Perry

hhhmmmm, well I think I just answered my own question.

I tested putting the Y pitch as negative, and it seems to have worked!
I did not expect that that would work.

Perry

Well, it seems this cat sung too soon :crying_cat_face:

The openmc-plotter shows exactly the geometry I want with my lattice pitch of “1.0 -1.0 1.0” and the appropriate transformations.
But the execution of openmc gives numerous “had a negative distance to a lattice boundary” lost particles,
which I am pretty sure are due to my negative pitch.

So the original question stands, unless any other ideas for my negative pitch.

Perry

Hey @yrrepy. Yes, in OpenMC when you specify the universes for a rectangular lattice, the y-indices are reversed (goes from higher y coordinates to lower y coordinates). This makes it such that when you “look” at your code, e.g.:

lattice.universes = [
    [u1, u1, u1],
    [u1, u1, u1],
    [u2, u2, u2]
]

it corresponds visually to what you would see if you took a slice through the geometry (i.e., what you’ll see in the plotter). If you want to reverse the y direction, the best thing I can suggest is to use numpy indexing capabilities. So, set the universes using a numpy array:

lattice.universes = np.array([
    [u2, u2, u2].
    [u1, u1, u1],
    [u1, u1, u1],
])

and then

# reverse y direction
lattices.universes[:] = lattice.universes[::-1, :]

Our lattices were never designed to work with negative pitches, although perhaps it wouldn’t be too difficult for us to make some fixes in the code such that it would.

Hi Paul, thanks.

Yes this is pretty much what I did.
I used a Python Pandas/Numpy script to take my lattice and reverse the ordering of the Y indices.

Cheers,
Perry