Encyclopaedia Index

(p) Handling slabwise arrays in DO loops

Suppose that density, DEN1, and temperature, TMP1, have been stored as FFV's by the command STORE(DEN1,TMP1) in the SATELLITE; suppose further that it is desired to calculate the density from the temperature and the pressure (P1) from the ideal-gas law. Then, one means of doing so is as follows:

Somewhat more economical, because it reduces the time spent in LBNAME, as mentioned above, is:

There is, however, an appreciable amount of computational work also within the INDYX and VARYX functions. This can be dispensed with if L0F is used directly as follows:

Finally it may be recognised that ICELL increases by 1 for each pass through the inner loop; consequently the double loop may be replaced by a single one as follows:

The last version is the least expensive computationally, and it is agreeably simple. It is to be recommended whenever the computation is indeed required for the whole slab. If the density values need to be set for only a part of the slab, however, a double loop would still be appropriate as follows:

This might well be judged too complex to justify the computer-time saving.

If users had wished to insert the density into a two-dimensional array which they had themselves introduced, for example by way of the declaration:

either a double loop would be used, as in:

or, if the whole slab were in question, one might employ:

However, the PHOENICS user who was more concerned with speed of writing than speed of computation might well prefer the conceptu- ally simpler form:

To avoid conflict with FORTRAN variable names used in EARTH commons, user-introduced variables should adhere to the following prefix conventions:

However, the following variable names beginning with G are already used by EARTH, and so are not be used:-