Fortran

Guide To Learn

Further reading

  • GNU Fortran compiler documentation: https://gcc.gnu.org/onlinedocs/gfortran
  • Wikipedia article on advection: https://en.wikipedia.org/wiki/Advection
  • Wikipedia article on finite differences: https://en.wikipedia.org/wiki/Finite_ difference

Summary

  • Building an executable Fortran program consists of the compilation and linking steps.
  • There are five program units in Fortran: main program, function, subroutine, module, and submodule.
  • A program begins with a program statement and ends with an end program statement.
  • In every program, we first declare the data, and executable code comes after.
  • Use implicit none at the top of your declarative code to enforce explicit declaration of all variables.
  • There are five built-in data types in Fortran: integerrealcomplexcharacter, and logical.
  • if blocks are used to test for conditions and take different execution branches depending on their values.
  • Use the stop statement to abort the program immediately and print a helpful message to the terminal.
  • do loops are used to iterate over sections of the code a specified number of times.
  • Start, end, and increment values of a do loop counter can have any integer value.
  • Fortran’s arithmetic rules are the same as those we learn in school: exponentiation is evaluated first, then multiplication and division are evaluated, and finally addition and subtraction go last; this order can be overruled with parentheses.
  • print * is an easy way to print the values of any variable or literal constant to the terminal.
Further reading

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top