# Solution not interpolating onto every element of the new mesh

**URL:** <https://community.freefem.org/t/solution-not-interpolating-onto-every-element-of-the-new-mesh/2171>\
**Category:** General Discussion\
**Created:** [December 6, 2022, 2:44am UTC](https://community.freefem.org/t/solution-not-interpolating-onto-every-element-of-the-new-mesh/2171 "2022-12-06T02:44:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [December 6, 2022, 2:44am UTC](https://community.freefem.org/t/solution-not-interpolating-onto-every-element-of-the-new-mesh/2171/1 "2022-12-06T02:44:28Z")

</div>

In my code, I have a numerical solution that I computed inside a cube. I also have the exact solution. I want to calculate the error between the two over a subset region of the cube. To do this, I build a new mesh onto which I interpolate my solution. However, the numerically computed solution is not interpolating onto all the elements of my new mesh. Can someone see where I’m going wrong? (Please note, I’m not quite sure how to interpret the rmid, rup, rdown parameters)

I’ve included a screenshot of the plot of the interpolated solution and also a screen shot of a cut of the solution.

> //Builds a mesh on a shell  
> ////{  
> real cx1 = 0.5; // centre of big disc  
> real cy1 = 0.5;  
> real r1 = 0.7; // radius of big  
> real cx2 = 0.5; // centre of small disc  
> real cy2 = 0.5;  
> real r2 = myEpsPlus; // radius of small disc  
> real zmin=0.1,zmax=0.9;  
> int[int] rup=[1,1], rdown=[1,2], rmid=[1,3,2,4];  
> border C1(t1=0,2_pi){x=cx1+r1_cos(t1);y=cy1+r1_sin(t1);label=1;};  
> border C2(t1=0,2_pi){x=cx1+r2_cos(t1);y=cy1+r2_sin(t1);;label=2;};
> 
> ```
> ThAnulus= buildmesh(C1(20)+C2(-20));
> //plot(Thcercle,wait =1);
> 
> ThShell=buildlayers(ThAnulus,
> 20,
> zbound=[zmin,zmax],
> labelmid=rmid, 
> labelup = rup, 
> labeldown = rdown); 
> 
> plot(ThShell,wait=1);
> 
> // fespace for solution and cut
> fespace VhShell(ThShell, P2); // u
> VhShell uu = u, uexact = exactSol; // u is the numerically computed solution
> plot(uu, wait = true);
> plot(uexact, wait = true);
> ////}
> 
> ```

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [December 6, 2022, 2:47am UTC](https://community.freefem.org/t/solution-not-interpolating-onto-every-element-of-the-new-mesh/2171/2 "2022-12-06T02:47:37Z")

</div>

![Screenshot 2022-12-05 at 21.16.24](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/3/368563cdd66c5282e2af5c69ce89ff7d8a9c2fb3.png)  
 ![Screenshot 2022-12-05 at 21.18.35](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/4/45acd8a91fa8fa0649337a7b115cb354b39690a3.jpeg)
