source: trunk/LMDZ.UNIVERSAL/libf/phygeneric/mod_grid_phy_lmdz.F90 @ 1133

Last change on this file since 1133 was 950, checked in by aslmd, 12 years ago

LMDZ.UNIVERSAL mod_grid_phy_lmdz.F90 is no longer a link towards version in LMDZ.VENUS. part 2.

File size: 11.5 KB
Line 
1!
2!$Header$
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!  fonctions generiques (privees)
280!----------------------------------------------------------------
281  SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
282    IMPLICIT NONE
283
284    INTEGER,INTENT(IN) :: dimsize
285    INTEGER,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
286    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
287    INTEGER :: i,ij,Offset
288
289   
290    Offset=nbp_lon
291       
292    DO i=1,dimsize
293      DO ij=1,klon_glo
294        VarOut(ij+offset-1,i)=VarIn(ij,i)
295      ENDDO
296    ENDDO
297   
298   
299    DO i=1,dimsize
300      DO ij=1,nbp_lon
301       VarOut(ij,i)=VarIn(1,i)
302      ENDDO
303    ENDDO
304   
305   
306    DO i=1,dimsize
307      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
308       VarOut(ij,i)=VarIn(klon_glo,i)
309      ENDDO
310    ENDDO
311
312  END SUBROUTINE grid1dTo2d_glo_igen   
313
314
315  SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
316    IMPLICIT NONE
317
318    INTEGER,INTENT(IN) :: dimsize
319    REAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
320    REAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
321    INTEGER :: i,ij,Offset
322
323   
324    Offset=nbp_lon
325       
326    DO i=1,dimsize
327      DO ij=1,klon_glo
328        VarOut(ij+offset-1,i)=VarIn(ij,i)
329      ENDDO
330    ENDDO
331   
332   
333    DO i=1,dimsize
334      DO ij=1,nbp_lon
335       VarOut(ij,i)=VarIn(1,i)
336      ENDDO
337    ENDDO
338   
339   
340    DO i=1,dimsize
341      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
342       VarOut(ij,i)=VarIn(klon_glo,i)
343      ENDDO
344    ENDDO
345
346  END SUBROUTINE grid1dTo2d_glo_rgen   
347
348  SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
349    IMPLICIT NONE
350   
351    INTEGER,INTENT(IN) :: dimsize
352    LOGICAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
353    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
354    INTEGER :: i,ij,Offset
355
356    Offset=nbp_lon
357       
358    DO i=1,dimsize
359      DO ij=1,klon_glo
360        VarOut(ij+offset-1,i)=VarIn(ij,i)
361      ENDDO
362    ENDDO
363   
364   
365    DO i=1,dimsize
366      DO ij=1,nbp_lon
367       VarOut(ij,i)=VarIn(1,i)
368      ENDDO
369    ENDDO
370   
371   
372    DO i=1,dimsize
373      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
374       VarOut(ij,i)=VarIn(klon_glo,i)
375      ENDDO
376    ENDDO
377
378  END SUBROUTINE grid1dTo2d_glo_lgen     
379 
380 
381  SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
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    IMPLICIT NONE
405
406    INTEGER,INTENT(IN) :: dimsize
407    REAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
408    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
409    INTEGER :: i,ij,offset
410
411    offset=nbp_lon
412
413    DO i=1,dimsize
414      DO ij=1,klon_glo
415        VarOut(ij,i)=VarIn(ij+offset-1,i)
416      ENDDO
417    ENDDO
418
419    DO i=1,dimsize
420      VarOut(1,i)=VarIn(1,i)
421    ENDDO
422   
423  END SUBROUTINE grid2dTo1d_glo_rgen
424   
425  SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
426    IMPLICIT NONE
427
428    INTEGER,INTENT(IN) :: dimsize
429    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
430    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
431    INTEGER :: i,ij,offset
432
433    offset=nbp_lon
434
435    DO i=1,dimsize
436      DO ij=1,klon_glo
437        VarOut(ij,i)=VarIn(ij+offset-1,i)
438      ENDDO
439    ENDDO
440
441    DO i=1,dimsize
442      VarOut(1,i)=VarIn(1,i)
443    ENDDO
444   
445  END SUBROUTINE grid2dTo1d_glo_lgen   
446
447END MODULE mod_grid_phy_lmdz
Note: See TracBrowser for help on using the repository browser.