D03 Chapter Contents
D03 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD03RYF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

D03RYF is designed to be used in conjunction with D03RBF. It can be called from the INIDOM to check the user-specified initial grid data and to obtain a simple graphical representation of the initial grid.

## 2  Specification

 SUBROUTINE D03RYF ( NX, NY, NPTS, NROWS, NBNDS, NBPTS, LROW, IROW, ICOL, LLBND, ILBND, LBND, IWK, LENIWK, PGRID, IFAIL)
 INTEGER NX, NY, NPTS, NROWS, NBNDS, NBPTS, LROW(NROWS), IROW(NROWS), ICOL(NPTS), LLBND(NBNDS), ILBND(NBNDS), LBND(NBPTS), IWK(LENIWK), LENIWK, IFAIL CHARACTER(*) PGRID(NY)

## 3  Description

D03RYF outputs a character array which can be printed to provide a simple graphical representation of the virtual and base grids supplied to D03RBF. It must be called only from within the INIDOM after all output parameters of INIDOM (other than IERR) have been set. D03RYF also checks the validity of the grid data specified in INIDOM.
You are strongly advised to call D03RYF during the initial call of D03RBF (at least) and to print the resulting character array in order to check that the base grid is exactly as required.
D03RYF writes a representation of each point in the virtual and base grids to the character array PGRID as follows:
 – internal base grid points are written as two dots (..); – boundary base grid points are written as the ILBND value (i.e., the type) of the boundary; – points external to the base grid are written as XX.
As an example, consider a rectangular domain with a rectangular hole in which the virtual domain extends by one base grid point beyond the actual domain in all directions. The output when each row of PGRID is printed consecutively is as follows:
``` XX XX XX XX XX XX XX XX XX XX XX XX XX XX
XX 23  3  3  3  3  3  3  3  3  3  3 34 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. 14  1  1  1  1 21 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. .. 43  3  3  3  3 32 .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX 12  1  1  1  1  1  1  1  1  1  1 41 XX
XX XX XX XX XX XX XX XX XX XX XX XX XX XX
```

None.

## 5  Parameters

