Periodic boundary conditions with PETSc and vectorial FEspace

Hello,
I’m trying to figure out the correct syntax for generating the matrices with
periodic boundary conditions with PETSc and vectorial FEspace, such as in the case of Stokes equations with periodic boundary conditions.
I looked at diffusion-periodic-2d-PETSc.edp and stokes-2D-PETSc.edp, and came up with this code, but I get an error:
load “PETSc” //
include “macro_ddm.idp” //
macro dimension()2// EOM // 2D or 3D

int[int] labPeriodic = [1,2,3,4];
macro Pk() [P2,P2,P1], periodic=[[2,y],[4,y]] //EOM
mesh Th = square(40,40);
Mat A;
int[int] n2o;
macro ThPeriodicity()labPeriodic//
macro ThN2O()n2o//
buildDmesh(Th)
//createMat(Th, A, Pk) //<--------------- This didn’t work either
buildMatPeriodic(Th, getARGV(“-split”, 1), A, Pk, piCommWorld,labPeriodic)

Thanks

The correct code should be

load “PETSc” //
include “macro_ddm.idp” //
macro dimension() 2 // EOM // 2D or 3D

int[int] labPeriodic = [2, 4];
macro Pk() [P2, P2, P1], periodic=[[labPeriodic[0], y], [labPeriodic[1], y]] //EOM
mesh Th = square(40, 40);
Mat A;
int[int] n2o;
macro ThPeriodicity() labPeriodic //EOM
macro ThN2O() n2o //EOM
buildDmesh(Th);
{
    macro def(u) [u, u#B, u#C] //
    macro init(u) [u, u, u] //
    createMat(Th, A, Pk);
}

Thank you, it worked.
Just one correction, I think you meant
macro Pk() [P2, P2, P1], periodic=[[labPeriodic[1], y], [labPeriodic[3], y]] //EOM

I think you meant macro Pk() [P2, P2, P1], periodic=[[labPeriodic[1], y], [labPeriodic[3], y]] //EOM

No. If your boundaries of label=2, 4 is a pair of periodic boundaries, then

int[int] labPeriodic = [2, 4];
macro ThPeriodicity() labPeriodic //EOM

and the FE macro is

macro Pk() [P2, P2, P1] periodic=[[labPeriodic[0], y], [labPeriodic[1], y]] //