pierrehirel / atomsk

Atomsk: A Tool For Manipulating And Converting Atomic Data Files -
https://atomsk.univ-lille.fr
GNU General Public License v3.0
203 stars 75 forks source link

Issue with Polycrystal mode #46

Closed tcphan0601 closed 1 year ago

tcphan0601 commented 2 years ago

Hi,

I noticed a couple issues with Polycrystal mode.

1/ When I use the polycrystal mode using the nodes information file below, some grains are not trimmed correctly, as shown in the screenshot (the triangular yellow regions). polycrystal.txt Ni.txt (I changed the extension from .cfg to .txt so that I can upload it here)

Screenshot from 2022-09-01 22-21-38

I notice in the code that the maximum vertices (neighboring nodes?) is limited to 21 for 2-D and 59 for 3-D (line 999 and 1001 in mode_polycrystal.f90). I suspect that this is the cause so I increase these limits to 100 and all the grains are trimmed correctly using the recompiled file. I didn't check the source for why you set these limits but it doesn't seem to work in this particular case.

The command I used to generate this error

atomsk --polycrystal Ni.cfg polycrystal.txt final.cfg

2/ Sometimes I ran into this error below. Screenshot from 2022-09-01 22-28-09

The files and command that I used to generate this error: Ni.txt polycrystal2.txt

atomsk --polycrystal Ni.cfg polycrystal2.txt final.cfg

I'm not sure what's going here but sometime it works and sometimes it terminate with this error (when I use different sets of nodes) Here is the MatLab code that I used to generate the set of nodes. You can create different set of nodes and sometimes it works, sometimes it doesn't. Seed_generation.txt (Again, I changed the extension from .m to .txt in order to upload here)

Best,

Thanh

pierrehirel commented 2 years ago

Dear Sir,

Thank you for reporting this. I was able to reproduce the bug with the files you provided. I have committed a new version on GitHub, which should fix the issue.

The fix consists in increasing the max. number of neighboring vertices used to cut each grain. In principle, assuming a uniform and random grain distribution, then each node should not be surrounded by more than 21 vertices. I assume that you ran into a problem because your distribution is not random and is not uniform, some grains being much larger than others. Increasing "maxvertex" seems to fix the issue, but it also costs more computing time. I imagine that a more clever implementation could also fix the issue, but I do not have more time to devote to it at the moment.

Concerning the program crash (SIGABRT), I was not able to reproduce it, Atomsk works fine with the files that you provided. Can you try with the latest version and let me know if you still experience those crashes?

Best regards

tcphan0601 commented 2 years ago

Hi,

Thanks for the clarification. Yes, it only happens when the grain distribution is not uniform. Increasing the "maxvertex" seems to fix the issue for that configuration. However, when I try another configuration with even more exaggerated non-uniformity (just out of curiosity), the issue stills happens as seen in the screenshot below, especially for those relatively larger grains. Please see the files I used below. I ran it using the latest version. Screenshot from 2022-09-02 13-22-11 polycrystal.txt Ni.txt

atomsk --polycrystal Ni.txt polycrystal.txt test.cfg

I think eventually you would probably need to implement another method to completely fix this issue since exaggerating the non-uniformity may still break the limit. Not sure if someone would be interested in going that far but it could still happen.

As for the program crash, the new version fixed it and it still occurs for the older version so I think it was somehow related to that "maxvertex" limit.

Best,

Thanh

pierrehirel commented 2 years ago

Hi,

I have found some time to work on this problem, and have committed a new version on GitHub which should fix completely this issue.

If you have time to test it I would appreciate your feedback.

Best regards

pierrehirel commented 1 year ago

Without any response for more than 2 months I close this issue.