VasiliBaranov / packing-generation

Hard-sphere packing generation in C++ with the Lubachevsky–Stillinger, Jodrey–Tory, and force-biased algorithms and packing post-processing.
MIT License
106 stars 43 forks source link

Confining walls #18

Open hfrusinque opened 4 years ago

hfrusinque commented 4 years ago

Hi Vasili,

is it possible to activate somehow the wall options? do you think that implementing spherical walls/confinement in your code is realizable?

Beste Grüße, Hector Rusinque

VasiliBaranov commented 4 years ago

Hi Hector,

i think it's realizable and it's definitely possible. I even think it worked several years ago when i started working on this program, but then i never needed this option and it probably doesn't work.

For the Lubachevsky-Stillinger algorithm, one will just have to reflect a particle elastically from a wall if a particle collides with a wall. So it will be another type of events, along with particle-particle collisions. I actually implement elastic reflections of particles, given that each particle is connected by a "tether" of a certain length to its original position. I needed it for the tether method of thermodynamic integration. So the task of reflecting from a single wall will be similar and even easier.

Unfortunately, i won't have time to implement it in the next several months. If you implement it, i will be happy to consider a pull request1

Best Regards, Vasili

VasiliBaranov commented 4 years ago

Hi Hector,

i've realized that everything is almost ready for confining (non-penetrable) walls for the LS algorithm.

There is this class and this function that moves a particle to the opposite wall if a particle crosses a wall during the flight: https://github.com/VasiliBaranov/packing-generation/blob/master/PackingGeneration/Generation/PackingGenerators/LubachevsckyStillinger/Source/WallTransferEventProcessor.cpp#L25 I think if you add an if-else like if (periodic){     use old code (shift the particle to the opposite wall) } else if (non-penetrable walls) {     do not shift the particle, but mirror-reflect the particle velocity } It will probably be enough! You can try this out, maybe search for usages of this class/method (i also mostly forgot the details of the program).

Hope this helps!

Best Regards, Vasili

hfrusinque commented 4 years ago

Thanks a lot for your kind reply, Vasili. I will try to find the time to give it a look. I definitely want to try to implement spherical impenetrable walls.

Thanks again for your time and help.

Beste Grüße, Héctor

VasiliBaranov commented 4 years ago

Dear Héctor,

no problem!

just a small addition: i actually implemented specular reflection from planes as well, here: https://github.com/VasiliBaranov/packing-generation/blob/master/PackingGeneration/Generation/PackingGenerators/LubachevsckyStillinger/Source/VoronoiTransferEventProcessor.cpp

It's even for a more complex case than reflection from simple cube walls; it's reflection from the walls of Voronoi cells that surround each particle (i needed it for thermodynamic integration).

Best Regards, Vasili

jayghoshter commented 4 years ago

Hi Vasili and Hector,

I'm interested in cylindrical walls for my project. Has there been any progress on this issue?

Best, Jayghosh Rao

VasiliBaranov commented 4 years ago

Hi Jayghosh,

sorry, i didn't have time to work on this. To be very honest, i don't realistically think it will happen in the next several months..

Best Regards, Vasili

jayghoshter commented 4 years ago

Hi Vasili,

I understand. If it's as simple as updating an if-statement as you mentioned above, I might get around to doing it myself when it becomes absolutely necessary.

Best, Jay