source: trunk/LMDZ.EARTH/libf/phylmd/mod_grid_phy_lmdz.F90 @ 1157

Last change on this file since 1157 was 1, checked in by emillour, 14 years ago

Import initial LMDZ5

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