Thursday, January 23, 2020

Running Longer Simulations

Last time I posted an XY plot generated by GMAT, showing the stage altitude versus time. If you run the simulation yourself you will notice that GMAT spends a lot of time drawing and redrawing this plot while the simulation is running, and it is not very efficient.

For longer simulations, simulating months or years, I have found that it is better to shut down the XY plot, and instead use the GMAT "report" function to capture the data into a csv data file, which can then be processed after the simulation finishes to generate plots, etc. Here is an example of the GUI to set it up:

The next thing I do for longer simulations is to cut down on the number of data points that go into the report file. I am mostly interested in the minimum altitude, i.e. the perilune, for each orbit, so in the setup of the GMAT mission I build a loop that propagates the orbit around to the perilune and records that point. In that way I get a single line in the report file for every two hours of the stage simulation. That's 12 points per simulated day, or about 4300 per year. That keeps the report files manageable for longer simulations.

The other thing about saving the data to a csv file is that I can import it into a spreadsheet to generate more meaningful plots. Compare the XY plot from GMAT with a plot of the same simulation generated with a spreadsheet program. I overlaid the blue line on the GMAT plot so that you can see how it relates to my plot. 


In my plot I can control the labeling and scaling of the of the axes to make things more clear.


This chart is a bit more abstract, in that it is only showing how the low point of the orbit evolves over time, and ignoring the higher parts of the orbit. On the other hand, the labeling makes it easier to relate to what it means, and its easier to see some important features. The GMAT XY plot appears to show the altitude as "0" in the lower left corner, but that is really "0 elapsed days", and the initial altitude of 20+ km is not clear. In my plot the altitude is much more clearly labelled. The other thing that is much easier to notice is that the perilune is showing an upward trend! Unexpectedly, not only was the stage still in orbit on July 20 when the Eagle landed, its perilune altitude was apparently HIGHER than at any time since staging, two months earlier.

One misleading thing about plotting only the perilune points is that it appears the stage is defying gravity by rising in its orbit, but look back up at the GMAT XY plot. As the perilune rises, the apolune is dropping. Another way of saying this is that the energy of the stage orbit is conserved. A bump in the perilune altitude is always accompanied by the dip in the apolune, and vice versa. The eccentricity of the orbit is oscillating, but the overall average height of the orbit remains the same. Keep that in mind when looking at the perilune plots.

OK, lets run the simulation out a full year to see if the trend of the first two months continues.

Now we see a new aspect of the oscillation of the orbit. The initial upward trend in the perilune doesn't hold up. Over about 5 months, the oscillations drop back down, and the minimum altitude of the stage is actually lower than it was in May, for the first time. But then it starts trending up again, so that by November, while Pete Conrad and Al Bean were down on the surface standing next to Surveyor, with Dick Gordon orbiting overhead, the stage was still whizzing around.

If you were hoping to find a crater marking the final resting place of the stage, as I was when I began this exercise, at this point you are realizing that these simulations won't be very helpful. (Actually there is a pattern in this data, which I will explain in a later post, that did give me some slim hope. What can I say...I am an optimist!) 

Next time I will show what happens when you run the simulations out 10 years and more.

No comments:

Post a Comment

All comments are moderated. Please keep it respectful, non-commercial, and relevant to the topic of the blog. Thanks! Roger.