Question on Lagrangian movement + relation between meshes

So it seems an adaptation problem…
I think that it is best to continue to use your elastic/harmonic solver, since you have full control on it and it lets you the freedom to subdivide the displacement in smaller steps in case you get convergence problems or inverted elements.

The picture at the second iteration is already after adaptation? Any warning from Mmg? (Verbosity >= 6 can help)

Can you save a mesh-metric pair with MMG3D_saveMesh and MMG3D_saveSol to test the same thing from command line?

I will do that tonight.
Do you expect that due to different options the mmg command line might give different results?
I use the default mmg options in feelpp, I should probably start adding the list of mmg options in feelpp and enable them from command line

No, I was just suggesting it for easier debug since the problem does not seem to come from feelpp :slight_smile: Otherwise the behaviour should be the same!
My first guess is that there is some warning that gets suppressed with low verbosity (maybe too small volumes that block the adaptation).

The default options are a good starting point if your metric specifies good edge lengths (not too big or too small, so if you don’t need to limit them) and since you don’t need to control the accuracy on the boundary (otherwise the Hausdorff parameter becomes essential).

@lcirrott setting debug to 1, makes the code to crash
here is the 4th remesh

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
MODULE MMG2D: 5.5.2 (Nov. 17, 2020)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
git branch: No git branch found
git commit: No git commit found
git date: No git commit found

– MMG2DLIB: INPUT DATA
– INPUT DATA COMPLETED. 0.000s
MAXIMUM NUMBER OF POINTS (NPMAX) : 50000
MAXIMUM NUMBER OF TRIANGLES (NTMAX) : 100000

– PHASE 1 : DATA ANALYSIS

– MESH QUALITY 15326
BEST 1.000000 AVRG. 0.914612 WRST. 0.002656 (4075)
HISTOGRAMM: 99.27 % > 0.12
96.45 % > 0.5
0.8 < Q < 1.0 13658 89.12 %
0.6 < Q < 0.8 891 5.81 %
0.4 < Q < 0.6 403 2.63 %
0.2 < Q < 0.4 206 1.34 %
0.0 < Q < 0.2 168 1.10 %
** SETTING TOPOLOGY
Connected component or subdomains: 15326
Tagged edges: 23039, ridges: 100, refs: 22939
0 corners, 0 singular points and 7714 non manifold points detected

– RESULTING EDGE LENGTHS 22939
AVERAGE LENGTH 0.1551
SMALLEST EDGE LENGTH 0.0015 5729 3212
LARGEST EDGE LENGTH 1.0000 1638 5728
0.60 < L < 1.30 1073 4.68 %

 HISTOGRAMM:
 0.00 < L < 0.30     19112   83.32 %  
 0.30 < L < 0.60      2754   12.01 %  
 0.60 < L < 0.71       610    2.66 %  
 0.71 < L < 0.90       455    1.98 %  
 0.90 < L < 1.30         8    0.03 %  

– PHASE 1 COMPLETED. 0.197s

– PHASE 2 : ISOTROPIC MESHING
** GEOMETRIC MESH
** COMPUTATIONAL MESH
** Defining isotropic map

– SIZEMAP CORRECTION : overwritten of sizes at required vertices

– GRADATION : 1.300000 (2.300000)
** Grading mesh
gradation: 0 updated, 1 iter.
** Grading required points.
gradation (required): 6747 updated, 9 iter.
5 splitted
5 splitted, 0 collapsed, 0 swapped
11 splitted
11 splitted, 0 collapsed, 0 swapped
68 vertices moved, 1 iter.
67 splitted, 8 collapsed, 0 swapped, 68 moved
2 edge swapped
88 vertices moved, 1 iter.
24 splitted, 4 collapsed, 2 swapped, 88 moved
1 edge swapped
89 vertices moved, 1 iter.
7 splitted, 6 collapsed, 1 swapped, 89 moved
59 vertices moved, 3 iter.
– PHASE 2 COMPLETED. 0.018s

