Add a more robust make_boundaries_periodic(..) and use for a cube mesh