ChristopherMayes / lume-astra

Python wrapper for Astra (A Space Charge Tracking Algorithm, DESY) for eventual use in LUME https://christophermayes.github.io/lume-astra/
https://christophermayes.github.io/lume-astra/
Apache License 2.0
14 stars 9 forks source link

How to use distgen or Astra.generator to generate two different particle beams? #7

Closed snwdiphone1994 closed 3 years ago

snwdiphone1994 commented 3 years ago

Dear All,

How to use distgen or Astra.generator to generate two different particle beams(Different time distributions, different space distributions, different momentum distributions)? Momentum distribution is not a common distribution function. Momentum distribution PDF needs to be read from a custom TXT file.

Thanks for the feedback.

ChristopherMayes commented 3 years ago

@snwdiphone1994 You will need to use https://github.com/colwyngulliford/distgen to make a bunch from a PDF in a file. If the feature you need isn't there, please raise an issue.

Tracking two different bunches is as simple as running two separate Astra runs. Does that make sense?

snwdiphone1994 commented 3 years ago

Hi @ChristopherMayes ,
We want to trace the effect of first electron bunch on the second electron bunch when there is a time delay in the emission of two electron bunchs. In Astra.generator, we can use ADD=True and N_add=2 to generate two bunchs, but it is hard to make a bunch from a PDF in a file. In distgen,it is easy to to make a bunch from a PDF in a file. But so far we have not found a way to generate two electron bunchs.

ChristopherMayes commented 3 years ago

@snwdiphone1994 Are you wanting to track the two bunches together, with a common space charge grid?

You can use distgen to make two separate bunches as ParticleGroup objects: P1 and P2, and simply add them to make a composite one: P = P1 + P2

snwdiphone1994 commented 3 years ago

Dear @ChristopherMayes,

many thanks