Weird results using metric in MMG2D

Hello everyone,

I’m currently exploring how to use level set discretization in combination with a metric in mmg2d, and I’ve been referring to the example IsosurfDiscretization_IsAndMetric for guidance.

In my implementation, I adopted the way the metric is applied in the example, but I modified the tensor values to make the metric isotropic (if I understand correctly) by changing the first tensor component from 10000` to 100:

for(k=1 ; k<=np ; k++) {
if ( MMG2D_Set_tensorSol(mmgMet,100,0,100,k) != 1 ) exit(EXIT_FAILURE);
}

When I looked at my results two things are weird to me:

However, I’m experiencing two unexpected behaviors:

1: Occasionally, the output mesh contains some oddly shaped, sharp triangles (see screenshot below).
2: Running the exact same script multiple times results in slightly different meshes at a given time step.

Both issues seem to disappear when I don’t provide a metric.

I would really appreciate any insights or advice on what’s going wrong here. Is there something I might be missing when combining a level set with a metric?

Thanks in advance!

Best regards,
Nils

Screenshot 2025-04-15 174010