SimVascular / svFSI

A multi-physics finite element solver for patient-specific blood flow simulation including fluid-structure interaction and cardiac electrophysiology
Other
31 stars 49 forks source link

Remeshing node interpolation does not always find the correct element #105

Open ktbolt opened 1 year ago

ktbolt commented 1 year ago

When remeshing the FINDN subroutine in the REMESH.f file is used to find the element in the old mesh for each node in the new mesh. This is used to interpolated the last solution to the new mesh.

When comparing the Fortran remeshing code results with the converted C++ code I've noticed that FINDN does not always return the element the node is actually contained in.

FINDN calls the MAT_INV function which in turn calls the MAT_INV_GE function to compute the inverse of a 4x4 matrix used to find the local element coordinates for a given node.

The problem is that MAT_INV_GE does not always compute the correct inverse matrix. The inverse matrix can in fact sometimes contain NaNs.

ktbolt commented 1 year ago

For svFSIplus I reimplemented the MAT_INV_GE function to compute a better pivot element I think and now the correct element is always found.