This note describes modeling, simulation and animation of the Earth-Moon dynamics. The developed model illustrates the use of the CT/DE ( Continuous Time/ Discrete Event) -domain of MLDesigner for systems described by continuous differential equations.
The developed dynamics model does not consider tidal effects and influences of the Sun and other planets. This reduces the dynamics to that of a 2-body problem with the inverse square gravity model.Newton's equations for mass is:
where force
is the gravity force of mass
on mass
. Equivalently the dynamics for mass are described by:
is the universal gravity constant
, the masses are:
,
and semi-major axis of the Earth-Moon system is
.
To simulate this system we have to define a coordinate system and initial conditions for position and velocity of the system. For simple initial conditions, we put an inertial coordinate system at the center of mass of the system (barycenter) and choose initial conditions for circular orbits.
The center of mass of the Earth-Moon system is located at:
(about two thirds of the radius of Earth) away from the center of Earth and
For the initial circular velocities, the centrifugal forces have to be in balance with the gravity forces.
![$v_{c_{Earth}} = \sqrt{ \dfrac{Gm_{Moon}R_{cm_{Earth}}}{a^{2}} } = 0.012452025 \frac{km}{s}$ [Image resource: Latex formula]](typo3/sysext/rtehtmlarea/htmlarea/plugins/EmbedLatex/images/133c33441018935f6c4b964e60736a61aac7d5e6.90.png)
and
To simulate the 2-body dynamics of the Earth-Moon system, we first write a module to compute accelerations due to gravity between 2 bodies, Figure 1. Mass times the gravity constant is divided by the third power of an incoming vector and multiplied by the vector.
Using the developed gravity acceleration module, we ca develop the simulation model, Figure 2. First accelerations of Earth and Moon are computed, these accelerations are integrated once to get the velocities, and integrated a second time to get the positions. The integrators are initialized with the above initial conditions. Initial velocity and position of Earth are,
We could just plot the results and would see the circles of the orbits of Earth and Moon, but no motion during the simulation. To animate the motions of Earth and Moon, we sample positions in buffers. When one buffer is read out for animation, the other one is filled by the simulation. This way we see a smooth orbital motion of Moon and Earth. Whereas the simulation is done in the CTDE-domain, the display of the sampled data is done in the SDF-domain of MLDesigner.
Figure 3 depicts a snapshot of this animation. The outer arc blue shows the orbit of the Moon. The small inner red arc shows the small orbit of Earth due to the motion of the Moon. During simulation, the lines of Earth and Moon are rapidly moving around their respective orbits.
Fore a more detailed documentation of the Earth-Moon-simulation model see the pdf-file.