Repository navigation
Barycentric refinement, overlap and intersection of curvilinear triangle meshes - #81
Open
PaulOlyslager wants to merge 6 commits into
Open
PaulOlyslager wants to merge 6 commits into
PaulOlyslager wants to merge 6 commits into
Conversation
barycentric_refinement(::CurvilinearMesh{U,3}) splits every curved triangle of
order O into the usual six children, which are curvilinear triangles of the same
order: their nodes are the parent chart evaluated at the images of the
reference nodes, so the children reproduce the curved surface exactly. Shared
nodes are merged by their exact rational barycentric position on the parent
vertex, edge or cell, so the refinement is conforming, and the cells are
numbered and oriented as in the refinement of flat meshes.
Also fix indextype(::CurvilinearMesh), which returned SVector{N-O+1} (right for
lines only, SVector{5} for quadratic triangles) instead of SVector{D1}; the
generic refinement failed on it.
Tested for orders 1-3 on gmshsphere: exact geometry of the children,
conformity (every edge in two cells with opposite orientation, no duplicate
nodes, Euler characteristic 2), orientation, and agreement with the flat
refinement for order 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmP8j8Kddkr1XembbhG7UZ
center(::CurvilinearSimplex{U,2}) evaluated the chart at the barycentric
coordinates (1/2, 1/2), the midpoint of an edge, instead of the centroid
(1/3, 1/3). This misplaced the positions of the functions of every space whose
`pos` is the center of a cell (e.g. Raviart-Thomas, discontinuous and dual
Lagrange spaces in BEAST) by a fraction of the element size. Tested against
barytocart at the centroid and, for order 1, against the flat mesh.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmP8j8Kddkr1XembbhG7UZ
- neighborhood_lazy(::CurvilinearSimplex, u) returns the full neighborhood,
as for quadrilaterals: the lazy one takes the tangents from the chart, which
is right only for flat simplices.
- tangents(::MeshPointNM) for curvilinear simplices returns all tangents as the
columns of a matrix, from the unitary base, as for flat simplices.
- faces(::CurvilinearSimplex{U,2}) returns the curved edges (edge j opposite to
corner j), as faces(::Simplex{3,2}) does.
- neighborhood(::CurvilinearSimplex, u) accepts the parameters as a tuple, as
for flat simplices.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmP8j8Kddkr1XembbhG7UZ
…harts
- chartinparent(::BarycentricRefinement{U,3}, cell): a cell of the barycentric
refinement as a flat simplex in the parametric domain of its parent. Curved
children cannot be located in their parent from their coordinates, but their
parametric domain maps affinely into the parent's.
- subcharts(::CurvilinearSimplex{U,2}, Val{1}): the curved edges with their
injections into the parametric domain, as for flat triangles.
- silvester/fast_silvester(::Val{P}, x) return static vectors, and the charts
evaluate them once per point instead of once per node: barytocart no longer
allocates (same arithmetic, same values).
Tests: chartinparent and subcharts against the parent's chart, orders 1-3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmP8j8Kddkr1XembbhG7UZ
coordtype, dimension, universedimension and vertextype on the type of a
CurvilinearSimplex were defined for CurvilinearSimplex{U,D,C,N,T}, which
leaves out the order O: a UnionAll, which the concrete type of a chart never
equals, so these methods never applied (dimension(eltype(charts)) failed,
for instance). They are now defined for its subtypes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- carttobary for curvilinear triangles: the parameters of the closest point, by Gauss-Newton iteration from those in the flat triangle through the corners. For a point on the chart it is the inverse of barytocart, also on the continuation of the chart beyond the reference triangle. - overlap and intersection of curvilinear triangles p and q: exact when q is an affine reparametrization of the map of p, as are a cell and its children in the barycentric refinement, or two children of the same cell. The corners of q located in p give the affine map, which is checked at the interpolation nodes of q. The intersection is then the triangle of q in the parametric domain of p clipped by the reference triangle, as curvilinear triangles of the order of p and with its orientation. Otherwise the triangles are taken not to overlap, as non coplanar flat triangles. New test test_curvilinear_intersect.jl, for orders 2 and 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Can you use the existing |
This branch has not been deployed
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.
Summary
Barycentric refinement of curvilinear triangle meshes, plus the chart functionality BEAST needs to build Buffa-Christiansen and dual Lagrange spaces on them and to assemble local operators between a curvilinear mesh and its refinement.
Changes
barycentric_refinement(::CurvilinearMesh{U,3}): every curved triangle is split into the usual six children, curvilinear triangles of the parent's order. Their nodes are the parent chart evaluated at the images of the reference nodes, so the children reproduce the curved surface exactly. Shared nodes are merged by their exact rational position, so the refinement is conforming, and cells are numbered and oriented as for flat meshes.chartinparent(::BarycentricRefinement{U,3}, cell): a child as a flat simplex in the parameter domain of its parent (curved children cannot be located in their parent from their coordinates).subcharts(ch, Val{1})andfaces(curved edges),tangentsat a point, tuple parameters inneighborhood,neighborhood_lazy.barytocartno longer allocates.carttobary,overlapandintersectionfor curvilinear triangles. These are exact when one triangle is an affine reparametrization of the other's map (a cell and its children, two children of a cell, copies of a mesh); otherwise the triangles are taken not to overlap, as for non-coplanar flat triangles.Fixes
center(::CurvilinearSimplex{U,2})evaluated the chart at an edge midpoint instead of the centroid.indextype(::CurvilinearMesh)returnedSVector{N-O+1}instead ofSVector{D1}.coordtype,dimension,universedimensionandvertextypenever matched a concreteCurvilinearSimplex, because they left out the order parameter.Tests
test_curvilinear_baryref.jl(orders 1-3: exact geometry, conformity, orientation, agreement with the flat refinement for order 1), additions totest_curvilinear_elements.jl, andtest_curvilinear_intersect.jl. The full test suite passes. Flat meshes are unaffected.The version in
Project.tomlis not bumped; these are new features, so the next release would be 1.2.0. BEAST.jl uses this in a companion PR.🤖 Generated with Claude Code