Getting Mesh Statistics Information
Use the function mphmeshstats to get mesh statistics and mesh information where stats is a structure containing the mesh statistics information. Enter:
stats = mphmeshstats(model)
The statistics structure has the following fields:
meshtag, the tag of the mesh sequence;
geomtag, the tag of the associated geometry;
geometricmodel, the geometric model used by the mesh sequence;
component, the tag of the component the mesh belongs to;
componentgeometricmodel, the geometric model used by the physics;
current, the current mesh feature tag;
isempty, boolean variable that indicates if the mesh is empty (1) or not(0);
hasproblems, boolean variable that indicates if the mesh contains error or warning nodes (1) or not (0);
iscomplete, boolean variable that indicates if the mesh is built to completion(1) or not(0);
secondorderelements, boolean variable that indicates if the mesh has second order elements(1) or not (0);
sdim, the space dimension;
contributing, the contributing physics and multiphysics feature for physics-controlled mesh;
types, the element types present in the mesh. The element type can be vertex (vtx), edge (edg), triangle (tri), quadrilateral (quad), tetrahedra (tet), pyramid (pyr), prism (prism), hexahedra (hex). The type can also be of all elements of maximal dimension in the selection (all);
numelem, the number of elements for each element type;
qualitymeasure, the quality measure used to evaluate the quality of the mesh.
minquality, the minimum element quality;
meanquality, the mean element quality;
qualitydistr, the distribution of the element quality;
minvolume, the minimum element volume/area;
maxvolume, the maximum element volume/area;
volume, the total volume/area of the mesh;
maxgrowthrate, the maximal growth rate value for the entire selection, regardless of the element type property;
meangrowthrate, the average growth rate value for the entire selection, regardless of the element type property.
The fields maxgrowthrate and meangrowthrate provide statistics for the entire selection regardless of the element type property.
If several mesh cases are available in the model object, specify the mesh tag:
stats = mphmeshstats(model, <meshtag>)
Set the number of bins in the quality distribution histogram (qualitydistr) with the property qualityhistogram:
stats = mphmeshstats(model,<meshtag>,'qualityhistogram',<num>)
where <num> is an integer corresponding to the desired number of bins.
Set the mesh quality measure from for the mesh statistics with the property qualitymeasure:
stats = mphmeshstats(model,<meshtag>,'qualitymeasure',<quality>)
where <quality> is one of 'condition' (condition number), 'growth' (growth rate), 'maxangle' (maximum number), 'skewness' (skewness), 'volcircum' (volume versus circumradius) or 'vollength' (volume versus length).
Mesh Element Quality in the COMSOL Multiphysics Programming Reference Manual.
Get Mesh statistics on specified entity or Selection
Specify the entity where to evaluate mesh quality with the property entity as in the command below:
stats = mphmeshstats(model,<meshtag>,'entity',entity)
where entity is one of 'domain', 'boundary', 'edge', or 'point'.
Use the selection property to specify the entity number where to get the mesh statistics:
stats = mphmeshstats(model,<meshtag>,'entity',entity,...
'selecti on',<selnum>)
where <selnum> is an integer array defining the selection number.
It is also possible to use the selection property to define a selection node defined in the model:
stats = mphmeshstats(model,<meshtag>,'selection',<seltag>)
where <seltag> is the tag of the desired selection node.
The properties entity and selection cannot be set if the mesh data information is returned.
Retrieve mesh statistics of a specific element type
Restrict the mesh statistics information structure a specific element type with the property type:
stats = mphmeshstats(model,<meshtag>,'type',type)
where type is one of the mesh element type available: vertex ('vtx'), edge ('edg'), triangle ('tri'), quad ('quad'), tetrahedron ('tet'), pyramid ('pyr'), prism ('prism') or hexahedron ('hex'). type can also be a cell array to return the mesh statistics of several mesh element type.