1:     NX – INTEGERInput
2:     NY – INTEGERInput
On entry: the number of virtual grid points in the $x$- and $y$-direction respectively (including the boundary points).
Constraint: NX and ${\mathbf{NY}}\ge 4$.
3:     NPTS – INTEGERInput
On entry: the total number of points in the base grid.
Constraint: ${\mathbf{NPTS}}\le {\mathbf{NX}}×{\mathbf{NY}}$.
4:     NROWS – INTEGERInput
On entry: the total number of rows of the virtual grid that contain base grid points.
Constraint: $4\le {\mathbf{NROWS}}\le {\mathbf{NY}}$.
5:     NBNDS – INTEGERInput
On entry: the total number of physical boundaries and corners in the base grid.
Constraint: ${\mathbf{NBNDS}}\ge 8$.
6:     NBPTS – INTEGERInput
On entry: the total number of boundary points in the base grid.
Constraint: $12\le {\mathbf{NBPTS}}<{\mathbf{NPTS}}$.
7:     LROW(NROWS) – INTEGER arrayInput
On entry: ${\mathbf{LROW}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NROWS}}$, contains the base grid index of the first grid point in base grid row $\mathit{i}$.
Constraints:
• $1\le {\mathbf{LROW}}\left(\mathit{i}\right)\le {\mathbf{NPTS}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NROWS}}$;
• ${\mathbf{LROW}}\left(\mathit{i}-1\right)<{\mathbf{LROW}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{NROWS}}$.
8:     IROW(NROWS) – INTEGER arrayInput
On entry: ${\mathbf{IROW}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NROWS}}$, contains the virtual grid row number that corresponds to base grid row $\mathit{i}$.
Constraints:
• $0\le {\mathbf{IROW}}\left(\mathit{i}\right)\le {\mathbf{NY}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NROWS}}$;
• ${\mathbf{IROW}}\left(\mathit{i}-1\right)<{\mathbf{IROW}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{NROWS}}$.
9:     ICOL(NPTS) – INTEGER arrayInput
On entry: ${\mathbf{ICOL}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NPTS}}$, contains the virtual grid column number that contains base grid point $\mathit{i}$.
Constraint: $0\le {\mathbf{ICOL}}\left(\mathit{i}\right)\le {\mathbf{NX}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NPTS}}$.
10:   LLBND(NBNDS) – INTEGER arrayInput
On entry: ${\mathbf{LLBND}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBNDS}}$, contains the element of LBND corresponding to the start of the $\mathit{i}$th boundary (or corner).
Constraints:
• $1\le {\mathbf{LLBND}}\left(\mathit{i}\right)\le {\mathbf{NBPTS}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBNDS}}$;
• ${\mathbf{LLBND}}\left(\mathit{i}-1\right)<{\mathbf{LLBND}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{NBNDS}}$.
11:   ILBND(NBNDS) – INTEGER arrayInput
On entry: ${\mathbf{ILBND}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBNDS}}$, contains the type of the $\mathit{i}$th boundary (or corner), as defined in D03RBF.
Constraint: ${\mathbf{ILBND}}\left(\mathit{i}\right)$ must be equal to one of the following: $1$, $2$, $3$, $4$, $12$, $23$, $34$, $41$, $21$, $32$, $43$ or $14$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBNDS}}$.
12:   LBND(NBPTS) – INTEGER arrayInput
On entry: ${\mathbf{LBND}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBPTS}}$, contains the grid index of the $\mathit{i}$th boundary point.
Constraint: $1\le {\mathbf{LBND}}\left(\mathit{i}\right)\le {\mathbf{NPTS}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBPTS}}$.
13:   IWK(LENIWK) – INTEGER arrayWorkspace
14:   LENIWK – INTEGERInput
On entry: the dimension of the array IWK as declared in the (sub)program from which D03RYF is called.
Constraint: ${\mathbf{LENIWK}}\ge {\mathbf{NX}}×{\mathbf{NY}}+1$.
15:   PGRID(NY) – CHARACTER(*) arrayOutput
On exit: ${\mathbf{PGRID}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NY}}$, contains a graphical representation of row ${\mathbf{NY}}-\mathit{i}+1$ of the virtual grid (see Section 3).
Constraint: $\mathrm{LEN}\left({\mathbf{PGRID}}\left(1\right)\right)\ge 3×{\mathbf{NX}}$.
16:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, NX or ${\mathbf{NY}}<4$, or ${\mathbf{NPTS}}>{\mathbf{NX}}×{\mathbf{NY}}$, or ${\mathbf{NROWS}}<4$, or ${\mathbf{NROWS}}>{\mathbf{NY}}$, or ${\mathbf{NBNDS}}<8$, or ${\mathbf{NBPTS}}<12$, or ${\mathbf{NBPTS}}\ge {\mathbf{NPTS}}$, or ${\mathbf{LROW}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{LROW}}\left(i\right)>{\mathbf{NPTS}}$, for some $i=1,2,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{LROW}}\left(i\right)\le {\mathbf{LROW}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{IROW}}\left(i\right)<0$, for some $i=1,2,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{IROW}}\left(i\right)>{\mathbf{NY}}$, for some $i=1,2,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{IROW}}\left(i\right)\le {\mathbf{IROW}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{NROWS}}$, or ${\mathbf{ICOL}}\left(i\right)<0$, for some $i=1,2,\dots ,{\mathbf{NPTS}}$, or ${\mathbf{ICOL}}\left(i\right)>{\mathbf{NX}}$, for some $i=1,2,\dots ,{\mathbf{NPTS}}$, or ${\mathbf{LLBND}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{NBNDS}}$, or ${\mathbf{LLBND}}\left(i\right)>{\mathbf{NBPTS}}$, for some $i=1,2,\dots ,{\mathbf{NBNDS}}$, or ${\mathbf{LLBND}}\left(i\right)\le {\mathbf{LLBND}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{NBPTS}}$, or ${\mathbf{ILBND}}\left(i\right)\ne 1$, $2$, $3$, $4$, $12$, $23$, $34$, $41$, $21$, $32$, $43$ or $14$, for some $i=1,2,\dots ,{\mathbf{NBNDS}}$, or ${\mathbf{LBND}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{NBPTS}}$, or ${\mathbf{LBND}}\left(i\right)>{\mathbf{NPTS}}$, for some $i=1,2,\dots ,{\mathbf{NBPTS}}$, or ${\mathbf{LENIWK}}<{\mathbf{NX}}×{\mathbf{NY}}+1$, or $\mathrm{LEN}\left({\mathbf{PGRID}}\left(1\right)\right)<3×{\mathbf{NX}}$.

Not applicable.