~10x Speed up for multi-bunch studies with short+long range impedance

Moderators: cyao, michael_borland

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

~10x Speed up for multi-bunch studies with short+long range impedance

Post by Seb_Wilkes » 28 Oct 2022, 04:04

Greetings fellow researchers,

I wanted to share something I've done that may be of relevance. I'm up for critique, as it's quite a big claim. If it is worth it, then I wonder if Michael could consider adding in a toggleable feature that's officially built into the framework?

First off, let me describe the set-up. I am simulating 899 bunches in Diamond-II, with an ideal Harmonic Cavity, and I'm interested in driving one bunch (and later, a few). I of course want to understand what the resulting effect of driving this one bunch is on the bunch itself. However, I could imagine that other researchers may only need the information, for whatever reason, from one bunch as it might provide enough of an explanation for their research questions.

It's nothing complicated, I literally just disable the processing of the short range impedance for any bunch that I'm not interested in via an IF statement. For 20k turns, ILMatrix, 1 thread, with 1250*899 particles I get 100:05:19 vs 08:53:37. Obviously it cannot be identical to the normal simulation, but as an example here are two meaningful quantities I care for in my work:
the_important_comparison.png
the_important_comparison_delta.png
For the speedup gained, I can't seem justify running the full simulation. Hence, constructive critique wanted! :shock:

(The code changes I made are in the zip files; I should technically note that the 'pristine' run used a well-tested modification to RFDF to enable me to drive only the particles I wanted. If there was no coupling between the bunches - IE: they are independent - then you can see how this change is identical to running an unmodified RFDF. With coupling, it obviously becomes important that if I only want to drive one bunch, I only drive one bunch!

These changes for the impedance files is pretty much just line 147 and line 135 in zlongit.c and ztransverse.c respectively)
Attachments
modified_z_files.zip
(73.62 KiB) Downloaded 9 times

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

Re: ~10x Speed up for multi-bunch studies with short+long range impedance

Post by michael_borland » 03 Nov 2022, 12:17

I think this is a perfectly legitimate approach and will see how it can be implemented in the code in a flexible fashion. A very easy way is just to provide START_PID and END_PID parameters for the short-range wake elements.

There is an alternative, use of pseudo-multi-bunch mode, but that assumes that bunches are equally-spaced, which is often not applicable. In this mode, one collection of particles stands in for all the bunches.

--Michael

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

Re: ~10x Speed up for multi-bunch studies with short+long range impedance

Post by michael_borland » 16 Nov 2022, 10:20

These improvements are incorporated into the latest release, version 2022.2.

--Michael

Post Reply