– MESH QUALITY 15504
BEST 1.000000 AVRG. 0.908374 WRST. 0.001493 (15502)
HISTOGRAMM: 98.94 % > 0.12
95.61 % > 0.5
0.8 < Q < 1.0 13688 88.29 %
0.6 < Q < 0.8 906 5.84 %
0.4 < Q < 0.6 442 2.85 %
0.2 < Q < 0.4 231 1.49 %
0.0 < Q < 0.2 237 1.53 %

– RESULTING EDGE LENGTHS 23206
AVERAGE LENGTH 0.4418
SMALLEST EDGE LENGTH 0.0135 7668 7652
LARGEST EDGE LENGTH 3.2033 309 7723
0.60 < L < 1.30 6019 25.94 %

 HISTOGRAMM:
 0.00 < L < 0.30     11075   47.72 %  
 0.30 < L < 0.60      6088   26.23 %  
 0.60 < L < 0.71       944    4.07 %  
 0.71 < L < 0.90       985    4.24 %  
 0.90 < L < 1.30      4090   17.62 %  
 1.30 < L < 1.41        16    0.07 %  
 1.41 < L < 2.00         1    0.00 %  
 2.00 < L < 5.00         7    0.03 %  

– MESH PACKED UP
NUMBER OF VERTICES 7803 CORNERS 0
NUMBER OF TRIANGLES 15504
NUMBER OF EDGES 23118

MMG2DLIB: ELAPSED TIME 0.219s

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
END OF MODULE MMG2D

Thanks! Still no errors from this log, but it does tell that the output edge lengths are terrible. Is it with verbosity >=6 ?
Are you passing only the outer domains to mmg, with required boundary faces? What kind of metric are you passing?

it is with verbosity=8
the metric can be based on the distance to the boundary of the object, min, avg or max mesh size.
I can also disable the metric and use simply .hsiz .hmin or .hmax parameter from mmg.
The result is always the same.
regarding the object, I pass it to mmg as well but have the elements required and I use the label trick to keep track of them. I could also just have the interface required(I have to do a little of work to enable that)
is that a problem to pass the object ? I want to use the new mesh immediately afterwards

I still have to save the mesh and solution to mmg format and use mmg app.

here is what happens in remeshing

before:

after

a few elements have been created, essentialy splitting.
idem at the next step, but then the elements are getting really elongated

Hi,

Thank you for all these precisions.

Is it possible to try the remeshing without the required size computation (-nosizreq) and the required gradation (-hgradreq -1)? Inside feelpp, you just have to add the following lines before the call of the MMG3D_mmg3dlib function:

MMG3D_Set_iparameter(mesh,sol,MMG3D_IPARAM_nosizreq,1);
MMG3D_Set_dparameter(mesh,sol,MMG3D_DPARAM_hgradreq,-1);

Thank you by advance,

Hello @Algiane ,I added the options you suggested

here are the results:

it changes at the tip of the structure
the elements are still elongated, it seems that the adaptation step does very little

I had to wait a few hours to be able to post, discourse does not want new users to post too often :slight_smile:

here is what mmg says at last iterations

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
MODULE MMG2D: 5.5.2 (Nov. 17, 2020)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
git branch: No git branch found
git commit: No git commit found
git date: No git commit found

– MMG2DLIB: INPUT DATA
– INPUT DATA COMPLETED. 0.000s
MAXIMUM NUMBER OF POINTS (NPMAX) : 50000
MAXIMUM NUMBER OF TRIANGLES (NTMAX) : 100000

– PHASE 1 : DATA ANALYSIS

