High-order coordinates via interpolated DMPlex (netgen-only) - #5277
Open
pbrubeck wants to merge 2 commits into
Open
High-order coordinates via interpolated DMPlex (netgen-only)#5277pbrubeck wants to merge 2 commits into
pbrubeck wants to merge 2 commits into
Conversation
This was referenced Jul 27, 2026
Merged
pbrubeck
commented
Jul 30, 2026
pbrubeck
commented
Jul 31, 2026
pbrubeck
commented
Jul 31, 2026
pbrubeck
commented
Jul 31, 2026
Comment on lines
+185
to
+189
| import finat.ufl | ||
| from firedrake.function import CoordinatelessFunction | ||
| from firedrake.functionspace import FunctionSpace | ||
| from firedrake.cython import dmcommon | ||
| from firedrake.mesh import make_mesh_from_coordinates |
Cython routines to set cellwise coordinate closures and to read back high-order DMPlex coordinates in Firedrake node ordering, used to build curved Netgen meshes without going through curve_field's FIAT-based permutation search.
Rework Netgen mesh construction (NetgenGeometry) and curved coordinate handling to go through the standard high-order coordinate DM path instead of a bespoke curve_field/redistribution scheme, so Netgen meshes compose with MeshHierarchy/AdaptiveMeshHierarchy like any other mesh. Drops the now-unused firedrake/mg/netgen.py.
pbrubeck
force-pushed
the
pbrubeck/netgen-plex
branch
from
July 31, 2026 13:24
5b72720 to
5036f7a
Compare
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
AI-assisted (Claude Code)
This PR replaces the Python-level Netgen cell-numbering nightmare (
find_permutation,netgen_distribute,sfBC_orig, and the dynamicnetgen_mesh/netgen_flagsmesh attributes) with the PETSc-native approach outlined below.What changed
PetscFE,Section, andVecfor Netgen meshes;coordinates are read/written through oriented DMPlex closures in compiled Cython
(
dmcommon.set_cell_coordinates,dmcommon.reordered_coords_high_order), replacing the oldpoint-matching/permutation search (
find_permutation,netgen_distribute).firedrake/netgen.pyis rewritten around a singleNetgenGeometryclass (replacingFiredrakeMesh) that owns the Netgen mesh, the DMPlex it produced, and the operations thatneed the geometry:
curve_field,snap(project a refined DMPlex's vertices back onto thegeometry), and
recurve(re-evaluate coordinates at a new degree on a refined mesh).MeshGeometrygains a single_geometry_sourceattribute (declared in__init__) replacingthe ad hoc
netgen_mesh/netgen_flags/sfBC_origattributes that were bolted on afterconstruction;
curve_fieldand the adaptive-refinement/MeshHierarchycode paths go throughthis attribute uniformly instead of
hasattrchecks.firedrake/mg/netgen.py(NetgenHierarchyand friends) is deleted;MeshHierarchybuildsNetgen hierarchies itself via
_geometry_source, so there is one hierarchy-construction codepath instead of two.
(
NetgenGeometry._local_mesh), only when a distributed refinement needs to snap/recurvelocally.
firedrake/adapt.py) and geometric multigrid (firedrake/mg/mesh.py)both preserve high-order Netgen geometry, in serial and under MPI.
Depends on NGSolve/ngsPETSc#125 (the
.github/actions/install/action.ymlpin to a branch is marked
DROP BEFORE MERGEand will be reverted once that PR merges).The extension to more generic high-order coordinates support via PetscFE is outlined in
#5278.