See: Boundary conditions about Mixed space - #2 by dokken i.e. you can use dolfinx.fem.petsc.set_bc
dolfinx.fem.petsc.set_bc