New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
maxdist.h90 in branches/devukmo2010/NEMO/OPA_SRC/OBS – NEMO

source: branches/devukmo2010/NEMO/OPA_SRC/OBS/maxdist.h90 @ 2128

Last change on this file since 2128 was 2128, checked in by rfurner, 14 years ago

merged branches OBS, ASM, Rivers, BDY & mixed_dynldf ready for vn3.3 merge

File size: 2.3 KB
Line 
1   REAL FUNCTION maxdist( pxv, pyv )
2      !!----------------------------------------------------------------------
3      !!                    ***  FUNCTION maxdist ***
4      !!
5      !! ** Purpose : Compute the maximum distance between any points within
6      !!              a cell
7      !!
8      !! ** Method  : Call to grt_cir_dis
9      !!
10      !! ** Action  :
11      !!
12      !! History :
13      !!        !  2006-08  (K. Mogensen)
14      !!        !  2006-10  (A. Weaver) Cleanup
15      !!----------------------------------------------------------------------
16
17      !! * Arguments
18      REAL(KIND=wp), DIMENSION(4), INTENT(IN) :: &
19          & pxv, &                 ! (lon, lat) of the surrounding cell
20          & pyv   
21
22      !! * Local declarations
23      REAL(KIND=wp), DIMENSION(4) :: &
24          &  zxv, &
25          &  zyv, &
26          &  za,  &
27          &  zb,  &
28          &  zc
29      REAL(KIND=wp) :: zdist
30     
31      INTEGER :: ji
32      INTEGER :: jj
33     
34      !-----------------------------------------------------------------------
35      ! Convert data to radians
36      !-----------------------------------------------------------------------
37      DO ji = 1, 4
38         zxv(ji) = pxv(ji) * rad
39         zyv(ji) = pyv(ji) * rad
40      END DO
41
42      !-----------------------------------------------------------------------
43      ! Prepare input to grt_cir_dis
44      !-----------------------------------------------------------------------
45      DO ji = 1, 4
46         za(ji) = SIN( zyv(ji) )
47         zb(ji) = COS( zyv(ji) ) * COS( zxv(ji) )
48         zc(ji) = COS( zyv(ji) ) * SIN( zxv(ji) )
49      END DO
50     
51      !-----------------------------------------------------------------------
52      ! Get max distance between any points in the area
53      !-----------------------------------------------------------------------
54      maxdist = 0.0
55      DO jj = 1, 4
56         DO ji = jj+1, 4
57            zdist = grt_cir_dis( za(jj), za(ji), zb(jj), &
58               &                 zb(ji), zc(jj), zc(ji))
59            IF ( zdist > maxdist ) THEN
60               maxdist = zdist
61            ENDIF
62         END DO
63      END DO
64     
65      !-----------------------------------------------------------------------
66      ! Convert to degrees.
67      !-----------------------------------------------------------------------
68      maxdist = maxdist / rad
69
70   END FUNCTION maxdist
Note: See TracBrowser for help on using the repository browser.