Here is a report that I wrote for my numerical analysis course at Marquette University.
Right now the code solves an arbitrary 2-d waveguide geometry for its k value. The code uses an eigenmode solution and should be rather easy to implement the eigenvector solution and print it out on gmesh.
Sidabras, J.W., “An Open-Source Cross-Platform Finite-Element Modeling Program”, EECE 249 - Numerical Techniques in Electromagnetics, December 14, 2007.