CHLNDDEV / OceanMesh2D

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).
https://github.com/sponsors/krober10nd
GNU General Public License v3.0
178 stars 64 forks source link

Infinite loop when cleanup the mesh #288

Closed Jiangchao3 closed 1 year ago

Jiangchao3 commented 1 year ago

Hi @krober10nd and @WPringle ,

I am making a mutiple scale mesh (out is ECGC, inner is the east florida coast), when I make the mesh, it can not stop during cleanup,

it seems fall into an infinite loop, any suggestions about how to solve it?

Poor or overlapping elements, cleaning again (Min Qual = 0.001589) Beginning mesh cleaning and smoothing operations... Employing default (medium) option or user-specified opts INFO: The following cleaning options have been enabled.. db: 0.2500 ds: 2 con: 9 djc: 0.2500 sc_maxit: 0 mqa: 0.2500 renum: 1 nscreen: 1 projL: 0

length of pfix = 0 Deleted 3 bad boundary elements Removed 0 thin triangles! Entry: Making mesh boundaries traversable... ACCEPTED: deleting 0 elements outside main mesh ACCEPTED: deleting 0 elements inside main mesh Exit: finished making mesh boundaries traversable.. Initial bandwidth is 130696 Renumbered bandwidth is 2356

A neighbor list was not present in the finite element structure. One is being added now.

The neigbor list was successfully added. The grids nodal connectivity is not higher than 9, nothing will be done. Returning the original mesh.

Smooth triangulation...


  |ITER.|          |MOVE(X)|          |DTRI(X)|     

      4                450             289656
      8                480             289656
     12                103             289656
     16                 46             289656
     20                 24             289656
     24                 20             289656
     28                  2             289656
     32                 10             289656

Poor or overlapping elements, cleaning again (Min Qual = 0.001589) Beginning mesh cleaning and smoothing operations... Employing default (medium) option or user-specified opts INFO: The following cleaning options have been enabled.. db: 0.2500 ds: 2 con: 9 djc: 0.2500 sc_maxit: 0 mqa: 0.2500 renum: 1 nscreen: 1 projL: 0

length of pfix = 0 Deleted 3 bad boundary elements Removed 0 thin triangles! Entry: Making mesh boundaries traversable... ACCEPTED: deleting 0 elements outside main mesh ACCEPTED: deleting 0 elements inside main mesh Exit: finished making mesh boundaries traversable.. Initial bandwidth is 157120 Renumbered bandwidth is 2625

A neighbor list was not present in the finite element structure. One is being added now.

The neigbor list was successfully added. The grids nodal connectivity is not higher than 9, nothing will be done. Returning the original mesh.

Smooth triangulation...


  |ITER.|          |MOVE(X)|          |DTRI(X)|     

      4                282             289654
      8                377             289654
     12                 78             289654
     16                 44             289654
     20                 18             289654

The following is my inner domain want to refine the resolution, I am not sure whether is the inner bbox place result in the infinite loop?

inner

Thanks!

Jiangchao3 commented 1 year ago

I changed the inner bbox, now it can stop after cleanup 7 times

WPringle commented 1 year ago

This does usually mean that there are some complications with bboxes intersecting islands and other things like that. Basically there are some very close points creating thin triangles, and may need to consider other cleaning options to try and remove those such as bad boundary element quality, db > 0.25 and setting sc_maxit > 0, in addition to moving inner box so you have a "clean" boundary

Jiangchao3 commented 1 year ago

@WPringle Thanks for your explaination, I am reading the doc for cleaning options, and I will carefully place the inner box

Jiangchao3 commented 1 year ago

Hi @WPringle , I tried to put a new inner box place to avoid intersecting with islands, and use a different db and sc_maxit:

m_1 = clean(m,'db',0.6,'sc_maxit',100);

the clean algorithom run about 10 times then end even the Min Qual did not match the mqa threshold 0.25,

Why does the clean end before the condition of Min Qual is met?

If i use this mesh with the min qual 0.0011416 for simulation, will it cause numerical instatbility?

see the last iteration of the cleanup as following:

Poor or overlapping elements, cleaning again (Min Qual = 0.0011416) Beginning mesh cleaning and smoothing operations... Employing default (medium) option or user-specified opts INFO: The following cleaning options have been enabled.. db: 0.6000 ds: 2 con: 9 djc: 0.1000 sc_maxit: 100 mqa: 0.2500 renum: 1 nscreen: 1 projL: 0

length of pfix = 0 Deleted 26 bad boundary elements Removed 0 thin triangles! Entry: Making mesh boundaries traversable... ACCEPTED: deleting 0 elements outside main mesh ACCEPTED: deleting 0 elements inside main mesh Exit: finished making mesh boundaries traversable.. ACCEPTED: deleted 0 bad elements that are connected to a single neighboring element Initial bandwidth is 88449 Renumbered bandwidth is 1919

A neighbor list was not present in the finite element structure. One is being added now.

The neigbor list was successfully added. The grids nodal connectivity is not higher than 9, nothing will be done. Returning the original mesh.

Smooth triangulation...


  |ITER.|          |MOVE(X)|          |DTRI(X)|     

      4                237             279680
      8                496             279680
     12                 55             279680
     16                 61             279680
     20                 43             279680
     24                  9             279680
     28                 10             279680
     32                  1             279680

number of nodes is 151015 mean quality is 0.9564 min quality is 0.0011416

the following is my new iner bbox:

123

WPringle commented 1 year ago

@Jiangchao3 Yeah we added a feature where the cleaning will end if there has been no change from previous iteration even if mqa condition not met. The simulation might just work ok. One thing you could do is use the fixmesh function with a higher ptol to remove very close points, or use the msh.bound_courant_number() function could be better actually.

Jiangchao3 commented 1 year ago

Hi @WPringle, really appreciate you are so kind for give me great suggestion.

I tied use msh.bound_courant_number(), but it is difficult to assign an appropriate dt value. when I use a small dt as 0.5s, it said that the mesh has been satisfied the desired cr value, but if I give a bigger value as 2 s, most of the triguranles will be deleted. see as following:

cr

I also try to buond the max_cr and min_cr, using bound_courant_number(m,30,8,0.1), it still don't work.

I think the bound_courant_number is recommended using for the scheme of adcirc_54, since adcirc 55 use a semi-implicit numerical scheme, the CFL condition is different from that of older version.

I tried use a passive mode but several user-defined parameters as following: m = clean(m,'passive','db',0.25,'ds',2,'con',9,'djc',0.1); it just iterate about 1-3 times can finish, but the min qual is about 0.001, can not met the 0.25 threshold.

Now i will try to simulate using this mesh and test if there will be instable issues with the min qual is 0.001.