Combining periodic and non periodic boundary conditions


Is there a way to combine periodic and non-periodic boundary conditions in the same problem in FreeFEM++? Particularly, I am interested in modeling Navier-Stokes equations with periodic boundary conditions for velocity and do-nothing conditions for pressure. Is there a way to side-step this old bug that doesn’t allow to mix periodic and non-periodic boundary conditions?

Thank you.

Can anyone comment on this matter, one way or the other? I am trying to decide whether to switch to a new software. If I need to provide a code to illustrate this issue, I can definitely do so.

Hi, @Alex
First I am sorry I can’t solve your problem. Do you mean that you define a FE space with vector format and not all FE functions satisfy periodic boundary conditions? you want to separate some of functions in FE space to deal with periodic boundary conditions, right?
Thank you.


I am trying to set up the FE spaces for velocity and pressure (Navier-Stokes) in such a way that the boundary conditions for velocity are periodic, and the ones for pressure are not. Unfortunately, it seems that the moment I decide to have periodic BCs for velocity, I no longer have a choice and I MUST introduce the vector FE space for velocity AND pressure, with periodic BCs for both of them, as in

fespace Vh2(Th3,[P2,P2,P2,P1], periodic=[[2,y,z],[4,y,z],[5,x,y],[6,x,y]]);

What I want is something like

fespace Vh2(Th3,P2, periodic=[[2,y,z],[4,y,z],[5,x,y],[6,x,y]]); for velocity


fespace Vh(Th3,P1) for pressure.

It’s OK if this cannot be done in FreeFEM++; I just need to know for sure, before I invest my time in learning another software.

Thank you,

I am not an expert in FreeFem, but I think you can define 2 separate FE spaces as you mentioned, and then assemble your matrices from blocks. A similar example can be found for the Stokes equation here.

Hi Aszaboa,

Thank you for your input and the link; to be honest, I haven’t tried assembling the matrices from blocks, but I doubt that this will resolve the issue. In all the examples that I’ve seen, periodicity is assumed for both velocity and pressure, and they are combined in a corresponding vector FE space.

Hi Alex,

In the example I linked in my previous post, the velocity and pressure are defined in different FE spaces. I don’t see why you could not enforce periodicity in the velocity FF field and specify a different BC in the pressure field (but I might be wrong).

Aszaboa - yes, the logic says that this should definitely be possible. However, there exists an old bug in FreeFEM, that doesn’t allow any combination of FE spaces in one problem, if one of these spaces has periodic boundary conditions. I created this post to see if this has been fixed.

I know, to day it is impossible to mix periodic and non periodic t’espace in same problem.

But generally, for Stokes or Navier-Stokes the periodic boundary condition are
on variable U and grad§, not P so P is periodic through a constante C.

For example in 2d a channel ]0,1[^2 with periodic BC (ie. x == x+ 1)
=> P = Pper + Cx , and the constant C is the parameter to fixe the horizontal flux.
where Pper is periodic.

you can write you formulation with unwon U,Pper if you now the constant C.

for Stokes Pb you can compute U,Pper by solving :

 - nu Laplacien(U) + grad (Pper) = -grad(Cx)  = [ -C , 0] 
  div(U) = 0