# Periodic Boundary Conditions for Mixed Finite Element Spaces

**URL:** <https://community.freefem.org/t/periodic-boundary-conditions-for-mixed-finite-element-spaces/4289>\
**Category:** General Discussion\
**Created:** [May 29, 2026, 9:59am UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-mixed-finite-element-spaces/4289 "2026-05-29T09:59:53Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [June 3, 2026, 11:49am UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-mixed-finite-element-spaces/4289/18 "2026-06-03T11:49:17Z")

</div>

The syntax error was due to a wrong definition `[un1ref, un2ref,rhon1ref,rhon2ref,pnref,mun1ref,mun1ref]` (`mun1ref` is repeated) instead of `[un1ref,un2ref,rhon1ref,rhon2ref,pnref,mun1ref,mun2ref]`.

In order to define an array of vector finite elements, you can do as (for example)

```auto
fespace Vh(Th,[P2,P1]);
Vh [u,v],[u1,v1];
Vh[int] [ua,va](3);
[u,v]=[x+y,x-y];
[ua[0],va[0]]=[u,v];
[u1,v1]=[ua[0],va[0]];

```

Your code corrected with this approach:  
[ff.edp](https://community.freefem.org/uploads/short-url/bfHLBqQ4iLk4YFgYPOw3envhqT0.edp) (17.4 KB)

---

_[View the full topic](https://community.freefem.org/t/periodic-boundary-conditions-for-mixed-finite-element-spaces/4289)._
