[FLASH-USERS] particles code conventions (was: Particles_sinkSyncWithParticles)

Joshua Wall joshua.e.wall at gmail.com
Wed May 3 15:49:14 EDT 2017


Dear Klaus,

     After reading your explanations, I think B+B' (each section makes no
assumptions) seems to be the most reasonable approach. It doesn't require
any rewrite of sections that implement particle sorting at the beginning of
the module like Particles_advance (and most other modules). Also it seems
reasonable that those modifying the code (like me) have the burden to
arrange the particles as needed, since different modules might require
different types of sorting.

     I think it would be reasonable to include a warning for this in the
User Guide in sections 8.9 (GridParticles, which describes the three
different sorting methods) and in the Particles section itself in section
19. Also it would be helpful to have this warning in the notes section of
the subroutine Grid_sortParticles.F90 since anyone who starts grepping
around the code to figure out how the particles are sorted will likely go
there first (that's the first place I went at least).

     I think this should be sufficient to avoid diversions of the type
graduate students are prone to. I appreciate the chance to have input on
the code which I've been lucky to work with and on, and I should say I'm
sure others on the list may have even better ideas on this than myself.

Cordially,

Josh

On Fri, Apr 28, 2017 at 2:08 PM Klaus Weide <klaus at flash.uchicago.edu>
wrote:

> On Thu, 27 Apr 2017, Joshua Wall wrote:
>
> >        I have found a second assumption in Flash that while not a bug
> > directly, can cause problems for users who are introducing their own
> > routines for particles that are not contained in Particles_advance.F90.
> It
> > has caused me some amount of headache to track down, so I feel it best to
> > at least get it documented on the email archive.
> .....
> > Hopefully if no change is made at least this helps others with the same
> > problem.
>
> Josh,
>
> Thank you for sharing this warning for others!
>
> 1. I would appreciate any suggested wording for NOTES or warnings in the
> code (and where to put them) (ideally in the form of diffs!), or for some
> text to be added in an appropriate place in the Users Guide.
>
> You probably have a very good idea what kind of warning would have saved
> you all that headache!
>
>
> 2. Some more general discussion -
>
>
> It appears that one of the following three must be true:
>
> (A) i. Sections of code that deal with particles in FLASH (while particles
>     are in a "settled" state, i.e., not in the middle of being transferred
>     etc.) are allowed to assume that the particles array is sorted in a
>     particular way.
>
>     ii. Sections of code that may change the order of particles in the
>     array must clean up after themselves, probably by calling
>     Grid_sortParticles.
>
> (B) i. Sections of code that deal with particles in FLASH must not make any
>     assumptions about the ordering of the particles array. If they require
>     a particular ordering to operate correctly, they are responsible for
>     establishing that ordering, probably by calling Grid_sortParticles.
>
>     ii. Sections of code that may change the order of particles in the
>     array are not required to restore any particular order.
>
> (C) Something intermediate, ad hoc, muddled.
>
> Additionally, a similar (but not independent) choice exists for who is
> responsible for keeping pt_typeInfo valid. Let's call the corresponding
> alternatives (A'), (B'), (C').
>
> It seems to me that in general the FLASH code assumes (B)+(B'), although
> there may be omissions.  [New code written with an abundance of caution
> could combine (B)i+(A)ii+(B')i+(A')ii...]
>
> Can we agree that these should be the rules of the road for dealing with
> particles in the FLASH code?
>
> If yes, how can this be made clearer?
>
>
> This should not prevent a more sophisticated approach being implemented in
> the future, to prevent unnecessarily repeated sorting.
>
>
> Klaus
>
-- 
Joshua Wall
Doctoral Candidate
Department of Physics
Drexel University
3141 Chestnut Street
Philadelphia, PA 19104
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20170503/2c31db5f/attachment.htm>


More information about the flash-users mailing list