source: branches/UKMO/r6232_tracer_advection/NEMOGCM/NEMO/OPA_SRC/OBS/maxdist.h90 @ 9295

Last change on this file since 9295 was 9295, checked in by jcastill, 3 years ago

Remove svn keywords

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