I'm trying to create a periodic mesh on a stochastically generated geometry contained within a cubical domain. To ensure that the mesh is periodic I do the meshing step by step by first meshing three orthogonal edges and copying them to all parallell edges. I then mesh every surface and copy it to its adjacent surface. Then fill in the geometry with free tetrahedrals.
For almost all my geometries, the meshing fails when I'm trying to copy the surface meshes. Some copying operations will fail due to "Different number of elements on edges". I don't understand why. COMSOL highlights which edge is failing and I've tried both making the element size finer, and specifying the number of elements. Outright counting the number of elements by eye also indicates that the number of elements should be the same. So why is COMSOL giving me this error?