Skip to content

Commit 3eef044

Browse files
Sébastien LoiselSébastien Loisel
authored andcommitted
Import Gmsh meshes at any order; finish tensor_dofmap 3D face gluing
Three related changes: 1. tensor_dofmap (src/TensorFEM.jl): implement the previously-unsupported case of shared 3D face-interior grids (d=3, k>=3). A face-interior node lies on a quad face shared between two hexes, which the two elements present in one of the face's 8 symmetries. New helper _tf_face_pos canonicalizes it: anchor at the minimum-id corner (unique for a valid face), measure the node from it along each axis, and order the two axes by the neighbour ids so axis 1 points toward the smaller-id neighbour. The key is then identical from both elements' framings, so the (k-1)^2 interior grid glues node-for-node. Subsumes the old k=2 special case; only interior grids on shared entities of dimension >= 3 (possible only at d >= 4) remain unimplemented. tensor_dofmap now supports any k for d <= 3. 2. Gmsh import (ext/MultiGridBarrierGmshExt): resample element geometry at MultiGridBarrier's Chebyshev reference nodes via getJacobians, so quads and hexes import at ANY order (Gmsh's equispaced high-order nodes otherwise only match the Chebyshev reference through k=2). Physical-group membership uses a corner-subset test, exact at any order. With tensor_dofmap finished, the earlier 3D-hex k<=2 cap is removed. 3. CI (.github/workflows/CI.yml): after deploydocs, POST to the Pages builds API to force a rebuild -- GitHub's legacy Pages builder intermittently hangs and leaves the published docs stale. Tests: transposed-2-hex tensor_dofmap oracle (shared face axes swapped) matches coordinate-dedup exactly at k=2,3,4; Gmsh quads k=1..4, curved disk, hexes k=1..3; full Pkg.test green, docs build clean.
1 parent 2ea27b8 commit 3eef044

7 files changed

Lines changed: 379 additions & 228 deletions

File tree

.github/workflows/CI.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ jobs:
9898
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9999
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
100100
run: xvfb-run --auto-servernum julia --project=docs --color=yes docs/make.jl
101+
# deploydocs pushes the built site to the gh-pages branch, but GitHub's
102+
# legacy Pages builder intermittently hangs (status "building", duration 0),
103+
# leaving the published site stale. Force a fresh Pages build so it updates.
104+
# Only on the events where deploydocs actually publishes (push to main / tags).
105+
- name: Nudge GitHub Pages build
106+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
107+
env:
108+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
run: gh api -X POST repos/${{ github.repository }}/pages/builds

docs/src/gmsh.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ automatically when both packages are imported and provides
1313
into a `Geometry` plus named node sets:
1414

1515
- 3/6-node triangles → `fem2d_P1` / `fem2d_P2` (curved P2 edges supported),
16-
- 4/9-node quadrilaterals → tensor `fem2d` with `k = 1/2` (curved quads
17-
supported; non-planar quad meshes become embedded surfaces),
18-
- 8/27-node hexahedra → `fem3d` with `k = 1/2`.
16+
- quadrilaterals → tensor `fem2d` of **any order** (curved; non-planar quad
17+
meshes become embedded surfaces),
18+
- hexahedra → `fem3d` of **any order**.
1919

2020
Gmsh **physical groups** come back as `(vertex, element)` node-pair lists — the
2121
same format as [`find_boundary`](@ref) — so named boundary parts plug directly
@@ -83,16 +83,21 @@ close() # hide
8383
```
8484
![](gmsh_hole.svg)
8585

86-
## Curved elements
86+
## Curved elements, any order
8787

88-
Second-order meshes import as isoparametric elements: `setOrder(2)` before
89-
importing gives curved 6-node triangles (`fem2d_P2`) or curved 9-node quads
90-
(tensor `fem2d`, `k = 2`) whose boundary nodes lie on the true geometry. For
91-
all-quad meshes, set `Mesh.RecombineAll = 1` (with
88+
High-order meshes import as isoparametric elements: call `setOrder(k)` before
89+
importing. Triangles are P2 (`setOrder(2)`); quadrilaterals support **any order**
90+
— the geometry is resampled at MultiGridBarrier's Chebyshev reference nodes, so a
91+
curved `Q_k` element imports exactly regardless of `k`. Boundary nodes lie on the
92+
true geometry. For all-quad meshes set `Mesh.RecombineAll = 1` (with
9293
`Mesh.SubdivisionAlgorithm = 1` to guarantee no leftover triangles); for
9394
hexahedra use transfinite/swept volumes, or subdivide a tet mesh with
94-
`Mesh.SubdivisionAlgorithm = 2`. Orders ≥ 3, serendipity elements, and
95-
tetrahedra are rejected with actionable error messages.
95+
`Mesh.SubdivisionAlgorithm = 2`. Hexahedra also import at any order. Order-≥3
96+
triangles (MultiGridBarrier has only P1/P2 triangles), serendipity (incomplete
97+
high-order) elements, and tetrahedra are rejected with actionable messages.
98+
99+
The example below imports a curved **fifth-order** disk and checks the disk
100+
area — the curved-boundary quadrature converges as the order rises:
96101

97102
```@example gmsh
98103
gmsh.initialize()
@@ -104,10 +109,10 @@ gmsh.option.setNumber("Mesh.MeshSizeMax", 0.25)
104109
gmsh.option.setNumber("Mesh.RecombineAll", 1)
105110
gmsh.option.setNumber("Mesh.SubdivisionAlgorithm", 1)
106111
gmsh.model.mesh.generate(2)
107-
gmsh.model.mesh.setOrder(2) # curved Q2 quads
112+
gmsh.model.mesh.setOrder(5) # curved Q5 quads
108113
gmd = gmsh_import()
109114
gmsh.finalize()
110-
sum(gmd.geometry.w) - π # curved quadrature: area error of the disk
115+
gmd.geometry.discretization.k, sum(gmd.geometry.w) - π # order, and disk-area error
111116
```
112117

113118
## API reference

0 commit comments

Comments
 (0)