|
6 | 6 | "id": "0", |
7 | 7 | "metadata": {}, |
8 | 8 | "source": [ |
9 | | - "# Particle-Particle interaction\n" |
| 9 | + "# 🎓 Particle-Particle interaction\n" |
10 | 10 | ] |
11 | 11 | }, |
12 | 12 | { |
|
15 | 15 | "id": "1", |
16 | 16 | "metadata": {}, |
17 | 17 | "source": [ |
18 | | - "In this notebook, we show an example of the new 'particle-particle-interaction' functionality in Parcels. Note that this functionality is still in development, and the implementation is fairly rudimentary for now. Importantly:\n", |
19 | | - "\n", |
20 | | - "- The type of interactions that are supported is still limited\n", |
21 | | - "\n", |
22 | | - "Interactions are implemented through `InteractionKernels`, which are similar to normal `Kernels`. The `InteractionKernels` are applied between particles that are located closer to each other than a specified `interaction_distance`. In general, the code structure needs three adaptations to apply particle-particle interaction:\n", |
23 | | - "\n", |
24 | | - "1. The `ParticleSet` requires an `interaction_distance` argument upon creation, to define the `interaction_distance`.\n", |
25 | | - "2. `ParticleSet.execute()` requires the `pyfunc_inter` argument, which contains the `InteractionKernels` that will be executed, similarly to the `pyfunc` argument for normal `Kernels`.\n", |
26 | | - "3. `InteractionKernels` have two additional arguments compared to normal `Kernels`:\n", |
27 | | - "\n", |
28 | | - "```python\n", |
29 | | - "def InteractionKernel(particle, fieldset, time, neighbors, mutator)\n", |
30 | | - "```\n", |
31 | | - "\n", |
32 | | - "The `neighbors` argument provides a list of the particles that are within a neighborhood (i.e. closer than the `interaction_distance` argument in `ParticleSet` creation).\n", |
33 | | - "\n", |
34 | | - "The `mutator` argument is an initially empty list with all the mutations that need to be performed on particles at the end of running all `InteractionKernels` on all particles.\n", |
35 | | - "This `mutator` argument is required, because otherwise the order at which interactions are applied has implications for the simulation. As a consequence, the simulation will likely be dependent on the order of the particle list if no mutator list is used.\n" |
| 18 | + "In this tutorial, we show an example of the 'particle-particle-interaction' functionality in Parcels. Note that this functionality is still fairly rudimentary for now. Importantly, as particle-interaction is a many-body problem it scales as $N^2$ and can thus become very slow for large ParticleSets. There is currently **no advanced optimisation** (such as using techniques from [Smoothed Particle Hydrodynamics](https://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics)) build-in to Parcels. " |
36 | 19 | ] |
37 | 20 | }, |
38 | 21 | { |
|
43 | 26 | "source": [ |
44 | 27 | "## Pulling particles\n", |
45 | 28 | "\n", |
46 | | - "Below is an example of what can be done with particle-particle interaction. We create a square grid of $N\\times N$ particles, which are all subject to Brownian Motion (via the built-in `DiffusionUniformKh` Kernel). Furthermore, some of the particles also 'attract' other particles that are within the interaction distance: these attracted particles move with a constant velocity to the attracting particles.\n" |
| 29 | + "Below is an example of what can be done with particle-particle interaction. We create a square grid of $N\\times N$ particles, which are all subject to Brownian Motion (via the built-in `DiffusionUniformKh` Kernel). Furthermore, two of the particles also 'attract' other particles that are within the interaction distance: these attracted particles move with a constant velocity to the attracting particles.\n" |
47 | 30 | ] |
48 | 31 | }, |
49 | 32 | { |
|
72 | 55 | "outputs": [], |
73 | 56 | "source": [ |
74 | 57 | "def Pull(particles, fieldset):\n", |
75 | | - " \"\"\"InterActionKernel that \"pulls\" all neighbor particles\n", |
| 58 | + " \"\"\"Kernel that \"pulls\" all neighbor particles\n", |
76 | 59 | " toward the attracting particle with a constant velocity\"\"\"\n", |
77 | 60 | " interaction_distance = 0.5\n", |
78 | 61 | " velocity = -0.04 # predefined attracting velocity\n", |
|
0 commit comments