Implementation of surfaces with custom implicit function#4010
Open
pferney05 wants to merge 23 commits into
Open
Implementation of surfaces with custom implicit function#4010pferney05 wants to merge 23 commits into
pferney05 wants to merge 23 commits into
Conversation
added 23 commits
May 20, 2026 16:51
…ct use.\nAdd a cache checker to warn for unused cached functions.\nAdd a test for wrong xml tag import.
…mplicit solver name is valid. changed max_iter to maxiter to get the same var name everywhere. Cell: check if in cell before throwing fatal error to avoid error in solid ray plot.
…oint, README.md notes for future improvement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds support for function-based implicit surfaces in OpenMC. It introduces a user-facing expression-tree interface for defining arbitrary 3D implicit functions, creates OpenMC surface objects from those functions, and enables them to be combined with standard regions through the existing Boolean geometry interface.
The implementation includes:
openmc.implicitexpression system for composing elementary symbols and operators into implicit functions.ImplicitSurfacesurface type with configurable isovalue support.Cachedexpression node that avoids redundant sub-expression evaluations during function evaluation.The motivation is to make OpenMC more robust and versatile for geometries that are difficult or inefficient to represent with constructive solid geometry primitives or triangular meshes, especially triply periodic minimal surface (TPMS) fuel concepts and graded TPMS lattices. Unlike standard quadrics, these surfaces generally do not have analytic ray-surface intersections, so the implementation uses numerical root finding along the ray.
The implementation was validated on eight calculations spanning seven geometries: a reference sphere, Primitive TPMS, Gyroid TPMS, Diamond TPMS, a strongly pitch-graded Primitive TPMS, a Squircle surface, and a Squared Circle surface. The implicit-surface sphere reproduces the standard OpenMC sphere result within statistical uncertainty, and the default solver parameters were found to give consistent results across all validation cases.
@sallustius @gridley @paulromano @ChasingNeutrons @shimwell You may be interested in this. This is a big PR which generalises #3292 to a wide range of functions.
Fixes # (issue)
N/A
Checklist