introduction to fortran 90/95 -...

2
Climate Change Research Center - UNSW Level 4, Mathews Building University of New South Wales Sydney, NSW, Australia, 2052 Email: [email protected] Introduction to Fortran 90/95 Llu´ ıs Fita 1 Description The course is a short introduction to the Fortran language in its 90/95 standard. This course will cover the basics of the language and some of its new capabilities, in relation to its previous version. The course is aimed at people who have never programmed before with this language, but it is also useful for those who are still using Fortran 77 (F77) standard. 2 Objectives At the end of the course, attendants should be able to understand the basics of any Fortran code. Attendants should be able to understand the code of the geophysical models that they are using on their research. Fortran 77 users should be able to start using the Fortran 90/95 standard. 3 Organization The course consists of 4 one-hour sessions. The course will take place every Tuesday, starting on May 22, in the CCRC seminar room (Mathews building level 4, UNSW Kensington campus) from 4 to 5pm. Each session will consist of a brief introductory explanation and practice activities illustrating the Fortran features covered. Each attendant is responsible for bringing a laptop or similar with a Fortran compiler. Some exercises will be assigned as homework to be completed by the following session. 4 Sessions 4.1 May 22nd: Fortran 90 basics During the first session we will cover the basics of the Fortran: variable declaration, DO loops, IF statements, in- put/output, strings, subroutine/function. We will also introduce some basic concepts about the good practices of programming: pre-design of the program, code indentation, commentaries, code organization. 4.2 May 29th: Fortran 90 beyond F77 We will go over some of the new features of the Fortran 90 standard: ALLOCATE dynamical definition of arrays, matrix capabilities, CASE statement, intrinsic functions 1

Upload: lamnguyet

Post on 17-Apr-2018

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Introduction to Fortran 90/95 - xn--llusfb-5va.catísfb.cat/fortran/CCRCcourse/CCRCLluis_FortranCourse.pdf · on Fortran programs, ... Fortran 90/95 explained, Oxford University Press

Climate Change Research Center - UNSW

Level 4, Mathews BuildingUniversity of New South WalesSydney, NSW, Australia, 2052Email: [email protected]

Introduction to Fortran 90/95

Lluıs Fita

1 Description

The course is a short introduction to the Fortran language in its 90/95 standard. This course will cover the basics ofthe language and some of its new capabilities, in relation to its previous version. The course is aimed at people whohave never programmed before with this language, but it is also useful for those who are still using Fortran 77 (F77)standard.

2 Objectives

At the end of the course, attendants should be able to understand the basics of any Fortran code. Attendants shouldbe able to understand the code of the geophysical models that they are using on their research. Fortran 77 usersshould be able to start using the Fortran 90/95 standard.

3 Organization

The course consists of 4 one-hour sessions. The course will take place every Tuesday, starting on May 22, in the CCRCseminar room (Mathews building level 4, UNSW Kensington campus) from 4 to 5pm. Each session will consist ofa brief introductory explanation and practice activities illustrating the Fortran features covered. Each attendant isresponsible for bringing a laptop or similar with a Fortran compiler. Some exercises will be assigned as homework tobe completed by the following session.

4 Sessions

4.1 May 22nd: Fortran 90 basics

During the first session we will cover the basics of the Fortran: variable declaration, DO loops, IF statements, in-put/output, strings, subroutine/function. We will also introduce some basic concepts about the good practices ofprogramming: pre-design of the program, code indentation, commentaries, code organization.

4.2 May 29th: Fortran 90 beyond F77

We will go over some of the new features of the Fortran 90 standard: ALLOCATE dynamical definition of arrays, matrixcapabilities, CASE statement, intrinsic functions

1

Page 2: Introduction to Fortran 90/95 - xn--llusfb-5va.catísfb.cat/fortran/CCRCcourse/CCRCLluis_FortranCourse.pdf · on Fortran programs, ... Fortran 90/95 explained, Oxford University Press

4.3 June 5th: more Fortran 90 beyond F77

We will address some of the new capabilities of the Fortran 90 standard: namelist configuration, use of attributeson Fortran programs, POINTER Fortran pointers, TYPE derived types of variables and modularity. Attendants will beencouraged to find a piece of Fortran code in any of the applications they use, in order to illustrate how science isFor-mula tran-slated. These pieces will be used as examples during the following and last session of the course.

4.4 June 12th: How do the physics in my model look like when written in Fortran?

The last session will consist of two different parts:

• A short explanation about other characteristics that are out of the scope of the course: debugging, parallelcomputing, use of external libraries such as: netcdf

• How is the geophysical science codified in Fortran? Some attendants will present some pieces of the code fromtheir applications in order to show their understanding of the Fortran code and illustrate how real formulas arecodified in Fortran

Links

• gcc Fortran compiler: http://gcc.gnu.org/fortran/

• NCI Fortran course: https://nf.nci.org.au/training/FortranBasic/slides/index.html

• Lluıs’ web page with material of the course: http://www.lluısfb.cat/fortran/CCRCcourse/FortranCCRCcourse.html or http://www.xn--llusfb-5va.cat/fortran/CCRCcourse/FortranCCRCcourse.html

• Quick Fortran Intrinsics: http://www.nsc.liu.se/~boein/f77to90/a5.html

• UCAR tutorial: http://www.cisl.ucar.edu/tcg/consweb/Fortran90/F90Tutorial/tutorial.html

References

Stephen J. Chapman, 1998: Fortran 90/95 for Scientists and Engineers, WCB McGraw-Hill, Boston

M. Metcalf and J. Reid, 1998: Fortran 90/95 explained, Oxford University Press Inc., New York

J. M. Ortega, 1994: An Introduction to FORTRAN 90 for Scientific Computing, Saunders College Publishing,Orlando

2