MFEM smoother

TMOP, the Target-Matrix Optimization Paradigm of MFEM, runs as an optional stage of the NekMeshPy smoothers: ("tmop", {...}) in a schedule or a session round. The native optimizer asks every element to become a square or a cube; TMOP asks each element to match a target element instead, so a graded mesh or a designed thin layer can keep its sizes while its shapes are repaired. It works on planar quad meshes and on hex meshes, at any order: a curved mesh is smoothed as a curved mesh.

pip install nekmeshpy[smooth]      # PyMFEM

Workflow

Each box links to the section that explains it.

1Install the extrapip install nekmeshpy[smooth]; MFEM is imported only when a tmop stage runs
↓
2Set up as usualresolve and run_schedule, or a SmoothSession, with the smoothers' own constraints: frozen nodes and axis-aligned planes and lines carry over, curved targets are held
↓
3Choose the targetwhat each element is asked to become; designed= keeps a layer's own shape
"input" (default): orthogonal, at its own size and aspect"input_smoothed": the same, sizes relaxed first"ideal": a square or a cube
↓
4Choose the metric and solverthe defaults suit most meshes
shape: 2 (quad), 303 (hex)shape + size: 80, 333untangling: 313"newton" or "lbfgs"
↓
5Propose, read the report, accept("tmop", {...}) alone or beside the native stages; the stage's reason says what was held, and a worse run is rolled back
↓ good enough
not yet: back to step 3 or 4 (undo a worse round)
6High-order mesh?smoothed as curved: every node moves and the order is kept; read the report at the solver's order and at the corners

Key points

  • Optional. MFEM is imported only when a tmop stage runs; the native smoothers never need it.

  • The target is the choice that matters. target="input" keeps each element’s own size and aspect, so a graded mesh stays graded; "ideal" seeks squares and cubes, as the native optimizer does, and thickens a thin layer unless that layer is designed.

  • Same constraints, partly mapped. Frozen nodes and axis-aligned planes and lines carry over exactly; a curved or tilted target is held fixed for now, and the stage’s reason says how many vertices were held.

  • Curved meshes stay curved. On an order-N mesh every Gauss-Lobatto node is a TMOP unknown, and the result has the input’s order. Read it at the solver’s order and at the corners: a positive reading at the nodes certifies nothing between them, and a .re2 file keeps the corners only (demo).

  • Planar quads only. A quad surface in 3-D is refused; hexes have no such limit.

Regenerating the pages

Each demo page is a run of its script in examples/smoother/mfem/; its numbers, viewer and chart are fragments in docs/smoother/mfem/_generated/ and files in docs/_static/smoother/mfem/, and no number is typed. After the bridge or an example changes, regenerate and commit (the demo keys need PyMFEM; the workflow chart does not):

python docs/_ext/gen_smoother_mfem_assets.py workflow thin_layer bent_pipe