# Fast and Efficient Lunar Finite Element Gravity Model
## 4 FEM Application in Astrodynamics: Satellite Trajectory Propagation
#### Trajectory Propagation Using FEM Versus LP (100 \(\times\) 100) SH Gravity Model  
In this section, the trajectory propagation results are compared using the coefficient values found from the FEM model to the classical SH method. Computations for the following examples were performed using a machine with the following configurations:  
* Intel(R) Xeon(R) CPU 3.70 GHz, 16.0 GB of RAM;
* Windows 64-bit operating system, x64-based processor;
* MATLAB R2019a. The final goal in this experiment is to justify that the coefficients produced by the original FEM routine can be used in various satellite orbit propagation problems. The steps needed for the orbit propagation experiment are the following:  
1. **Produce a set of initial values**: \(\phi_{0}\), \(\lambda_{o}\), and \(R\). These values represent the spacecraft's azimuth, elevation, and radius from the lunar surface, respectively, at \(t=0\). 2. **Set an \"ending\" position or time. ** This can be achieved by providing \(\phi_{final}\), \(\lambda_{final}\) or providing a time span. 3. **Produce a small trajectory across a small shell. ** Using the coefficient values saved at a particular radius from the previous FEM routine to calculate the acceleration of the spacecraft along this initial trajectory using both the FEM and SH approaches. At this point, the resulting computational time and error between the two methods are then compared. 4. **Generate satellite positions. ** Using MATLAB's \"ode45\" function to solve the differential two-body problem represented as Equation (33), we feed in the acceleration values calculated from step 3, and a time span to find the spacecraft's position as a function of time. 5. **Generate satellite velocities. ** To achieve this, the MATLAB function \"fsolve\" is adopted to solve the systems of nonlinear equations of several values to solve for the satellite's velocity over the course of the small shell provided initial velocities of \(V_{x_{0}}\), \(V_{y_{0}}\), \(V_{z_{0}}\), the spacecraft's position, and the time span. 6. **Generate a long-span satellite orbit trajectory. ** This is achieved, again, by utilizing the \"ode45\" function to generate satellite positions at a longer time span and the resulting final velocities. Before determining the entire trajectory of a spacecraft, a smaller portion of its trajectory based on three different radii above the lunar surface (100 km, 150 km, and 200 km) is simulated first. This small trajectory spans over the (4 \(\times\) 4) square degree shell at this radius. In this analysis, three tests on orbit propagation are considered. These tests differ in how the initial values are produced:  
1. **Test 1**: Randomized position changes. Using MATLAB's \"rand\" function, we randomize a uniformly distributed pseudorandom set of values for \(d\phi\) and \(d\lambda\), i.e., the changes in azimuth and elevation, respectively. Using these randomized values, two ranges for \(\phi\) and \(\lambda\) are created: \[ \begin{split}[\phi_{min}&=0^{o}<\phi+d\phi<\phi_{ max}=4^{o}]\\ [\lambda_{min}&=0^{o}<\lambda+d\lambda<\lambda_{ max}=4^{o}]\end{split} \] (34) With these simulated ranges and a radius 100 km above the lunar surface, these values are then converted into Cartesian coordinates to obtain starting \(x\), \(y\), and \(z\) positions of the simulated spacecraft. 2. **Test 2**: A Monte Carlo simulation of initial conditions. With this approach, randomized values are repeated for \(d\phi\) and \(d\lambda\) under the conditions that \(\phi_{min}\ <\phi_{max}\) and \(\lambda_{min}\ <\lambda_{max}\). This produces various amounts of ranges for \(\phi\) and \(\lambda\) in which a randomly picked set of ranges is sought to achieve the initial positions of the simulated spacecraft. 3. **Test 3**: Set starting and final positions. This approach is the most simple and straightforward, as it is reflective of the most basic problems in orbit propagation.