Crash During buildmesh Execution: Failure of try-catch and Impact of Additional Boundary

Hello,
I am experiencing an issue with my code, which I have attached for reference. The code consistently crashes during the execution of the buildmesh command. I tried to use the try-catch block, but it couldn’t catch the error either. Interestingly, when I add a new tiny boundary bound00, the issue disappears for the given parameters.
My questions are the following:

  1. What could be causing this crash during the meshing process and how can I prevent it (without try-catch)?
  2. Why does the try-catch block fail to catch and handle this error?
  3. How did adding the bound00 help? Will it help with other parameters’ values?
    I would greatly appreciate your insights on this matter.
    meshing_bug_example(1).edp (2.0 KB)

Hello,
I think that your borders are too close to each other. When discretized, their boundary elements could cross and make the geometry impossible. It can happen for bound3 and bound4 which are close and for which you ask for a different number of points meshsize1 or meshsize2
bound3(meshsize1) + bound4(meshsize2)
The fact that they cross or not is somehow random, depending on where the points are located. This randomness could be stimulated by the addition of bound00.

1 Like

Thank you for your reply. Yes, we also suspected that there might be a problem with the distance between boundaries, so we tried using the “try-catch” block to catch the “random” cases and edit the geometry.
Can you/someone help understand why the “try-catch” block doesn’t work to catch the wrong geometry?