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
179 stars 65 forks source link

what is the blue holes in grid? #215

Closed carrey95 closed 3 years ago

carrey95 commented 3 years ago

What is the blue holes in the grid?

blue hole in grid in OceanMesh2D

krober10nd commented 3 years ago

Hey @carrey95 looks like it's trying to identify some holes in the mesh for some reason as ocean boundaries. I assume you've ran

m = make_bc(m,'auto',gdat); 

This can be controlled...see help msh.make_bc under the auto option.

carrey95 commented 3 years ago

Thanks for the comment. I ran m = make_bc(m,'auto',gdat,'distance'); Somehow it makes those blue holes in the water. Anyone knows how the holes can be avoided?

krober10nd commented 3 years ago

Does your shoreline have islands there?

Could you visualize your geodata

plot(gdat,'shp')
carrey95 commented 3 years ago

there are no islands there but just water. That is why I wonder. Thanks.

krober10nd commented 3 years ago

Okay if it's not too hard, I would rebuild the mesh from scratch and see if they happen again. Note you should set the random seed so the generation is reproducible by placing this before calling meshgen.

rand('seed',1);

where 1 here is your seed. This way I'll also be able to build you instance of the mesh if this keeps happening.

If this re build doesn't work, I'd recommend removing the cleanup step during mesh generation by passing cleanup,0 to meshgen.

carrey95 commented 3 years ago

when using 'cleanup',0 in meshgen, some error occurs:

m = make_bc(m,'auto',gdat,'distance'); Unable to perform assignment because the size of the left side is 1-by-2 and the size of the right side is 0-by-2. Error in extdom_polygon (line 103) temp(k,:) = pts(sel,:); Error in msh/make_bc (line 1380) [polys,poly_idxs] = extdom_polygon(etbv,obj.p,1);

carrey95 commented 3 years ago

used meshgen as mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1,'nscreen',5,'proj','Equidistant Cylindrical','cleanup',0);

krober10nd commented 3 years ago

yep, that's because the mesh isn't cleaned. I wanted to know if that fixed your holes issue or not. Can you plot the connectivity?

carrey95 commented 3 years ago

'cleanup',0 does not remove the holes. Somehow, using rand('seed',1) and different maximum resolution resolves the problem. Thanks.

carrey95 commented 3 years ago

by the way, how can I plot the connectivity?

krober10nd commented 3 years ago

plot(m)

see

help msh.plot