Wrapper potentials only work for potentials, not general forces (because they inherit from Potential) and when applied to forces, they often silently fail (e.g., in C).
Reproducible example
import numpy
from galpy import potential
from galpy.orbit import Orbit
def M(t):
return 1.
MW= potential.MWPotential2014
past= numpy.linspace(0.,-4.,1001)*u.Gyr
#Initialize potentials and time-varying potentials
df = potential.ChandrasekharDynamicalFrictionForce(GMs = 3.0*10**10*u.Msun)
df_wrap = potential.TimeDependentAmplitudeWrapperPotential(A=M, amp=1, pot=df)
#Initialize and integrate orbits.
o = Orbit.from_name("Fornax")
oweird = Orbit.from_name("Fornax")
o.integrate(past, pot=MW+df)
oweird.integrate(past, pot=MW+df_wrap,method='dop853')
print(o.x(past[5]), oweird.x(past[5])) # They are not equivalent
(Example adapted from one sent by Urmila Chadayammuri). Note that applying TimeDependentAmplitudeWrapperPotential isn't quite right, because it doesn't consistently change the mass)
Expected behavior
No silent failure, solution could be:
Error when initializing wrapper if applied to Force
🐛 Bug
Wrapper potentials only work for potentials, not general forces (because they inherit from
Potential
) and when applied to forces, they often silently fail (e.g., in C).Reproducible example
(Example adapted from one sent by Urmila Chadayammuri). Note that applying
TimeDependentAmplitudeWrapperPotential
isn't quite right, because it doesn't consistently change the mass)Expected behavior
No silent failure, solution could be:
System Details
Additional context
Originally reported by Urmila Chadayammuri