Note
Go to the end to download the full example code.
Simple droplet dynamics
Minimal examples of passive droplets interacting in a common background.

0%| | 0/10.0 [00:00<?, ?it/s]
Initializing: 0%| | 0/10.0 [00:00<?, ?it/s]
0%| | 0/10.0 [00:05<?, ?it/s]
0%| | 0.025/10.0 [00:07<48:34, 292.20s/it]
0%| | 0.05/10.0 [00:07<24:13, 146.11s/it]
3%|▎ | 0.275/10.0 [00:07<04:18, 26.57s/it]
3%|▎ | 0.275/10.0 [00:07<04:18, 26.59s/it]
100%|██████████| 10.0/10.0 [00:07<00:00, 1.37it/s]
100%|██████████| 10.0/10.0 [00:07<00:00, 1.37it/s]
from droplets import SphericalDroplet
from pde import ScalarField, UnitGrid
import emulsim
# set up state
grid = UnitGrid([32, 32], periodic=True)
background = emulsim.ScalarFieldElement.from_field(ScalarField(grid, 0.1))
droplet_data = [SphericalDroplet(grid.get_random_point(), 0.5) for _ in range(10)]
droplets = emulsim.SphericalDropletsElement.from_droplets(droplet_data)
state = emulsim.State({"background": background, "droplets": droplets})
# set up simulation
simulation = emulsim.Simulation(state)
simulation.add_actor("background", emulsim.DiffusionActor())
simulation.add_actor(("droplets", "background"), emulsim.SphericalDropletActor())
# run simulation
result = simulation.run(t_range=10)
result.plot()
Total running time of the script: (0 minutes 7.411 seconds)