# Interpolate results from one mesh to another mesh (subdomain)

**URL:** <https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605>\
**Category:** General Discussion\
**Created:** [July 16, 2023, 3:53am UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605 "2023-07-16T03:53:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![clthu](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@clthu](https://community.freefem.org/u/clthu)\
**Post date:** [July 16, 2023, 3:53am UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/1 "2023-07-16T03:53:25Z")

</div>

Dear all,  
I want to interpolate my results ( for example,(th1, [P2 P2 P1]) on the mesh1 (Th1) to the mesh2 (Th2) (Th2 is only one part of the Th1, its boundary is in the interior of Th1, but the mesh densitiy is higher in Th2). And then I could do my following calculation on Th2.  
How could I make it easily? (Or is there any example?)  
Thanks a lot !

---

<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:** [July 16, 2023, 7:54pm UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/2 "2023-07-16T19:54:52Z")

</div>

I think you can achieve this via standard interpolation with `=`, you just need to use the syntax for vectorial FE spaces. If you are using PETSc, the situation is a bit more complicated, but I think you can achieve what you want with the `transfer` macro, about which you can find more in the forum.

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [July 16, 2023, 10:59pm UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/3 "2023-07-16T22:59:22Z")

</div>

In some cases the interpolation is pretty easy. For example,  
Vh x=xold(x,y)  
as the paren operator does interpolation. You can also use the IIRC  
interpolate function to get a matrix from one set of points in one fespace  
to another. This is of course better if you have a lot of transforms.

---

<div class="post-metadata">

**Author:** ![clthu](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@clthu](https://community.freefem.org/u/clthu)\
**Post date:** [July 17, 2023, 6:08am UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/4 "2023-07-17T06:08:56Z")

</div>

Thanks a lot~ I use “=” to make it！

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [July 17, 2023, 10:02am UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/5 "2023-07-17T10:02:21Z")

</div>

Be careful because x have to sense here (x the coordinate and Vh x a field ) so in FreeFem the last definition win so you write something like:

```auto
Vh xx=xold(xx,y)

```

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [July 17, 2023, 12:36pm UTC](https://community.freefem.org/t/interpolate-results-from-one-mesh-to-another-mesh-subdomain/2605/6 "2023-07-17T12:36:31Z")

</div>

oh yes thanks, I keep doing that but FF does warn about globals 🙂
