Beginner Fortran 90 tutorial

Download Free course and training document about Fortran 90, tutorial on 20 pages for beginners by Guy Munhoven.

Table of contents

  • Basic program structure in Fortran
  • Exercise
  • Outputting data
  • Reading data
  • Do loops
  • Functions
  • Arrays
  • Subroutines

General structure of a Fortran 90 program

Fortran 90 distinguishes the following program units (scoping units):

  • main program;
  • subroutines: subroutines and functions;
  • modules;
  • block data.

At first, we will not deal with modules or block data. It should be noted that the modules are among the most useful innovations of Fortran 90.

Main program

The main program has the following structure:

[PROGRAM [program name]]
specification and declaration instructions
executable instructions
[CONTAINS internal procedures]
END [PROGRAM [program name]]

Everything enclosed in square brackets ([...]) is optional (the brackets themselves are to be omitted in all cases). The PROGRAM statement is not mandatory, but the END statement. The latter can be completed by the PROGRAM attribute which must then be followed by the name of the program

name of the program. Different types of content (specification instructions
and declaration, executable instructions, etc.) are described below.

Subroutines

The subroutine subroutines have a structure similar to that of the main program:

SUBROUTINE name of the subroutine [(arguments)]
specification and declaration instructions
executable instructions
[CONTAINS internal procedures]
END [SUBROUTINE name of the subroutine]

The END statement is mandatory, but not the SUBROUTINE additional specification. If it is given, which is recommended, especially in the case where several subroutines are gathered in the same file, it must be
completed by the name of the subroutine, exactly as specified on the SUBROUTIN line.
Subroutines are run using the CALL command name of the subroutine [(arguments)]

functions

Function type subroutines return a result by calling them by name:

[type] FUNCTION function name ([argument list])
specification and declaration instructions
executable instructions
[CONTAINS internal procedures]
END [FUNCTION function name]

The type (see below) can be specified (recommended); otherwise, it is determined by the default typing rules (see below).

Size134.745 Kb
File typepdf
Downloads173
Created2018-05-21
Cover of Beginner Fortran 90 tutorial

Download

  • Programming for Computations - Python, 2nd Edition

    This book presents computer programming as a key method for solving mathematical problems...., download free Programming for Computations tutorial in PDF (350 pages) created by Svein Linge ....

  • Introduction to ADA 2012

    This course is for developers who already know Ada 95 and want to learn about the new possibilities brought by Ada 2005 and Ada 2012. A brief introduction to Ada 2012 by John Barnes....

  • A Byte of Python

    This is a free book on programming using the Python language. It serves as a tutorial or guide to the Python language for a beginner audience. If all you know about computers is how to save text files, then this is the book for you. This book is written for the latest Python 3, even though Python ...

  • A Whirlwind Tour of Python

    Download free course A Whirlwind Tour of Python, pdf file on 98 pages by by Jake VanderPlas....

  • Java Persistence with JPA

    This tutorial is a reference guide to provide a framework on how to work with JPA and help you to start your first JPA applications,free PDF training course material on 33 pages ....

  • : Advanced R

    It is impossible to become expert in R in only one training course. Yet, this course aims at giving a wide understanding of many aspects of R. Some external resources will be referred to in this book for you to be able to deepen what you would have learned in this course....

  • Programming for Computations - Python: A Gentle Introduction to Numerical Simulations with Python

    This book presents computer programming as a key method for solving mathematical problems. There are two versions of the book, one for MATLAB and one for Python. The book was inspired by the Springer book TCSE 6: A Primer on Scientific Programming with Python (by Langtangen), but the style is more...

  • Learning C++

    Learn C ++ language step by step, complete PDF tutorial on 920 free download pages created by StackOverFlow....

  • DotNet for professionnals

    Download free DotNet tutorial course in PDF, training file in 58 chapters and 192 pages. Free unaffiliated ebook created from Stack OverFlow contributor....

  • Practices of the Python Pro

    Professional developers know the many benefits of writing application code that's clean, well-organized, and easy to maintain. By learning and following established patterns and best practices, you can take your code and your career to a new level....