-
I'm analysing some UFDs and some of then have great impact of the LMC and/or SMC.
This way I can integrate this orbit with respect to the Milky Way,'s potential but I'm not sure how to take into account the effects of LMC and SMC both at the same time, along with the effect of the Milky Way? Specially because the phase space of this dwarf with respect to the LMC/SMC is different in positions and velocities. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
You can do this by using a
You can look at this section of the documentation for an example of how to do steps 1 and 2. You can get the SMC orbit using Happy to provide further feedback as you try to implement this. If you want feedback on code, full examples that I can ran are most useful. |
Beta Was this translation helpful? Give feedback.
-
Dear Jo Bovy,
“galpyWarning: You specified integration times as a Quantity, but are evaluating at times not specified as a Quantity; assuming that time given is in natural (internal) units (multiply time by unit to get output at physical time)”. However, as exhibited in the code below, all time intervals I add units in Gyr.
Here's my code: import numpy as np
import math
import random
import matplotlib.pyplot as plt
from galpy.util.conversion import get_physical
from galpy.orbit import Orbit
from galpy.potential.mwpotentials import Irrgang13I as asi
from galpy.potential import evaluateRforces, evaluatephitorques, evaluatezforces, NonInertialFrameForce, ChandrasekharDynamicalFrictionForce, HernquistPotential, MovingObjectPotential
from astropy import units
plt.rcParams['text.usetex'] = True
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
RFsun=get_physical(asi)
RFsun_num=[]
for k, v in RFsun.items():
RFsun_num.append(float(v))
msol_to_kg=1.9885*(10**30)
"""
######################################################################################################
######################################################################################################
Defining the MW+CDF+moving LMC potential
######################################################################################################
######################################################################################################
"""
#LMC orbit
oLMC= Orbit.from_name('LMC', ro=RFsun_num[0], vo=RFsun_num[1])
cdf= ChandrasekharDynamicalFrictionForce(GMs=1.38**11*units.Msun, rhm=5.*units.kpc, dens=asi, ro=RFsun_num[0], vo=RFsun_num[1])
ts=np.linspace(0,2,10001)*units.Gyr
oLMC.integrate(ts, asi+cdf, method='rk4_c')
#moving potential
lmcpot= HernquistPotential(amp=1.38*10.**11*units.Msun, a=5.*units.kpc/(1.+np.sqrt(2.)))
moving_lmcpot= MovingObjectPotential(oLMC,pot=lmcpot)
#LMC acceleration over the MW
loc_origin= 1e-4
ax= lambda t: evaluateRforces(moving_lmcpot,loc_origin,0.,phi=0.,t=t, ro=RFsun_num[0], vo=RFsun_num[1], use_physical=True)
ay= lambda t: evaluatephitorques(moving_lmcpot,loc_origin,0.,phi=0.,t=t, ro=RFsun_num[0], vo=RFsun_num[1], use_physical=True)/loc_origin
az= lambda t: evaluatezforces(moving_lmcpot,loc_origin,0.,phi=0.,t=t, ro=RFsun_num[0], vo=RFsun_num[1], use_physical=True)
if oLMC.time(use_physical=True)[0] > oLMC.time(use_physical=True)[1]:
t_intunits= oLMC.time(use_physical=True)[::-1] # need to reverse the order for interp
else:
t_intunits= oLMC.time(use_physical=True)
ax4int= np.array([ax(t) for t in t_intunits])
ax_int= lambda t: np.interp(t,t_intunits,ax4int)
ay4int= np.array([ay(t) for t in t_intunits])
ay_int= lambda t: np.interp(t,t_intunits,ay4int)
az4int= np.array([az(t) for t in t_intunits])
az_int= lambda t: np.interp(t,t_intunits,az4int)
nip= NonInertialFrameForce(a0=[ax,ay,az])
#final potential
mw_lmc=asi+nip+moving_lmcpot
sunts= np.linspace(0.,1.,10001)*units.Gyr
osun_inertial= Orbit([8.4*units.kpc,22.*units.km/units.s,242*units.km/units.s,0.*units.kpc,22.*units.km/units.s,0.*units.deg], ro=RFsun_num[0], vo=RFsun_num[1])
osun_inertial.integrate(sunts, asi, method='rk4_c')
osun_inertial.plotx(label=r'$\mathrm{Inertial}$')
osun_noninertial= Orbit([8.4*units.kpc,22.*units.km/units.s,242*units.km/units.s,0.*units.kpc,22.*units.km/units.s,0.*units.deg], ro=RFsun_num[0], vo=RFsun_num[1])
osun_noninertial.integrate(sunts, mw_lmc, method='rk4_c')
osun_noninertial.plotx(overplot=True, label=r'$\mathrm{Non-inertial}$')
plt.legend(fontsize=18.,loc='upper left',framealpha=0.8) The value for the LMC mass (1.38×10^(11) Msun) is taken from: https://academic.oup.com/mnras/article/487/2/2685/5491315 |
Beta Was this translation helpful? Give feedback.
-
By the way, I just executed the code from the tutorial. It ran smoothly, fast, and the results were as expected. |
Beta Was this translation helpful? Give feedback.
-
I was making some tests with the MW potential, and to implement the SMC I need its half-mass radius. |
Beta Was this translation helpful? Give feedback.
-
Good morning, I just tested and it worked! 'Physical unit conversion parameters (ro,vo) are not compatible between potentials to be combined' I tried to use: I'll send you the code again. It's a little slow, but I imagine it is because I'm using in the same code both the MWPotential2014 and Irrgang13I to make this new potential that adds LMC & SMC influence. `import numpy as np plt.rcParams['text.usetex'] = True RFsun=get_physical(asi) ts= np.linspace(0,2.1,10001)*units.Gyr """ #LMC on MW influence #SMC moving potential #final potential """ #moving potential #SMC moving potential #final potential """ osun_inertial_asi= Orbit([8.4*units.kpc, 22.units.km/units.s, 242units.km/units.s, 0.*units.kpc, 22.*units.km/units.s, 0.units.deg], **get_physical(asi)) osun_inertial_mwp.plotx(color='r', label=r'$\mathrm{Inertial - MWP}$') |
Beta Was this translation helpful? Give feedback.
-
I found the problem! |
Beta Was this translation helpful? Give feedback.
You can do this by using a
MovingObjectPotential
for the LMC and the SMC. Becausegalpy
isn't an N-body code, you can't account for the full set of interactions, but luckily the hierarchy of the masses is such that the following is a very good approximation:asi
in your caseMovingObjectPotential
for the LMC using this LMC orbit. Because the LMC is so massive, you might also want to account for its effect on the MW barycenterMovingObjectPotential
for the SMC using this SMC orbit