Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Interpolate values to grid function in 2D

More
4 years 7 months ago #1803 by pgangl
Hi,

I am given coordinates (x_i, y_j) of points in my computational domain together with the corresponding function values z_ij. I would like to interpolate the function values and assign the interpolated function to a GridFunction. For 1D domains this works fine using BSplines which return a CoefficientFunction.

Is it possible to interpolate my data using a Bspline surface which I can then assign to the GridFunction living on a 2D domain?

I tried scipy.interpolate.interp2d ( docs.scipy.org/doc/scipy/reference/gener...interpolate.interp2d ), but I cannot assign the resulting interpolating function to a GridFunction.

Thank you very much in advance for your help!

Best regards,
Peter
More
4 years 7 months ago #1807 by joachim
Hi Peter,

you can use a GridFunction on a secondary finite element mesh (maybe structured) to represent your given data.

This GridFunction you can use as a coefficient in your formulation, or you can interpolate this data onto your unstructured finite element mesh.

Interpolating between different meshes obviously has some costs, but we use geometric search trees to keep the asymptotic costs low.

Hope this helps,
Joachim
Time to create page: 0.119 seconds