opendrift icon indicating copy to clipboard operation
opendrift copied to clipboard

Division of particles?

Open AndresSepulveda opened this issue 3 years ago • 6 comments

Is it possible to create new particles during a run?

We are thinking of a particle that represents many individuals and due to growth we should have two particles.

AndresSepulveda avatar Apr 28 '22 21:04 AndresSepulveda

No, the number of particles must be determined before starting the run. But it could be possible to make a hack in your module to achieve what you want, by e.g. keeping some particles "waiting", and later move them to the position where you want to split one into more. But there is no ready mechanism for this.

knutfrode avatar Apr 29 '22 06:04 knutfrode

I was curious to hear what @knutfrode had to say, and I think that maybe an easy way for users to make customizations without creating a new model is to allow hooks at time steps. E.g. a post-step hook where the user can define a function which can then add, remove or modify the elements. Not a good way to do it I think for adding new models, but maybe a good way to tweak the ones we have without having endless configuration options.

gauteh avatar Apr 29 '22 06:04 gauteh

Yes, such a hook-mechanism would be useful, and not difficult to make.

But for seeding/adding/scheduling new elements, there is a challenge that the output history array, and possibly an output netCDF-file, has been initialized to a specific number of elements and time steps. And e.g. extending both the particle and time dimension of a netCDF-file during writing might be very inefficient, if not problematic. But there should certainly be a way to work around this limitation, I am just not sure how much work it would be and what other side effects there might be.

knutfrode avatar Apr 29 '22 07:04 knutfrode

Hm, good point. Maybe this is something xarray could do for us if we used it for those arrays. Is there a way for xarray /dask to write and cache data to disk so that not everything is kept in memory?

gauteh avatar Apr 29 '22 07:04 gauteh

Yes, when re-writing OpenDrift core around Xarray (next year?), we should keep in mind the wish to be able to add a dynamic/unknown number of elements during simulation.

knutfrode avatar Apr 29 '22 07:04 knutfrode

So the conclusion is that this is unlikely to work with a quick implementation now.

gauteh avatar Apr 29 '22 07:04 gauteh

One trick could be to release the double (or triple) number of particles and to create and attribute that would activate after the "growth" period of such organism. This way they will be moving from the same initial position.

AndresSepulveda avatar Oct 04 '22 15:10 AndresSepulveda

On the other hand, some organisms (algae) congregate and form chains, so a super-individual approach is also valid.

AndresSepulveda avatar Oct 04 '22 15:10 AndresSepulveda