I'm currently trying to finish up a new sink particle implementation using the new active particle framework. The idea is that this will be a reference implementation that people can look at if they want to convert one of the nontrivial star particles to active particles or if they want to design an entirely new active particle that does distributed feedback.
Unfortunately, I'm getting hung up on how to merge active particles. I think I have a more or less working implementation except for this one last hurdle.
For my sink particle, each processor receives a global list of all of the active particles in the simulation. Using this particle list, I run a friends-of-friends finder to search for clustered particles, which I then merge. The position of the new particle is the mass-weighted mean of the positions of the parent merged particles.
This leaves me with a problem: how do I know which grid the new particle should be assigned to?
I think I have to find the finest resolution grid associated with some arbitrary position in the simulation box. It's not clear to me how to do that - are there geometry routines already in enzo that I can call? Another piece of the code that does something I can look at? I can't wait for RebuildHierarchy to correct the grid assignment, since the particle merging happens just before EvolveLevel evolves the grids by one timestep.
Thanks for any help anyone can provide with this,
-Nathan Goldbaum
One option would be a modification of the technique adopted in the current implementation (CommunicationMergeStarParticle.C), which would be to have a global list of merged particles and then loop over all the grids, moving them in as appropriate. You could mostly adopt the infrastructure used there, but add a loop over all levels, starting from the finest level (maybe using LevelArray, which is an array of linked lists to all the grids, one linked list per level). By starting at the finest level, you would guarantee the particle would end up in the correct grid.
One thing to be careful about is that all processors must end with an accurate count of all particles on all grids. That is one reason why you need a global list of merged particles.
Thanks for the work on coding this stuff up.
Hope that helps,
Greg
> --
> You received this message because you are subscribed to the Google Groups "enzo-dev" group.
> To post to this group, send email to enzo...@googlegroups.com.
> To unsubscribe from this group, send email to enzo-dev+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/enzo-dev?hl=en.
>
Thanks for the suggestion and the pointer to CommunicationMergeStarParticle - that is exactly what I was looking for!
-Nathan