Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

About Fortran

Fortran (earlier FORTRAN) is a low level programming language. It is often recognised as the first programming language and was created in the 1950s. The name Fortran is derived from FORmula TRANslator. When Fortran was created computers did not have near the computing power of modern computers it prioritized computation-speed over code-readability. The high computation speed is the main reason behind Fortrans continued use. It is very well suited for numeric computing and is still widely used for scientific purposes. 

Panel
borderColor#dfe1e5
bgColor#eff9ff
borderWidth2
titlePage content

Table of Contents



Panel

How to download and install Fortran

To get started with using Fortran you need a compiler compatible with your desired Fortran version. NTNU has an educational license for NAG Fortran builder, and it supports FORTRAN 90 with most of the implementations from FORTRAN 2008



Panel

Getting started with Fortran

In the Fortran builder most work is done in projects. The project folder should contain all the files for the current project, including input and output files.

Creating your first project

  • After opening the program for the first time, go to file → new → new project and the "create project" menu will open
  • Recommended project type for first time users is "Console Application" but there are others options
    • Console Application: A Fortran program or application that uses a console window for i/o.
    • Static Library: A library of routines that can be statically linked into a program
    • Simdem Application: A Fortran program or application that uses the Simdem library for plotting or menu based programming. There are over 60 template programs provided.
    • Lapack Application: A Fortran program or application that uses the Lapack linear algebra library. NAG provide over 15 templates with several examples per template.
    • Dynamic Link Library: A library that can be linked to dynamically by a program or application. The program can be written in another language, e.g. C++ Visual Basic. The application could be Excel or Matlab for example.
  • You can either look at the templates for "Console Application" or create a blank project.


Creating a new file

  • After creating a project. You need to create a file. File→new→ file (ctrl+N)
  • To create a fortran script choose a .f90 file (Fortran90). It's common practice to name the first file in a program "main"
  • You are now ready to start programming in Fortran.

Hello World

Copy the code snippet bellow to create your first program. It will print "Hello world" to the i/o window.


Code Block
program main
  implicit none
  print *, 'Hello World'
end program


Execute a program

To run a script click the lightning symbol on the toolbar. This will execute the script without debugging features. The play button next to the lightning will execute the script with debugging features




Panel

Useful tutorials





BibTeX Display Table