c
c file name gxnepat.htm 031104 C**** SUBROUTINE GXNEPA is called from group 13 of GREX3, and is C entered when the patch name begins with character 'NE', which C stands for "neighbour". C The third character of the name (P, M, O, N, S, E, W, H or L) C also has significance, as has also the entry (GRNDx, where x C is one of 1, 2, 3, 4, 5, 6, 7, or 8). C These significances are explained in annotations to the coding C below. C C.... The library cases 118, 790-801 make the use of it; C also the CLDA (conservative low-dispersion algorithm), and the C PLANT case z110. C SUBROUTINE GXNEPA(NPAT) INCLUDE 'farray' INCLUDE 'grdloc' INCLUDE 'satgrd' COMMON /IGE/IXF,IXL,IYF,IYL,IREG,NZSTEP,IGR,ISC,IRUN,IZSTEP,ITHYD, 1 ISWEEP,ISTEP,INDVAR,VAL,CO,NDIREC,WALDIS,PATGEO,IGES20(6) INTEGER VAL,CO,WALDIS,PATGEO COMMON /NAMFN/NAMFUN,NAMSUB COMMON/ASLP/IND CHARACTER*6 NAMFUN,NAMSUB CHARACTER*1 NP3,NP4 C NAMSUB = 'GXNEPA' NP3=NPAT(3:3) NP4=NPAT(4:4) IF(NP3.EQ.'P') THEN C.... Neighbour has a higher value of INDVAR IF(NP4.EQ.'5') THEN IND=INDVAR+5 ELSEIF(NP4.EQ.'4') THEN IND=INDVAR+4 ELSEIF(NP4.EQ.'3') THEN IND=INDVAR+3 ELSEIF(NP4.EQ.'2') THEN IND=INDVAR+2 ELSE IND=INDVAR+1 ENDIF ELSEIF(NP3.EQ.'M') THEN C.... Neighbour has a lower value of INDVAR IF(NP4.EQ.'5') THEN IND=INDVAR-5 ELSEIF(NP4.EQ.'4') THEN IND=INDVAR-4 ELSEIF(NP4.EQ.'3') THEN IND=INDVAR-3 ELSEIF(NP4.EQ.'2') THEN IND=INDVAR-2 ELSE IND=INDVAR-1 ENDIF ELSEIF(NP3.EQ.'O') THEN IF(NP4.EQ.'2') THEN IND=OLD(INDVAR+2) ELSEIF(NP4.EQ.'1') THEN IND=OLD(INDVAR+1) ELSE IND=OLD(INDVAR) ENDIF C.... Neighour is the variable itself, one cell away ELSEIF(NP3.EQ.'N') THEN IND=NORTH(INDVAR) ELSEIF(NP3.EQ.'S') THEN IND=SOUTH(INDVAR) ELSEIF(NP3.EQ.'E') THEN IND=EAST(INDVAR) ELSEIF(NP3.EQ.'W') THEN IND=WEST(INDVAR) ELSEIF(NP3.EQ.'H') THEN IND=HIGH(INDVAR) ELSEIF(NP3.EQ.'L') THEN IND=LOW(INDVAR) ELSE IND=OLD(INDVAR-2) ENDIF C.... If VAL = GRND1, GRND2, GRND3, GRND4, GRND5, GRND6, GRND7, GRND8, c or OLDNE, NORNE, SOUNE, EASNE, WESNE, HIGNE, LOWNE, LOCNE C then ISC= 13, 14, 15, 16, 17, 18, 19, 20 C.... Neighbour has a different INDVAR and a different location IF(ISC.EQ.13) THEN IND=OLD(IND) ELSEIF(ISC.EQ.14) THEN IND=NORTH(IND) ELSEIF(ISC.EQ.15) THEN IND=SOUTH(IND) ELSEIF(ISC.EQ.16) THEN IND=EAST(IND) ELSEIF(ISC.EQ.17) THEN IND=WEST(IND) ELSEIF(ISC.EQ.18) THEN IND=HIGH(IND) ELSEIF(ISC.EQ.19) THEN IND=LOW(IND) ELSEIF(ISC.EQ.20) THEN IND=IND ENDIF IF(ISC.EQ.10 .OR. ISC-12.EQ.9) RETURN CALL FN0(VAL,IND) NAMSUB = 'gxnepa' END c