Continuum percolation
Overlapping disks at uniform positions in a square.
- Class:
ContinuumPercolationSystem - Import:
from skcomplex.systems.physics.statistical_mechanics import ContinuumPercolationSystem - Field:
physics/statistical_mechanics - Topics:
percolation,disorder,clusters,static - References:
- Satz 2022
- Mertens and Moore 2012
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.physics.statistical_mechanics import ContinuumPercolationSystem
trajectory = ContinuumPercolationSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
filling |
1.1 |
side |
60.0 |
radius |
1.0 |
random_state |
0 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | any |
| Space | continuous |
| Laws | any |
| Randomness | deterministic |
| Domains | vector |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class ContinuumPercolationSystem(BaseSystem):
"""Overlapping disks at uniform positions in a square.
Their clusters percolate near a filling of 1.13.
The number of disks is `filling side^2 / (pi radius^2)`. The clusters of touching disks are read by
`clusters(source, radius=radius)`, and a `sweep` varies `filling` and `random_state` for the spanning
probability (Satz 2022 ch. 3). The system has the positions `disks.x`.
Args:
filling:
The filling factor, the total area of the disks over the area of the square.
side:
The side of the square.
radius:
The radius of a disk.
random_state:
The seed or generator of the positions.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.physics.statistical_mechanics import ContinuumPercolationSystem
>>> ContinuumPercolationSystem(1.0, side=10.0).prepare().system_.elements[0].size
32
"""
field = 'physics/statistical_mechanics'
topics = ('percolation', 'disorder', 'clusters', 'static')
references = ('Satz 2022', 'Mertens and Moore 2012')
def __init__(
self,
filling: float = 1.1,
*,
side: float = 60.0,
radius: float = 1.0,
random_state: int | np.random.Generator | None = 0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.filling = filling
self.side = side
self.radius = radius
self.random_state = random_state
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set `system_` to the disks at uniform positions in the square.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
size = round(self.filling * self.side**2 / (np.pi * self.radius**2))
positions = np.random.default_rng(self.random_state).uniform(0.0, self.side, (size, 2))
square = ContinuousSpace(extent=[self.side, self.side])
disks = DiskElement('disks', x=positions, radius=self.radius, size=size, space=square)
self.system_ = System(self.label, elements=[disks], space=square)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
DiskElement, fromElement
class DiskElement(Element):
"""Disk of the plane at a position that no law moves.
Args:
label:
The label of the disk or the group.
x:
The position of its centre.
radius:
The radius of the disk, which it is drawn with.
size:
The number of disks, or `None` for one.
space:
The plane of the disks, or `None` for none.
Examples:
>>> from skcomplex.systems.physics.statistical_mechanics import DiskElement
>>> DiskElement('disk', x=(1.0, 2.0)).x
(1.0, 2.0)
"""
visual = VisualSpec('points', {'position': 'x', 'radius': 'radius', 'states': ()})
def __init__(
self,
label: str,
x: npt.ArrayLike = 0.0,
radius: Annotated[float, RealSet.open(0, oo)] = 1.0,
*,
size: int | None = None,
space: BaseSpace | None = None,
) -> None:
super().__init__(label, size=size, space=space)
self.x = x
self.radius = radius