# Import finite difference field to FreeFem

**URL:** https://community.freefem.org/t/import-finite-difference-field-to-freefem/907
**Category:** General Discussion
**Created:** [April 12, 2021, 2:42pm UTC](https://community.freefem.org/t/import-finite-difference-field-to-freefem/907 "2021-04-12T14:42:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sgkkr](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@sgkkr](https://community.freefem.org/u/sgkkr)
#### Post date: [April 12, 2021, 2:42pm UTC](https://community.freefem.org/t/import-finite-difference-field-to-freefem/907/1 "2021-04-12T14:42:38Z")

</div>

I have a finite-difference 1-dimensional velocity field which I want to import to FreeFem. I perform the following task on FreeFem to record the velocity field in tempx.

Wh tempx;  
{  
ifstream file(“velfield.txt”);  
file \>\> val;  
};  
real[int] xx(1000),yy(1000),ux(1000);  
for (int i=0;i\<yy.n;i++){  
xx(i) = 0.;  
yy(i) = val(i,0);  
ux(i) = val(i,1);}  
matrix Ixx = interpolate(Wh,xx,yy,op=0,composante=0);  
tempx[] = Ixx\*ux;

Now I create another mesh that is different from the one earlier and try to interpolate the velocity field using these lines.

Whr tempxx;  
tempxx=tempx;

But the velocity field is not interpolated properly. Any suggestions?
