opendrift
opendrift copied to clipboard
Division of particles?
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.
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.
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.
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.
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?
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.
So the conclusion is that this is unlikely to work with a quick implementation now.
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.
On the other hand, some organisms (algae) congregate and form chains, so a super-individual approach is also valid.