Handmade Matlab FEM...
Clear all

Handmade Matlab FEM solver not converging with refinement


New Member
Joined: 2 months ago
Posts: 1
Topic starter  

Hello everyone,

To solve 2D Helmholtz equation on a square, I wrote on Matlab a FEM solver with P1 triangular elements. But when I refine the mesh, the solution decreases in amplitude almost linearly with the mesh refinement (in terms of element size).

I don't understand my mistake. I though that I wrongly assembled the stiffness, but don't see the problem, regarding the theory.

If anyone could have a look on my code, it would be amazing, since I really need to fix this issue.  I can my code in attachment, if asked (around 100 lines, all hand made, without the matlab FEM functions).

If preferred, we can also have a short call to introduce quickly to the code in order not to waste your time.

I am sure (at least I hope) it's a stupid mistake, but...

Thanks in advance!