Showing posts with label GMAT. Show all posts
Showing posts with label GMAT. Show all posts

Monday, January 20, 2020

How to run simulations

When I started looking for the stage, I had no idea how to go about it. I assumed there were good simulators out there, and I understood that there were good models for lunar gravity. I just didn't know where to find these things.

Eventually I ran across a post discussing the merits of different simulation environments, and learned about GMAT, or the "General Mission Analysis Tool". This is a free, open-source package, developed by NASA, that has been used to design real missions. Since August of last year I have been learning the ins and outs of this environment, and using it to search for Snoopy. Unfortunately the acronym for this package is shared with another important "GMAT", the test that people take to get into graduate school. If you go searching the internet for this package, you may find you have better luck spelling out its name in full.

You can download GMAT here. There is a youtube channel with tutorials on how to use it here. Documentation for GMAT exists in various places, but I find this to be the easiest to use. As the name implies, it is a general tool, that can simulate objects in Earth orbit, Mars missions, etc.

One of the first things you will want to do with GMAT for any lunar simulation work is to upgrade the lunar gravity model. The gravity field of the moon is notoriously "lumpy", due to mass concentrations, or "mascons". The gravity model accounts for this lumpiness by decomposing the field using spherical harmonics, and there are a few things you need to know about it. The model that is installed by default is a decent model, named LP165P, but you should upgrade to a GRAIL model. GRAIL models derive from data gathered by a pair of lunar satellites, named Ebb and Flow, that tracked each other around the moon for several years. The resulting data has been processed into a series of ever-more-detailed gravity models. I have been using this one. In order to use it you download the file, save it as "", and copy it into the lunar gravity file directory in your GMAT installation. On my installation it is at ...\AppData\Local\GMAT\R2018a\data\gravity\luna\

This image was derived from GRAIL data and shows the local "lumpy" variations in the moon's gravity field. The "lumps" are likely from heavy objects that hit the moon and then stayed close to it's surface, creating mass concentrations or "mascons"

The model above has "420" in the name because it can run with the degree and order set as high as 420. This is how many spherical harmonics can be used to simulate the field, and more is better in terms of the fidelity. However, more is also slower, in terms of simulation time. I once ran a simulation with a high-fidelity model, with the degree and order set to 1000. This simulation ran for about a week on my computer, simulating a month in orbit. This is too slow for most of what I do, and it does not seem to be required. By running the same simulation with higher degree/order, I have noticed that there are diminishing returns, i.e. very small differences in the results, above degree/order setting of 150/150.


The descent stage of the Apollo 10 Lunar Module ("Snoopy") may still be in lunar orbit today. This defies conventional wisdom. It goes against all expectation about how things behave in lunar orbit. It is the last thing I expected to find when I set out to look for an impact crater that I assumed would be the final resting place of the stage. Nonetheless, this is what simulations of the stage orbit show. In this blog I will show how I arrived at this surprising conclusion.

This picture of the descent stage ladder and footpad comes from the 16mm "DAC" film taken on May 22, 1969, during the dramatic moments when the stage was jettisoned. 

Snoopy's tail was jettisoned into lunar orbit on May 22, 1969, during a daring mission that paved the way for the first moon landing less than two months later. Apollo 10 was the first mission to take a Lunar Module to the moon; the first test of all the hardware and procedures. All except landing. It was the first demonstration of Lunar Orbit Rendezvous, the risky, radical, "sine qua non" of Apollo. 

When I started looking for the stage, I was expecting a quick orbital decay. Everything I read said that's what happened. I thought this would mean less uncertainty about the impact point...a smaller search area. So I was disappointed when I started running simulations, showing that the stage stayed in orbit for months. That was not helpful for finding a crater. My remaining hope was that some high piece of lunar terrain might have snatched the stage if it slowly drifted down to lower and lower altitudes. Perhaps I could focus the search on lunar mountaintops. So I kept looking.

The stage orbit was unusual, in terms of Apollo orbits. In order to demonstrate undocking, firing the LM descent engine to approach the moon, and then firing the ascent engine for the rendezvous, NASA had a problem. Without any landing, they needed a way to arrange for the right timing of the maneuvers. The descent would put the LM in a lower orbit, moving it ahead of the Command Service Module. (The "CSM".) Demonstrating the ascent and rendezvous required that the CSM be leading the LM. The solution was the "Phasing" maneuver. This special burn, never performed by any other Apollo mission, would raise the high side of the LM orbit to 190 nautical miles above the far side of the moon, slowing down the LM's orbital period enough to allow the CSM to overtake it.

This plot of the LM position relative to the Command Module, from mission planning documents, shows how the "Phasing" burn pushed the LM into a higher orbit, so that it would drop behind the CM, giving the right alignment for rendezvous.

While the LM was in the Phasing orbit, 12 n.m. at its low point, and 190 at the high point, the descent stage was jettisoned, with an initial velocity relative to the ascent stage of around 2 feet per second. (Both parts were zipping along at a mile a second at this point.) The goal was to kick the stage forward, but unexpected problems with the attitude controls during staging altered this, and the stage was pushed "upward" relative to the local horizontal at the time of staging. (Notice that the moon is "upside down" in the picture above taken during wasn't supposed to be this way.) Regardless of the extra drama, ten minutes later, the stage was at a safe distance, and the crew fired the ascent engine, slowing their velocity and lowering the high side of their orbit, putting them on track for a successful rendezvous and docking. The stage was left behind in the phasing orbit. It was assumed that this orbit would quickly decay, impacting the moon within days or weeks.

As I starting running simulations of the stage orbit, the hope for a quick demise did not pan out. I ran the simulations out longer and longer, out 10 years, and still the stage kept going. Finally I decided to run the simulation out to the present. This took about 40 hours on my laptop. At the end, the stage remained in orbit all the way to the present, with no sign of decay or orbital instability. As I build out this blog I will share more details, and show you how to try it to see for yourself.