# Exporting boundary value

**URL:** https://community.freefem.org/t/exporting-boundary-value/2028
**Category:** General Discussion
**Created:** [September 27, 2022, 7:21pm UTC](https://community.freefem.org/t/exporting-boundary-value/2028 "2022-09-27T19:21:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)
#### Post date: [September 27, 2022, 7:21pm UTC](https://community.freefem.org/t/exporting-boundary-value/2028/1 "2022-09-27T19:21:40Z")

</div>

Dear all

I want to export the boundary value of velocity, exact nodes on the boundary labrle 1 and 2. I wrote the following:  
int Nbtriangle=th.nbe;  
for (int k=0; k\<Nbtriangle; k++)  
{  
int L=th.be(k).label;  
if (L==1 || L==2)  
{

```
		real xx=th.be(k)[1].x;
		real yy=th.be(k)[1].y;
		file1 << xx << " " << yy << " " << Cr(xx,yy)<< endl;
	}
}

```

when I compared the profile with the paper it was different. then I exported the vtk plot of my domain to tecplot and wanted to plot velocity profile at inlet (Labels 1 and 2) the plot was exactly the same as paper. how I can write it to give me the right value?

BR,

Zeinab

---

<div class="post-metadata">

### Author: ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)
#### Post date: [September 27, 2022, 8:59pm UTC](https://community.freefem.org/t/exporting-boundary-value/2028/2 "2022-09-27T20:59:39Z")

</div>

I would just use something like the following (based on [this](https://community.freefem.org/t/how-to-identify-the-boundary-label-for-an-import-mesh/161/2) post):

```auto
fespace Vh(Th, [P2,P2,P2,P1]);
Vh [ux, uy, uz, p];
Vh [xx, xy, xz, xp] = [x,x,x,x];
Vh [yx, yy, yz, yp] = [y,y,y,y];
varf vBC1([u1, u2, u3, p], [v1, v2, v3, q]) = 
            on(1, u1 = 1.); // variational formulation to set the values corresponding to the velocity x at label1 to 1
real[int] bcLab1vec = vBC1(0,Vh,tgv=-1); 
for(int i=0; i< bcLab1vec .n; i++) {
    if(abs(bcLab1vec[i]-1)<1e-10)
         file1 << xx[][i]<< " " << yx[][i] << " " << ux[][i] << endl;
}

```

---

<div class="post-metadata">

### Author: ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)
#### Post date: [September 30, 2022, 1:39pm UTC](https://community.freefem.org/t/exporting-boundary-value/2028/3 "2022-09-30T13:39:06Z")

</div>

Dear aszaboa

Thank you for your response. Sorry, I didn’t understand if(abs(bcLab1vec[i]-1)\<1e-10) because its name presents the boundary label but when I use it is not that and doesn’t show me anything.

BR

---

<div class="post-metadata">

### Author: ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)
#### Post date: [September 30, 2022, 8:35pm UTC](https://community.freefem.org/t/exporting-boundary-value/2028/4 "2022-09-30T20:35:45Z")

</div>

The vector `bcLab1vec` just contains some arbitrary nonzero number at the gridpoints with a certain label. It could contain the label itself:

```auto
mesh Th = square(20, 20); 

fespace Vh(Th, [P2,P2,P2,P1]);
Vh [ux, uy, uz, p] = [sin(x*pi), 0, 0 ,0];
Vh [xx, xy, xz, xp] = [x,x,x,x];
Vh [yx, yy, yz, yp] = [y,y,y,y];

int lab = 2;
varf vBC1([u1, u2, u3, p], [v1, v2, v3, q]) = 
            on(lab, u1 = lab); // variational formulation to set the values corresponding to the velocity x at a certain label to the label value
real[int] bcLabvec = vBC1(0,Vh,tgv=-1); 

for(int i=0; i< bcLabvec .n; i++) {
    if(abs(bcLabvec[i]-lab)<1e-10)
         cout << xx[][i]<< " " << yx[][i] << " " << ux[][i] << endl;
}

```

If this was not your question, I am sorry, please try to explain it in more detail.
