source: LMDZ4/trunk/libf/dyn3d/ord_coordm.F @ 524

Last change on this file since 524 was 524, checked in by lmdzadmin, 20 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1!
2! $Header$
3!
4       SUBROUTINE ord_coordm ( nmax, xi, xo, jjm, jmods, decrois )
5
6c   ....  Auteur :  P. Le Van  ....
7
8c   ... Reordonne eventuellement les coordonnees de la grille modele ...
9c
10       IMPLICIT NONE
11
12c    .....  Arguments  en entree  .....
13
14       INTEGER nmax,jjm
15       REAL xi(nmax)
16
17c    .....  Arguments  en sortie  .....
18c
19       REAL xo(nmax+1)
20       LOGICAL decrois
21       INTEGER jmods
22
23c    .... Variables  locales  ....
24
25       REAL xscr(nmax)
26       INTEGER i
27       REAL pi, degres, chmin, chmax,mult
28c
29       DO i = 1, nmax
30        xo(i) = xi(i)
31       ENDDO
32
33       mult = 1.
34       IF( xo(1).GT.xo(nmax) )  mult = - 1.
35       IF( nmax.EQ.jjm    ) jmods = nmax +1
36       IF( nmax.EQ.jjm +1 ) jmods = nmax -1
37     
38       pi     = 2.*ASIN(1.)
39       degres = 180./pi
40       decrois = .FALSE.
41
42       CALL minmax(nmax,xo(1),chmin,chmax)
43
44       IF(chmax.LT.6.5 )  THEN
45          DO i = 1,nmax
46           xo(i) = xo(i) * degres
47          ENDDO
48       ENDIF
49
50       IF( nmax.EQ.jjm )   THEN
51         IF( xo(1).GT.xo(nmax) )   THEN
52           DO i = 1, nmax
53            xscr(i) = xo(i)
54           ENDDO
55           DO i = 1, nmax
56            xo(i+1) = xscr(i)
57           ENDDO
58            xo (   1    ) =   90.
59         ELSE
60            xo ( nmax+1 ) =   90.
61         ENDIF
62       ELSE
63          IF( nmax.NE.jjm +1 )   THEN
64             PRINT *,'  Dans la routine ord_coordm , l argument nmax '
65             PRINT *,'  n est pas egal a jjm ni a jjm +1 . Corriger !'
66             CALL ABORT
67          ELSE
68            IF( ABS( xo(1)+ mult * 90.).GT.0.01 )  THEN
69              PRINT *,' Avec nmax =',nmax,'on devrait avoir des',
70     ,    ' ordonnees = 90. deg pour j=1 ou jjm+1 ! '
71             CALL ABORT
72            ELSE
73               IF( xo(1).LT.xo(nmax) )  THEN
74                 DO i = 1, nmax
75                  xscr(i) = xo(i)
76                 ENDDO
77                 DO i = 1, nmax -1
78                  xo(i) = xscr(i+1)
79                 ENDDO
80               ENDIF
81            ENDIF
82          ENDIF
83       ENDIF
84
85       IF ( xo(2).LT.xo(1) ) decrois =.TRUE.
86
87       DO i = 3, nmax
88
89        IF(decrois.AND.xo(i).GT.xo(i-1) ) THEN
90         PRINT 1
91         CALL ABORT
92        ENDIF
93        IF(.NOT.decrois.AND.xo(i).LT.xo(i-1) ) THEN
94         PRINT 1
95         CALL ABORT
96        ENDIF
97
98       ENDDO
99       
100       IF( decrois )  THEN
101         CALL sort(jmods,xo(1))
102       ENDIF
103
104
1051      FORMAT(5x,' Incoherence dans les valeurs des latitudes de la ',
106     ,  'grille du modele ')
1072      FORMAT(1x,8f8.2)
108
109       RETURN
110       END
Note: See TracBrowser for help on using the repository browser.