On Tue, Mar 8, 2011 at 10:43 AM, Mark Baumann <markb_at_physics.utexas.edu>wrote:
>
> Hello,
>
> Like others I am implementing sink particles in Gadget. Thanks to previous
> discussions on this list I believe I have sink particles working on a single
> process. Here is my approach:
>
> All "STAR" particles are considered sink particles
> All "GAS" particles are absorbed by sink particles when they come within a
> predefined distance of a STAR particle.
>
> I've added a method called sink_particle() that is called from the main
> loop before domain_Decomposition(). The sink_particle() method does the
> following:
>
> loop through all particles (i in the range 0..NumPart) on the local
> processor and find the STAR particles
>
> for each STAR particle found:
> loop through all Gas particles (i in the range 0..N_gas) on the
> local processor
> if Gas particle i is within predefined distance of STAR particle,
> flag it by setting its particle type to -1 and increment
> the variable "numcoll"
>
> if numcoll > 0:
> create a new particle array with size MaxPart
> create a new SPH array with size MaxPartSph
> copy all particles of type -1 into the new particle array and the
> new SPH array
> delete the old particle array and the old SPH array
> update particle counts as follows:
> NumPart -= numcoll
> N_gas -= numcoll
> All.TotNumPart -= numcoll
> All.TotN_gas -= numcoll
> force a new domain decomposition by setting
> All.NumForcesSinceLastDomainDecomp
>
> Then, in the routine gravity_tree(), before anything else is done I update
> the value of NumForceUpdate in the way Volker Springel suggested.
>
> First, this seems to work but does anyone see any potential problems?
>
> And second, how would I make this work on multiple processors?
>
> In particular, I am still unclear on how particles are managed across
> multiple processors, so here are a few thoughts:
>
> When I delete a particle on the local processor, do I need to update
> particle arrays on other processors, or is it sufficient to simply decrement
> the All.TotNumPart and All.TotNgas counts by the appropriate amounts?
As far as I know, a processor only knows about arrays (particles) on other
processors when there's a send-receive operation. For example on
*density.c*you first calculate the density of the local particles due
to local
particles with *density_evaluate(i,0).* And then, every processor exports
the necessary information about their gas particles and imports information
about particles on other processors to evaluate the contribution of foreign
particles (on other processors) on the density of the local ones with *
density_evaluate(j,1)*.
So at the end it should be enough to deal with the arrays locally and to
update the global variables like All.TotN_gas.
>
> Would I need to check for "collisions" between a STAR particle on the local
> processor and GAS particles on other processors, or is it impossible for
> such a thing to happen? And conversely, do I need to check for collisions
> between a GAS particle on the local processor and STAR particles on the
> other processors?
>
Yes, what you're doing right now is to check only collisions or accretion
within local particles (on the same processor), remember that this doesn't
necessarily means that these particles are close in distance, so you could
have particles on other processors that lie within your predefined distance
for accretion.
If you want to do it on several processors you should first look for sink
particles within each processor, and compute the local gas swallowing, then
you should export the information about these sink particles to other
processors so each processor can compute the gas accretion of their own gas
particles on such sink particles. You can figure out how to do this by
looking at the density_evaluate() function. Hope this helps.
Aldo Batta
> Thank you for your insights!
>
> Best,
>
> Mark
>
>
>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> minimalist_at_MPA-Garching.MPG.de with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
> http://www.mpa-garching.mpg.de/gadget/gadget-list
>
--
Aldo Alberto Batta Márquez
Instituto de Astronomia
Universidad Nacional Autonoma de Mexico (UNAM)
http://www.astroscu.unam.mx
Received on 2011-03-08 20:51:48