– MESH QUALITY 15148
BEST 1.000000 AVRG. 0.783740 WRST. 0.000001 (6293)
HISTOGRAMM: 96.06 % > 0.12
86.67 % > 0.5
0.8 < Q < 1.0 9549 63.04 %
0.6 < Q < 0.8 2762 18.23 %
0.4 < Q < 0.6 1273 8.40 %
0.2 < Q < 0.4 654 4.32 %
0.0 < Q < 0.2 910 6.01 %
** SETTING TOPOLOGY
Connected component or subdomains: 15148
Tagged edges: 22772, ridges: 100, refs: 22672
0 corners, 0 singular points and 7625 non manifold points detected
– PHASE 1 COMPLETED. 0.195s

– PHASE 2 : ISOTROPIC MESHING
** GEOMETRIC MESH
** COMPUTATIONAL MESH
** Defining isotropic map

– GRADATION : 1.300000
** Grading mesh
gradation: 0 updated, 1 iter.
– PHASE 2 COMPLETED. 0.008s

– MESH QUALITY 15148
BEST 1.000000 AVRG. 0.783740 WRST. 0.000001 (6293)
HISTOGRAMM: 96.06 % > 0.12
86.67 % > 0.5
0.8 < Q < 1.0 9549 63.04 %
0.6 < Q < 0.8 2762 18.23 %
0.4 < Q < 0.6 1273 8.40 %
0.2 < Q < 0.4 654 4.32 %
0.0 < Q < 0.2 910 6.01 %

– RESULTING EDGE LENGTHS 22672
AVERAGE LENGTH 0.0869
SMALLEST EDGE LENGTH 0.0008 5007 6734
LARGEST EDGE LENGTH 0.6650 2108 6
0.60 < L < 1.30 1 0.00 %

 HISTOGRAMM:
 0.00 < L < 0.30     21339   94.12 %  
 0.30 < L < 0.60      1332    5.88 %  
 0.60 < L < 0.71         1    0.00 %  

– MESH PACKED UP
NUMBER OF VERTICES 7625 CORNERS 0
NUMBER OF TRIANGLES 15148
NUMBER OF EDGES 22772

MMG2DLIB: ELAPSED TIME 0.208s

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
END OF MODULE MMG2D
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Hello @prudhomm,
Thanks for the log! I notice now a couple of things: apparently there are 15148 triangles in input

and mmg finds 15148 indipendent domains:

This means that there is a different reference on every element in the mesh: this is a bit extreme and it could backfire because mmg would treat every edge as a geometrical surface that it should preserve (geometrically) while adapting, as I feared here but maybe I failed to explain well… Relation between required faces or elements between remeshes - #5 by lcirrott

Couldn’t you put references/labels only on the required elements? (Since they are required, it doesn’t do any harm to have internal surfaces between them)

Oops you are right my bad!
I understood properly but wasn’t careful in the implementation. I will fix ASAP

I hope this fixes it!
Then mmg should start giving more meaningful errors if it finds too small or negative elements, like:

(which I suspect it is skipping due to the previous problem)

ok it works better. I used @Algiane recommendation and get the following mesh


if I remove them the algorithm fails often

Metric gradation from required entities can be sometime buggy…

Could you try with a smaller MMG3D_DPARAM_hausd? Since there is a geometric surface containing all the required elements, asking for an increased accuracy (smaller Hausdoff parameter) near the boundary should also propagate smaller sizes a bit further into the domain.

it is better, I get something like that

with

MMG3D_Set_iparameter(mesh,sol,MMG3D_IPARAM_nosizreq,1);
MMG3D_Set_dparameter(mesh,sol,MMG3D_DPARAM_hgradreq,-1);

If I set my own metric, it get stuck after a few iterations

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
MODULE MMG2D: 5.5.2 (Nov. 17, 2020)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
git branch: No git branch found
git commit: No git commit found
git date: No git commit found

– MMG2DLIB: INPUT DATA
– INPUT DATA COMPLETED. 0.000s
MAXIMUM NUMBER OF POINTS (NPMAX) : 50000
MAXIMUM NUMBER OF TRIANGLES (NTMAX) : 100000

