openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Refactor surface crossings

Open pshriwise opened this issue 6 months ago • 1 comments

Description

Right now we have a method, Particle::cross_surface that handles updates to Particle state for geometry as a particle moves across a surface and locates the next cell the particle enters. We can avoid this by creating a DAGUniverse::cross_surface method and doing a check against the current universe type (Universe::geom_type()) and surface crossing level on Particle::BoundaryInfo.

Ideally we'd have an analogous Universe::cross_surface for CSG universes, but the global nature of the searches that occur during CSG surface crossings doesn't lend it self well to that. There's no reason we couldn't place the code there, but it would be a bit misleading as it relies on namespace calls rather than data on the Universe class itself.

The main perk of this is the removal of pre-compiler statements in particle.cpp. I'll code it up and see how it turns out.

Alternatives

Dive more deeply into how we could/should support similar operations on the CSG Universe class.

Compatibility

This would be an internal refactor with no compatibility issues.

pshriwise avatar Jul 15 '25 14:07 pshriwise

In the context of additional geometry types (thinking of unstructured mesh surfaces and perhaps a TRISO specific geometry type), I think this makes for a better pattern than the #ifdef's that are present in the particle code now.

pshriwise avatar Jul 15 '25 14:07 pshriwise