Repository navigation
Allow submeshes as boundary pieces; add a per-field boundary-completeness check - #54
Merged
Merged
Conversation
Maps each cell of a lower-dimensional Ferrite grid to a facet of the parent by node coordinates and adds the facets as a named facet set. A facet set containing interior facets is now an error rather than a warning, since a piece lies on the boundary. Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Boundary facets with no condition for a field whose equation has a flux now give one aggregated warning per discretize call. FEMDiscretization(natural = [pieces]) declares them zero-flux, boundary_check = :error makes the warning an error and :off skips it. Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Keeps both sides: master's M4 (steady, eliminate, observed, SUPG, multifield, operators) and the submesh boundary pieces with the per-field boundary-completeness check. The DFG cylinder example and docs declare the outlet natural. Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
…tests These tests have no boundary conditions on purpose, so they print the completeness warning on every run (12 lines in the Frontend log). They now declare natural sides; the two @test_logs that assert the warning are unchanged. Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
xtalax
marked this pull request as ready for review
November 5, 2026 03:24
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.
Two boundary features, requested together: boundary pieces given as submeshes, and a boundary-completeness check.
Submeshes as boundary pieces.
add_boundary_pieces!(grid, name => submesh, ...; atol = nothing)(also a method taking a dictionary) is exported and documented. It adds a facet setnameto the parentFerrite.Gridand returns the grid, so every existing route (boundarypiece(MeshDomain(grid), name),FEMSpace, the PDESystem) takes the new piece like any other; the named-facet-set route is unchanged. It is a function on the grid, not aFEMDiscretizationkeyword, because pieces are created before the PDESystem exists andMeshDomainbelongs to PDEBase. Matching is by node coordinates (two Ferrite grids number their nodes independently): each submesh node maps to the nearest parent node withinatol(default 1e-8 times the larger of 1 and the parent's largest extent), and a submesh cell matches the parent facet with exactly those corner nodes; higher-order cells match through their corner nodes. The call is atomic: if one piece fails, nothing is added.Boundary completeness, not a hard error by default. An unlisted boundary is a legitimate natural (zero-flux, symmetry or outflow) condition, and the DFG cylinder outflow and every insulated-wall example rely on it. Two new
FEMDiscretizationkeywords:natural = [pieces]declares pieces natural,boundary_check = :warn | :error | :off(default:warn;:errorgives strict MethodOfLines-style completeness).test/shared/frontend_tests/boundaries.jlunless noted)errors.jltest/Space/space.jlatolatolatol <= 0@warnperdiscretizecall, per field, listing pieces with facet counts and facets in no named piecenatural, a zero Neumann condition, orboundary_checkboundary_check = :errorArgumentErrorboundary_check = :offFields whose equation has no flux (a pressure, say) are not checked. Pure-Neumann (rank-deficient) detection is skipped: a time-dependent problem with a mass matrix is well-posed and detecting a singular steady problem is not cheap, and steady problems are rejected until M4; the docs say so. End-to-end tests solve a 2D box with four 1D submeshes (reversed node numbering, mixed orientation) and a 3D hexahedral box with six quadrilateral face submeshes, against the exact solution to 1e-8.
Impact on existing tests: the warn test in
errors.jlnow matches the aggregated message; thecheck_facetsetsinterior-facet assertion intest/Space/space.jlis now an error;test/qa/qa.jladds three Ferrite names (vertices,reference_facets,getrefdim) to the ExplicitImports ignore list, with a comment.FEMDiscretizationgains two fields (natural,boundary_check). Docs: a "Boundary completeness" section and submesh pieces indocs/src/boundary_conditions.md, plusdocs/src/discretization.mdand the README.Local results on Julia 1.12.1: Core 1, QA 21, Frontend 254 (including 41 new), Integration 304, Solution 215, Space 196, all pass; docs build exits 0; Runic 1.13 clean; Codex approved after four rounds (earlier rounds found and fixed a crash on meshes with no facet sets, an
atol = 0crash and an integer overflow for translated meshes). lts was not run. CI is billing-blocked.🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: 43e03fde-3384-4386-bae9-03e81f19ba7c