Main Content

Morph 2-D Mesh to Modified Boundary

Morph a mesh of a 2-D domain to accommodate a modification to the domain boundary.

Load the data. The mesh to be morphed is defined by trife, xfe, and yfe, which is a triangulation in face-vertex format.

load trimesh2d
clf
triplot(trife,xfe,yfe)
axis equal
axis([-10 310 -10 310])
axis equal
title("Initial Mesh")

Figure contains an axes object. The axes object with title Initial Mesh contains an object of type line.

Construct a background triangulation - a Constrained Delaunay triangulation of the set of points representing the mesh boundary. For each vertex of the mesh, compute a descriptor that defines its location with respect to the background triangulation. The descriptor is the enclosing triangle together with the barycentric coordinates with respect to that triangle.

dt = delaunayTriangulation(x,y,Constraints);
clf
triplot(dt)
axis equal
axis([-10 310 -10 310])
axis equal
title("Background Triangulation")

Figure contains an axes object. The axes object with title Background Triangulation contains an object of type line.

descriptors.tri = pointLocation(dt,xfe,yfe);
descriptors.baryCoords = cartesianToBarycentric(dt,descriptors.tri,[xfe yfe]);

Edit the background triangulation to incorporate the desired modification to the domain boundary.

cc1 = [210 90];
circ1 = (143:180)';
x(circ1) = (x(circ1)-cc1(1))*0.6 + cc1(1);
y(circ1) = (y(circ1)-cc1(2))*0.6 + cc1(2);
tr = triangulation(dt(:,:),x,y);
clf
triplot(tr)
axis([-10 310 -10 310])
axis equal
title("Edited Background Triangulation - Hole Size Reduced")

Figure contains an axes object. The axes object with title Edited Background Triangulation - Hole Size Reduced contains an object of type line.

Convert the descriptors back to Cartesian coordinates using the deformed background triangulation as a basis for evaluation.

Xnew = barycentricToCartesian(tr,descriptors.tri,descriptors.baryCoords);
tr = triangulation(trife,Xnew);
clf
triplot(tr)
axis([-10 310 -10 310])
axis equal
title("Morphed Mesh")

Figure contains an axes object. The axes object with title Morphed Mesh contains an object of type line.