🔺 Meshing

Automatic Delaunay triangulation with Ruppert refinement — fast, high-quality, running entirely in your browser via WebAssembly.

The spade Mesher

ThermX uses spade, a Constrained Delaunay Triangulation (CDT) engine written in Rust and compiled to WebAssembly (WASM). The spade WASM binary is only 185 KB — small enough to ship inline — and runs at near-native speed in both the browser and desktop app.

The meshing algorithm is based on Ruppert's refinement, which iteratively improves mesh quality by inserting new Steiner points until all triangles meet the user-specified angle and area constraints.

Generating a Mesh

  1. Complete your geometry (all regions drawn, no overlaps)
  2. Assign materials and boundary conditions
  3. Open the Mesh tab in the right panel
  4. Adjust quality parameters if needed (defaults work well for most models)
  5. Click Generate Mesh

The mesh is generated in a background Web Worker so the UI remains responsive. For typical building component cross-sections, meshing takes under one second.

Quality Parameters

Min edge length
0.5 – 50 mm
Lower bound on triangle edge length. Prevents over-refinement in thin regions. Default: 0.5 mm.
Max edge length
0.5 – 50 mm
Upper bound. Larger values produce coarser meshes. Default: 10 mm. Both sliders use a logarithmic scale.
Min angle
0 – 34°
Minimum interior angle for any triangle. Higher values improve numerical quality but increase element count. Default: 20°.
Max area
Any (mm²)
Maximum area per triangle. Leave blank to disable. Useful for ensuring fine resolution in large homogeneous regions.
Best Practice

Start with defaults. If results show large temperature gradients in a region, reduce max edge length there or set a max area constraint and remesh. For thin insulation layers, ensure min edge is smaller than the layer thickness.

Dual-Slider Controls

The min/max edge length sliders are linked: the minimum can never exceed the maximum. Both sliders use a logarithmic scale so that fine control is available at small values (below 2 mm) while still allowing coarse values up to 50 mm.

Real-Time Mesh Preview

After meshing, the canvas shows the triangulation overlaid on your geometry. Triangles are color-coded by quality:

Hover over any triangle to see its area, minimum angle, and element index.

Mesh Statistics

After generation, the Mesh panel shows:

Technical Details

ComponentDetails
AlgorithmConstrained Delaunay + Ruppert's Refinement
Implementationspade (Rust crate)
RuntimeWebAssembly (WASM), 185 KB binary
ThreadingRuns in a Web Worker (non-blocking)
ConstraintsAll geometry edges are preserved as constrained edges
Material boundariesAutomatically preserved — no triangle spans multiple materials

Common Issues

Meshing fails or hangs

This usually means geometry has overlapping regions or extremely short edges (degenerate geometry). Check for overlaps using Check Geometry and ensure no vertices are placed closer together than the min edge length.

Too many elements, slow solve

Increase the max edge length or the max area. For a quick check, use a coarse mesh; for final results, refine.

Poor quality near thin layers

Reduce the min edge length below the layer thickness. Alternatively, increase the min angle to force more equilateral triangles in those regions.