Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge circumcenters option? #812

Closed
thopri opened this issue Apr 5, 2024 · 5 comments
Closed

merge circumcenters option? #812

thopri opened this issue Apr 5, 2024 · 5 comments

Comments

@thopri
Copy link

thopri commented Apr 5, 2024

Hello,

I am using dfm_tools and adapting the model builder example to create a model configuration, this all works well unless the coastline is quite complicated, e.g. French coast on the English Channel. When trying to run the configuration I get the following error:

ERROR : 748 small flow links discarded. Run 'merge circumcenters' to remove small flow links or increase threshold

The merge circumcenters doesn't seem to be part of dfm_tools? I can only find references for the option in the delft3d GUI. The only solution I have found so far is to increase the cell size but this often ends with quite a large resolution before all the circumcenters are on longer too close together.

I can see that there is a threshold that can be increased? its not clear where to do this or if it is sensible to do so?

Any guidance would be appreciated.

@veenstrajelmer
Copy link
Collaborator

@lucacarniato would you have time to provide a meshkernel example for merge circumcenters?

@thopri
Copy link
Author

thopri commented Apr 5, 2024

Would the function "mkernel_mesh2d_delete_small_flow_edges_and_small_triangles";on this page

https://deltares.github.io/MeshKernel/namespacemeshkernelapi.html#a40a8202bcfaa2902b5d42aed1cec50bb

Be a solution?

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Apr 9, 2024

Hi @thopri, indeed, but you would need the meshkernelpy function mk.mesh2d_delete_small_flow_edges_and_small_triangles(): https://github.com/Deltares/MeshKernelPy/blob/ceba1501bd85ba56170a37665d4c5012019c614d/meshkernel/meshkernel.py#L992

Then you can just use the meshkernel instance generated by the dfm_tools modelbuilder code.

You would have to set sensible values for the two required parameters, my suggestion is to start with small_flow_edges_length_threshold=0.1 and min_fractional_area_triangles=0.2.

So something like this:

mk_object = dfmt.make_basegrid(lon_min, lon_max, lat_min, lat_max, dx=dxy, dy=dxy, crs=crs)
[do your refinement, cutting, etcetera]
mk_object.mesh2d_delete_small_flow_edges_and_small_triangles(
        small_flow_edges_length_threshold=0.1, 
        min_fractional_area_triangles=0.2)

@lucacarniato
Copy link

mk.mesh2d_delete_small_flow_edges_and_small_triangles is intended for deleting small flow edges. A representative flow edge length is computed from the square root of the average area of neighboring faces. The 'small_flow_edges_length_threshold' is used as a multiplier of this area for deleting the edges crossed by such small flow edges.

min_fractional_area_triangles is used as a multiplier of the average face area to determine triangles at the boundary which can be deleted.

@thopri
Copy link
Author

thopri commented Apr 10, 2024

Excellent thanks for the help, my model config now runs 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants