Note
Go to the end to download the full example code.
Droplets with emitters
Demonstrates how the dynamics of droplets can be affected by randomly positioned points in the background fluid that emit extra material.

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]
1%| | 0.1/10.0 [00:07<11:50, 71.76s/it]
2%|▏ | 0.2/10.0 [00:07<05:51, 35.88s/it]
3%|▎ | 0.3/10.0 [00:07<03:52, 23.92s/it]
3%|▎ | 0.3/10.0 [00:07<03:52, 23.92s/it]
100%|██████████| 10.0/10.0 [00:07<00:00, 1.39it/s]
100%|██████████| 10.0/10.0 [00:07<00:00, 1.39it/s]
from droplets import SphericalDroplet
from pde import UnitGrid
import emulsim
# set up state
grid = UnitGrid([32, 32], periodic=True)
background = emulsim.ScalarFieldElement(parameters={"grid": grid})
droplet_data = [SphericalDroplet(grid.get_random_point(), 1) for _ in range(3)]
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(parameters={"diffusivity": 0.1})
)
positions = [grid.get_random_point() for _ in range(5)]
simulation.add_actor(
"background", emulsim.EmittersActor({"positions": positions, "strengths": 10})
)
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.263 seconds)