Skip to content

The lost art of Fortran programming

My first and only Fortran programming class was at a small college with a big computer. The computer was actually part of the business school and I was one of only a few people who seemed to use it only a regular basis.  The computer was fast which allowed me to make programming mistakes fast and fix bugs even faster.

The source code was punched on small cards by a machine that resembled the old teletype devices. It almost walked around the room while punching the cards. Now I have totally dated myself!

I was excited about programming in Formula Translation. I could finally solve some fairly sophisticated math and engineering problems again and again by simply changing the input to the software.

Engineering and math students graduating from college today seem to be quite proficient in MATLAB, C and C++. I personally can barely spell C! Unless we are developing deliverable software, people tend to program in a language with a high comfort level. Many young engineers have heard of Fortran but few have actually seen Fortran source code. I am not aware of Fortran classes offered to engineering students.

In aerospace engineering we do lots of things in MATLAB. But we also do many more types of analysis in Fortran. The so-called “industry standard” aerospace programs like POST (Program to Optimize Simulated Trajectories) and OTIS (Optimal Trajectories by Implicit Simulation) are both written in Fortran. I don’t know about other engineering disciplines, but in aerospace the majority of heritage software is written in Fortran. Also, I don’t know many people who are interested in porting thousands of lines of source code to another high level language.

Fortran was written for number-crunching. It has evolved over the years to take advantage of such features as modern programming constructs, dynamic memory allocation and modules. It’s easy to read and easy to use. Fortran is a compiled language that executes orders of magnitude faster than MATLAB which is an interpretive language. If you know MATLAB you should be able to learn Fortran quickly.

We need engineers who are not intimidated by Fortran and large scientific simulations.

For example, where I work we have a task to “hook” the Fortran version of the GRAM 2010 atmosphere model into a trajectory simulation. Since both GRAM 2010 and the trajectory simulation are written in Fortran, the integration and checkout should be straight forward. The problem is the lack of engineers who are proficient with Fortran.


How I create computer programs

In this blog I will talk about how I create different computer programs using MATLAB, Fortran and Numerit Pro.

Most of these computer programs rely on a suite of subroutines (Fortran) or functions (MATLAB and Numerit Pro).  These are typically short utility routines that perform a single type of calculation (coordinate transformation, evaluate a system of differential equations, etc.).  The collection of Fortran routines I call the “Orbital Mechanics with Fortran” toolbox. Likewise, for MATLAB the suite is called “Orbital Mechanics with MATLAB”.

These support routines have been used for many years and are for all practical purposes, “bullet proof”.  This means that they will always work correctly provided I give them the right information in the correct units.  This is very important when developing new applications.  If the application or main program crashes, it’s likely something in the call to these routines and not the routines themselves.  This approach makes creating complex scientific simulations much easier.

An excellent example is the computer program that solves the n-body, integrated Earth-to-Mars flight mechanics problem. This is a fairly complicated trajectory optimization problem.

The solution is achieved using the following major computational steps;

(1) solve the two-body, patched-conic interplanetary Lambert problem for the energy (C3), declination (DLA) and asymptote (RLA) of the outgoing hyperbola

(2) compute the orbital elements of the geocentric launch hyperbola and the components of the interplanetary injection delta-v vector

(3) perform geocentric orbit propagation from perigee of the geocentric launch hyperbola to the Earth’s sphere-of-influence (SOI)

(4) perform an n-body heliocentric orbit propagation from the Earth’s SOI to the B-plane at Mars encounter

(5) target to the user-defined B-plane coordinates by minimizing a heliocentric trajectory correction maneuver (TCM) at the Earth’s sphere-of-influence

The analysis results at the conclusion of each step can be displayed and checked for accuracy before going on to the next step. Of course, it is the responsibility of the programmer/analyst to determine is the results from each step are correct.

You might think of this programming approach as “divide and conquer”.

Finally, remember that numbers computed by computers are not always the right numbers.  They simply do what you tell them.

Welcome to the Orbital and Celestial Mechanics blog

Hello, I’ve decided to create a blogging capability in order to inform people about the computer programs I’m currently working on.  This is also a place where I can read and respond to current and prospective users of the software I’ve developed. I’ve been asked many times about why I offer so-called “freeware” computer programs.  Actually, it’s a way that I can give back to an aerospace community which has been very good to me over a career spanning more than 30 years.

The computer programming I do is not all about making money. It’s a way to keep my mind sharp (and to prevent it from totally turning to mush!) and it’s fun, too. I’m currently semi-retired, working part-time at Kennedy Space Center.  After 30+ years in the business, it can be hard to just walk away. I love to solve problems, especially those that involve optimization of space flight mechanics problems. The software that is offered for sale helps support my computer “habit”.  The income helps pay for the Fortran compiler, graphics package and other software products that allow me to create computer programs (and the companion documentation) for solving practical problems.  It also helps purchase hardware like a fast computer and a good printer.  I’m currently using a “homemade” core I7 computer running Windows 7.

Documentation is created with Word, MathType and Grapher. I’m currently working on a Fortran program that will solve the integrated, n-body gravity-assist problem.  The initial guess for this program is based on the patched-conic solution.  The program then attempts to solve the problem by numerically integrating the full n-body equations of motion while constraining the B-plane coordinates at the flyby or gravity-assist planet and flying on to the destination or arrival body. I will try to blog as often as possible. Your comments and questions are welcome. However, I will not do your homework nor will I provide software that you should create as part of your homework assignment.

David Eagle

Hello world!

Welcome to After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.