ElementMeshInterpolation[{emesh},{f1,f2,…}]
constructs an InterpolatingFunction object of the function values fj, corresponding to coordinate j of an ElementMesh object.
ElementMeshInterpolation[{{t1,t2,…},emesh},
{{{f11,f12,…}},{{f21,f22,…}},…}]
constructs an interpolation of the function values fij, corresponding to discrete ti and coordinate j of an ElementMesh object.
ElementMeshInterpolation
ElementMeshInterpolation[{emesh},{f1,f2,…}]
constructs an InterpolatingFunction object of the function values fj, corresponding to coordinate j of an ElementMesh object.
ElementMeshInterpolation[{{t1,t2,…},emesh},
{{{f11,f12,…}},{{f21,f22,…}},…}]
constructs an interpolation of the function values fij, corresponding to discrete ti and coordinate j of an ElementMesh object.
Details and Options
- ElementMeshInterpolation returns an InterpolatingFunction object, which can be used like any other pure function.
- The function values f can be real or complex numbers.
- The ElementMesh object may contain curved elements.
- ElementMeshInterpolation works by fitting polynomial curves between data points belonging to the same element.
- The degree of the polynomial curves is specified by the option InterpolationOrder.
- The default InterpolationOrder is the order of the ElementMesh.
- You can do linear interpolation by using the setting InterpolationOrder1.
- ElementMeshInterpolation[data] generates an InterpolatingFunction object that returns values with MachinePrecision.
- ElementMeshInterpolation has the same options as Interpolation, with the following additions:
-
"ExtrapolationHandler" Automatic specify how extrapolation is handled - Setting the option from NDSolve and related functions is explained in NDSolve Finite Element Options.
Examples
open all close allBasic Examples (2)
Needs["NDSolve`FEM`"]Set up an ElementMesh:
mesh = ToElementMesh[Disk[]]Set up function values at the mesh coordinates:
Short[values = Function[{x, y}, x ^ 2 + y ^ 2]@@@mesh["Coordinates"]]Create an InterpolatingFunction:
if = ElementMeshInterpolation[{mesh}, values]Apply the function to find interpolated values:
if[0, 0]Plot the interpolating function:
Plot3D[if[x, y], {x, y}∈Disk[]]Generate function values for a time-dependent interpolation:
time = Range[0, 1, 0.1];
data = {values * #}& /@ Sin[time];Construct a time-dependent interpolating function:
tif = ElementMeshInterpolation[{time, mesh}, data]Options (6)
"ExtrapolationHandler" (6)
Construct an InterpolatingFunction:
if = ElementMeshInterpolation[{mesh}, values]Query the InterpolatingFunction outside of its domain:
if[2, 2]Construct an InterpolatingFunction with an extrapolation handler that returns Indeterminate for queries outside the domain:
if = ElementMeshInterpolation[{mesh}, values, "ExtrapolationHandler" -> {Function[Indeterminate]}]Query the InterpolatingFunction outside of its domain:
if[2, 2]Construct an InterpolatingFunction with an extrapolation handler that extrapolates outside its domain and does not give a warning message:
if = ElementMeshInterpolation[{mesh}, values, "ExtrapolationHandler" -> {Automatic, "WarningMessage" -> False}]Query the InterpolatingFunction outside of its domain:
if[2, 2]Construct an InterpolatingFunction with an extrapolation handler that returns 0 outside its domain:
if = ElementMeshInterpolation[{mesh}, values, "ExtrapolationHandler" -> {Function[0.]}]Query the InterpolatingFunction outside of its domain:
if[2, 2]Construct an InterpolatingFunction with an extrapolation handler that returns Indeterminate outside its domain and does not give a warning message:
if = ElementMeshInterpolation[{mesh}, values, "ExtrapolationHandler" -> {Function[Indeterminate], "WarningMessage" -> False}]Query the InterpolatingFunction outside of its domain:
if[2, 2]The default for NDSolve and the finite element method is to return InterpolatingFunction objects that do not extrapolate outside of the given domain:
ifun = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 1, DirichletCondition[u[x, y] == 0, True]}, u, {x, y}∈Disk[]];
ifun[2, 0]Allow InterpolatingFunction objects generated by NDSolve to extrapolate when evaluated outside of the simulation domain and not warn about it:
ifun = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 1, DirichletCondition[u[x, y] == 0, True]}, u, {x, y}∈Disk[], "ExtrapolationHandler" -> {Automatic, "WarningMessage" -> False}];
ifun[2, 0]While it is not generally possible to construct periodic interpolating functions for arbitrary meshes, one can mimic periodic interpolating functions based on rectangular regions by specifying an "ExtrapolatiopnHandler".
data = Flatten[Table[{i, j, Sin[i + j]}, {i, 0, 2 π, 2 π / 50}, {j, 0, 2 π, 2 π / 50}], 1];
mesh2 = ToElementMesh["Coordinates" -> data[[All, {1, 2}]]]Generate a temporary interpolating function from this mesh and data:
temp = ElementMeshInterpolation[{mesh2}, data[[All, 3]]];Use the extrapolation handler to map the coordinates outside of the meshed domain back into the domain and evaluate over the temporary interpolating function:
f = ElementMeshInterpolation[{mesh2}, data[[ ;; , -1]], "ExtrapolationHandler" -> {Function[{x, y}, temp[Mod[x, 2 π], Mod[y, 2 π]]]}]To verify that the interpolation is now periodic, visualize the function f both inside and outside the original domain:
{ContourPlot[f[x, y], {x, 0, 2 π}, {y, 0, 2 π}], ContourPlot[f[x, y], {x, 0, 4 π}, {y, 0, 4 π}]}Properties & Relations (1)
For time-independent interpolation, ListInterpolation can also be used:
ListInterpolation[values, mesh]Related Guides
Text
Wolfram Research (2020), ElementMeshInterpolation, Wolfram Language function, https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshInterpolation.html (updated 2024).
CMS
Wolfram Language. 2020. "ElementMeshInterpolation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshInterpolation.html.
APA
Wolfram Language. (2020). ElementMeshInterpolation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshInterpolation.html
BibTeX
@misc{reference.wolfram_2026_elementmeshinterpolation, author="Wolfram Research", title="{ElementMeshInterpolation}", year="2024", howpublished="\url{https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshInterpolation.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_elementmeshinterpolation, organization={Wolfram Research}, title={ElementMeshInterpolation}, year={2024}, url={https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshInterpolation.html}, note=[Accessed: 13-June-2026]}