# Problem with periodic bc

**URL:** <https://community.freefem.org/t/problem-with-periodic-bc/772>\
**Category:** General Discussion\
**Created:** [January 28, 2021, 10:38am UTC](https://community.freefem.org/t/problem-with-periodic-bc/772 "2021-01-28T10:38:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [January 28, 2021, 10:38am UTC](https://community.freefem.org/t/problem-with-periodic-bc/772/1 "2021-01-28T10:38:54Z")

</div>

hi,  
when i run this script :  
load “msh3”  
load “medit”  
load “UMFPACK64”  
load “iovtk”  
load"gmsh"  
lockOrientation = false;  
// Global parameters  
//verbosity = 0;  
real cpu=clock();  
int N=1;  
mesh3 Th=gmshload3(“CC\_simple\_geo.msh”);  
mesh3 Th2=gmshload3(“CC\_simple\_geo\_2.msh”);  
mesh3 Th3 = Th + Th2;  
mesh3 Th4 = gmshload3(“Thassembly.msh”);  
lockOrientation = true;  
fespace Ph(Th, P2);  
fespace Ph2(Th2, P2);  
Ph condair = 0.024;  
Ph2 condpu = 0.29;  
fespace Ph3(Th3, P2);  
Ph3 cond= condair+condpu;

mesh3 renumbered = Th4;  
fespace Vh(renumbered, P2,periodic=[[36,y,x],[35,y,x],[49,y,x],[61,y,x],[46,y,x],[64,y,x],[43,y,x],[58,y,x],[55,y,x],[52,y,x],[44,y,z],[39,y,z],[42,y,z],[38,y,z],[48,y,z],[51,y,z],[63,y,z],[56,y,z],[60,y,z],[54,y,z]]);  
Vh u = x + y + z, wh1,wh2,wh3,vh,coeffh;

i receive this error :

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/3a4138b1d69e560211b4f230a92519770d1a7eff.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/8a523de93b34b0f80359c9af92aac8bebaadbe54.png)

is there any solution please ?

---

<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 28, 2021, 4:50pm UTC](https://community.freefem.org/t/problem-with-periodic-bc/772/2 "2021-01-28T16:50:50Z")

</div>

Please, send the mesh file to see where is the problème.

---

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [January 28, 2021, 4:58pm UTC](https://community.freefem.org/t/problem-with-periodic-bc/772/3 "2021-01-28T16:58:37Z")

</div>

[CC\_simple\_geo\_2.mesh](https://community.freefem.org/uploads/short-url/lWfCL3FIvU9wAzo10W6aog2dT9a.mesh) (146.0 KB) [test6.edp](https://community.freefem.org/uploads/short-url/fJVtlwCl1j7DmXIdjHnfAyCNYpp.edp) (1.1 KB) [test6.log](https://community.freefem.org/uploads/short-url/lmxQTx9ThPaMS5sONQQnOkFbtGB.log) (2.4 KB) [Th.mesh](https://community.freefem.org/uploads/short-url/24jWptrhGxcL7KfoOGc2ComxB7l.mesh) (184.5 KB)

the problem is specially in surfaces 4 and 6 and also with surfaces 5 and 3.  
thank you.

---

<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 29, 2021, 3:29pm UTC](https://community.freefem.org/t/problem-with-periodic-bc/772/4 "2021-01-29T15:29:32Z")

</div>

I sorry put your code is wrong  
I do the following check:

1. the normal direction in you periodic B.C are wrong

the face with label 3?5 are // to plane 0,x,z so the periodic condition is [3,x,z],[5,x,z]

1. 

the mesh of surface 3 et 5 are not just a translation same for 4,6 surface,

So it is impossible to periodic B.C on this mesh.  
Please before to ask something do verification…

my freefem script to do verification:  
[test6-FH.edp](https://community.freefem.org/uploads/short-url/3A6wzkuoVRyU1tpj9VIKlrV8naN.edp) (2.2 KB)

---

<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 31, 2021, 2:25pm UTC](https://community.freefem.org/t/problem-with-periodic-bc/772/6 "2021-01-31T14:25:29Z")

</div>

An idea is to build all you surface mesh with you cad tool and do the assembly with freefem++.  
I know is a little tricky but it works.