– PHASE 1 : DATA ANALYSIS

– MESH QUALITY 6053
BEST 1.000000 AVRG. 0.925292 WRST. 0.008296 (4828)
HISTOGRAMM: 99.85 % > 0.12
99.36 % > 0.5
0.8 < Q < 1.0 5395 89.13 %
0.6 < Q < 0.8 569 9.40 %
0.4 < Q < 0.6 66 1.09 %
0.2 < Q < 0.4 13 0.21 %
0.0 < Q < 0.2 10 0.17 %
** SETTING TOPOLOGY
Connected component or subdomains: 2469
Tagged edges: 3943, ridges: 33, refs: 3910
4 corners, 0 singular points and 1445 non manifold points detected
30 calculated normal vectors

– RESULTING EDGE LENGTHS 9063
AVERAGE LENGTH 0.0589
SMALLEST EDGE LENGTH 0.0012 2775 259
LARGEST EDGE LENGTH 1.2723 27 1911
0.60 < L < 1.30 197 2.17 %

 HISTOGRAMM:
 0.00 < L < 0.30      8739   96.43 %  
 0.30 < L < 0.60       127    1.40 %  
 0.60 < L < 0.71        34    0.38 %  
 0.71 < L < 0.90        78    0.86 %  
 0.90 < L < 1.30        85    0.94 %  

– PHASE 1 COMPLETED. 0.006s

– PHASE 2 : ISOTROPIC MESHING
** GEOMETRIC MESH
2 splitted
1210 vertices removed
240 edge swapped
2 splitted, 1210 collapsed, 240 swapped
25 splitted
21 vertices removed
64 edge swapped
25 splitted, 21 collapsed, 64 swapped
22 splitted
12 vertices removed
12 edge swapped
22 splitted, 12 collapsed, 12 swapped
20 splitted
10 vertices removed
10 edge swapped
20 splitted, 10 collapsed, 10 swapped
20 splitted
10 vertices removed
10 edge swapped
20 splitted, 10 collapsed, 10 swapped
** COMPUTATIONAL MESH
** Defining isotropic map

– SIZEMAP CORRECTION : overwritten of sizes at required vertices

– GRADATION : 1.300000 (2.300000)
** Grading mesh
gradation: 0 updated, 1 iter.
** Grading required points.
gradation (required): 390 updated, 4 iter.
193 splitted
91 vertices removed
396 edge swapped
193 splitted, 91 collapsed, 396 swapped
166 splitted
28 vertices removed
218 edge swapped
166 splitted, 28 collapsed, 218 swapped
32 splitted
12 vertices removed
37 edge swapped
32 splitted, 12 collapsed, 37 swapped
33 splitted
3 vertices removed
8 edge swapped
33 splitted, 3 collapsed, 8 swapped
51 splitted
6 vertices removed
21 edge swapped
51 splitted, 6 collapsed, 21 swapped
197 edge swapped
426 vertices moved, 1 iter.
417 splitted, 473 collapsed, 197 swapped, 426 moved
488 edge swapped
856 vertices moved, 1 iter.
998 splitted, 567 collapsed, 488 swapped, 856 moved
378 edge swapped
1212 vertices moved, 1 iter.
1033 splitted, 672 collapsed, 378 swapped, 1212 moved
301 edge swapped
1494 vertices moved, 1 iter.
936 splitted, 643 collapsed, 301 swapped, 1494 moved

it is a pity, the mesh is quite good, but it seems we have very small elements at the tip
Screenshot 2021-05-08 at 00.47.45

here is the overall view (iteration right before it gets stuck)

ok I got a good result but I need to take very small step at a time

1 Like

Nice to see it!

By “stuck” you mean that suddenly it refuses to improve the mesh and returns? The mesh does seem to have almost null elements near the tip, I can’t see if they are there before adapting.
Maybe the time step could be reduced only when the Harmonic extensions produces elements with volume below a given tolerance!