1
2      SUBROUTINE LOCATE(PARRAY,LVLBLW,LVLABV,VALUE,NDXBLW)
3!=======================================================================
4!             LOCATE Module of the AMS/EPA Regulatory Model - AERMOD
5!
6!   Purpose:     To return the array index such that VALUE is between
7!                PARRAY(NDXBLW) and PARRAY(NDXBLW+1).
8!
9!   Input:       Array of gridded values (PARRAY)
10!                Lower array bound at which to start the search (LVLBLW)
11!                Upper array bound at which to end the search (LVLABV)
12!                Value being searched for (VALUE)
13!
14!   Output:      Index of PARRAY immediately below VALUE (NDXBLW)
15!
16!   Called by:   Utility routine that can be used by any module:
17!                  SRCSET (in SOSET) for stack heights
18!                  METEXT for mixing height
19!
20!   Assumptions: PARRAY must be montonically increasing or decreasing;
21!                LVLBLW can be no less than 1;
22!
23!   Developer(s): Jim Paumier and Roger Brode, PES, Inc.
24!   Date:         30 September 1993
25!
26!   Revision history:
27!                <none>
28!
29!-----------------------------------------------------------------------
30!
31!---- Variable declarations
32!
33      IMPLICIT NONE
34
35      INTEGER LVLABV , LVLBLW , NDXBLW , JL , JM , JU
36      REAL PARRAY(LVLABV) , VALUE
37!
38!---- Data dictionary
39!     JL   lower bound temporary variable
40!     JM   midpoint temporary variable
41!     JU   upper bound temporary variable
42!
43!----
44      JL = LVLBLW - 1                                                   !198804K
45      JU = LVLABV + 1
46
47      DO WHILE ( (JU-JL).GT.1 )
48
49         JM = (JU+JL)/2                                                 !217142K
50
51         IF ( VALUE.GE.PARRAY(JM) ) THEN
52            JL = JM                                                     !263094K
53         ELSE
54            JU = JM                                                     !954047K
55         ENDIF
56
57      ENDDO
58
59      NDXBLW = JL                                                       !198804K
60
61      CONTINUE
62      END


HyperKWIC - Version 1.00DD executed at 20:00 on 1 Mar 2018 | Personal or Academic or Evaluation User | Free for Non-Commercial, Non-Government Use