I’m doing a postprocessing work which needs to calculate the Gauss integration points’ Cartesian coordinates. One way to implement this is substituting the Gauss coordinates into the basis functions or shape functions, and then multiplying the basis function vector with the element nodal coordinates vector.
Here, my question is about the basis functions used in FreeFem++. I found it is a bit different from that in the monograph of “The Finite Element Method Its Basis and Fundamentals” by Zienkiewicz, Taylor & Govindjee. According to the source code
FreeFem-sources/src/femlib/P012_2d.cpp at master · FreeFem/FreeFem-sources · GitHub
FreeFem-sources/src/femlib/P012_3d.cpp at master · FreeFem/FreeFem-sources · GitHub
where the nvedge array can be found in
FreeFem-sources/src/femlib/Mesh2dn.cpp at master · FreeFem/FreeFem-sources · GitHub
FreeFem-sources/src/femlib/Mesh3dn.cpp at master · FreeFem/FreeFem-sources · GitHub
The basis functions for P2 triangular element is
// P2 Lagrange shape functions
[l0 * (2 * l0 - 1),
l1 * (2 * l1 - 1),
l2 * (2 * l2 - 1),
4 * l1 * l2,
4 * l2 * l0,
4 * l0 * l1];
and for P2 tetrahedral element is
// P2 Lagrange shape functions
[l0 * (2 * l0 - 1),
l1 * (2 * l1 - 1),
l2 * (2 * l2 - 1),
l3 * (2 * l3 - 1),
4 * l0 * l1,
4 * l0 * l2,
4 * l0 * l3,
4 * l1 * l2,
4 * l1 * l3,
4 * l2 * l3];
Are the above results correct?