serial version of elegant renumbers particleID values

Moderators: cyao, michael_borland

Post Reply
GPenn
Posts: 40
Joined: 28 Aug 2018, 09:46

serial version of elegant renumbers particleID values

Post by GPenn » 25 Oct 2019, 15:03

A lot of my post-processing revolves around picking an individual particle in a bunch and seeing its trajectory, or looking at lost particles and seeing where they started, etc. The only way I know how to do this is to use a WATCH element and track particles by their particleID. For Pelegant, this seems to work fine, but when using serial elegant the particleID values get altered after particle losses so they always take the range 1..npart, where npart is the current # of particles. This breaks my postprocessing, and it also makes me worry that maybe in certain conditions I cannot rely on the particleID remaining constant during a simulation even when using Pelegant.

In theory I could use the lost particles file to figure out how the particleID values are being reassigned, assuming they are just being shifted. But that is complicated and I was wondering if there is a flag I can set to prevent particleID from changing during a run. Is there a better way to label the particles to keep them distinct?

I am currently using the 2019.1.1 version of elegant.

Thanks,
Gregg

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: serial version of elegant renumbers particleID values

Post by michael_borland » 25 Oct 2019, 16:11

Gregg,

I'm really surprised to hear this, since no version of elegant should renumber the particles. The only exception is the SCRIPT element, which will renumber the particles if USE_PARTICLE_ID=0.

Can you send me an example that illustrates the problem?

--Michael

GPenn
Posts: 40
Joined: 28 Aug 2018, 09:46

Re: serial version of elegant renumbers particleID values

Post by GPenn » 28 Oct 2019, 23:16

Sorry I was too quick to see a problem before, I was reading the output like a text file and missed that the particle order was just being shuffled - I guess whenever a particle gets lost, it trades places with the last valid particle. That means if I have 1000 particles and lose 2, the end of the page will usually show particle IDs 996, 997 and 998, but particles 999 and 1000 are still there they just wind up buried in the middle of the file. Pelegant must include some sorting of the output files, or maybe I just never noticed it before.

We are having an extended power outage here at LBL right now, so I can't check the exact case I was looking at earlier, but it looks like everything is actually ok and my postprocessing routines are working.

Thanks,
Gregg

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: serial version of elegant renumbers particleID values

Post by michael_borland » 29 Oct 2019, 09:11

Gregg,

If you need the files sorted by particleID, just use sddssort

Code: Select all

sddssort -column=particleID <filename>
If you then want to read the file as a text file, I recommend using sdds2plaindata to ensure you get consistent ordering of the data columns. This is generally not guaranteed in SDDS files (since it doesn't matter when data is self-describing).

Good luck with the power recovery.

--Michael

Post Reply