Skip to content

Gradient-based longitudinal space charge calculation#108

Open
austin-hoover wants to merge 23 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:lsc-grad
Open

Gradient-based longitudinal space charge calculation#108
austin-hoover wants to merge 23 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:lsc-grad

Conversation

@austin-hoover

@austin-hoover austin-hoover commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

This PR adds the option to calculate the longitudinal space charge kick in LSpaceChargeCalc using the gradient of the charge density. The current solver calculates the kick in frequency space using the impedance formulation.

An option has also been added to set the number of FFT modes used to calculate the energy kicks in the impedance-based formulation. Before it was set to half the number of grid cells.

@austin-hoover austin-hoover marked this pull request as draft February 19, 2026 19:56
@austin-hoover austin-hoover marked this pull request as ready for review February 19, 2026 20:56
@austin-hoover

Copy link
Copy Markdown
Contributor Author

It looks good in some initial tests; will need to think about how to benchmark.

@austin-hoover austin-hoover requested review from azukov and shishlo May 27, 2026 21:35
@shishlo

shishlo commented May 28, 2026

Copy link
Copy Markdown
Contributor

So, what about the benchmark? Was it successful? As I understand frequency approach allows to cut or to keep high frequency noise. What about the suggested new gradient method? Could you reproduce the results of the paper:
https://journals.aps.org/prab/abstract/10.1103/PhysRevSTAB.7.094201
So, bottom line: would it better to keep the old frequency based method and add a new one with derivatives?

@austin-hoover

Copy link
Copy Markdown
Contributor Author

This PR doesn't replace the frequency approach, just adds option to use gradient instead.

One option for a benchmark would be a uniform disk in x-y plane within conducting pipe of radius b, and then a Gaussian z distribution. The energy kick from the 1D and 2D-sliced solvers should agree with the analytic result.

I've tested this 1D solver against 2D-sliced for bunch compression simulations in the SNS ring, and they give similar results. But we do expect differences in that case since the transverse distribution is not uniform.

I'm not sure about the space-charge-sustained microbunching. We should definitely try to reproduce these simulations, but it might be better to start with a simpler benchmark.

@shishlo

shishlo commented May 28, 2026

Copy link
Copy Markdown
Contributor

I know that people are using this node in J-PARC simulations. What method will be used by default? Also, could you add an example of how to use and comparison of two methods?

@austin-hoover

Copy link
Copy Markdown
Contributor Author

We will keep frequency-based model as default. Eventually documentation should explain the difference between the methods.

@austin-hoover

Copy link
Copy Markdown
Contributor Author

Added benchmark for Gaussian distribution. the initial distribution has zero energy spread and a Gaussian longitudinal distribution. We assume the transverse distribution is uniform within radius $a$ and that there is a conducting pipe at radius $b > a$.

Frequency-based: number of modes

Used 10,000 particles and 32 bins. Scanned number of FFT mode: {2, 4, 8, 16}. Analytic result is shown in red.

fig_02 fig_04 fig_08 fig_16

Gradient-based: number of particles

Used 32 bins. Scanned number of macroparticles: {1e4, 1e5, 1e6}.

fig_1e4 fig_1e5 fig_1e6

Gradient-based: smoothing

Used 100,000 particles and 32 bins. Scanned gradient smoothing {off, on}.

fig_smooth_0 fig_smooth_1

@shishlo

shishlo commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Thanks, Austin! To my mind, that makes sense. I’m in favor of the merger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants