mphwritemesh
Write mesh data as an mphtxt, mphbin or STL file.
Syntax
mphwritemesh(model, meshtag, filename)
mphwritemesh(model, meshtag, filename, arguments...)
Description
Primary use is to write the elements in the mesh as an mphtxt or mphbin file, which can later be loaded into COMSOL. Alternatively, this function can also write 3D surface mesh data as STL-files.
The mesh is written using full precision of the mesh data. It is possible to choose which element types that should be written (for example, quad). Selections are supported.
The function
mphxmeshinfo
accepts the following property/value pairs:
Table 6-54:
property value/pairs for the mphwritemesh function.
Property
Value
Default
Description
types
vtx
|
edg
|
tri
|
quad
|
tet
|
hex
|
pyr
all
Element types to export
selection
Selection
entity
point
|
edge
|
boundary
|
domain
Entity for selection
exportselections
off
|
on
off
Export selections that are defined by the mesh
format
mphtxt
|
mphbin
|
stl
|
stlbinary
mphtxt
File format
name
String
mphwritemesh
Name of the exported mesh
Example
Write the surface elements (
tri
and
quad
) to an MPHTXT-file. Only include elements from domain number 2:
model = mphopen('model_tutorial_llmatlab.mph')
mphrun(model, 'mesh1')
mphwritemesh(model, 'mesh1', 'filename', ...
'types', {'tri' 'quad'}, ...
'selection', 2, ...
'entity', 'domain')