# Wrong orientation of "internal" boundary elements

**URL:** https://community.freefem.org/t/wrong-orientation-of-internal-boundary-elements/3402
**Category:** General Discussion
**Created:** [July 17, 2024, 4:28pm UTC](https://community.freefem.org/t/wrong-orientation-of-internal-boundary-elements/3402 "2024-07-17T16:28:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [July 17, 2024, 4:28pm UTC](https://community.freefem.org/t/wrong-orientation-of-internal-boundary-elements/3402/1 "2024-07-17T16:28:06Z")

</div>

Hello,  
I am importing a simple 2d mesh from a file meshtest.msh as

```auto
10 9 11
0. 0. 1
0. 1. 10
1. 0. 1
2. 0. 4
0. 2. 10
1. 2. 2
2. 2. 4
2. 3. 4
1. 3. 4
0. 3. 10
1 3 2 11
3 4 6 11
3 6 2 11
4 7 6 11
6 5 2 99
8 6 7 11
10 5 6 99
9 10 6 11
8 9 6 11
10 5 10
5 2 10
8 9 4
9 10 4
4 7 4
7 8 4
1 3 1
3 4 1
2 1 3
2 6 2
6 10 2

```

It looks like

 ![meshtest](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/4/4fdbe1e6739c096b5fcaf90cf25175d7a2327484.png)  
The box has height 3 and width 2

The fact is that it has two internal border elements (the two last lines of the file), with boundary label 2, each linking respectively the points  
(0. , 1.) to (1. , 2.)  
(1. , 2.) to (0. , 3.)  
They delimit two regions, number 11 (on the right) and 99 (on the left).  
When I upload the file with `readmesh`, the orientation of the first element is inverted, it goes down instead of going up, linking (1.,2.) to (0. , 1.) instead of the converse.  
We have (0. , 1.) = vertex 1, (1. , 2. ) = vertex 5, (0. , 3. ) = vertex 9  
Here is the test file  
[testinternalelement.edp](https://community.freefem.org/uploads/short-url/sEPkyAsEq5KTMudKdVsTc5HFZk4.edp) (1.6 KB)

The consequence is that when computing the integral of the normal N along this internal boundary, the result is (0,2) instead of the expected (2,0).  
I don’t understand why this inversion, and I can produce many examples with lot of internal boundary element changing orientation when uploaded with readmesh.  
Does anybody know if this is “normal”, or is it a bug? Is there a way to set the orientation of such an internal boundary, which determines the orientation of the normal along it (for example by specifying that it should go from region 99 to region 11)?
