# Inflow and outflow direction

**URL:** <https://community.freefem.org/t/inflow-and-outflow-direction/1222>\
**Category:** General Discussion\
**Created:** [September 22, 2021, 6:16pm UTC](https://community.freefem.org/t/inflow-and-outflow-direction/1222 "2021-09-22T18:16:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![erdo](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@erdo](https://community.freefem.org/u/erdo)\
**Post date:** [September 22, 2021, 6:16pm UTC](https://community.freefem.org/t/inflow-and-outflow-direction/1222/1 "2021-09-22T18:16:09Z")

</div>

Hello,  
I work navier stokes flow on a rectengular domain. And i want to control inflow and outflow direction of fluid as the picture below. How can i do this?  
Thank you

```auto
int nn = 10; //number of nodes by unit
real L = 5.0; //length
real D = 1.0; //diameter
//Labels
int input = 1; //left side
int output = 2; //right side
int borders = 3; //borders
 
//Variables
string filename = ""; //save name
mesh Th; //mesh
 
//Mesh
//Border
border gamma1(l=0, L){x=l; y=0.0; label = borders;};
border gamma2(l=0, D){x=L; y=l; label = output;};
border gamma3(l=0, L){x=L-l; y=D; label = borders;};
border gamma4(l=0, D){x=0; y=D-l; label = input;};
//Mesh
Th = buildmesh(gamma1(L*nn) + gamma2(D*nn) + gamma3(L*nn) + gamma4(D*nn));
 
//Save
//Mesh
filename = "tube_2D";
savemesh(Th, filename + ".msh");
//Parameters
ofstream file(filename + ".dat");
file << "L\t" << L << endl;
file << "D\t" << D << endl;
file << "E\t" << input << endl;
file << "S\t" << output << endl;
file << "B\t" << borders << endl;
 
//Display
plot(Th, cmm = "Number of triangles = " + Th.nt + ", Length = " + L + ", Diameter = " + D);

```

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