Home > Legacy archive > Specific versions > FARGO-ADSG > FARGO-SG > **Poisson solver**

We calculate the radial and azimuthal self-gravitating accelerations with Fast Fourier Transforms (FFT). This requires (i) the use of a grid with a logarithmic radial spacing, and (ii) that the softening length, adopted to avoid numerical divergences, scales with , the radial coordinate. The calculation is done with function `compute_selfgravity`

in sgmain.c. Its steps are the following:
(a) initialization step with function `init_sg`

in sginit.c: array declarations, construction of the forward and backward FFT plans.
(b) calculation of TF() and TF() with `compute_fftkernel`

in sgkernel.c, where and denote the radial and azimuthal kernel convolutions. This step is done only once.
(c) calculation of TF() and TF() with `compute_fftdensity`

in sgdens.c, where and denote the radial and azimuthal "reduced" surface densities. This calculation is done every timestep.
(d) calculation of and , the radial and azimuthal accelerations, as TF(TF() . TF() ), to within a normalization factor. This is done (every timestep of course) with function `compute_sgacc`

in sgacc.c.
(e) eventually, the gas velocities are updated with and with function `update_sgvelocity`

, in sgupdate.c.
In the case where you take into account only the axisymmetric component of the disk self-gravity (which involves only the axisymmetric part of the disk surface density), and depends only on . Only 1D FFT calculations are therefore required, which do not need to be parallelized. The calculation of is done with function `compute_SGZeroMode`

in sgzero.c.