Skip to content

Refactor communicator layer, integrate with SubDofHandler - #52

Draft
termi-official wants to merge 2 commits into
mainfrom
kc/refactor_communicator
Draft

Refactor communicator layer, integrate with SubDofHandler#52
termi-official wants to merge 2 commits into
mainfrom
kc/refactor_communicator

Conversation

@termi-official

Copy link
Copy Markdown
Member

NODDofHandler now wraps a standard Ferrite.DofHandler on the local grid, gaining full SubDofHandler support: fields restricted to subdomains, including subdomains that do not intersect every partition. The legacy DofHandler fork and the ported ConstraintHandler/evaluation code are replaced by forwarding to the SubDofHandler-aware Ferrite machinery.

Dof ownership and global numbering are negotiated per (entity, field) block in two rounds of neighborhood collectives on the interface graph, replacing the rank-serialized MPI.Send/Recv chains; the owned dof offset uses MPI.Exscan. The new InterfaceCommunicator (src/Communicator.jl) wraps the graph communicator and is reused by the PartitionedArrays and HYPRE extensions (the latter's ghost value sync is now a request/reply exchange).

Entity dof queries (vertex_dofs etc.) are based on the entity dicts from Ferrite.__close! instead of cell layout arithmetic, making them correct across SubDofHandlers. CoverTopology/NODGrid now track shared edges in 2D, fixing the numbering of interior edge dofs (e.g. 2D quadratic interpolations) across ranks.

Breaking: the legacy field query API (field_dims, integer field indices on the handler, entity dof queries on serial handlers) is gone; use the Ferrite SubDofHandler API instead.

KristofferC and others added 2 commits July 17, 2026 17:12
NODDofHandler now wraps a standard Ferrite.DofHandler on the local grid,
gaining full SubDofHandler support: fields restricted to subdomains,
including subdomains that do not intersect every partition. The legacy
DofHandler fork and the ported ConstraintHandler/evaluation code are
replaced by forwarding to the SubDofHandler-aware Ferrite machinery.

Dof ownership and global numbering are negotiated per (entity, field)
block in two rounds of neighborhood collectives on the interface graph,
replacing the rank-serialized MPI.Send/Recv chains; the owned dof offset
uses MPI.Exscan. The new InterfaceCommunicator (src/Communicator.jl)
wraps the graph communicator and is reused by the PartitionedArrays and
HYPRE extensions (the latter's ghost value sync is now a request/reply
exchange).

Entity dof queries (vertex_dofs etc.) are based on the entity dicts from
Ferrite.__close! instead of cell layout arithmetic, making them correct
across SubDofHandlers. CoverTopology/NODGrid now track shared edges in
2D, fixing the numbering of interior edge dofs (e.g. 2D quadratic
interpolations) across ranks.

Breaking: the legacy field query API (field_dims, integer field indices
on the handler, entity dof queries on serial handlers) is gone; use the
Ferrite SubDofHandler API instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Local node ids are now assigned in ascending global node id order, so
node id comparisons agree between processes. This makes the canonical
entity orientation (sortedge/sortface) identical on all ranks, meaning
shared dof blocks with more than one dof per edge (e.g. cubic Lagrange)
transfer correctly without extra orientation handling. Remove the
corresponding restriction and test quadratic/cubic (scalar and vector)
interpolations against the serial numbering.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@termi-official

Copy link
Copy Markdown
Member Author

The PR looks good for review on my end. However, I would like to merge the GPU support and make a release first before merging this, as there might be some problems popping up in the dispatches (which might become ambiguous).

As a follow up, before registering a v0.1, we must upstream the remaining debris in utils.jl to Ferrite.

@termi-official
termi-official marked this pull request as ready for review July 27, 2026 16:57

@koehlerson koehlerson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only remark I have is we may leave an issue/todo or whatever for unifying the code regarding EntityDofInfo with https://github.com/Ferrite-FEM/Ferrite.jl/blob/master/src/Dofs/DofHandler.jl#L110-L114

Comment thread src/NODDofHandler.jl
ldh = getlocaldofhandler(dh)
_, vertexdicts, edgedicts, facedicts = Ferrite.__close!(ldh)
counts = _entity_dof_counts(ldh)
setfield!(dh, :entity_dofs, EntityDofInfo(vertexdicts, edgedicts, facedicts, counts))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hm maybe at least a todo regarding the changes of the dofhandler on master storing optionally the dicts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I guess we should stall this until the AMR has a new Ferrite release.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

problem is that in the current master it checks explicitly for a NonConformingGrid and only stores in that case the dict

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@termi-official
termi-official marked this pull request as draft July 31, 2026 17:59
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.

3 participants