source: LMDZ5/branches/LMDZ5-DOFOCO/libf/phylmd/mod_grid_phy_lmdz.F90 @ 5160

Last change on this file since 5160 was 1675, checked in by Ehouarn Millour, 12 years ago

Include subroutines in the mod_grid_phy_lmdz module, in order to get rid of the "circular dependency" warning (which was harmless) when building/analyzing code.
EM

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.5 KB
Line 
1!
2!$Id $
3!
4MODULE mod_grid_phy_lmdz
5
6  PUBLIC
7  PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
8             grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
9 
10  INTEGER,SAVE :: nbp_lon  ! == iim
11  INTEGER,SAVE :: nbp_lat  ! == jjmp1
12  INTEGER,SAVE :: nbp_lev  ! == llm
13  INTEGER,SAVE :: klon_glo
14
15  INTERFACE grid1dTo2d_glo
16    MODULE PROCEDURE grid1dTo2d_glo_i,grid1dTo2d_glo_i1,grid1dTo2d_glo_i2,grid1dTo2d_glo_i3, &
17                     grid1dTo2d_glo_r,grid1dTo2d_glo_r1,grid1dTo2d_glo_r2,grid1dTo2d_glo_r3, &
18                     grid1dTo2d_glo_l,grid1dTo2d_glo_l1,grid1dTo2d_glo_l2,grid1dTo2d_glo_l3
19   END INTERFACE
20
21   INTERFACE grid2dTo1d_glo
22    MODULE PROCEDURE grid2dTo1d_glo_i,grid2dTo1d_glo_i1,grid2dTo1d_glo_i2,grid2dTo1d_glo_i3, &
23                     grid2dTo1d_glo_r,grid2dTo1d_glo_r1,grid2dTo1d_glo_r2,grid2dTo1d_glo_r3, &
24                     grid2dTo1d_glo_l,grid2dTo1d_glo_l1,grid2dTo1d_glo_l2,grid2dTo1d_glo_l3
25   END INTERFACE
26 
27CONTAINS
28
29!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30!! SUBROUTINE grid1dTo2d  !! 
31!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32
33
34  SUBROUTINE Init_grid_phy_lmdz(iim,jjp1,llm)
35  IMPLICIT NONE
36  INTEGER, INTENT(in) :: iim
37  INTEGER, INTENT(in) :: jjp1
38  INTEGER, INTENT(in) :: llm
39 
40    nbp_lon=iim
41    nbp_lat=jjp1
42    nbp_lev=llm
43    klon_glo=(iim*jjp1)-2*(iim-1)
44 
45  END SUBROUTINE Init_grid_phy_lmdz
46 
47 
48  SUBROUTINE grid1dTo2d_glo_i(VarIn,VarOut) 
49  IMPLICIT NONE 
50    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
51    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
52   
53    CALL grid1dTo2d_glo_igen(VarIn,VarOut,1)
54 
55  END SUBROUTINE grid1dTo2d_glo_i
56 
57
58  SUBROUTINE grid1dTo2d_glo_i1(VarIn,VarOut) 
59  IMPLICIT NONE 
60    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
61    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
62   
63    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2))
64 
65  END SUBROUTINE grid1dTo2d_glo_i1
66
67  SUBROUTINE grid1dTo2d_glo_i2(VarIn,VarOut) 
68  IMPLICIT NONE 
69    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
70    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
71   
72    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
73 
74  END SUBROUTINE grid1dTo2d_glo_i2
75 
76  SUBROUTINE grid1dTo2d_glo_i3(VarIn,VarOut) 
77  IMPLICIT NONE 
78    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
79    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
80   
81    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
82 
83  END SUBROUTINE grid1dTo2d_glo_i3
84
85
86  SUBROUTINE grid1dTo2d_glo_r(VarIn,VarOut) 
87  IMPLICIT NONE 
88    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
89    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
90   
91    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,1)
92 
93  END SUBROUTINE grid1dTo2d_glo_r
94 
95
96  SUBROUTINE grid1dTo2d_glo_r1(VarIn,VarOut) 
97  IMPLICIT NONE 
98    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
99    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
100   
101    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2))
102 
103  END SUBROUTINE grid1dTo2d_glo_r1
104
105  SUBROUTINE grid1dTo2d_glo_r2(VarIn,VarOut) 
106  IMPLICIT NONE 
107    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
108    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
109   
110    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
111 
112  END SUBROUTINE grid1dTo2d_glo_r2
113 
114  SUBROUTINE grid1dTo2d_glo_r3(VarIn,VarOut) 
115  IMPLICIT NONE 
116    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
117    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
118   
119    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
120 
121  END SUBROUTINE grid1dTo2d_glo_r3
122 
123 
124 
125  SUBROUTINE grid1dTo2d_glo_l(VarIn,VarOut) 
126  IMPLICIT NONE 
127    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
128    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
129   
130    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,1)
131 
132  END SUBROUTINE grid1dTo2d_glo_l
133 
134
135  SUBROUTINE grid1dTo2d_glo_l1(VarIn,VarOut) 
136  IMPLICIT NONE 
137    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
138    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
139   
140    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2))
141 
142  END SUBROUTINE grid1dTo2d_glo_l1
143
144  SUBROUTINE grid1dTo2d_glo_l2(VarIn,VarOut) 
145  IMPLICIT NONE 
146    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
147    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
148   
149    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
150 
151  END SUBROUTINE grid1dTo2d_glo_l2
152 
153  SUBROUTINE grid1dTo2d_glo_l3(VarIn,VarOut) 
154  IMPLICIT NONE 
155    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
156    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
157   
158    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
159 
160  END SUBROUTINE grid1dTo2d_glo_l3 
161 
162    SUBROUTINE grid2dTo1d_glo_i(VarIn,VarOut) 
163  IMPLICIT NONE 
164    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
165    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
166   
167    CALL grid2dTo1d_glo_igen(VarIn,VarOut,1)
168 
169  END SUBROUTINE grid2dTo1d_glo_i
170 
171
172  SUBROUTINE grid2dTo1d_glo_i1(VarIn,VarOut) 
173  IMPLICIT NONE 
174    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
175    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
176   
177    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3))
178 
179  END SUBROUTINE grid2dTo1d_glo_i1
180
181  SUBROUTINE grid2dTo1d_glo_i2(VarIn,VarOut) 
182  IMPLICIT NONE 
183    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
184    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
185   
186    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
187 
188  END SUBROUTINE grid2dTo1d_glo_i2
189 
190  SUBROUTINE grid2dTo1d_glo_i3(VarIn,VarOut) 
191  IMPLICIT NONE 
192    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
193    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
194   
195    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
196 
197  END SUBROUTINE grid2dTo1d_glo_i3
198 
199
200
201
202  SUBROUTINE grid2dTo1d_glo_r(VarIn,VarOut) 
203  IMPLICIT NONE 
204    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
205    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
206   
207    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,1)
208 
209  END SUBROUTINE grid2dTo1d_glo_r
210 
211
212  SUBROUTINE grid2dTo1d_glo_r1(VarIn,VarOut) 
213  IMPLICIT NONE 
214    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
215    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
216   
217    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3))
218 
219  END SUBROUTINE grid2dTo1d_glo_r1
220
221  SUBROUTINE grid2dTo1d_glo_r2(VarIn,VarOut) 
222  IMPLICIT NONE 
223    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
224    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
225   
226    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
227 
228  END SUBROUTINE grid2dTo1d_glo_r2
229 
230  SUBROUTINE grid2dTo1d_glo_r3(VarIn,VarOut) 
231  IMPLICIT NONE 
232    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
233    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
234   
235    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
236 
237  END SUBROUTINE grid2dTo1d_glo_r3
238
239
240
241  SUBROUTINE grid2dTo1d_glo_l(VarIn,VarOut) 
242  IMPLICIT NONE 
243    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
244    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
245   
246    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,1)
247 
248  END SUBROUTINE grid2dTo1d_glo_l
249 
250
251  SUBROUTINE grid2dTo1d_glo_l1(VarIn,VarOut) 
252  IMPLICIT NONE 
253    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
254    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
255   
256    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3))
257 
258  END SUBROUTINE grid2dTo1d_glo_l1
259
260  SUBROUTINE grid2dTo1d_glo_l2(VarIn,VarOut) 
261  IMPLICIT NONE 
262    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
263    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
264   
265    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
266 
267  END SUBROUTINE grid2dTo1d_glo_l2
268 
269  SUBROUTINE grid2dTo1d_glo_l3(VarIn,VarOut) 
270  IMPLICIT NONE 
271    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
272    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
273   
274    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
275 
276  END SUBROUTINE grid2dTo1d_glo_l3
277
278!----------------------------------------------------------------
279!  Generic (private) fonctions
280!----------------------------------------------------------------
281 
282  SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
283
284    IMPLICIT NONE
285
286    INTEGER,INTENT(IN) :: dimsize
287    INTEGER,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
288    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
289    INTEGER :: i,ij,Offset
290
291   
292    Offset=nbp_lon
293       
294    DO i=1,dimsize
295      DO ij=1,klon_glo
296        VarOut(ij+offset-1,i)=VarIn(ij,i)
297      ENDDO
298    ENDDO
299   
300   
301    DO i=1,dimsize
302      DO ij=1,nbp_lon
303       VarOut(ij,i)=VarIn(1,i)
304      ENDDO
305    ENDDO
306   
307   
308    DO i=1,dimsize
309      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
310       VarOut(ij,i)=VarIn(klon_glo,i)
311      ENDDO
312    ENDDO
313
314  END SUBROUTINE grid1dTo2d_glo_igen   
315
316
317  SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
318
319    IMPLICIT NONE
320
321    INTEGER,INTENT(IN) :: dimsize
322    REAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
323    REAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
324    INTEGER :: i,ij,Offset
325
326   
327    Offset=nbp_lon
328       
329    DO i=1,dimsize
330      DO ij=1,klon_glo
331        VarOut(ij+offset-1,i)=VarIn(ij,i)
332      ENDDO
333    ENDDO
334   
335   
336    DO i=1,dimsize
337      DO ij=1,nbp_lon
338       VarOut(ij,i)=VarIn(1,i)
339      ENDDO
340    ENDDO
341   
342   
343    DO i=1,dimsize
344      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
345       VarOut(ij,i)=VarIn(klon_glo,i)
346      ENDDO
347    ENDDO
348
349  END SUBROUTINE grid1dTo2d_glo_rgen   
350
351  SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
352
353    IMPLICIT NONE
354   
355    INTEGER,INTENT(IN) :: dimsize
356    LOGICAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
357    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
358    INTEGER :: i,ij,Offset
359
360    Offset=nbp_lon
361       
362    DO i=1,dimsize
363      DO ij=1,klon_glo
364        VarOut(ij+offset-1,i)=VarIn(ij,i)
365      ENDDO
366    ENDDO
367   
368   
369    DO i=1,dimsize
370      DO ij=1,nbp_lon
371       VarOut(ij,i)=VarIn(1,i)
372      ENDDO
373    ENDDO
374   
375   
376    DO i=1,dimsize
377      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
378       VarOut(ij,i)=VarIn(klon_glo,i)
379      ENDDO
380    ENDDO
381
382  END SUBROUTINE grid1dTo2d_glo_lgen     
383 
384 
385  SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
386
387    IMPLICIT NONE
388
389    INTEGER,INTENT(IN) :: dimsize
390    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
391    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
392    INTEGER :: i,ij,offset
393
394    offset=nbp_lon
395
396    DO i=1,dimsize
397      DO ij=1,klon_glo
398        VarOut(ij,i)=VarIn(ij+offset-1,i)
399      ENDDO
400    ENDDO
401
402    DO i=1,dimsize
403      VarOut(1,i)=VarIn(1,i)
404    ENDDO
405   
406  END SUBROUTINE grid2dTo1d_glo_igen   
407 
408  SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
409
410    IMPLICIT NONE
411
412    INTEGER,INTENT(IN) :: dimsize
413    REAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
414    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
415    INTEGER :: i,ij,offset
416
417    offset=nbp_lon
418
419    DO i=1,dimsize
420      DO ij=1,klon_glo
421        VarOut(ij,i)=VarIn(ij+offset-1,i)
422      ENDDO
423    ENDDO
424
425    DO i=1,dimsize
426      VarOut(1,i)=VarIn(1,i)
427    ENDDO
428   
429  END SUBROUTINE grid2dTo1d_glo_rgen
430   
431  SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
432
433    IMPLICIT NONE
434
435    INTEGER,INTENT(IN) :: dimsize
436    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
437    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
438    INTEGER :: i,ij,offset
439
440    offset=nbp_lon
441
442    DO i=1,dimsize
443      DO ij=1,klon_glo
444        VarOut(ij,i)=VarIn(ij+offset-1,i)
445      ENDDO
446    ENDDO
447
448    DO i=1,dimsize
449      VarOut(1,i)=VarIn(1,i)
450    ENDDO
451   
452  END SUBROUTINE grid2dTo1d_glo_lgen   
453
454END MODULE mod_grid_phy_lmdz
Note: See TracBrowser for help on using the repository browser.