adrn/gala

Bug in SCFInterpolatedPotential

adrn opened this issue · 0 comments

adrn commented

It doesn't seem to be correctly handling the center of mass of the expansion.

Sjnlm = np.zeros((5, 3, 3, 3))
Sjnlm[:, 0, 0, 0] = 1.
Tjnlm = np.zeros_like(Sjnlm)

t = np.linspace(0, 10, Sjnlm.shape[0])
comx = np.zeros((3, Sjnlm.shape[0]))
comv = np.zeros((3, Sjnlm.shape[0]))

pot = gp.scf.SCFInterpolatedPotential(
    m=1e10, r_s=1., Sjnlm=Sjnlm, Tjnlm=Tjnlm, tj=t, com_xj=comx, com_vj=comv,
    units=galactic
)

x0 = [0.5, 0, 0.] * u.kpc
w0 = gd.PhaseSpacePosition(
    pos=x0,
    vel=[0, 0, 1] * pot.circular_velocity(x0)[0]
)

orbit = pot.integrate_orbit(w0, dt=0.1, n_steps=1000, Integrator=gi.DOPRI853Integrator);