I am quite new at FEM. I was trying to create a triangular mesh of a rectangular region. I wanted to do something very basic: Discretize the domain using squares and then subdivide each square into two rectangles. Here is the code:
Needs["NDSolve`FEM`"]
Nx = 4;
Ny = Nx;
Dx = Subdivide[-2, 2, Nx]
Dy = Subdivide[-2, 2, Ny]
vertcoords = Tuples[{Dx, Reverse@Dy}]
LTidx = {(#1 - 1)*(Nx + 1) + #2, (#1)*(Nx + 1) + #2, (#1)*(Nx +
1) + #2 + 1} & @@@ Tuples[{Range[1, Nx], Range[1, Ny]}];
UTidx = {(#1 - 1)*(Nx + 1) + #2 +
1, (#1 - 1)*(Nx + 1) + #2, (#1)*(Nx + 1) + #2 + 1} & @@@
Tuples[{Range[1, Nx], Range[1, Ny]}];
Tidx = Flatten[Transpose@{LTidx, UTidx}, 1]
\[CapitalOmega] =
ToElementMesh["Coordinates" -> vertcoords,
"MeshElements" -> {TriangleElement[Tidx]}]
\[CapitalOmega]["Wireframe"]
The plot looks fine to me, but then I get a warning:
ToElementMesh::femimq: The element mesh has insufficient quality of -0.866025. A quality estimate below 0. may be caused by a wrong ordering of element incidents or self-intersecting elements.
I am not entirely sure what's wrong here.
Thanks