source: LMDZ5/trunk/libf/phylmd/cfmip_point_locations.F90 @ 5342

Last change on this file since 5342 was 2346, checked in by Ehouarn Millour, 9 years ago

Physics/dynamics separation:

  • remove all references to dimensions.h from physics. nbp_lon (==iim) , nbp_lat (==jjm+1) and nbp_lev (==llm) from mod_grid_phy_lmdz should be used instead.
  • added module regular_lonlat_mod in phy_common to store information about the global (lon-lat) grid cell boundaries and centers.

EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1MODULE cfmip_point_locations
2  IMPLICIT NONE
3
4CONTAINS
5
6 SUBROUTINE read_CFMIP_point_locations(npCFMIP, tab, lonCFMIP, latCFMIP)
7  IMPLICIT none
8  INTEGER :: npCFMIP
9  REAL, DIMENSION(npCFMIP) :: lonCFMIP, latCFMIP
10  INTEGER :: tab(npCFMIP), np
11
12  WRITE(*,*) 'npCFMIP=',npCFMIP
13! OPEN(20, file="pointlocations.txt",status='old')
14  OPEN(20, file="pointlocations.txt",status='old',err=999)
15  OPEN(21, file="pointlocations_lon180.txt")
16  np=1
1710 READ(20,*) tab(np), lonCFMIP(np), latCFMIP(np)
18!!! passage de 0-360 a -180/180
19   IF (lonCFMIP(np).GT.180.) THEN
20    lonCFMIP(np)=lonCFMIP(np)-360.
21   ENDIF
22   WRITE(21,*) np, lonCFMIP(np), latCFMIP(np)
23   np=np+1
24   IF(np.LE.npCFMIP) THEN
25    GOTO 10
26   ENDIF
27   CLOSE(20)
28   CLOSE(21)
29999 RETURN
30 END SUBROUTINE read_CFMIP_point_locations
31
32 SUBROUTINE LMDZ_CFMIP_point_locations(npCFMIP, lonCFMIP, latCFMIP, &
33  tabijGCM, lonGCM, latGCM, ipt, jpt)
34  USE dimphy
35  USE iophy
36  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo
37
38  IMPLICIT none
39  INTEGER :: npCFMIP
40  REAL, DIMENSION(npCFMIP) :: lonCFMIP, latCFMIP
41  INTEGER :: i, j, np, ip
42  INTEGER, DIMENSION(npCFMIP) :: ipt, jpt
43  REAL :: dlon1, dlon2
44  REAL :: dlat1, dlat2
45  REAL, DIMENSION(nbp_lon+1) :: lon
46  INTEGER, DIMENSION(npCFMIP) :: tabijGCM
47  REAL, DIMENSION(npCFMIP) :: lonGCM, latGCM
48
49  lon(1:nbp_lon)=io_lon(:)
50  lon(nbp_lon+1)=-1*lon(1)
51  OPEN(22, file="LMDZ_pointsCFMIP.txt")
52  DO np=1, npCFMIP
53  DO i=1, nbp_lon
54!
55! PRINT*,'IM np i lonCF lonGCM lonGCM+1',np,i,lonCFMIP(np),lon(i), &
56!  lon(i+1)
57!
58   IF(lonCFMIP(np).GE.lon(i).AND.lonCFMIP(np).LT.lon(i+1)) THEN
59    dlon1 = abs (lonCFMIP(np) - lon(i))
60    dlon2 = abs (lonCFMIP(np) - lon(i+1))
61    IF (dlon1.LE.dlon2) THEN
62     ipt(np)=i
63    ELSE
64     ipt(np)=i+1
65    ENDIF
66   ENDIF
67  END DO
68  END DO
69!
70   np=1
7130 j=1
7240 IF(latCFMIP(np).LE.io_lat(j).AND.latCFMIP(np).GE.io_lat(j+1)) THEN
73    dlat1 = abs (latCFMIP(np) - io_lat(j))
74    dlat2 = abs (latCFMIP(np) - io_lat(j+1))
75    IF (dlat1.LE.dlat2) THEN
76     jpt(np)=j
77    ELSE
78     jpt(np)=j+1
79    ENDIF
80    np=np+1
81    IF(np.LE.npCFMIP) THEN
82     GOTO 30
83    ENDIF
84   ELSE
85    j=j+1
86    IF(j.LE.nbp_lat-1) THEN
87     GOTO 40
88    ENDIF
89   ENDIF
90
91  DO np=1, npCFMIP
92   WRITE(22,*) lon(ipt(np)), io_lat(jpt(np))
93  ENDDO
94  CLOSE(22)
95
96  OPEN(23, file="pointsCFMIPvsLMDZ.txt")
97    DO ip=1, npCFMIP
98     lonGCM(ip)=lon(ipt(ip))
99     latGCM(ip)=io_lat(jpt(ip))
100     if(jpt(ip).GE.2.AND.jpt(ip).LE.nbp_lat-1) THEN     
101      tabijGCM(ip)=1+(jpt(ip)-2)*nbp_lon+ipt(ip)
102     else if(jpt(ip).EQ.1) THEN
103      tabijGCM(ip)=1
104     else if(jpt(ip).EQ.nbp_lat) THEN
105      tabijGCM(ip)=klon_glo
106     else
107      print*,'ip jpt tabijGCM',ip,jpt(ip),tabijGCM(ip)
108     endif
109!    PRINT*,'CFMIP ip lon lat tabijGCM',ip,lonGCM(ip),latGCM(ip),tabijGCM(ip)
110    ENDDO
111    DO ip=1, npCFMIP
112     if(lonGCM(ip).EQ.io_lon(1)) lonGCM(ip)=360.+lonGCM(ip)
113    ENDDO
114   DO i=1, npCFMIP
115    WRITE(23,*) i, lonCFMIP(i), latCFMIP(i), lonGCM(i), latGCM(i), tabijGCM(i)
116   ENDDO
117   CLOSE(23)
118 END SUBROUTINE LMDZ_CFMIP_point_locations
119
120END MODULE CFMIP_point_locations
Note: See TracBrowser for help on using the repository browser.