Vector Finite Elements

Well I managed to complete my mission. I figured out first and second order vector finite elements. It was quite the struggle. Understanding the Math is one but there is quite some more detail to get right regarding the local and global orientations of vector basis functions and the management of all that information in the mesh.

To my surprise, ChatGPT has been quite helpful in debugging on several occasions. Mostly in detecting more annoying programming errors like switching the return argument order of two matrices you calculate or forgetting to do your indexing correctly.

And then even if you program your vector finite elements correctly, you have to find a way to interpolate the fields to check if your modes make sense. In this case, the interpolation functions are the same basis function you also use to compute the matrix coefficients so its easy to make a mistake in both, one or the other and not know where it is coming from. Is your result wrong because you plot correctly with wrong data or are you creating the right data but plotting it correctly? Ive had all situations occur.

In any case, now that I have the second order Nedelec basis function working, I can start implementing boundary condition and more modelling features and intelligence. If I find the time I really hope to share more regular updates!

The vector field of the second resonance mode in a box cavity

The easiest problem to tackle at first is an eigenmode problem. You only have to implement the PEC boundary condition, which is just a matter of removing those corresponding rows and columns from the matrices.

Where each tetrahedron in the first order Nedelec basis function has just 6 terms that have to be computed (6 by 6 matrix coefficients), the second order basis function has 20 (20x20). In order to make sure I got them all correctly, I implemented a quick symbollic solver using some more abstract programming in Python. This took some effort but eventually meant that I was fairly certain that I got the right values and coefficients. I still ended up making an error but if I had to do all of this by hand it would have been much more sensitive to errors!

Next
Next

Searching the space of filters [Heavi]