FORTRAN (Lab 2)
Goals
- To learn how to write FORTRAN programs to solve scientific problems.
Introductory Lecture. PDF Copy of PowerPoint Lecture for Fortran week 2 .
Handouts (paper or electronic)
Activities in Lab
- creating and using linux aliases.
- add modules to share data .
- writing output files .
- interpret compiler error messages .
- continue learning how to debug code.
Instructions
Homework Assignment.
Lab and Homework. You will write your fortran code in stages, a little at a
time. This is the top-down approach to programming. To
ensure that you do this, I ask that you give a different name to each
version of your code. You must get each version of the code
compiled and running, before you enhance the code to create the next
version. This way, the marker can see all the versions of your
code, can confirm that each version compiled and ran successfully, and
can mark each one separately.
Reading Assignment
- Skim chapters 6 & 8 of the following FORTRAN tutorials.
(courtesy of Stephen Brooks, Univ. of St. Andrews, Scotland. http://www-solar.mcs.st-and.ac.uk/%7Esteveb/course/course.html )
- Basics: program structure, data types, programming style, conditional statements, loops, arrays .
- Arithmetic expressions, intrinsic functions, simple input and output (I/O) .
- Characters, strings, print .
- Internal subroutines and functions .
- Modules .
- More about arrays, dynamic allocation of arrays, key words .
- More about I/O .
- Case statement .
- Read Chapter 5 on Debugging, from Kernighan and Pike "The Practice of Programming" (which is in the course material pack).
-end-
Copyright © 2012 by Roland Stull.
UBC.