From generic element to periodic element

Hi there!

So I have the following problem. I have two finite element spaces over a square domain in my program:

fespace Vh(Th, P1);
fespace Vhp( Th , P1 , periodic = [ [2,y],[4,y],[1,x],[3,x] ]);

I have an element u of type Vh which is zero on the boundary. Since u is clearly periodic, is there a way to turn u from type Vh to type Vhp? Or is there a clean way to create a new element v of type Vhp that is equal to u?

I would like to add that my domain in a square.

mesh Th = square(n, m, [x0+(x1-x0)*x, y0+(y1-y0)*y]);
Vh u;

I’ve tried to guess which indices of u[] correspond to the boundary elements but this was to no avail. Anyone can help?

Have you tried simply Vhp up = u?