# How to mesh annulus?

**URL:** <https://community.freefem.org/t/how-to-mesh-annulus/1295>\
**Category:** General Discussion\
**Created:** [November 3, 2021, 4:04pm UTC](https://community.freefem.org/t/how-to-mesh-annulus/1295 "2021-11-03T16:04:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![distractor](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@distractor](https://community.freefem.org/u/distractor)\
**Post date:** [November 3, 2021, 4:04pm UTC](https://community.freefem.org/t/how-to-mesh-annulus/1295/1 "2021-11-03T16:04:35Z")

</div>

Hi,

I tried to mesh annulus with different number of nodes on the inner radius:

```auto
real r1 = 1.0;
real r2 = 1.3;
border outter(t = 0, pi / 2.){x = r2 * cos(t); y = r2 * sin(t); label=1;}
border inner(t = 0, pi / 2.){x = r1 * cos(t); y = r1 * sin(t); label=2;}
border left(t = 0, 1){x = 0; y = r1 + (r2 - r1) * t; label=3;}
border bottom(t = 0, 1){x = r1 + (r2 - r1) * t; y = 0; label=4;}
mesh Th = buildmesh(left(30) + outter(50) + bottom(30) + inner(30));
if (makePlot) {
    plot(Th, wait=1, cmm="Initial mesh");
}

```

But this does not work for some reason.

The expected result is something like this:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/585406704a88ee7c95da0ed0c43554c3eb09675e.jpeg)

---

<div class="post-metadata">

**Author:** ![julienG](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/julieng/32/222_2.png) [@julienG](https://community.freefem.org/u/julienG)\
**Post date:** [November 3, 2021, 8:39pm UTC](https://community.freefem.org/t/how-to-mesh-annulus/1295/2 "2021-11-03T20:39:08Z")

</div>

Sorry, I cannot write full functional example. but I hope this will help

> // TT : the mesh  
> // Rrad : ring radii [Rout,Rin]  
> // Aangle : angular sector (in units of pi)  
> // npts : the nb of points on the perimeter  
> // labs : array of labels of segments of the boundary  
> // labs[0] : outter disk border  
> // labs[1] : inner disk border  
> // labs[2] : axis 1  
> // labs[3] : axis 2  
> real LCout=Aangle\*pi\*Rrad[0], LCin=Aangle\*pi\*Rrad[1], LZ=Rrad[0]-Rrad[1];  
> int CptsIn= int(npts\*LCin/(LCin+LCout+2\*LZ)); // pts on the circle-axis sides  
> int CptsOut= int(npts\*LCout/(LCin+LCout+2\*LZ)); // pts on the circle-axis sides  
> int Zpts= int(npts\*LZ/(LCin+LCout+2\*LZ)); // pts on the z-axis sides  
> border circleOut (t=0.0,Aangle\*pi){  
> x=Rrad[0]\*cos(t);  
> y=Rrad[0]\*sin(t);  
> label = labs[0];}  
> border circleIn (t=Aangle\*pi,0){  
> x=Rrad[1]\*cos(t);  
> y=Rrad[1]\*sin(t);  
> label = labs[1];}  
> border axis1 (t=Rrad[0],Rrad[1]){  
> x=t\*cos(Aangle\*pi);  
> y=t\*sin(Aangle\*pi);label = labs[2];}   
> border axis2 (t=Rrad[1],Rrad[0]){x=t;y=0;label = labs[3];}   
> TT=buildmesh(circleOut(CptsOut)+axis1(Zpts)+circleIn(CptsIn)+axis2(Zpts));

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 3, 2021, 9:49pm UTC](https://community.freefem.org/t/how-to-mesh-annulus/1295/3 "2021-11-03T21:49:11Z")

</div>

Simply change your mesh definition to this and it works.

```auto
mesh Th = buildmesh(left(-30) + outter(50) + bottom(30) + inner(-30)); // notice the - signs

```
