# Meshing in FreeFem++

**URL:** https://community.freefem.org/t/meshing-in-freefem/1459
**Category:** General Discussion
**Created:** [January 28, 2022, 5:50pm UTC](https://community.freefem.org/t/meshing-in-freefem/1459 "2022-01-28T17:50:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ajinks](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ajinks/32/816_2.png) [@Ajinks](https://community.freefem.org/u/Ajinks)
#### Post date: [January 28, 2022, 5:50pm UTC](https://community.freefem.org/t/meshing-in-freefem/1459/1 "2022-01-28T17:50:37Z")

</div>

Hi, I am creating a 2D mesh for my crack problem. I need one edge to be discretized into 100 parts. So, I used border commands for creation. It creates mesh. but the issue here is, Freefem++ considers that edge as the boundary. So It looks like parts are divided. I also attaching my code.

```auto
real d = 0.05;
border L1(t=0,1) {x=-0.5; y=-0.5+(0.5-d)*t;}
border C1(t=0,1) {x=-0.5+0.5*t; y=-d+d*t;}
border CC1(t=0,1){x=0; y=0-0.5*t;}
border B1(t=0,1) {x=0-0.5*t; y=-0.5;}
border C2(t=0,1) {x =0-0.5*t;y = 0+d*t ;}
border L2(t=0,1) {x = -0.5; y=d+(0.5-d)*t; }
border T1(t=0,1) {x = -0.5+0.5*t; y=0.5; }
border CC2(t=0,1){x = 0; y=0.5-0.5*t;}
border C3(t=0,1) {x= 0+0.5*t; y=0; }
border R1(t=0,1) {x= 0.5; y=0-0.5*t;}
border B2(t=0,1) {x=0.5-0.5*t; y=-0.5;}
border T2(t=0,1) {x = 0+0.5*t; y=0.5;}
border R2(t=0,1) {x = 0.5;y=0.5-0.5*t; }

int n = 10;
//plot(L1(-n) + C1(-n) + CC1(-n) + B1(-n) + C2(-n) + L2(-n) +T1(-n)
// + CC2(-n) + C3(-n) + R1(-n) +B2(-n) + T2(-n) + R2(-n) , wait=true);

mesh Th = buildmesh(L1(-n) + C1(-n) + B1(-n) + C2(-n) + L2(-n) +T1(-n)
     + C3(-100) + R1(-20) +B2(-n) + T2(-n) +R2(-20) );

plot(Th, wait=true);

```

I don’t want C3 as a boundary. How should I use discretization without boundaries?

Previously I tried to import the mesh from GMSH but it not working.

---

<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: [January 30, 2022, 11:58am UTC](https://community.freefem.org/t/meshing-in-freefem/1459/2 "2022-01-30T11:58:00Z")

</div>

I am note sure to understand why there is a problem here. Your mesh contains an internal border (C3) but is still simply connected. The mesh contains two closed regions, so when you plot it there are two colors, but the regions (parts) are not divided.  
As a remark, you gave no labels to the borders, so you will not be able to set boundary conditions.  
For controlling the mesh without boundaries you can look at the `adaptmesh()` function: [Mesh Generation](https://doc.freefem.org/documentation/mesh-generation.html#the-command-adaptmesh)

---

<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: [February 3, 2022, 2:05pm UTC](https://community.freefem.org/t/meshing-in-freefem/1459/3 "2022-02-03T14:05:08Z")

</div>

To remove the internal boundary you can do

```auto
     Th=change(Th,rmInternalEdges=1);

```

and to haveolso only one region 0

```auto
      Th=change(Th,rmInternalEdges=1,fregion=0);

```

after build mesh Th.

---

<div class="post-metadata">

### Author: ![Ajinks](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ajinks/32/816_2.png) [@Ajinks](https://community.freefem.org/u/Ajinks)
#### Post date: [February 3, 2022, 3:15pm UTC](https://community.freefem.org/t/meshing-in-freefem/1459/4 "2022-02-03T15:15:31Z")

</div>

Thanks, both for your remarks. It solved the problem of internal boundary problems.

---

<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: [February 4, 2022, 9:13am UTC](https://community.freefem.org/t/meshing-in-freefem/1459/5 "2022-02-04T09:13:11Z")

</div>


