Skip to content

Conversation

yrrepy
Copy link

@yrrepy yrrepy commented Sep 3, 2025

This PR seeks to resolve issues, #37, #38

#37, resolved by changing flip_sense for RPP facets all to false. A bit surprising to me, but I guess the way it considers them is already correct?

#38 , resolved by detection of RCCs with negative height. This was messing up the selection of the correct facet and sense. The detection of negative height than informs replace_macrobody_facets method.

The latter probably occurs with other macrobodies when they too are defined in, particular ways. And this is a RCC specific fix-up, not generalized.

I have tested this on the example inputs for issues 37, 38, as well as on an original much larger model and another macrobody heavy model.
The fixes work in these cases and the larger model and macrobody conversion is not broken.

I have not systematically tested this on a large variety of inputs (which would be best).

I used quite a bit of Claude Opus 4.1 to implement the detection and flipping. Though I have steered it quite a bit and tested the implementation myself manually. But probably some greater scrutiny is called for.

RCC with negative height.
Facet being called, gets wrong side and sense

openmc-dev#38
Wrong sense on RPP macrobody facets
openmc-dev#37
Comment on lines 367 to 368
# Rotate the RCC
surf = surf.rotate(rotation, pivot=(vx, vy, vz))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the arbitrary orientation case, it looks like the facet assignments should work as is because the top/bottom surfaces are rotated into the correct orientation. Perhaps a better solution is to just get rid of the special cases where we check for hx/hy/hz being equal to zero (where a negative height ends up swapping the facets)?

Copy link
Author

@yrrepy yrrepy Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm second-guessing myself and getting very geometrically confused about this:

            if (hx+hy+hz) < 0:  
                height_was_negative = True

I guess it comes down to how
https://docs.openmc.org/en/stable/_modules/openmc/model/surface_composite.html
defines bottom and top (vs. MCNP beginning and end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants