EvaluatePosition and EvaluateLocation don't commute in vtkLagrange cells
As the title states, the functions EvaluatePosition
(from physical space to element reference space) and EvaluateLocation
don't commute for vtkLagrange
cells (at least forvtkLagrangeQuadrilateral
and vtkLagrangeHexahedron
, although I'm pretty sure that most vtkHighOrder
cells are concerned).
This happens due to the fact that the EvaluatePosition
of vtkLagrange
cells linearizes the physical space to element reference space transform by calling the EvaluatePosition
of the subcells of the non-linear cell.
This linearization of the problem is exact if all subcells form a uniform cartesian mesh. But if this is not the case, a small error is introduced in EvaluatePosition
. Therefore, a subsequent call to EvaluateLocation
using the element reference space coordinates obtained from EvaluatePosition
won't yield the initial physical space coordinates given to EvaluatePosition
.
I suppose that this linearization gives good enough results for visualization purposes.
However, for numerical simulation codes which use VTK to compute shape functions or derivatives, the small error introduced in EvaluatePosition
might be important.
I have coded a fix for vtkLagrangeQuadrilateral
cells in which the transformation the physical space to element reference space is performed using a Newton solver based on the Jacobian of the transformation of the complete vtkLagrange
cell. It is important to note that this incurs an increase in the computational cost.
Before submitting an MR to treat this issue, I would want to discuss the following subjects
- Are you willing to improve the current implementation of
EvaluatePosition
for high-order cells? - If 1 is true, do you think that it might be worth it to use other function name for the new implementation such as
EvaluatePositionImproved
so that the user is aware that he's calling a more computationally expensive version ofEvaluatePosition
?