Encyclopaedia Index

(s) Handling slabwise arrays by means of the -YX subroutines

Whereas the FN-subroutines always put the array of values which they create into a segment of EARTH's F-array, two -YX subroutines effect interactions between the F-array and arrays dimensioned by the user in GROUND. The -YX subroutines in question are:

GETYX(LB,array name,NYDIM,NXDIM) SETYX(LB,array name,NYDIM,NXDIM)

Here "array name" is that which appears in the dimension statement, and NYDIM and NXDIM are the numbers appearing in that statement. Thus, for the example in section (p), "array name" is UUDEN, NYDIM is 20 and NXDIM is 30. The parameter NXDIM may be greater than NX, and the parameter NYDIM may be greater than NY. Over-dimensioning of user-dimensioned arrays in GROUND is often desirable because it reduces the need to re-dimension the arrays when the grid is refined.

GETYX takes NX*NY values from the F-array segment with zero index L0F(LB) and puts it into the user's 2-dimensional array; SETYX proceeds in the reverse direction.

There is another -YX subroutine, namely:

PRNYX('name',array name,NYDIM,NXDIM)

This simply prints out the contents of the array, under the heading 'name'.

The method of using GETYX and SETYX to calculate the density from the ideal-gas law (to continue with the above example) is as follows:

• (i) Create three stores:

DIMENSION UUDEN(NYDIM,NXDIM),UUGP1(NYDIM,NXDIM),
1 UUGTEM(NYDIM,NXDIM)

• (ii) Fill the arrays by the use of GETYX:

CALL GETYX(P1,UUGP1,NYDIM,NXDIM)
CALL GETYX(LBNAME('TMP1'),UUGTEM,NYDIM,NXDIM)

• (iii) Compute UUDEN:

DO 10 IX=1,NX
DO 10 IY=1,NY
10 UUDEN(IY,IX)=GASCON*UUGP1(IY,IX)/UUGTEM(IY,IX)

• (iv) Put the results into the relevant EARTH array:

CALL SETYX(LBNAME('RHO1'),UUDEN,NYDIM,NXDIM)

This method of coding is still very popular among GROUND users, partly because of its conceptual simplicity, but mainly because, in earlier versions of PHOENICS, it was the ONLY possible method. However, it is wasteful of both storage and of computer time; it does not remove the burden of writing DO-loops; and it provides many opportunities for making mistakes. If a DO-loop has to be written, one might as well directly address the EARTH variables involved.

wbs