Simple 2D Periodic BC

Hey,

I’m new to Fenicsx and wondering if there is any easy and clean solution to 2D Periodic BCs?
Something like this implementation in dolfin but on all boundary sites and in dolfinx : https://fenicsproject.org/olddocs/dolfin/1.4.0/python/demo/documented/periodic/python/documentation.html

# Sub domain for Periodic boundary condition
class PeriodicBoundary(SubDomain):

    # Left boundary is "target domain" G
    def inside(self, x, on_boundary):
        return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)

    # Map right boundary (H) to left boundary (G)
    def map(self, x, y):
        y[0] = x[0] - 1.0
        y[1] = x[1]

# Create periodic boundary condition
pbc = PeriodicBoundary()

Thanks in advance

You can use dolfinx MPC: GitHub - jorgensd/dolfinx_mpc: Extension for dolfinx to handle multi-point constraints.
see for instance dolfinx_mpc/demo_periodic_geometrical.py at main · jorgensd/dolfinx_mpc · GitHub