Evaluate B(theta, phi) = sum_k B_mn(k)*cos(m(k)*theta - nfp*n(k)*phi)
on the equidistant angle grid by a single 2D inverse FFT.
On the grid theta_j = 2*pi*(j-1)/n_fft, phi_l = 2*pi/nfp*(l-1)/n_fft
the phase becomes 2*pi*(m*(j-1)/n_fft - n*(l-1)/n_fft) — nfp cancels
and every phase is a root of unity. Writing the cosine as
(exp(i*phase) + exp(-i*phase))/2 and scattering B_mn/2 onto both
(m, -n) and (-m, n) therefore turns the mode sum into an unnormalised
2D inverse DFT of a Hermitian spectrum, whose transform is real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | m(:) |
poloidal mode numbers (flat array) |
||
| integer, | intent(in) | :: | n(:) |
toroidal mode numbers normalised to nfp (flat array) |
||
| real(kind=dp), | intent(in) | :: | B_mn(:) |
Fourier coefficients of B in Tesla (flat array) |
||
| integer, | intent(in) | :: | n_fft |
transform length per direction, a power of two above 2*mn_max |
||
| real(kind=dp), | intent(out) | :: | fft_B(:,:) |
field strength on the open (periodic point excluded) fft angle grid |