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:04<?, ?it/s]
0%| | 0.025/10.0 [00:06<42:08, 253.52s/it]
0%| | 0.05/10.0 [00:06<21:01, 126.77s/it]
3%|▎ | 0.35/10.0 [00:06<02:54, 18.11s/it]
3%|▎ | 0.35/10.0 [00:06<02:54, 18.12s/it]
100%|██████████| 10.0/10.0 [00:06<00:00, 1.58it/s]
100%|██████████| 10.0/10.0 [00:06<00:00, 1.58it/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 6.424 seconds)