Getting started with Fortran

You will learn: Before learning how to write a Fortran program, let's start with some information about Fortran and where to find tutorials and documentation.

To get started, you can follow on of these links:

Fortran: an old and new programming language..

Seen in a historical perspective Fortran is an old programming language: But a new programming language too: it evolves with user needs and technologies. For instance Fortran 2003 incorporates object-oriented programming support with type extension and inheritance, polymorphism, dynamic type allocation and type-bound procedures and the latest standard Fortran 2008 includes a parallel execution model (coarrays).

So why Learning Fortran?

But the (best) reasons why it's still useful to learn Fortran are:

Compiling, Linking...


compilation
Compiling and linking...

gfortran myprog.f90 -o myprog.exe There are compiler options which makes your code to fail if it does not comply to the chosen Fortran standard. With Gfortran, use -std i.e.:
gfortran myprog.f90 -o myprog -std=f95
gfortran myprog.f90 -o myprog -std=f2003
gfortran myprog.f90 -o myprog -std=f2008


And with Intel Fortran compilers (ifort):
ifort myprog.f90 -o myprog -std95
ifort myprog.f90 -o myprog -std03
ifort myprog.f90 -o myprog -std08
Not all Fortran 2003 or 2008 features have been implemented for all available compilers. To get an overview of the current status visit:

Useful compiler options for debugging

compilerOptions
Compiler options
compilerOptions2
Runtime options


Coding practices



Starting from an existing example is usually the best way to learn Fortran. Take it, compile it, test it and then start to modify it. Try to add a new "feature" (add a new test, change the way the output results are written, or how the input parameters are provided, etc.), a new algorithm, etc.

Use a version control system

Keep your code and documents safe: this is true that having backup is one of the most important best practices, but it should be maintained in well managed way. If you have multiple copies of the same source code or document, then it will create confusion and it would be difficult to identify the latest code or document. This is why it is mandatory to use a proper source code version control system (such as git, mercurial, etc.) for your assignment project: it helps to keep track of your files. For our project, we will be using git and github to collaborate. You can find several good tutorials on the web. Here is a short list on git tutorials but feel free to use any other resources: