# PeriodicInterpolation does not work in ElementMeshInterpolation

I want to use `ElementMeshInterpolation` to generate interpolation function with periodic boundary condition.

I use below data as an example

``data=Flatten[Table[{i,j,Sin[i+j]},{i,0,2\[Pi],2\[Pi]/50},{j,0,2\[Pi],2\[Pi]/50}],1]; ListContourPlot[data] ``

which gives This data is periodic along x and y direction.

Using Interpolation

``f = Interpolation[data, PeriodicInterpolation -> True]; {ContourPlot[f[x, y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}],   ContourPlot[f[x, y], {x, 0, 4 \[Pi]}, {y, 0, 4 \[Pi]}]} ``

gives We can see the Interpolation function is fine with periodic condition as wanted.

using ElementMeshInterpolation

Though `Interpolation` works fine for this data set. But Interpolation has problem that it frequently run into "femimq" problem. So `ElementMeshInterpolation` on a refined mesh is necessary sometimes.

``mesh = ToElementMesh[data[[;; , 1 ;; 2]]]; f = ElementMeshInterpolation[{mesh}, data[[;; , -1]],     PeriodicInterpolation -> {True, True}]; {ContourPlot[f[x, y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}],   ContourPlot[f[x, y], {x, 0, 4 \[Pi]}, {y, 0, 4 \[Pi]}]} ``

this gives You see the generated Interpolation function has no periodicity.

using ListInterpolation

mesh can also be used in `ListInterpolation`

``mesh = ToElementMesh[data[[;; , 1 ;; 2]]]; f = ListInterpolation[data[[;; , -1]], mesh,     PeriodicInterpolation -> {True, True}]; {ContourPlot[f[x, y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}],   ContourPlot[f[x, y], {x, 0, 4 \[Pi]}, {y, 0, 4 \[Pi]}]} ``

but this gives the same result as `ElementMeshInterpolation`.

So the question is how to correctly make periodic interpolation function using `ElementMeshInterpolation`.

Posted on Categories cheapest proxies