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

Increasing the mesh resolution in the boundaries #226

Closed Kasra-n90 closed 3 years ago

Kasra-n90 commented 3 years ago

Hi, I hope you are good.

In my case of mesh-generation, the boundaries are not that important. Therefore, I want to keep the resolution at that places quite high. However, based on my experience, we only can use 'max_el_ns' in edgefx function to determine the maximum resolution. Is here any way to determine the minimum resolution for the boundaries?

Thanks

krober10nd commented 3 years ago

Hey @Kasra-n90 the minimum mesh resolution is enforced in your meshing domain via the parameter h0 that is passed to the geodata class constructor.

The parameter max_el_ns limits the expansion of the shoreline resolution when using the feature size mesh resolution distribution.

Kasra-n90 commented 3 years ago

Thank you for your kind answer. But, in my case, I want to have a fine resolution throughout my river (by using the channel scale ('ch' and 'channels' parameters) ) and a coarse resolution in my boundaries. However, the parameter 'h0', impacts the resolution throughout the river also. So is there any way to keep the resolution fine in river vicinity and have a coarse one in the boundaries?

Thanks again.

krober10nd commented 3 years ago

Then I would recommend creating a polygon around your channel area that you want to use fine resolution and using a different h0 in that area than in the larger river. Use the multiscale approach.

Note the enforceMin option in meshgen; this will allow you to not have to enforce the minimum edge length from all your domains.

krober10nd commented 3 years ago

Also, please next time try to use the issue templates and makes sure you answer the relevant questions. This will greatly help the process to help you!

Kasra-n90 commented 3 years ago

Thank you for the kind answer...Yes, I will keep the template in mind next time!

krober10nd commented 3 years ago

Hey @Kasra-n90 if you have had success and can share any images of your problem or code, this would be useful to potentially help future users too in case they want to achieve similar things.

Otherwise, can I close this issue?

Kasra-n90 commented 3 years ago

I have another issue. Whenever, I want to separate a region and create a mesh inside that, my code does exclude that part and creates a mesh around that area.

For instance, here, I want to allocate a higher resolution to my river inside the basin. but as the second picture shows, the code has excluded the river and has created a fine mesh around it. image image

For instance, if I have a shapefile of river like below picture, how should I define my 'bbox', so the mesh gets created inside the river. image

Should I add all the code, shapefiles and DEM for better considering the issue?

Thank you for your time.

krober10nd commented 3 years ago

OM meshes regions defined by polygons so in your last image, the closed polygon is actually what is being meshed, which is the opposite of what you want.

Anyway, to mesh the river: in the inner domain's geodata object, switch the field inpoly_flip from it's existing value to the opposite. So if inpoly_flip is currently 1 for that domain, switch it to 0.

krober10nd commented 3 years ago

Has your issue been resolved? Can I close this?