Extracting Xmesh Information
The function mphxmeshinfo returns the extended mesh information. To get the xmesh information of the current solver and mesh node, enter the command:
info = mphxmeshinfo(model)
where info is a MATLAB structure that contains the fields in the table:
The dofs substructure contains the fields listed in the table:
Global coordinates for all DOFs in the model length unit. The kth column of this matrix contains the coordinates of DOF number k.
0-based indices into dofNames for all DOFs.
The nodes substructure contains the fields listed in the table:
Global coordinates for all nodes. The nth column contains the coordinates of node point number n.
0-based DOF numbers for all nodes in this geometry. dofs()[k][n] is the DOF number for DOF name dofNames()[k] at node point n. A value of -1 means that there is no DOF with this name at the node. Note: If there is a slit, only one of the DOFs is given for each node point.
The elements substructure contains the fields listed in the table:
The type substructure lists the information for each element. The possible mesh types are vtx, edg, quad, tri, quad, tet, hex, prism, and pyr. The substructure type contains the fields listed in the table:
Local coordinates of nodes. The kth column contains the coordinates of local node point number k.
0-based node point indices for all mesh elements of type type. A value -1 means that there is no node point at this location.
0-based DOF numbers for all mesh elements of type type. A value -1 means that there is no DOF at this location.
Specify the Information to Retrieve
To specify the solver node to retrieve the xmesh information, set the property soltag as in this command:
info = mphxmeshinfo(model, 'soltag', <soltag>)
where <soltag> is the tag of the solver used to extract the xmesh information.
To retrieve the xmesh information for a specific study step node, specify it with the property studysteptag:
info = mphxmeshinfo(model, 'studysteptag', <studysteptag>)
where <studysteptag> is the tag of either a compiled equation node or a variable node.
Some models may contains internal variables that are used within Comsol Multiphysics to improve the accuracy of certain quantities depending on the physics. The function mphxmeshinfo can return information both for the case where the internal variables are included and without. If the studysteptag in the call above is the tag of a variables node then the internal variables are not included. Otherwise they are included.
In case several mesh cases have been used by a specific solver (for example, with an automatic remeshing procedure), you can specify which mesh case to use to get the discretization information:
info = mphxmeshinfo(model, 'meshcase', <meshcase>)
where <meshcase> is the mesh case number or the tag of the mesh case.