# Mesh problem bad sens

**URL:** <https://community.freefem.org/t/mesh-problem-bad-sens/195>\
**Category:** General Discussion\
**Created:** [December 12, 2019, 6:49pm UTC](https://community.freefem.org/t/mesh-problem-bad-sens/195 "2019-12-12T18:49:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiam](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@wiam](https://community.freefem.org/u/wiam)\
**Post date:** [December 12, 2019, 6:49pm UTC](https://community.freefem.org/t/mesh-problem-bad-sens/195/1 "2019-12-12T18:49:37Z")

</div>

help please ,i cant mesh my space "Meshing error: Bamg  
number : 777, " bad sens and i dont know where the problem is i checked in every common poit its verifies that the space is closed  
this is my program  
//datas  
int a=1;  
int N=50;  
//trace des bordures:

border ommega1(t=0,1){label=1;x=2_a_t;y=-2_a_(t-1);};  
border ommega2(t=0,1){label=1;x=-2_a_(t-1);y=-2_a_t;};  
border ommega3(t=0,1){label=1;x=0;y=a_t-2_a;};  
border ommega4(t=0,1){label=2;x=a_sin(pi_t);y=a_cos(pi_t);};  
border ommega5(t=0,1){label=1;x=0;y=a\*t+a;};

plot(ommega1(N)+ommega2(N)+ommega3(N)+ommega4(N)+ommega5(N));

mesh Th= buildmesh(ommega1(N)+ommega2(N)+ommega3(N)+ommega4(N)+ommega5(N));

plot(Th);

---

<div class="post-metadata">

**Author:** ![iftikhar](https://avatars.discourse-cdn.com/v4/letter/i/cab0a1/32.png) [@iftikhar](https://community.freefem.org/u/iftikhar)\
**Post date:** [December 13, 2019, 10:44am UTC](https://community.freefem.org/t/mesh-problem-bad-sens/195/2 "2019-12-13T10:44:30Z")

</div>

There is problem with your parametric equations, they are not defined correctly.  
Instead you can try this code.

//data for  
int a=1;  
int n=50;  
// trace des borders  
border b1(t=0,2){x=t;y=t-2; label=1;}  
border b2(t=2,0){x=t;y=-t+2; label=2;}  
border b3(t=2,1){x=0;y=t; label=3;}  
border b4(t=1,-1){x=sqrt(1-t^2);y=t; label=4;}  
border b5(t=1,2){x=0;y=-t; label=5;}

plot(b1(n)+b2(n)+b3(n)+b4(n)+b5(n));

mesh Th=buildmesh(b1(n)+b2(n)+b3(n)+b4(n)+b5(n));  
plot(Th);

---

<div class="post-metadata">

**Author:** ![wiam](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@wiam](https://community.freefem.org/u/wiam)\
**Post date:** [December 15, 2019, 7:42pm UTC](https://community.freefem.org/t/mesh-problem-bad-sens/195/3 "2019-12-15T19:42:29Z")

</div>

thank you it worked i tried again and made sure the - borders are oriented counter-clockwise  
so i got this code //datas  
real a=1;  
real k=0.05;  
real T=100;  
real dt=1;  
real t=0;  
int N=100;  
int ue=80;  
//trace des bordures:

border ommega1(t=0,1){label=1;x=-2_a_t+2_a;y=2_a_t;};  
border ommega2(t=0,1){label=2;x=2_a_t;y=2_a_t-2_a;};  
border ommega3(t=0,1){label=3;x=0;y=-a_t-a;};  
border ommega4(t=0,1){label=4;x=a_sin(pi_t);y=a_cos(pi_t);};  
border ommega5(t=0,1){label=5;x=0;y=-a_t+2\*a;};  
plot(ommega5(N)+ommega4(N)+ommega3(N)+ommega2(N)+ommega1(N));  
mesh Th= buildmesh(ommega5(N)+ommega4(N)+ommega3(N)+ommega2(N)+ommega1(N));  
plot(Th);  
thank you for the help

---

<div class="post-metadata">

**Author:** ![AFourmont](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/afourmont/32/56_2.png) [@AFourmont](https://community.freefem.org/u/AFourmont)\
**Post date:** [December 17, 2019, 4:48pm UTC](https://community.freefem.org/t/mesh-problem-bad-sens/195/4 "2019-12-17T16:48:09Z")

</div>

Hello,  
just one remark, don’t use the variable N in your script,  
it’s aFreeFEM variable environnement  
Axel
