Skip to content

Fix new hanging glue on 3D portions - #108

Open
ericneiva wants to merge 5 commits into
fe_space_on_triangulationfrom
fix_new_hanging_glue_on_3D_portions
Open

ericneiva wants to merge 5 commits into
fe_space_on_triangulationfrom
fix_new_hanging_glue_on_3D_portions

Conversation

@ericneiva

Copy link
Copy Markdown
Member

Hello, @amartinhuertas,

For hanging faces on 3D triangulation portions, we must check whether any of the cells around the owner face is active to ensure a correct re-classification into regular/hanging faces.

Here is a PR that applies the necessary changes to account for this. Previously, the code only checked if the owner cell was active or not., that led to an incorrect classification. For instance, in this mesh,

Captura desde 2026-09-08 10-20-39

the circled hanging vertex was being marked as regular.

I've added a file test/issue_108.jl with the MWE of the mesh above. It's a little ad-hoc, because it comes from a GridapEmbedded.jl. Let me know what should we do with it.

Please, review and accept this PR whenever you have some time.

Thanks!

Also thanks @nannaberre for the help!

@amartinhuertas

Copy link
Copy Markdown
Member

Hi @ericneiva,

thanks for the PR. I mostly tested this machinery with 2D, no 3D as far as I remember. Thus, I am not surprised that you found BUGs when testing in 3D.

I've added a file test/issue_108.jl with the MWE of the mesh above. It's a little ad-hoc, because it comes from a GridapEmbedded.jl. Let me know what should we do with it.

Can we add it to the test suite as we do, e.g., in Gridap.jl/GridapDistributed.jl?

Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are correctness/robustness issues (helpers returning nothing on invalid input) and the newly added regression test is not wired into the repository’s test harness as-is.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes incorrect regular/hanging reclassification for non-conforming entities on 3D triangulation portions by detecting whether any cell incident to the owner face is active (not just the nominal owner cell), preventing misclassification that later breaks distributed FE space assembly.

Changes:

  • Update non-conforming glue regeneration to reclassify hanging faces based on activity of cells around the owner face and (when needed) remap owner-cell/subface data consistently.
  • Fix 3D edge entity propagation and related topology wiring during active model generation.
  • Add an MWE/regression reproducer for issue 108.
File summaries
File Description
src/OctreeDistributedDiscreteModels.jl Adjusts non-conforming glue regeneration and face classification logic for 3D portions; includes helper utilities moved/added for face lid bookkeeping.
src/FESpaces.jl Removes duplicated helper functions now defined elsewhere in the module.
test/issue_108.jl Adds an MWE/regression script demonstrating the failure mode and expected non-hanging classification behavior.
Review details

Suppressed comments (2)

src/OctreeDistributedDiscreteModels.jl:2690

  • face_lid_within_dim can also return nothing for out-of-range face_lid, producing a Union{Int,Nothing} return type. Throw an explicit error if the input lid is invalid.
function face_lid_within_dim(num_vertices, num_edges, num_faces, face_lid)
    if (face_lid <= num_vertices)
        return face_lid
    elseif (face_lid <= num_vertices + num_edges)
        return face_lid - num_vertices

test/issue_108.jl:67

  • This call relies on the pirated Triangulation(::AdaptedTriangulation, mask) method defined above. After switching to a local helper, call it here explicitly to avoid extending Gridap’s API from tests.
    Ω1_trians = map(local_views(Ωh), cell_active) do trian, mask
        Triangulation(trian, mask)
    end
  • Files reviewed: 3/3 changed files
  • Comments generated: 7
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +2353 to +2356
cell_reffe = first(Gridap.Geometry.get_reffes(model))
num_cell_vertices = Gridap.ReferenceFEs.num_faces(cell_reffe,0)
num_cell_edges = Dcm==3 ? Gridap.ReferenceFEs.num_faces(cell_reffe,1) : 0
num_cell_faces = Gridap.ReferenceFEs.num_faces(cell_reffe,Dcm-1)
Comment on lines +2676 to +2684
function face_dim(num_vertices, num_edges, num_faces, face_lid)
if (face_lid <= num_vertices)
return 0
elseif (face_lid <= num_vertices + num_edges)
return 1
elseif (face_lid <= num_vertices + num_edges + num_faces)
return (num_edges==0 ? 1 : 2)
end
end
Comment thread test/issue_108.jl
Comment on lines +17 to +19
Gridap.Geometry.Triangulation(t::Gridap.Adaptivity.AdaptedTriangulation,
mask::AbstractArray{<:Bool}) =
Gridap.Geometry.Triangulation(t.trian, mask)
Comment thread test/issue_108.jl
Comment on lines +33 to +36
outdir = joinpath(@__DIR__, "mwe_sphere_out_no_embedded")
rank == 0 && mkpath(outdir)
MPI.Barrier(MPI.COMM_WORLD)

Comment thread test/issue_108.jl
Comment on lines +170 to +172
with_mpi() do distribute
mwe_sphere_3d_hanging_glue_on_portion(distribute,3,3)
println("finished")

for d=0:Dcm-1
cell_faces_old = get_faces(topology_old, Dcm, d)
face_cells_old = get_faces(topology_old, d, Dcm)
Comment thread test/issue_108.jl
Comment on lines +170 to +173
with_mpi() do distribute
mwe_sphere_3d_hanging_glue_on_portion(distribute,3,3)
println("finished")
end No newline at end of file
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