Main Content

pdeInterpolant

Interpolant for nodal data to selected locations

pdeInterpolant and [p,e,t] representation of FEMesh data are not recommended. Use interpolateSolution and evaluateGradient to interpolate a PDE solution and its gradient to arbitrary points without switching to a [p,e,t] representation.

Description

An interpolant allows you to evaluate a PDE solution at any point within the geometry.

Partial Differential Equation Toolbox™ solvers return solution values at the nodes, meaning the mesh points. To evaluate an interpolated solution at other points within the geometry, create a pdeInterpolant object, and then call the evaluate function.

Creation

Description

F = pdeInterpolant(p,t,u) returns an interpolant F based on the data points p, elements t, and data values at the points, u.

Use meshToPet to obtain the p and t data for interpolation using pdeInterpolant.

example

Input Arguments

expand all

Data point locations, specified as a matrix with two or three rows. Each column of p is a 2-D or 3-D point. For details, see Mesh Data.

For 2-D problems, construct p using the initmesh function, or export from the Mesh menu of the PDE Modeler app. For 2-D or 3-D geometry using a PDEModel object, obtain p using the meshToPet function on model.Mesh. For example, [p,e,t] = initmesh(g) or [p,e,t] = meshToPet(model.Mesh).

Triangulation elements, specified as a matrix. For details, see Mesh Data.

For 2-D problems, construct t using the initmesh function, or export from the Mesh menu of the PDE Modeler app. For 2-D or 3-D geometry using a PDEModel object, obtain t using the meshToPet function on model.Mesh. For example, [p,e,t] = initmesh(g) or [p,e,t] = meshToPet(model.Mesh).

Data values to interpolate, specified as a vector or matrix. Typically, u is the solution of a PDE problem returned by assempde, parabolic, hyperbolic, or another solver. For example, u = assempde(b,p,e,t,c,a,f). You can also export u from the Solve menu of the PDE Modeler app.

The dimensions of the matrix u depend on the problem. If np is the number of columns of p, and N is the number of equations in the PDE system, then u has N*np rows. The first np rows correspond to equation 1, the next np rows correspond to equation 2, etc. For parabolic or hyperbolic problems, u has one column for each solution time; otherwise, u is a column vector.

Object Functions

evaluateInterpolate data to selected locations

Examples

collapse all

This example shows how to create a pdeInterpolant from the solution to a scalar PDE.

Solve the equation -Δu=1 on the unit disk with zero Dirichlet conditions.

g0 = [1;0;0;1]; % circle centered at (0,0) with radius 1
sf = 'C1';
g = decsg(g0,sf,sf'); % decomposed geometry matrix
model = createpde;
gm = geometryFromEdges(model,g);
% Zero Dirichlet conditions
applyBoundaryCondition(model,"dirichlet", ...
                             "Edge",(1:gm.NumEdges), ...
                             "u",0);
[p,e,t] = initmesh(gm);
c = 1;
a = 0;
f = 1;
u = assempde(model,p,e,t,c,a,f);

Construct an interpolant for the solution.

F = pdeInterpolant(p,t,u);

Evaluate the interpolant at the four corners of a square.

pOut = [0,1/2,1/2,0;
    0,0,1/2,1/2];
uOut = evaluate(F,pOut)
uOut = 4×1

    0.2485
    0.1854
    0.1230
    0.1852

The values uOut(2) and uOut(4) are nearly equal, as they should be for symmetric points in this symmetric problem.

Version History

Introduced in R2014b

See Also

|

Topics