visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
438 stars 116 forks source link

Verdict Mesh Quality Stretch is Wrong #17241

Open bender10 opened 2 years ago

bender10 commented 2 years ago

Visit's calculation of quad stretch is wrong. An exact square should have a stretch of 1.0. The errant lines of code are here: https://github.com/visit-dav/visit/blob/develop/src/third_party_builtin/verdict/V_QuadMetric.C#L450

Visit's version of Verdict introduces a "length_squared" function for a VerdictVector and redefines the "length" function. The call to sqrt at line 475 expects the edge length to be squared, but it is not ( https://github.com/visit-dav/visit/blame/develop/src/third_party_builtin/verdict/V_QuadMetric.C#L475 )

markcmiller86 commented 2 years ago

@bender10 thanks for pointing this out. We'll get that fixed. Out of curiosity, do you know of any more recent implementations of the Verdict mesh quality metrics? Or, do you know of any input mesh tests we can use to confirm all the metrics compute was it expected?

I know VTK now includes the Verdict metrics. Maybe we should switch to that? Does their stretch have the same issue?

bender10 commented 2 years ago

Sandia's version is on github: https://github.com/sandialabs/verdict

Note that I've found issues with Verdict's use of the 'is_collapsed_quad' method to defer some quad computations to the triangle version. The results of quad_minimum_angle, quad_maximum_angle, and quad_scaled_jacobian will change if the node positions are rotated (0->1, ..., 3-> 0). There is also an issue with the use of 'signed_corner_areas' for computing 'quad_taper' and using the edge difference method provides more reliable results.

I don't know if using VTK's version would be the "latest", but this posted bug was fixed in this commit: https://github.com/Kitware/VTK/commit/655b94af18c05085838611b25f388d81d817420d

markcmiller86 commented 2 years ago

@bender10 thanks for pointing us to verdict on github. Didn't know any work was happening on Verdict. We have a few outstanding issues and ideas relating to Verdict. If you have any thoughts to add to any of those to recommend strategy, feel free to enter them in any of those issues.