Skip to content

2d surface measures - #57

Merged
drummerdoc merged 5 commits into
Pele-Suite:developmentfrom
drummerdoc:2d-surface-measures
Aug 11, 2026
Merged

2d surface measures#57
drummerdoc merged 5 commits into
Pele-Suite:developmentfrom
drummerdoc:2d-surface-measures

Conversation

@drummerdoc

Copy link
Copy Markdown
Contributor

Three fixes found while adding PeleLMeX as a simulation backend to the RWTH
combustion-model-validation-framework-openfoam, which needs 2D flame-surface
measures from isosurface and binMEF.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds robust 2D “surface measure” support to the isosurface → MEF → binMEF pipeline, enabling downstream tooling to compute and bin arc length in 2D (and preserving area in 3D) reliably.

Changes:

  • Fixes Vec constructor declarations in Tools/SDFGen/vec.h to use correct in-class constructor naming.
  • Updates isosurface to compute the extracted iso-measure before surface-output clears element/node storage, and extends it to report length in 2D and area in 3D.
  • Extends binMEF to support 2-node elements (2D contours) by binning segment arc length, adds dimensionality sanity checks, and improves load-balance reporting for 2D/3D.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Tools/SDFGen/vec.h Corrects template class constructor declarations to standard C++ form.
Src/isosurface.cpp Computes and reports iso-measure (2D length / 3D area) before surface-output memory reclamation.
Src/binMEF.cpp Adds 2D MEF support by binning segment length, validates MEF dimensionality, and reports total binned elements consistently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Two cheap checks on the assembled surface, both added because a defect
there is silent: it corrupts the reported measure by tens of percent
while every element still looks individually plausible.

Edge lengths: marching squares/cubes cuts one cell, so no edge can exceed
the finest cell diagonal. Checked for the single segment in 2D and all
three triangle edges in 3D, since a triangle can be badly shaped while
its area looks unremarkable. Reports the count, the worst edge in cell
diagonals and its endpoints, and states that the measure is unreliable.
Tolerance via edge_length_tol (default 1.5).

Periodic face images: after a correct periodic clip, each crossing of a
periodic face leaves one node on each face at the same transverse
position, so the two face node sets are images of each other. A dropped
sliver, a duplicated piece, an inconsistently resolved saddle or a
resolution mismatch across the seam all break that. Inactive until the
clip exists -- no node lies on a face without it -- and it says so rather
than passing silently.

Motivated by a periodic 1600^2 case where the crossing between the last
and first cell centres was interpolated from raw coordinates rather than
the minimum image, placing a node mid-domain: segments of 65.8 mm and
14.1 mm where a cell is 0.05 mm, inflating the arc length by 45%, and
109% in the worst plotfile. It is intermittent across regrids, so a
passing case proves nothing -- hence a run-time check rather than a test.

Disable with check_surface=0.
@drummerdoc
drummerdoc merged commit 24ac0d8 into Pele-Suite:development Aug 11, 2026
3 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.

3 participants