Skip to content

Anisotropic Mesh Utilities

Fan edited this page Jan 17, 2018 · 7 revisions

List of utilities

In our tool-set under the test folder, there are a few utilities for the visualization and measurement of anisotropic meshes. These are

  • measureAnisoStats
  • visualizeAnisoSizes
  • runSimxAnisoAdapt

How to use

These utilities require an input .smb mesh which has two nodal fields:

  1. Field of type apf::VECTOR which holds the principal scales/sizes at each node (vertex for linear meshes)
  2. Field of type apf::MATRIX which holds the principal directions at each node (vertex for linear meshes).

OR an input .sms mesh which may or may not have the above two nodal fields. In case of there are not these two nodal fields, the size field is obtained by using V_size.

The name of these fields must be passed to the executable measureAnisoStats, visualizeAnisoSizes and runSimxAnisoAdapt, as will be explained next.

measureAnisoStats

To measure the statistic (in metric space) for an anisotropic mesh the user can execute the following

measureAnisoStats <mesh.smb/sms> <output_prefix> <scale field name> <frames field name>

where <mesh.smb/sms> is the input (anisotropic) mesh, <output_prefix> is the name of the folder where the results will be written to, and <scale field name>/<frame field name> are, respectively, the name of the scales and frames fields in the mesh. Note that, the input mesh can be non-simplex mesh. But the non-simplex mesh elements will be ignored for now.

This will produce two files per processor:

  1. linearETable_N.dat holding the metric edge lengths
  2. linearQTable_N.dat holding the metric qualities

And one vtk file mesh_quality_vis in which we can see the distribution of the mesh quality.

Note that the input mesh is the adapted mesh whereas the size fields and frames are based on the pre-adapted mesh. These size fields and frames will be destroyed along with the ma::Input* object unless a copy of the fields are made:

apf::Field* adaptSize  = apf::createFieldOn(m, "adapt_size", apf::VECTOR);
apf::Field* adaptFrame = apf::createFieldOn(m, "adapt_frame", apf::MATRIX);

apf::copyData(adaptSize, sizes);
apf::copyData(adaptFrame, frames);

ma::Input* in = ma::configure(m,adaptSize,adaptFrame);

In this example, the adaptSize and adaptFrame fields will be destroyed but the original sizes and frames field will be transferred to the adapted mesh at which point you can use the measureAnisoStats utility.

visualizeAnisoSizes

To visualize the anisotropic size field the user can execute the following

visualizeAnisoSizes <mesh.smb/sms> <output_prefix> <scale field name><frames field name> <n_u> <n_v> <scale>

where the first four arguments are the same as the first four arguments of measureAnisoStats, <n_u> and <n_v> are resolutions for the parameterization of the ellipsoid, and <scale> is a scaling factor. This will produce a Paraview mesh in which an ellipsoid is drawn at each vertex in the mesh.

runSimxAnisoAdapt

To run a simmetrix adapt for comparision purposes the used can execute the following

runSimxAnisoAdapt <model.dmg> <mesh.smb> <prefix><scale field name> <frame field name>

This will produce a .smd model prefix.smd, the initial mesh in simmetrix format simx_initial.sms, the adapted mesh in simmetrix format simx_adapted.sms, and the adapted mesh in PUMI format simx_adapted0.smb