To use mshmet on your mesh + solution couple, you can run the following command :
mshmet temp.mesh -eps 0.00001 -hmin 0.01 -iso
It creates a
temp.new.sol file that contains the computed metric. To find suitable values for the parameters, I find more easier to always start in iso mode (even if I finally want an anisotropic metric). Normally it is not too hard to set the
hmin value (you just have to know the size for which you will consider your edges too small). Then I just play with the
eps parameter until obtaining a satisfying result.
With these parameters, I obtain the metric shown (left) and after adaptation, the two meshes in the middle and on the right. In the middle we see the surface mesh, on the right a volume section.
For the adaptation step, I have used the
develop branch of Mmg (because this branch contains some fixes for anisotropic meshes) and I have run the following command :
mmg3d_O3 temp.mesh -sol temp.new.sol
To obtain an anisotropic metric, you can run mshmet with the same parameters but without the
-iso argument. Then, for Mmg, as mshmet impose its own gradation, I recommand to disable entirely all the Mmg gradations (besides I have to correct bugs in the required gradation (
mmg3d_O3 temp.mesh -sol temp.new.sol -hgrad -1 -hgradreq -1 -nosizreq
I obtain the following results after adaptation (left you have the surface adaptation, right a cut through the volume):
It is not very aniso but the test case is difficult : you have lot of singularities (corners, non-manifold edges and sharp angles) in your mesh and such entities propagates isotropic ratio and in addition the input mesh is coarse so there are not lot of internal nodes to reach higher anisotropic ratio while keeping good qualities elements. I think that aniso ration will increase after few steps of adaptation…
In fact you can’t pass directly your solution field to Mmg (you can’t provide a pressure or a vector flux). Mmg is expecting a sol file that contains, either a metric (for adaptation mode), or a level-set distance (for isosurface discretization mode), or a displacement field (for lagrangian movment mode).