[FLASH-USERS] Particles_sinkSyncWithParticles
Klaus Weide
klaus at flash.uchicago.edu
Wed Apr 26 19:09:00 EDT 2017
On Wed, 26 Apr 2017, Joshua Wall wrote:
> So my question is basically, should Particles_sinkSyncWithParticles be
> modified to include the BLK_PART_PROP
> in the call to Grid_sortParticles when TYPE_PART_PROP is defined as seen in
> other sections of the code? Doing
> so in my case seems to fix a problem where sinks and a second particle type
> appear to get their places exchanged in the particles array after a
> particle file is written (which calls Particles_sinkSyncWithParticles).
Hello Josh,
After reviewing the code of Grid_sortParticles.F90, I believe that the
answer is: yes, Particles_sinkSyncWithParticles should be modified as
you have proposed.
Grid_sortParticles isn't really a general-purpose sorting routine - one
cannot just sort on any attribute. In practice, attrib1 pretty much has to
be BLK_PART_PROP, and attrib2 should be TYPE_PART_PROP if present.
(The likely reason for passing these as arguments instead of hardwiring
them is that Grid_sortParticles may be used for other data elements than
particles (e.g., rays, protons), and those can use different index
values.)
So the
call Grid_sortParticles(particles,NPART_PROPS,pt_numLocal,NPART_TYPES, &
pt_maxPerProc,particlesPerBlk,TYPE_PART_PROP)
is basically invalid, but happens to work, more or less, without invalid
array references as long as for all particle type attribute values T:
0 < int(T) < number of blocks on local proc .
Klaus
More information about the flash-users
mailing list