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
107 stars 44 forks source link

Generating a packing with few particles #8

Open hhucyl opened 6 years ago

hhucyl commented 6 years ago

Hi, I have been using your code to generate a random packing with very few particles (50~100). I have tried this generation.conf Particles count: 100 Packing size: 10. 10. 10. generation start: 1 boundaries mode: 1 contraction rate: 1e-4 The particles are overlapped with each other. Could please tell how to fix it? Or, is it possible to use your code to generate a random packing with very few particles?

VasiliBaranov commented 6 years ago

Hi,

one possible reason is that due to historical reasons the final particle diameters saved in the packing.xyzd file are equal to the initial particle diameters (specified in the user-provided packing.xyzd or diameters.txt files) and you have to rescale the diameters linearly to get the "real" final particle diameters. Please see this section for more details and sample code. Hope rescaled particles will have no intersections.

Best, Vasili

hhucyl commented 6 years ago

Hi, Thanks for your quick reply. I did forget to rescale it, however when I use this generation.conf Particles count: 80 Packing size: 5. 5. 5. Generation start: 1 Seed: 341 Steps to write: 1000 Boundaries mode: 1 Contraction rate: 1.5e-004

  1. boundaries mode: 1 - bulk; 2 - ellipse (inscribed in XYZ box, Z is length of an ellipse); 3 - rectangle
  2. generationMode = 1 (Poisson, R) or 2 (Poisson in cells, S) The results still overlap with each other. And it comes wit this results in the terminal: Checking... Calc. porosity is 0.313706 Theoretical porosity is 0.664897 Checking min particle distance in a naive way... Finish: Calc. porosity is 0.313705899228934 Theoretical porosity is 0.664897 Inner diameter ratio is 1.26992251534201 Time: 46.8032 s, iterations are 8284 Since the calculated porosity is not equal to the theoretical one, I suppose something is wrong. The visualized result is in the attachment. This I do remember to scale it. Many thanks for your time. packiong
hhucyl commented 6 years ago

Hi, Somehow, I suspect that my post processing drawing script is wrong, I used matlab function ellipsoid to visualize to the result. Could you please tell me how you visualize it?

VasiliBaranov commented 6 years ago

Hi,

Since the calculated porosity is not equal to the theoretical one, I suppose something is wrong.

Actually, this is not a problem. The theoretical porosity is the expected porosity, the one calculated from original diameters (which are unity by default). The FBA algorithm uses this expected porosity as a parameter. But it will not always be able to reach it. The LS algorithm doesn't use it at all. So the calculated porosity can have any value.

As i tried to explain in the Readme (section referenced before), you have to multiply particle diameters by (finalDensity / theoreticalDensity)^(1/3) = ((1 - finalPorosity) / (1 - theoreticalPorosity))^(1/3). I think it shall be enough. The only other thing that comes to mind is you can make sure that if your visualization function accepts radii, you pass radii there, not diameters.

I was using some Visual Molecular Dynamics software for visualization actually, but it's probably an overkill. But you can check this reply.

Best, Vasili

hhucyl commented 6 years ago

Dear Vasili

Thanks for your quick reply. I have confused the diameter with radii. Sorry for all this trouble.

Cheers Chen