Skip to content

Ensure fibre vectors have unit length

Kristian Gregorius Hustad requested to merge kghustad/renormalise-fibres into master

What does this MR do?

Using incorrectly scaled fibre vectors can lead to divergence in the PDE solver. The root cause can be difficult to identify for the end user. @lenam and @hermenegild discovered this issue. They found that the fibres generated by CARPentry were not properly normalised. Regardless of which program generated the fibres, it would be useful if openCARP would renormalise the fibres if needed.

The normality check performed here is relatively inexpensive (~7 ms for 419 000 elements running on a single core) and will also inform the user if some of the fibre vectors are incorrectly scaled (i.e. don't have unit length).

I have attempted to follow the coding style, but do let me know if you would like any changes.

Some points for the reviewer to consider:

  • zero-length vectors are now being silently ignored. Should this be handled differently?
  • The check is currently performed unconditionally. Should it be possible to disable/enable with a parameter?
  • Would a fibre orthogonality check be useful (when two fibre directions are provided per element)?

Related issues

Author's checklist

Reviewer's checklist

All reviewers can help ensure accuracy, clarity, completeness, and adherence to the Contribution Guidelines.

Reviewer

  • Review by a code reviewer or other selected colleague to confirm accuracy, clarity, and completeness. This can be skipped for minor fixes without substantive content changes.

Maintainer

  • Review by assigned maintainer, who can always request/require the above reviews.
  • Ensure a release milestone is set.
Edited by Kristian Gregorius Hustad

Merge request reports