Skip to content

Control number of FFT modes in longitudinal space charge solver#107

Open
austin-hoover wants to merge 13 commits intoPyORBIT-Collaboration:mainfrom
austin-hoover:lsc
Open

Control number of FFT modes in longitudinal space charge solver#107
austin-hoover wants to merge 13 commits intoPyORBIT-Collaboration:mainfrom
austin-hoover:lsc

Conversation

@austin-hoover
Copy link
Contributor

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

This PR gives the option to restrict the number of modes used in longitudinal space charge kicks. From Chao (3.7), the formula for the energy gain from longitudinal impedance $Z_{0}^{\parallel}(\omega)$ for particle at position $z$ is

$$ V(z) = -\int_{z}^{\infty} \rho(z') W_0'(z - z') dz'. $$

In the frequency domain (3.10):

$$ V(z) = -\frac{1}{2 \pi} \int_{-\infty}^{\infty} e^{i \omega z / c} Z_0^{\parallel}(\omega) \tilde{\rho}(\omega) d\omega. $$

From the FFT, the solver uses $N / 2$ frequencies/modes, where $N$ is the number of longitudinal bins.

double LSpaceChargeCalc::_kick(double angle)
{
// n=0 term has no impact (constant in phi)
// f(phi) = _FFTMagnitude(1) + sum (n = 2 -> N / 2) of
// [2 * _FFTMagnitude(i) * cos(phi * (n - 1) +
// _FFTPhase(n) + _chi(n))]
double kick = 0.;
double cosArg;
for(int n = 1; n < nBins / 2; n++)
{
cosArg = n * (angle + OrbitConst::PI) + _fftphase[n] + _chi[n];
kick += 2 * _fftmagnitude[n] * _z[n] * cos(cosArg);
}
return kick;
}

This PR lets the user restrict the number of modes used in the energy kick, acting as a low-pass filter.

@austin-hoover
Copy link
Contributor Author

Example with decreasing number of modes:

rotation_fft_modes.mov

@austin-hoover austin-hoover marked this pull request as draft February 26, 2026 23:41
@austin-hoover
Copy link
Contributor Author

Wait, that formula is the net energy loss of the beam. The space charge impedance is purely imaginary and doesn't contribute. Closing this as I need to review the formula used for the energy kick.

@austin-hoover
Copy link
Contributor Author

The correct expression is Chao Eq. (7), which gives the voltage for a particle at position $z$ in CGS units:

$$ V(z) = -\int_{z}^{\infty} \rho(z') W_0'(z - z') dz'. $$

In the frequency domain (3.10):

$$ V(z) = -\frac{1}{2 \pi} \int_{\infty}^{\infty} e^{i \omega z / c} Z_0^{\parallel}(\omega) \tilde{\rho}(\omega) d\omega. $$

@austin-hoover
Copy link
Contributor Author

Updated formula in original comment.

@austin-hoover austin-hoover reopened this Feb 27, 2026
@austin-hoover austin-hoover marked this pull request as ready for review February 27, 2026 18:34
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.

1 participant