Fortran has long been the language of choice for numerically intensive computing, including numerical weather prediction (NWP) models, climate models, and other fluid dynamic simulations. Almost every major model in atmospheric and oceanic science is still written in Fortran, to my knowledge.
Among computer scientists, Fortran has a reputation for being hopelessly out of date, and for that reason it’s hard to find courses that teach Fortran anymore. But this reputation is largely based on Fortran 77, which is indeed archaic and is still found in wide use. The newer dialect Fortran 90 (or, with minor enhancements, Fortran 95) is considerably more modern and versatile, and there’s no reason that I know of to shun it, especially given the huge body of existing Fortran code that is still out there for a wide range of numerical tasks.
About the only major gripe I have with Fortran is that it has no built-in facility for graphic output, unlike Python, IDL, MatLab, etc. It’s also a lower level language in that it doesn’t have built-in functions to do complex tasks. That said, if numerical speed is what you’re after, a compiled numerically-oriented language like Fortran is just what the doctor ordered.
Getting a Fortran compiler
In order to use Fortran, you have to have a Fortran compiler installed on your machine. While there are excellent commercial compilers from the Portland Group and from Intel, my own preference is for open source solutions, so I use gfortran
, which is free and supports Fortran 90. There is another widely used free Fortran compiler called g77, but to my knowledge it does not support Fortran 90.
I believe gfortran can be installed like any other GNU package under Linux.
For Macs, you have to first install Apple’s XCode distribution that provides developer (programmer) support. You have to register (for free) as an Apple developer; then you should be able to access and install XCode
on your Mac.
See the first section of this page
for current binary distributions of the GNU compilers for Mac OS X, including gfortran.
There is one situation in which you might prefer an expensive commercial compiler from the Portland Group or the Intel ‘ifort’ compiler (which is free under certain circumstances): My understanding is that these compilers can generate considerably faster executable code than gfortran. So if speed is your top priority, it’s probably worth the cost and/or hassle of being tethered to a licensed copy of one of these compilers.
Creating Fortran programs
You need a suitable text editor to create the source files that will be subsequently compiled into an executable program.
I highly recommend Emacs
as your text editor for not only Fortran but any common language (IDL, Python, C, C++, LaTeX, Java, etc.) because of its tremendous support for language-specific syntax highlighting, source code formatting, and other very helpful features.