-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix bug in GridFiller when using <density> option #375
Conversation
Currently, the CI fails since the DropletCoalescence/liq/config_1_generateLiq.xml example fails. This is due to the fixed bug in GridFiller (and therefore, no explosions any more) and an issue also mentioned in PR #319. This should be solved with PR #371 (which fails due to the bug in the GridFiller). So I would suggest to comment out this example in the example list for the present PR and re-introduce it with PR #371. |
I see the issue you have. This is indeed a limitation of the generator utilities library. From my point of view, this has to be solved in the io/Readers. |
How or where would you solve this in the io/Readers? After the generation of the initial particle configuration, the is no reader/IO involved before the simulation starts. Why should the reader or IO modify the position of the particles? |
It has been some time since I implemented all of this and I need to have a look at the details again. |
Ok. So for just setting up a simulation filled with a grid which should not explode, the use of the CubicGridGenerator is better. There were other issues with it (see #376), which I fixed in PR #377. |
Description
Currently, the GridFiller might place particles in a way that leads to
explosions
at the beginning of the simulation. This is due to the close distance of some particles across the periodic boundary conditions when the entire simulation domain should be filled with a grid. See also issues below.The problem is, in my opinion, that the size of the unit cell is calculated with the desired density. However, the desired density is probably not met at the end due to the lattice and therefore the discrete number of inserted particles. Another issue could be that a cubic unit cell is used.
This PR solves this problem by scaling the unit cell so that the object box size is evenly divisible by the unit cell size. This leads to the same distance between all unit cells even across the PBC.
This PR also cleans up the readXML method of the GridFiller since (as already written in the doc) the
<lattice>
option is ignored/overwritten when the<density>
option is set. Therefore,<lattice>
is only read if<density>
was not specified.This is also the reason why
<lattice>
was deleted in the config xmls in files where<density>
was set.Further improvements
In the future, it would be nice to add a mechanism which ensures that the desired density is met, e.g. by deleting particles. Currently, there is no generator that just creates a simulation with a given density and temperature (like in ms2).
This is not part of the present PR.
Resolved Issues
How Has This Been Tested?
There are explosions when running this example, see also PR #371.
With the changes of the present PR, the explosions are gone. It was also tested what happens when both
<lattice>
and<density>
are specified (--><lattice>
is ignored as expected).