<div dir="ltr"><div><div><div><div><div>Juan,<br><br></div> It sounds like you want to get information from a particle knowing the tag. For that you can use the QSort subroutines after a call to pt_sinkGatherGlobal() to sort by particles by tag, then call the particles using the index array returned by QSort. If you want to then change any information you can do this, then loop over the sinks up to localnp on each processor because the particles_global() array on each processor lists the local particles in the first localnp positions in the array.<br><br></div> You can also use this sequence of steps to make the calls by tags. I've written a small set of functions as getters and setters for position, velocity and mass for sinks in FLASH. As an example to get particle positions by tag number I wrote the following:<br><br>###############################################################################################################<br><br>FUNCTION get_particle_position_array(tags, x, y, z, nparts)<br> implicit none<br> integer :: nparts, MyPe<br> double precision, dimension(nparts) :: x, y, z, tags<br> integer :: get_particle_position_array, i, j, p<br> integer, dimension(:), allocatable :: QSindex, id_sorted<br><br>call Driver_getMype(GLOBAL_COMM, MyPe)<br>call pt_sinkGatherGlobal()<br><br>! I only need one proc to do this.<br><br>if (MyPe .eq. 0) then<br><br> ! Sort by particle tag. Note that output positions will also be<br> ! ordered by tag number then.<br><br> allocate(QSindex(localnpf))<br> allocate(id_sorted(localnpf))<br><br> do p = 1, localnpf<br> id_sorted(p) = int(particles_global(TAG_PART_PROP,p))<br> end do<br><br> call NewQsort_IN(id_sorted, QSindex)<br><br> ! Are we checking every particle in the simulation?<br> <br> if (nparts .eq. localnpf) then ! Yes, then lets do them all at once.<br><br> do i=1, localnpf<br><br> x(i) = particles_global(POSX_PART_PROP, QSindex(i))<br> y(i) = particles_global(POSY_PART_PROP, QSindex(i))<br> z(i) = particles_global(POSZ_PART_PROP, QSindex(i))<br> <br> end do<br> <br> else<br><br> ! If not doing them all, have to do it by tag number.<br> <br> do i=1, localnpf<br> <br> do j=1, nparts<br> <br> if (id_sorted(QSindex(i)) .eq. tags(j)) then ! Check for matching tag.<br><br> x(j) = particles_global(POSX_PART_PROP, QSindex(i))<br> y(j) = particles_global(POSY_PART_PROP, QSindex(i))<br> z(j) = particles_global(POSZ_PART_PROP, QSindex(i))<br> <br> end if<br> <br> end do<br> <br> end do<br> <br> end if<br><br> deallocate(QSindex)<br> deallocate(id_sorted)<br><br>end if<br><br>get_particle_position_array=0<br>END FUNCTION<br><br>##############################################################################################################<br><br></div>For the example that inspired my functions also take a look at the Particles_sinkAccelGasOnSinks() subroutine which uses this type of sorting to write information to the sink particle arrays in parallel.<br><br></div>Hope that helps!<br><br></div>Josh<br><div><div><div><div><br></div></div></div></div></div><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 12:02 AM Juan Camilo Ibañez Mejia <<a href="mailto:jcibanezmejia@gmail.com">jcibanezmejia@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
is there a simple way to get the information in a sink particle knowing the particle tag ?<br>
Like using the particles_global array ? something like :<br>
<br>
> blockID = particles_global( BLK_PART_PROP, SinkTag )<br>
<br>
The problem here is that the second input is the particle position in the global array,<br>
not the particle tag so of course this doesn’t work.<br>
<br>
I need this because at some point one processor, hosting a sink particle, informs the<br>
sink tag to all other processors. Then each processor needs to look for the position,<br>
velocity, mass and blockID of the sink.<br>
<br>
Thanks,<br>
<br>
Juan</blockquote></div>