An introduction to fortran programming, focusing on its application in scientific computing. It covers the history of fortran, the process of solving scientific problems using fortran, and the basics of writing, compiling, and running a fortran program. It also introduces the reader to the unix operating system and text editors used in the department. Intended for university students in meteorology and climate science who need to use fortran for data analysis, computation, or equation solving.
Involves simultaneous solution of multiple equations at multiple locations in the atmosphere at multiple times to get a forecast
Solving a scientific/engineering problem
ALWAYS involves many steps.
Many of these steps do not involve Fortran!!!
So we will learn much more than just Fortran
in this class!
The first step is to do as much work as
possible on paper
make sure you have defined the problem properly
make sure you have as much information as possible
Example: Suppose we wish to calculate how
much kinetic energy is in hurricane Irene.
Think first about how you would do this with pen and pencil.
Recall that kinetic energy is defined as:
(speed)^2 /
Now we can take real wind data (e.g., from research aircraft, forecast models etc.) and compute “K” using our formula.
Computers are VERY good at these tasks.
Note that wind speed could be both horizontal winds (“large” numbers) and vertical winds (“small” numbers)
The next step is to break the calculation down
into small bite-sized pieces.
Typically we do this on paper (or in your head
when the problem is easy AND you have lots
of experience)
In our KE example…
And now - translate each step in the list above
into Fortran!
This is like translating into Spanish.
You need to know two things:
Vocabulary
Words like: IF, STOP, GO TO, PRINT » They all look pretty obvious!
Rules
Things like: the commands “STOP” and “END” must appear in your program.
Computers are very smart!
They can do many things
they can remember lots of stuff (via memory)
they are VERY fast
Once you have your Fortran program written,
the next step is to present the program to a
computer!
If you are on a laptop with Fortran software
installed, this will be straightforward.
If you are on a department machine (including
laptop), there are extra steps…see later.
Computers are very dumb!
They don’t know what Fortran is!
They have to translate your Fortran program into a low-level machine language. - Fortran is machine-independent. - Machine language is machine-dependent.
The compiler digests this and produces an executable file – a file called program.exe
This is what then “runs” on the computer to solve your problem (e.g., make a forecast)
Putting it all together…
With a computer that has Fortran software
installed, you would:
Open up the Fortran software (just like opening up Word)
Type in your Fortran code using a text editor
MS Word is a very fancy text editor; we use simpler ones (see later)