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
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
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
Travis Sippel 2021 年 3 月 26 日
Ismail, Mohammad, did you ever get this problem figured out?
Travis

サインインしてコメントする。

回答 (2 件)

Giao Vu
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.

3 件のコメント

Mohammad Faris
Mohammad Faris 2019 年 11 月 15 日
Hello thank you for replying actually yes I use same size sphere but can you explain more please Tnks
Giao Vu
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
Giao Vu 2019 年 11 月 15 日

サインインしてコメントする。

Kenneth
Kenneth 約8時間 前

0 投票

If you want true random close packing (or densities of ~64%), 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.
You can use the following matlab snippet (or others on the exchange and repo) to generates dense packings with 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): This setup is a little more complex but shows the breathe of the kinds of cases you can create, but more simple cases like monodisperse, bidisperse, etc in a unit box (with or without periodic boundaries) are easy to setup (see repo for examples)
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
Creating your own code
If you want to build this yourself, you can, but it can be quite involved. You generally need to evolve the system toward a "jammed state". Here are a couple approaches:
1. Optimization-based packing algorithms
These methods allow particles to slightly overlap during the optimization process.
The idea is:
  1. Start from a random low-density configuration.
  2. Gradually increase particle diameters.
  3. Use an optimizer to adjust particle positions to minimize overlaps.
  4. 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:
  1. A gas of spheres starts at low density with high kinetic energy
  2. Particle diameters are slowly increased
  3. Energy is gradually removed from the system
  4. 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 ExchangeCoordinate Systems についてさらに検索

タグ

質問済み:

2015 年 6 月 12 日

回答済み:

2026 年 3 月 16 日 21:44

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by