Closed random Sphere Pack
显示 更早的评论
Hi Guys
I need a Closed Random sphere pack with radius distribution for my Master Thesis.
i write code and its run good.
but i have 1 problem.
When Matlab Place Some Spheres and check their Overlapping, some spheres have free space between each other and matlab cant place another sphere there. i need a porous space that have porosity about 35-37%. but matlab take too many time for make that porous. if anyone can help me plz reply. i need make closed sphere pack or transfer spheres to near each other.
Tnx
3 个评论
Sonti Srinivasa Murali Kartheek
2020-10-1
Hi I am badly looking for this model as part of my research wotk. Can you please share the code? p20180450@hyderabad.bits-pilani.ac.in
Ismail Can Karaoglu
2020-11-3
Hi, I also need such a code for my thesis. Could you please share the code with me?
My mail: ismailckaraoglu@gmail.com
Thanks in advance.
Travis Sippel
2021-3-26
Ismail, Mohammad, did you ever get this problem figured out?
Travis
回答(1 个)
Giao Vu
2019-11-15
0 个投票
are you using only 1 size sphere? you could try to make the spheres size adjustable (+-20%)and adjust the you code to 'shrink' or expand a little when needed.
4 个评论
Mohammad Faris
2019-11-15
Giao Vu
2019-11-15
for one size particle you can only obtain up to 35% porosity. (https://en.wikipedia.org/wiki/Random_close_pack). The higher the max_size/min_size ratio the smaller the porosity you can get. You can try first to randomly embed sphere in the medium, if successful, make the next step to expain it (for example 20%, if it doesn't work try sth like 19% and so forth).
In the case of overlapping, one coud try to calculate how much overlapping and shrink the particle accordingly (up to 20% less, for example).
There are different techniques, like in DEM (Discrete Element Method), after fill up the geometry, they start to run simulation to compact them. or you could also use periodic packing/boundary. You could try to look into opensource software like Woo or Yade where they have implemented this packing method.
Giao Vu
2019-11-15
I just saw this one, not sure if it would help :)
Kenneth
about 2 hours 前
If you want true random close packing, the problem is more complicated than simply placing spheres randomly and rejecting overlaps. That approach only works at very low densities.
To generate dense packings of non-overlapping spheres, you usually need an algorithm that evolves the system toward a jammed configuration using either an optimization method or a dynamical simulation.
As a practical example, the following matlab snippet generates a dense packing using rcpgenerator (github repo and code on mathworks file exchange) open-source library for this purpose (disclaimer: I am the author of both this library and the underlying physics publications): Below is a more complex setup, but more simple ones like monodisperse, bidisperse, etc in a unit box (with or without periodic boundaries) are easy to setup (see repo for examples)
%% Code
Ndim = 3; % Number of dimensions
Box = ones(1,Ndim); % Set container size to 1 x 1
verbose = 0; % Print packing update as it goes
N = 500; % Number of particles
phi = 0.1; % Initial Packing Fraction for seeding particles
% Particle size distribution
distribution.type = 'BiGaussian';
distribution.mu1 = 1; % Smaller diameter
distribution.sigma1 = 0.2; % Smaller std diameter
distribution.mu2 = 5; % Larger diameter
distribution.sigma2 = 1; % Larger std diameter
distribution.p = 0.6; % 60% of particles with d1
walls = [-3,1,1]; % Make first 3 dimensions circular boundaries
fix_height = 0; % do not constrain container height to particle diameter
% Initialize Particles
[x0, D0] = initialize_particlesND(phi, N, Box, distribution);
% Create Packing
[x, D, U_history, phi_history, Fx] = CreatePacking(x0, D0, Box, walls, fix_height, verbose);
% Plot packing
plot_particles_3D(x, D, [1,1,1],5)
%%
Below are images of packings rendered using the matlab code



Two common approaches are used in the literature to create such packings.1. Optimization-based packing algorithms
These methods allow particles to slightly overlap during the optimization process.
The idea is:
- Start from a random low-density configuration.
- Gradually increase particle diameters.
- Use an optimizer to adjust particle positions to minimize overlaps.
- Stop when overlaps fall below a small tolerance.
In well-converged packings, overlaps are typically extremely small (often ~10⁻³ of the particle diameter or less).
The position updates can follow either:
- physics-inspired force updates, or
- purely mathematical optimization methods.
2. Dynamical hard-sphere simulations
Another class of algorithms simulates true hard spheres colliding like billiard balls.
In these algorithms:
- A gas of spheres starts at low density with high kinetic energy
- Particle diameters are slowly increased
- Energy is gradually removed from the system
- The system evolves through collisions until particles become jammed
These methods follow physically realistic particle dynamics and have been widely used to study hard-sphere systems.Practical considerations
Physics-based updates typically involve an associated step size (typically a time step) that must remain relatively small for numerical stability, and slow dramatically for highly polydisperse packings where the largest-to-smallest particle size ratio is large. Optimization methods, on the other hand, can take larger non-physical steps toward the minimum overlap configuration and tend to be more stable in highly polydisperse cases.
Because of this, optimization approaches often reach dense packings more quickly (allowing one to generate packings of 1000+ particle in seconds to minutes), although the intermediate states do not correspond to a physically realistic trajectory. In practice, structural properties of packings generated by optimization algorithms tend to agree well with physical experiments (packing fraction, structure factor, coordination number, etc).
rcpgenerator uses an optimization-based approach (ADAM optimizer) to separate particles as they grow in size.
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!