I built the stiffness matrix for the Poisson equation on a 2-dimensional domain with the shape of "almost" an octagon, using pyramid basis functions. I used almost to intend the fact that I have an "irregular" shape.
The mesh has been given to me by a point matrix $P$ and a connectivity matrix $T$. In $P$ I have the points of the domain, while in the matrix $T$ I have in each entry the vertices of the triangles. On page 47 of Larson & Bengzon book (section "Data Storage Structures") is explained better what I mean with a simple example.
Anyway, I implemented the assembly procedure as described on page 85 and I
obtain the right result for simple squared domains. I also tried to use the code for the $[0,1]$-interval with grid size $h$ and things are good.
Of course here the point matrix is made by a linspace
from $0$ to $1$, while $T$ is a matrix like $$T =\begin{bmatrix} 1& 2&3 \\ 2&3&4\end{bmatrix} $$ and I end up with the usual Laplacian matrix (modulo a factor of $h$). So it's right.
Now the main question:
How can I check that the matrix I obtain for the "irregular" domain is correct?
I already checked it's symmetric, and since there were Homogeneous Dirichlet boundary conditions I followed the approach of Wolfgang Bangerth explained here at slide 14 (approach 2a). After this, I computed the condition number $K$ of the matrix and it is $K \approx 6$.
assema
to see if the matrix is the same, but the MatLab stiffness matrix is even singular! (My matrix, as wrote above, has condition number equal to $6$. As far as I know, this is usual for matrix coming from finite element discretizations $\endgroup$