[FLASH-USERS] particles code conventions (was: Particles_sinkSyncWithParticles)
Klaus Weide
klaus at flash.uchicago.edu
Fri Apr 28 14:08:30 EDT 2017
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
More information about the flash-users
mailing list