# Periodic Boundary Conditions for a 2D Problem

**URL:** <https://community.freefem.org/t/periodic-boundary-conditions-for-a-2d-problem/2859>\
**Category:** General Discussion\
**Created:** [January 1, 2024, 11:14am UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-a-2d-problem/2859 "2024-01-01T11:14:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.javad98](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@m.javad98](https://community.freefem.org/u/m.javad98)\
**Post date:** [January 1, 2024, 11:14am UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-a-2d-problem/2859/1 "2024-01-01T11:14:24Z")

</div>

Hi, I am new to FreeFem++, and I am trying to solve a BVP to obtain the micropolar strain localization tensor in a 2D square with some periodic boundary conditions that its dimensions are as follows: [-0.5,0.5]×[-0.5,0.5]. I have four unknowns, h1,h2,h3, and h4.

The boundary conditions are  
h1(-0.5,y)+ h3(-0.5,y)= h1(0.5,y)+ h3(0.5,y)  
h2(-0.5,y)+ h4(-0.5,y)= h2(0.5,y)+ h4(0.5,y)  
h1(x,-0.5)+ h3(x,-0.5)= h1(x,0.5)+ h3(x,0.5)  
h2(x,-0.5)+ h4(x,-0.5)= h2(x,0.5)+ h4(x,0.5)

I have a problem with defining these boundary conditions in FreeFem++.

I would appreciate it if you could help me with this.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [January 2, 2024, 3:04pm UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-a-2d-problem/2859/2 "2024-01-02T15:04:20Z")

</div>

If you problem is linear make a change of variable

h13 = h1+h3  
h31 = h1-h3  
h24 = h2+h4  
h42 = h2-h4  
h13 and h24 will be real periodic,  
which BC on h31 and h42 ?

if you know ? you can write the Variationnal form.  
otherwise you problem is not well defined!

---

<div class="post-metadata">

**Author:** ![m.javad98](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@m.javad98](https://community.freefem.org/u/m.javad98)\
**Post date:** [January 15, 2024, 1:50pm UTC](https://community.freefem.org/t/periodic-boundary-conditions-for-a-2d-problem/2859/3 "2024-01-15T13:50:02Z")

</div>

Dear Prof. Hecht,

Thank you for your help, it worked well for my problem.

Sincerely,  
Javad
