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 !
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.
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.
Thanks a lot~ I use “=” to make it!
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:
Vh xx=xold(xx,y)
oh yes thanks, I keep doing that but FF does warn about globals