Skip to content

Split the generated triangles with two sides on the boundary - #183

Merged
nikoscham merged 1 commit into
release/0.5.0-rcfrom
fix/147-corner-triangles
Dec 4, 2026
Merged

nikoscham merged 1 commit into
release/0.5.0-rcfrom
fix/147-corner-triangles

Conversation

@nikoscham

Copy link
Copy Markdown
Member

Closes #147.

At some sizes the triangle generator left a triangle in a corner of the domain with both sides on the walls. With velocity set on the walls, five of the six velocity nodes of such a quadratic (Taylor-Hood) triangle were fixed, and the creeping flow near the corner was wrong.

Fix (src/mesh/triangleMesh.js, splitCornerTriangles): after the refinement, a triangle with two sides on the boundary gets a vertex in the middle of its inner side. The vertex lies inside the triangle's circumcircle, so the Delaunay triangulation always joins it to the corner, and each half has one side on the boundary. A triangle with three sides on the boundary gets a vertex at its centroid. The mesh is then refined again, so minAngle still holds.

Lid-driven cavity, size 0.35, minAngle 30 Before After
Strongest return flow, u −0.3455 −0.3227
Where lid corner (0.125, 1.875) middle (2.0, 0.63)
Corner triangles 4 0
Elements 256 264

Sizes 0.3 and 0.15 behave the same way. The structured 12 × 6 mesh gives −0.3245. The smallest angle did not drop in any geometry tried (rectangle, L-shape, rectangle with a hole, thin strip, triangle).

Decisions:

  • Sharp corners are left alone. A corner under twice minAngle (40° at the default of 20) keeps its triangle. Splitting it would make angles smaller than minAngle, and the refinement would then never finish. Flow in a corner that sharp is nearly still anyway. Nothing tells the user this happened.
  • It applies to linear meshes too. Only quadratic flow is affected by the bug, but this way a geometry gives the same mesh whatever the element order. Meshes that had corner triangles get a few more elements; for example, a square with no size went from 2 to 6.

Tests:

  • The cavity regression test has a new case on a generated mesh at size 0.35. Every case now also checks that the strongest return flow is away from the side walls.
  • The triangle mesh unit tests check that no corner triangles are left (rectangle at sizes 0.35, 0.3 and 0.15 in both element orders, the L-shape, a square and a triangle with no size) and that minAngle still holds. They also check that a 15° corner keeps its triangle.
  • On the old generator these new checks fail: 5 in the regression test and 10 in the unit tests.
  • node --test passes all 30 test files on Node 22. dist/ is not changed.

CHANGELOG entry under Unreleased, Fixed. The docs (Mesh and mesh generators pages) are on the release/0.5.0-rc branch of FEAScript-documentation.

At some sizes the Delaunay refinement left a triangle in a corner of the
domain with both sides on the walls. Five of its six velocity nodes were
then fixed, and the Taylor-Hood creeping flow near the corner was wrong:
in the lid-driven cavity at size 0.35, 0.3 or 0.15 the strongest return
flow moved into a lid corner (u = -0.3455 instead of about -0.323).

After the refinement, such a triangle gets a vertex in the middle of its
inner side, which the Delaunay triangulation joins to the corner, and a
triangle with three sides on the boundary a vertex at its centroid. The
halves are refined again, so minAngle still holds. A corner of less than
twice minAngle keeps its triangle, since its halves would have smaller
angles and their refinement would not end.

Closes #147

Signed-off-by: Nikos Chamakos <nikoscham@gmail.com>
@nikoscham nikoscham added this to the 0.5.0 milestone Dec 4, 2026
@nikoscham nikoscham self-assigned this Dec 4, 2026
@nikoscham
nikoscham merged commit 90a6453 into release/0.5.0-rc Dec 4, 2026
4 checks passed
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.

1 participant