Turn off quantum excitation
Add option to turn off the quantum excitation. For example useful when want to run with a single particle per bunch.
Merge request reports
Activity
requested review from @GAMELIN
assigned to @GAMELIN and @TeresiaOlsson
Are we sure that, in this case, everything will work as it should? The amplitude of the particle will decay exponentially forever. This is not the physical reality. What I think should be done instead is to provide an option to specify necessary sigmas if the bunch object cannot compute them. What do you two think?
Update: I've even checked that the class does not use the Bunch object to compute the sigmas; only the ring object is used, which should work for a single macroparticle, too. So, in my view, there's no need to make any modifications.
Edited by GUBAIDULIN@GUBAIDULIN I'm not entirely sure I understood what you meant? The user case for this is if you want to run a simulation where you only have a single particle per bunch. In this case I think no sigma should be calculated because the result wouldn't make sense. And the centroids will eventually damp to the equilibrium orbit. At least that's how it worked in the old mbtrack where I tried this before. If I remember correctly that code just didn't output any sigma results when you had a single particle. It doesn't give the correct result for very non-gaussian bunches, but I found it quite useful for studying things like the RF feedback where you might want to run quick simulations trying different parameters and don't care about the sigmas.
One problem I ran into is that
init_beam
automatically generates a Gaussian beam so the particle started with some random values. I however avoided that by using the feature where you can build a beam from a list of Bunch objects. Then I could specify that every particle should start at zero. That worked nicely :)I just commented on your use case of turning quantum excitation. My point was that the quantum excitation effect still exists for a single particle. So, there's no need to turn it off when a beam consists of a single particle. SynchrotronRadiation() works for a single particle in a bunch in the current implementation (I've just tried it now, and I think it works correctly). The mbtrack2 SynchrotronRadiation() class only uses equilibrium std parameters defined in the ring object. It never computes std values of a single bunch. Of course, the option to switch off quantum excitation or synchrotron radiation can still be useful. But physically, I think both effects are always present.
For example, with the code below (if you replace v2366 by your own mbtrack2 Synchrotron() object) you should be able to have radiation effects with a single particle in a bunch.
def run_mbtrack2( n_turns=100_000, n_macroparticles=2000, bunch_current=1.2e-3, ): ring = v2366(IDs="open") # ring.emit[1] = ring.emit[0]*0.3 particle = Electron() mybunch = Bunch( ring, mp_number=n_macroparticles, current=bunch_current, track_alive=False ) np.random.seed(42) mybunch.init_gaussian() mybunch['tau'][:] = 7e-10 mybunch['delta'][:] = ring.sigma_delta long_map = LongitudinalMap(ring) sr = SynchrotronRadiation(ring, switch=[1, 1, 1]) trans_map = TransverseMap(ring) V_rf = 1.7e6 rf = RFCavity(ring, m=1, Vc=V_rf, theta=np.arccos(ring.U0 / V_rf)) bunch_monitor = PhaseSpaceMonitor(0, sample_number=1, save_every=1, buffer_size=n_turns, total_size=n_turns, file_name='test_monitor') tracking_elements = [trans_map, long_map, rf, bunch_monitor, sr] white_noise = 2e-8 try: for i in tqdm(range(n_turns)): for el in tracking_elements: el.track(mybunch) finally: bunch_monitor.close() return None
This code still worked with a single particle, and I can see the damping, for example, in the picture below, where a "tau" of a single particle is shown.
Edited by GUBAIDULINAh, okay. I understand. You are referring to the part where the
SynchrotronRadiation
object is created and which values it gets. That I also thinks works correctly independently of the number of particles. The reason why I want to turn the quantum excitation off is to explicitly be able to exclude that effect when tracking. Similar to theSREFFECTS
element in Elegant where you in addition to the quantum excitation can turn off the damping and average energy loss if you want by just changing a flag.https://ops.aps.anl.gov/manuals/elegant_latest/elegantsu217.html#x228-23300010.107
If I turn the quantum excitation off, I can use a single particle per bunch to represent the centroid of the bunch. The results will be approximate since the simulation doesn't correctly include the effect of the bunch profile, but it's useful for example to quickly be able to study transient beam loading. If I include the quantum excitation, the particles will still damp down but the final transient will look very noisy since it's like the "centroid" gets a small kick every turn.
mentioned in merge request !19 (closed)
Hi @TeresiaOlsson,
This can be considered again now that !21 (merged) has been completed.
I've closed !19 (closed) as these changes have already been included in !21 (merged).
I think you should rebase the change on the current (merged)
develop
branch so only the QE stuff is in this MR.added 11 commits
-
2fc549f0...e792f648 - 10 commits from branch
develop
- 59247a5a - Merge branch 'develop' into turn-off-qexec
-
2fc549f0...e792f648 - 10 commits from branch
enabled an automatic merge when all merge checks for 02eb28a5 pass
mentioned in commit bb41cdf8