# Adaptmesh chaging boundary labels

**URL:** <https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201>\
**Category:** General Discussion\
**Created:** [May 2, 2024, 9:00am UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201 "2024-05-02T09:00:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [May 2, 2024, 9:00am UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/1 "2024-05-02T09:00:49Z")

</div>

Hello everyone,

I have a mesh resulting from adaptmesh function, now, I’m trying to use this mesh to solve a new problem, however, my problem has neumann and non homogeneous dirichlet boundary conditions and the solution is coming out wrong, is there a way to use adaptmesh but keep the boundary labels?

For exemple, this is my initial mesh

```auto
real x0 = 0.;
real x1 = 1200;
real y0 = 0;
real y1 = 2200;

int globalH = 2^3;
mesh calP = square(globalH,globalH);

```

since I’m using square, the boundary labels are 1, 2, 3 and 4, I would like to keep this labels in the adapted mesh.

I’m using this function:

```auto
ReMeshIndicator(calP, Etah, V0, etaTot[], 1, nDoFu0);

```

as specified in the documentation section 5.1.9 Adaptation using residual error indicator.

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [May 2, 2024, 11:12am UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/2 "2024-05-02T11:12:47Z")

</div>

I think you might be having a different problem… adaptmesh shouldn’t change your boundary labels.

---

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [May 2, 2024, 12:47pm UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/3 "2024-05-02T12:47:41Z")

</div>

Interesting…  
because I have another example and the only thing that changes is the boundary condition, I though it might have something to do with it.

Thanks though!

---

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [May 3, 2024, 12:52pm UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/4 "2024-05-03T12:52:33Z")

</div>

I’m imposing a global boundary condition like this:

```auto
varf muhgbndDir(unused,muh) = int1d(calP, 1)((1.*muh)) + int1d(calP, 3)((0.*muh));

```

and then, when I look at the solution, it seems that for these specific corner elements, it doesn’t work and I have no idea why, beacause the other side is basically the same

 ![Screenshot from 2024-05-03 13-34-43](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/1/18530f8e3a549e505f77809972bad171a641c6af.png)

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [May 3, 2024, 1:10pm UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/5 "2024-05-03T13:10:39Z")

</div>

its unclear to me what you are trying to do. Your BC on boundary 3 is not doing anything since it is multiplied by 0. Did you mean to use the `on()` function?

---

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [May 3, 2024, 4:50pm UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/6 "2024-05-03T16:50:56Z")

</div>

either way, is the same problem  
the boundary condition on boundary 3 is suposed to do nothing, is there just in case I wanted to change examples  
but my problem is for the condition on boundary 1, it seems that it’s not working on that last element

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [May 3, 2024, 5:03pm UTC](https://community.freefem.org/t/adaptmesh-chaging-boundary-labels/3201/7 "2024-05-03T17:03:20Z")

</div>

What are you imposing on boundary 2?
