Arbitary charge per bunch with arbitary macro-particles per bunch?

Moderators: cyao, michael_borland

Post Reply
Seb_Wilkes
Posts: 15
Joined: 04 Mar 2022, 09:48

Arbitary charge per bunch with arbitary macro-particles per bunch?

Post by Seb_Wilkes » 30 Aug 2022, 07:30

Hi all,

I'm scratching my head how to do this. Take for instance if we want to run hybrid mode. Right now, if we want to run a bunch with a greater charge, we have to run more particles (with CHARGE, PER_PARTICLE=1). Clearly we are concerned with the running of the single bunch with greater charge, but wish to know how long range wake effects affect the dynamics. At a minimum we would like to run every bunch with the minimum number of particles required (just with different charge specified). Perhaps a little safer still would be to specify more particles for the studied bunch in question. Afterall, the long range effects aren't as strong meaning that the exact shape and position of the other bunches isn't as essential to the calculations.

Siwei_Wang
Posts: 21
Joined: 27 Jun 2017, 07:28

Re: Arbitary charge per bunch with arbitary macro-particles per bunch?

Post by Siwei_Wang » 02 Sep 2022, 03:44

I'm facing the same problem. Recently I'm doing hybrid mode filling patterns and charge variation where each bunch have different charges. Now I have to use different number of particles to distinguish the charge difference, this is fine for a standard filling pattern where the charges of different bunches are similar. But for hybrid mode filling pattern, there will be several bunches have much higher charges than the other ones, so those bunches will need much higher number of particles. This might cause a different sensitivity of the bunches to, for example, short-range impedance. It would be good if we can have the same number of particles per bunch but different charge assignment.

Seb_Wilkes
Posts: 15
Joined: 04 Mar 2022, 09:48

Re: Arbitary charge per bunch with arbitary macro-particles per bunch?

Post by Seb_Wilkes » 08 Sep 2022, 05:29

Hvaing dug into the source code, it strongly appears that the code is designde around the principle of the charge being fixed around the number of particles or bunches, but not either. I suspect this post is now a feature request. I can't personally think of a simple way of correctly allocating the charge.

In terms of getting some bunches to be ignored by certain elements, I am going to explore just having something like the following (taken from ztransverse.c):

Code: Select all

    long max_buckets;
    long iBucket; // index used in MB's For Loop
    if (single_bunch_only!=-1) {
        // this means you only want to affect one bunch of your choice; we only run the For loop once
        iBucket = single_bunch_only;
        max_buckets = single_bunch_only + 1;
    }
    else {
      // standard running
      iBucket = 0;
      max_buckets = nBuckets;
    }
    for (iBucket; iBucket<max_buckets; iBucket++) {...}
Will report back if I get this to work.

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

Re: Arbitary charge per bunch with arbitary macro-particles per bunch?

Post by michael_borland » 19 Sep 2022, 13:25

Seb,

There's some infrastructure in elegant to support variable weighting of simulation particles. However, implementing it consistently across the code is a big job that I haven't found time to take on.

For example, you'll note in track.h there is a definition of a quantity weightIndex. This gives the index in the particle properties array of the weight property. It just isn't used for anything.

--Michael

Post Reply