meshmode icon indicating copy to clipboard operation
meshmode copied to clipboard

Automatically fix orientation of volume meshes from gmsh?

Open inducer opened this issue 3 years ago • 3 comments

Given the grief in https://github.com/illinois-ceesd/drivers_y2-isolator/issues/13, I wonder whether it might not be better to automatically fix the orientation of volume meshes coming in from gmsh.

Some aspects to consider.

  • There's of course some cost to this.
  • As of #299, the element orientation check is no longer disabled by python -O.
  • Automatic flipping is only possible for volume meshes (AFAIK).
  • Orientation finding and flipping is only implemented for simplicial meshes ATM. This is important because any automatic feature breeds an expectation that it works unconditionally, on all types of meshes. It's not hard to fix this though.

@lukeolson @mtcam @anderson2981, opinions?

inducer avatar Mar 27 '22 19:03 inducer

I wonder whether it might not be better to automatically fix the orientation of volume meshes coming in from gmsh.

👍 from my perspective. A nice fat warning would be nice: "Nice try, fool."

I think this has been true for at least a half a week already, right? Allowing a run to proceed that is using a mis-oriented mesh, imo should be disallowed. If a user wants to do this, they can monkey with it .. thy own self on YOYO time.

  • Orientation finding and flipping is only implemented for simplicial meshes ATM. This is important because any automatic feature breeds an expectation that it works unconditionally, on all types of meshes. It's not hard to fix this though.

This issue does not affect us atm, and we have no plans (or need) to use anything other than simplicial elements afaik. Other element types would be nice to have soon. We could mesh some boundary layer with long bricks, which might be nice, some day.

Overall, i'd say if you can fix this on-the-fly, then go for it. Save the users from themselves in this one case, not because they deserve it, but because it benefits ~~me~~, us! i meant us!.

@lukeolson @MTCam @anderson2981, opinions?

MTCam avatar Mar 27 '22 21:03 MTCam

I'm on board with a fix and a notification that it's being fixed, which allows the user to figure out why their mesh is wonky.

anderson2981 avatar Mar 28 '22 14:03 anderson2981

Seems reasonable to either fail (and not proceed), or to fix the bad elements.

Meaning, if there's an assumption on mesh orientation and the mesh violates that, then it's an input error.

Is the fix simply to swap two vertices in the element list (for 2D or 3D simplex)?

lukeolson avatar Mar 28 '22 16:03 lukeolson