0
$\begingroup$

I am trying to numerically solve the orbit of a space probe around the moon in a non-spherical gravitational field .

$ \Large \begin{align} \frac{d^{2} x}{dt^2} = - \frac{G M x}{(x^2 + y^2)^{3/2}} - \frac{q\ G M x^\prime}{(x^{^\prime2} + y^{^\prime2})^{3/2}} \end{align} $

$ \Large \begin{align} \frac{d^{2} y}{dt^2} = - \frac{G M y}{(x^2 + y^2)^{3/2}} - \frac{q\ G M y^\prime}{(x^{^\prime2} + y^{^\prime2})^{3/2}} \end{align} $

$ \Large \begin{align} x^\prime = x + 0.8\ R \cos \left( \frac{2 \pi t}{T_{Moon}} \right) \end{align} $

$ \Large \begin{align} y^\prime = y + 0.8\ R \sin \left( \frac{2 \pi t}{T_{Moon}} \right) \end{align} $

where q = 0.00025 and T_moon = 27.3

I have tried to implement this with the velocity Verlet algorithm and have obtained a height verus time graph for the orbit. The space probe is supposed to hit the lunar surface at one point and here is the graph of the height versus time until the probe collides with the surface :

enter image description here

Here are the height oscillations versus time when I set the initial height so that the probe does not collide with the lunar surface after many orbits, compared with the previous result: enter image description here

Is this physically correct with the equations of motion given above? Would this really happen in reality? How can I interpret this result? Here is the code I used in python to generate this. I used the velocity verlet algorithm to generate the numerical solution to the orbit and I am not sure if the implementation is correct, any comments on my implementation are very welcome.

    from IPython.display import HTML
    import matplotlib.pyplot as plt
    from matplotlib import animation, rc
    import numpy as np
    from scipy import integrate, optimize
    import time
    
    plt.rcParams['figure.figsize'] = (10, 6)
    plt.rcParams['font.size'] = 16
    
    # Gravitational constant
    gg     = 6.67408e-11 # m^3 s^-1 kg^-2
    # Lunar mass
    mass   = 7.342e22 # kg
    # Lunar radius
    radius = 1738000 # m
    # 1 day in seconds
    day    = 3600*24 # seconds
    
    ### Initial positions and velocities at t=0
    rs = [1842280, 0] # m
    vs = [0, 1634]    # m/s
    N=10**5
    t_moon = 27.3*24*3600    
    ts = np.linspace(0,t_moon, N-1)     
    q = 0.00025
        
    rs = np.array([1842280, 0]) # m
    vs = np.array([0, 1634])    # m/s
    distance = np.array([(np.linalg.norm(rs) - radius),0])
    for i in ts:
        x_prime = rs[0] + 0.8*radius*np.cos((2*np.pi*i)/t_moon)
        y_prime = rs[1] + 0.8*radius*np.sin((2*np.pi*i)/t_moon)
        r_primes = np.array([x_prime,y_prime])
        acs = np.array([-((gg*mass*rs[0])/(np.linalg.norm(rs)**3))-((q*(gg*mass*r_primes[0]))/(np.linalg.norm(r_primes)**3)),-((gg*mass*rs[1])/(np.linalg.norm(rs)**3))-((q*(gg*mass*r_primes[1]))/(np.linalg.norm(r_primes)**3))])
        rs = rs + vs*ts[1] + acs*((ts[1]**2)/2)
        next_acs = np.array([-((gg*mass*rs[0])/(np.linalg.norm(rs)**3))-((q*(gg*mass*r_primes[0]))/(np.linalg.norm(r_primes)**3)),-((gg*mass*rs[1])/(np.linalg.norm(rs)**3))-((q*(gg*mass*r_primes[1]))/(np.linalg.norm(r_primes)**3))])
        vs = vs + ((next_acs + acs)*ts[1])/2
        pos = np.c_[pos,rs]
        distance = np.c_[distance,[(np.linalg.norm(rs)-radius),i+ts[1]]]
        if np.linalg.norm(rs) <= radius:
            print("BANG")
            print("time is: ", ts[len(pos[0,:])])
            break   
    plt.xlabel("time(hrs)")
    plt.ylabel("height(km)")
   # plt.plot(pos[0,:], pos[1,:])
             
    plt.plot(distance[1,:]/3600,distance[0,:]/(10**3)) 
$\endgroup$
8
  • $\begingroup$ step size is ts[1] ?, and the initial conditions $\endgroup$
    – Eli
    Commented Oct 17, 2020 at 14:23
  • $\begingroup$ @Eli yes and the initial conditions are at the beginning of the code $\endgroup$
    – Σ baryon
    Commented Oct 17, 2020 at 14:24
  • $\begingroup$ please give me the numbers of the step size $\endgroup$
    – Eli
    Commented Oct 17, 2020 at 14:24
  • $\begingroup$ @Eli the step size in time are ts[1], this is the second item in the time list, the first being = 0 because time starts from 0. You should run the code and look at the variables it will be much easier to see $\endgroup$
    – Σ baryon
    Commented Oct 17, 2020 at 14:30
  • $\begingroup$ I could run the equations and got proper results, but not with python , I think that your problem is the step size , reduce the step size an d see what's happened. $\endgroup$
    – Eli
    Commented Oct 17, 2020 at 14:34

1 Answer 1

0
$\begingroup$

These are my equations with $(q=1)$

$${\ddot{x}}+1/2\,{\frac {MGx}{ \left( {x}^{2}+{y}^{2} \right) ^{3/2}}}+1 /4\,MG \left( 2\,x+2\,aR\cos \left( 2\,{\frac {\pi \,\tau}{T_{{M}}}} \right) \right) \left( \left( x+aR\cos \left( 2\,{\frac {\pi \, \tau}{T_{{M}}}} \right) \right) ^{2}+ \left( y+aR\sin \left( 2\,{ \frac {\pi \,\tau}{T_{{M}}}} \right) \right) ^{2} \right) ^{-3/2}-2\, aR\cos \left( 2\,{\frac {\pi \,\tau}{T_{{M}}}} \right) {\pi }^{2}{T_{{ M}}}^{-2}=0 $$

$${\ddot{y}}+1/2\,{\frac {MGy}{ \left( {x}^{2}+{y}^{2} \right) ^{3/2}}}+1 /4\,MG \left( 2\,y+2\,aR\sin \left( 2\,{\frac {\pi \,\tau}{T_{{M}}}} \right) \right) \left( \left( x+aR\cos \left( 2\,{\frac {\pi \, \tau}{T_{{M}}}} \right) \right) ^{2}+ \left( y+aR\sin \left( 2\,{ \frac {\pi \,\tau}{T_{{M}}}} \right) \right) ^{2} \right) ^{-3/2}-2\, aR\sin \left( 2\,{\frac {\pi \,\tau}{T_{{M}}}} \right) {\pi }^{2}{T_{{ M}}}^{-2} =0$$

with your data I got this result simulation time 32000 [S]

enter image description here

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.