It is now complete and working. I also added some minor improvements to moduleMesh.f90 using 'associate' to practice.
I noticed there are a lot of things (allocating K, for example) that are common for all meshes and should be moved to a general module.