You could try to use the assemble_nest
functionality highlighted in: dolfinx_mpc/python/demos/demo_stokes_nest.py at main · jorgensd/dolfinx_mpc · GitHub
or you could try to use my newly developed periodic mesh: Periodic conditions for vector valued spaces - #9 by dokken (given that your mesh is actually periodic).