Create initial 2-D mesh
This page describes the legacy workflow. New features might
not be compatible with the legacy workflow. For the corresponding
step in the recommended workflow, see
[p,e,t] = initmesh(g) [p,e,t] = initmesh(g,'PropertyName',PropertyValue,...)
[p,e,t] = initmesh(g) returns
a triangular mesh using the 2-D geometry specification
a Delaunay triangulation algorithm. The mesh size is determined from
the shape of the geometry and from name-value pair settings.
g describes the geometry of
the PDE problem.
g can be a Decomposed Geometry
matrix, the name of a Geometry file, or a function handle to a Geometry
file. For details, see 2-D Geometry.
the mesh data.
In the Point matrix
the first and second rows contain x- and y-coordinates
of the points in the mesh.
In the Edge matrix
the first and second rows contain indices of the starting and ending
point, the third and fourth rows contain the starting and ending parameter
values, the fifth row contains the edge segment number, and the sixth
and seventh row contain the left- and right-hand side subdomain numbers.
In the Triangle matrix
the first three rows contain indices to the corner points, given in
counter clockwise order, and the fourth row contains the subdomain
initmesh accepts the following name/value
|estimate||Maximum edge size|
numeric, strictly between
|Mesh growth rate|
|Preserve bounding box|
|Algorithm for generating initial mesh|
Hmax property controls the size of the
triangles on the mesh.
initmesh creates a mesh
where triangle edge lengths are approximately
Hgrad property determines the mesh growth
rate away from a small part of the geometry. The default value is
i.e., a growth rate of 30%.
Hgrad cannot be equal
to either of its bounds,
are related to the way the mesh algorithm works. By turning on
can get a good idea of how the mesh generation algorithm works within
the bounding box. By turning on
Init you can see
the initial triangulation of the boundaries. By using the command
[p,e,t] = initmesh(dl,'hmax',inf,'init','on'); [uxy,tn,a2,a3] = tri2grid(p,t,zeros(size(p,2)),x,y); n = t(4,tn);
you can determine the subdomain number
xy. If the point is outside the geometry,
n = t(4,tn) results in a failure.
Jiggle property is used to control whether
jiggling of the mesh should be attempted (see
details). Jiggling can be done until the minimum or the mean of the
quality of the triangles decreases.
be used to set an upper limit on the number of iterations.
MesherVersion property chooses the algorithm
for mesh generation. The
'R2013a' algorithm runs
faster, and can triangulate more geometries than the
Both algorithms use Delaunay triangulation.
Make a simple triangular mesh of the L-shaped membrane in the PDE Modeler app. Before you do
anything in the PDE Modeler app, set the Maximum edge size to
inf in the Mesh Parameters dialog box. You open the dialog box by
selecting the Parameters option from the
Mesh menu. Also select the items Show Node
Labels and Show Triangle Labels in the
Mesh menu. Then create the initial mesh by pressing the button. (This can also be done by selecting the
Mesh option from the Mesh
The following figure appears.
The corresponding mesh data structures can be exported to the main workspace by selecting the Export Mesh option from the Mesh menu.
p p = -1 1 1 0 0 -1 -1 -1 1 1 0 0 e e = 1 2 3 4 5 6 2 3 4 5 6 1 0 0 0 0 0 0 1 1 1 1 1 1 1 2 3 4 5 6 1 1 1 1 1 1 0 0 0 0 0 0 t t = 1 2 3 1 2 3 4 5 5 5 5 6 1 1 1 1
George, P. L., Automatic Mesh Generation — Application to Finite Element Methods, Wiley, 1991.