# Phase shifted periodic BC

**URL:** <https://community.freefem.org/t/phase-shifted-periodic-bc/4224>\
**Category:** General Discussion\
**Created:** [February 23, 2026, 12:35pm UTC](https://community.freefem.org/t/phase-shifted-periodic-bc/4224 "2026-02-23T12:35:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khaldrogo](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Khaldrogo](https://community.freefem.org/u/Khaldrogo)\
**Post date:** [February 23, 2026, 12:35pm UTC](https://community.freefem.org/t/phase-shifted-periodic-bc/4224/1 "2026-02-23T12:35:43Z")

</div>

I am relatively new to freefem++. I am just wondering if there’s a way to implement a phase shifted ‘periodic’ bc? say instead of:  
int[int] labPeriodic = [1, 3];  
macro Pk()[P2, P2, P1], periodic=[[labPeriodic[0],rcoord], [labPeriodic[1],rcoord]]// EOM

i want that bc[1]=phase\*bc[3].

Will appreciate any response.

---

<div class="post-metadata">

**Author:** ![vlaude](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/vlaude/32/939_2.png) [@vlaude](https://community.freefem.org/u/vlaude)\
**Post date:** [February 23, 2026, 4:47pm UTC](https://community.freefem.org/t/phase-shifted-periodic-bc/4224/2 "2026-02-23T16:47:21Z")

</div>

Dear Khaldrogo,

Do you want to implement a Bloch wave computation? If you have a solution of the form u(x,y) exp(i (kx\*\*x+ky\*\*y)) where u(x,y) is periodic, it is better to introduce the Bloch wavevector k=(kx,ky) inside the variational form directly by selecting function u(x,y) as the FE function to solve for instead of the full Bloch wave.

Let us know what your exact need is, so we can look for an example. The code you suggest does not make much sense now.

Vincent

---

<div class="post-metadata">

**Author:** ![Khaldrogo](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Khaldrogo](https://community.freefem.org/u/Khaldrogo)\
**Post date:** [February 23, 2026, 5:46pm UTC](https://community.freefem.org/t/phase-shifted-periodic-bc/4224/3 "2026-02-23T17:46:57Z")

</div>

Hello Sir. Thank you for your response.

Yes, I want to do some sort of Bloch wave computation. I’m doing a global stability analysis (Fourier decomposition only in time). Right now, im doing effectively bc[1]=bc[3], where phase=0 by using the built-in periodic function in freefem. I already have a working code.

But in general case where phase is not equal to zero (e^(im\*theta) where m\>0), I want to know if it is possible? let me know if it’s not clear. I might not have explained it clearly.

---

<div class="post-metadata">

**Author:** ![vlaude](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/vlaude/32/939_2.png) [@vlaude](https://community.freefem.org/u/vlaude)\
**Post date:** [February 23, 2026, 9:36pm UTC](https://community.freefem.org/t/phase-shifted-periodic-bc/4224/4 "2026-02-23T21:36:24Z")

</div>

Yes, your explanations are very unclear to me.

You do a Fourier decomposition only in time but do a (periodic) finite element computation in space. Do you represent time as a spatial coordinate?

Can you please write down your equations?
