Docsity

Repetitive Exection Two - Mechanical Engineering - Lecture Slides, Slides of Mechanical Engineering

Partial preview of the text

Download Repetitive Exection Two - Mechanical Engineering - Lecture Slides and more Slides Mechanical Engineering in PDF only on Docsity!

MET 50

A bit more on… Repetitive EXECUTION

In Meteorology, it is common to use the letters

I,J,K to denote counters.

  • “I” is the counter to tell us where we are west → east
  • “J” is the counter to tell us where we are north → south
  • “K” is the counter to tell us where we are up → down

And then, you would see loops like this:

DO I = 1, IMAX

DO J = 1, JMAX

DO K = 1, KMAX

(important meteorological calculations) ENDDO ENDDO ENDDO

How does this look in “old” Fortran 77 code???

DO 10 I = 1, IMAX

(important meteorological calculations) 10 CONTINUE

  • Statement label goes in columns 2-5.
  • Why???
  • Because we used to use cards, and columns 1-6 on the cards were special!

History lesson…cards…

Col 1

2 3 4 5 6 7 8 9 10 … 80

C State ment

Numb ers

State ment

Numb ers

Continuation Code Code Code Code Code Code

1 0 E N D C P R I N T D O 1 2

1 2 E N D

In 3D?

DO 10 I = 1, IMAX

DO 20 J = 1, JMAX

DO 30 K = 1, KMAX

(important meteorological calculations) 30 CONTINUE 20 CONTINUE 10 CONTINUE

Where…

DO 10 I = 1, IMAX

DO 20 J = 1, JMAX

DO 30 K = 1, KMAX

(important meteorological calculations) 30 CONTINUE 20 CONTINUE 10 CONTINUE

4) column 7+ etc. etc.