source: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/allocate_field_mod.F90 @ 5225

Last change on this file since 5225 was 5159, checked in by abarral, 3 months ago

Put dimensions.h and paramet.h into modules

  • 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
File size: 15.8 KB
Line 
1MODULE allocate_field_mod
2
3  INTERFACE allocate_u
4    MODULE PROCEDURE allocate1d_u1d,allocate2d_u1d,allocate3d_u1d
5  END INTERFACE allocate_u
6
7  INTERFACE switch_u
8    MODULE PROCEDURE switch1d_u1d,switch2d_u1d,switch3d_u1d
9  END INTERFACE switch_u
10
11  INTERFACE switch_v
12    MODULE PROCEDURE switch1d_v1d,switch2d_v1d,switch3d_v1d
13  END INTERFACE switch_v
14
15  INTERFACE allocate_v
16    MODULE PROCEDURE allocate1d_v1d,allocate2d_v1d,allocate3d_v1d
17  END INTERFACE allocate_v
18
19  INTERFACE allocate2d_u
20    MODULE PROCEDURE allocate1d_u2d,allocate2d_u2d,allocate3d_u2d
21  END INTERFACE allocate2d_u
22
23  INTERFACE allocate2d_v
24    MODULE PROCEDURE allocate1d_v2d,allocate2d_v2d,allocate3d_v2d
25  END INTERFACE allocate2d_v
26
27  INTERFACE switch2d_u
28    MODULE PROCEDURE switch1d_u2d,switch2d_u2d,switch3d_u2d
29  END INTERFACE switch2d_u
30
31  INTERFACE switch2d_v
32    MODULE PROCEDURE switch1d_v2d,switch2d_v2d,switch3d_v2d
33  END INTERFACE switch2D_v
34
35  REAL :: nan
36
37CONTAINS
38
39  SUBROUTINE Init_nan
40  IMPLICIT NONE
41    REAL(kind=8) :: rnan
42    INTEGER :: inan(2)
43    EQUIVALENCE(rnan,inan)
44   
45    inan(1)=2147483647
46    inan(2)=2147483647
47   
48    nan=rnan
49 
50  END SUBROUTINE Init_nan
51
52  SUBROUTINE allocate1d_u1d(field,d)
53  USE parallel_lmdz
54  IMPLICIT NONE
55  REAL,POINTER :: field(:)
56  TYPE(distrib),INTENT(IN) :: d
57
58!$OMP BARRIER
59!$OMP MASTER   
60    IF (ASSOCIATED(field)) DEALLOCATE(field)
61    ALLOCATE(field(d%ijb_u:d%ije_u))
62!$OMP END MASTER
63!$OMP BARRIER
64
65  END SUBROUTINE allocate1d_u1d
66
67
68  SUBROUTINE allocate2d_u1d(field,dim1,d)
69  USE parallel_lmdz
70  IMPLICIT NONE
71  REAL,POINTER :: field(:,:)
72  INTEGER      :: dim1
73  TYPE(distrib),INTENT(IN) :: d
74
75!$OMP BARRIER
76!$OMP MASTER   
77    IF (ASSOCIATED(field)) DEALLOCATE(field)
78    ALLOCATE(field(d%ijb_u:d%ije_u,dim1))
79!$OMP END MASTER
80!$OMP BARRIER
81
82  END SUBROUTINE allocate2d_u1d
83
84  SUBROUTINE allocate3d_u1d(field,dim1,dim2,d)
85  USE parallel_lmdz
86  IMPLICIT NONE
87  REAL,POINTER :: field(:,:,:)
88  INTEGER      :: dim1,dim2
89  TYPE(distrib),INTENT(IN) :: d
90
91!$OMP BARRIER
92!$OMP MASTER   
93    IF (ASSOCIATED(field)) DEALLOCATE(field)
94    ALLOCATE(field(d%ijb_u:d%ije_u,dim1,dim2))
95!$OMP END MASTER
96!$OMP BARRIER
97
98  END SUBROUTINE allocate3d_u1d   
99
100
101
102  SUBROUTINE allocate1d_v1d(field,d)
103  USE parallel_lmdz
104  IMPLICIT NONE
105  REAL,POINTER :: field(:)
106  TYPE(distrib),INTENT(IN) :: d
107
108!$OMP BARRIER
109!$OMP MASTER   
110    IF (ASSOCIATED(field)) DEALLOCATE(field)
111    ALLOCATE(field(d%ijb_v:d%ije_v))
112!$OMP END MASTER
113!$OMP BARRIER
114
115  END SUBROUTINE allocate1d_v1d
116
117
118  SUBROUTINE allocate2d_v1d(field,dim1,d)
119  USE parallel_lmdz
120  IMPLICIT NONE
121  REAL,POINTER :: field(:,:)
122  INTEGER      :: dim1
123  TYPE(distrib),INTENT(IN) :: d
124
125!$OMP BARRIER
126!$OMP MASTER   
127    IF (ASSOCIATED(field)) DEALLOCATE(field)
128    ALLOCATE(field(d%ijb_v:d%ije_v,dim1))
129!$OMP END MASTER
130!$OMP BARRIER
131
132  END SUBROUTINE allocate2d_v1d
133
134  SUBROUTINE allocate3d_v1d(field,dim1,dim2,d)
135  USE parallel_lmdz
136  IMPLICIT NONE
137  REAL,POINTER :: field(:,:,:)
138  INTEGER      :: dim1,dim2
139  TYPE(distrib),INTENT(IN) :: d
140
141!$OMP BARRIER
142!$OMP MASTER   
143    IF (ASSOCIATED(field)) DEALLOCATE(field)
144    ALLOCATE(field(d%ijb_v:d%ije_v,dim1,dim2))
145!$OMP END MASTER
146!$OMP BARRIER
147
148  END SUBROUTINE allocate3d_v1d   
149
150
151
152
153
154
155
156
157
158  SUBROUTINE allocate1d_u2d(field,d)
159  USE parallel_lmdz
160  USE lmdz_dimensions
161  USE lmdz_paramet
162  IMPLICIT NONE
163  REAL,POINTER :: field(:,:)
164  TYPE(distrib),INTENT(IN) :: d
165
166!$OMP BARRIER
167!$OMP MASTER   
168    IF (ASSOCIATED(field)) DEALLOCATE(field)
169    ALLOCATE(field(iip1,d%jjb_u:d%jje_u))
170!$OMP END MASTER
171!$OMP BARRIER
172
173  END SUBROUTINE allocate1d_u2d
174
175
176  SUBROUTINE allocate2d_u2d(field,dim1,d)
177  USE parallel_lmdz
178  USE lmdz_dimensions
179  USE lmdz_paramet
180  IMPLICIT NONE
181  REAL,POINTER :: field(:,:,:)
182  INTEGER      :: dim1
183  TYPE(distrib),INTENT(IN) :: d
184
185!$OMP BARRIER
186!$OMP MASTER   
187    IF (ASSOCIATED(field)) DEALLOCATE(field)
188    ALLOCATE(field(iip1,d%jjb_u:d%jje_u,dim1))
189!$OMP END MASTER
190!$OMP BARRIER
191
192  END SUBROUTINE allocate2d_u2d
193
194  SUBROUTINE allocate3d_u2d(field,dim1,dim2,d)
195  USE parallel_lmdz
196  USE lmdz_dimensions
197  USE lmdz_paramet
198  IMPLICIT NONE
199  REAL,POINTER :: field(:,:,:,:)
200  INTEGER      :: dim1,dim2
201  TYPE(distrib),INTENT(IN) :: d
202
203!$OMP BARRIER
204!$OMP MASTER   
205    IF (ASSOCIATED(field)) DEALLOCATE(field)
206    ALLOCATE(field(iip1,d%jjb_u:d%jje_u,dim1,dim2))
207!$OMP END MASTER
208!$OMP BARRIER
209
210  END SUBROUTINE allocate3d_u2d   
211
212
213
214  SUBROUTINE allocate1d_v2d(field,d)
215  USE parallel_lmdz
216  USE lmdz_dimensions
217  USE lmdz_paramet
218  IMPLICIT NONE
219  REAL,POINTER :: field(:,:)
220  TYPE(distrib),INTENT(IN) :: d
221
222!$OMP BARRIER
223!$OMP MASTER   
224    IF (ASSOCIATED(field)) DEALLOCATE(field)
225    ALLOCATE(field(iip1,d%jjb_v:d%jje_v))
226!$OMP END MASTER
227!$OMP BARRIER
228
229  END SUBROUTINE allocate1d_v2d
230
231
232  SUBROUTINE allocate2d_v2d(field,dim1,d)
233  USE parallel_lmdz
234  USE lmdz_dimensions
235  USE lmdz_paramet
236  IMPLICIT NONE
237  REAL,POINTER :: field(:,:,:)
238  INTEGER      :: dim1
239  TYPE(distrib),INTENT(IN) :: d
240
241!$OMP BARRIER
242!$OMP MASTER   
243    IF (ASSOCIATED(field)) DEALLOCATE(field)
244    ALLOCATE(field(iip1,d%jjb_v:d%jje_v,dim1))
245!$OMP END MASTER
246!$OMP BARRIER
247
248  END SUBROUTINE allocate2d_v2d
249
250  SUBROUTINE allocate3d_v2d(field,dim1,dim2,d)
251  USE parallel_lmdz
252  USE lmdz_dimensions
253  USE lmdz_paramet
254  IMPLICIT NONE
255  REAL,POINTER :: field(:,:,:,:)
256  INTEGER      :: dim1,dim2
257  TYPE(distrib),INTENT(IN) :: d
258
259!$OMP BARRIER
260!$OMP MASTER   
261    IF (ASSOCIATED(field)) DEALLOCATE(field)
262    ALLOCATE(field(iip1,d%jjb_v:d%jje_v,dim1,dim2))
263!$OMP END MASTER
264!$OMP BARRIER
265
266  END SUBROUTINE allocate3d_v2d   
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286  SUBROUTINE switch1d_u1d(field,old_dist,new_dist,up,down)
287  USE parallel_lmdz
288  USE mod_hallo
289  IMPLICIT NONE
290  REAL,POINTER :: field(:)
291  TYPE(distrib),INTENT(IN) :: old_dist
292  TYPE(distrib),INTENT(IN) :: new_dist
293  INTEGER, OPTIONAL,INTENT(IN) :: up
294  INTEGER, OPTIONAL,INTENT(IN) :: down
295 
296  REAL,POINTER,SAVE :: new_field(:)
297  TYPE(request) :: req
298 
299  !$OMP BARRIER
300  !$OMP MASTER   
301    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u))
302    new_field=nan
303  !$OMP END MASTER
304  !$OMP BARRIER
305    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
306 
307    CALL SendRequest(req)
308
309  !$OMP BARRIER
310    CALL WaitRequest(req)     
311  !$OMP BARRIER
312   
313  !$OMP MASTER
314    DEALLOCATE(field)
315    field=>new_field
316  !$OMP END MASTER
317  !$OMP BARRIER
318   
319    CALL barrier
320  END SUBROUTINE switch1d_u1d 
321 
322  SUBROUTINE switch2d_u1d(field,old_dist,new_dist,up,down)
323  USE parallel_lmdz
324  USE mod_hallo
325  IMPLICIT NONE
326  REAL,POINTER :: field(:,:)
327  TYPE(distrib),INTENT(IN) :: old_dist
328  TYPE(distrib),INTENT(IN) :: new_dist
329  INTEGER, OPTIONAL,INTENT(IN) :: up
330  INTEGER, OPTIONAL,INTENT(IN) :: down
331
332  REAL,POINTER,SAVE :: new_field(:,:)
333  TYPE(request) :: req
334 
335  !$OMP BARRIER
336  !$OMP MASTER   
337    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u,size(field,2)))
338    new_field=nan
339  !$OMP END MASTER
340  !$OMP BARRIER
341    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
342 
343    CALL SendRequest(req)
344
345  !$OMP BARRIER
346    CALL WaitRequest(req)     
347  !$OMP BARRIER
348   
349  !$OMP MASTER
350    DEALLOCATE(field)
351    field=>new_field
352  !$OMP END MASTER
353  !$OMP BARRIER
354    CALL barrier
355
356  END SUBROUTINE switch2d_u1d 
357
358  SUBROUTINE switch3d_u1d(field,old_dist,new_dist,up,down)
359  USE parallel_lmdz
360  USE mod_hallo
361  IMPLICIT NONE
362  REAL,POINTER :: field(:,:,:)
363  TYPE(distrib),INTENT(IN) :: old_dist
364  TYPE(distrib),INTENT(IN) :: new_dist
365  INTEGER, OPTIONAL,INTENT(IN) :: up
366  INTEGER, OPTIONAL,INTENT(IN) :: down
367
368  REAL,POINTER,SAVE :: new_field(:,:,:)
369  TYPE(request) :: req
370 
371  !$OMP BARRIER
372  !$OMP MASTER   
373    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u,size(field,2),size(field,3)))
374    new_field=nan
375  !$OMP END MASTER
376  !$OMP BARRIER
377    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
378 
379    CALL SendRequest(req)
380
381  !$OMP BARRIER
382    CALL WaitRequest(req)     
383  !$OMP BARRIER
384   
385  !$OMP MASTER
386    DEALLOCATE(field)
387    field=>new_field
388  !$OMP END MASTER
389  !$OMP BARRIER
390    CALL barrier
391
392  END SUBROUTINE switch3d_u1d 
393
394
395
396
397  SUBROUTINE switch1d_v1d(field,old_dist,new_dist,up,down)
398  USE parallel_lmdz
399  USE mod_hallo
400  IMPLICIT NONE
401  REAL,POINTER :: field(:)
402  TYPE(distrib),INTENT(IN) :: old_dist
403  TYPE(distrib),INTENT(IN) :: new_dist
404  INTEGER, OPTIONAL,INTENT(IN) :: up
405  INTEGER, OPTIONAL,INTENT(IN) :: down
406
407  REAL,POINTER,SAVE :: new_field(:)
408  TYPE(request) :: req
409 
410  !$OMP BARRIER
411  !$OMP MASTER   
412    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v))
413    new_field=nan
414  !$OMP END MASTER
415  !$OMP BARRIER
416    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
417 
418    CALL SendRequest(req)
419
420  !$OMP BARRIER
421    CALL WaitRequest(req)     
422  !$OMP BARRIER
423   
424  !$OMP MASTER
425    DEALLOCATE(field)
426    field=>new_field
427  !$OMP END MASTER
428  !$OMP BARRIER
429
430    CALL barrier
431  END SUBROUTINE switch1d_v1d 
432 
433  SUBROUTINE switch2d_v1d(field,old_dist,new_dist,up,down)
434  USE parallel_lmdz
435  USE mod_hallo
436  IMPLICIT NONE
437  REAL,POINTER :: field(:,:)
438  TYPE(distrib),INTENT(IN) :: old_dist
439  TYPE(distrib),INTENT(IN) :: new_dist
440  INTEGER, OPTIONAL,INTENT(IN) :: up
441  INTEGER, OPTIONAL,INTENT(IN) :: down
442
443  REAL,POINTER,SAVE :: new_field(:,:)
444  TYPE(request) :: req
445 
446  !$OMP BARRIER
447  !$OMP MASTER   
448    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v,size(field,2)))
449    new_field=nan
450  !$OMP END MASTER
451  !$OMP BARRIER
452    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
453 
454    CALL SendRequest(req)
455
456  !$OMP BARRIER
457    CALL WaitRequest(req)     
458  !$OMP BARRIER
459   
460  !$OMP MASTER
461    DEALLOCATE(field)
462    field=>new_field
463  !$OMP END MASTER
464  !$OMP BARRIER
465    CALL barrier
466
467  END SUBROUTINE switch2d_v1d 
468
469  SUBROUTINE switch3d_v1d(field,old_dist,new_dist,up,down)
470  USE parallel_lmdz
471  USE mod_hallo
472  IMPLICIT NONE
473  REAL,POINTER :: field(:,:,:)
474  TYPE(distrib),INTENT(IN) :: old_dist
475  TYPE(distrib),INTENT(IN) :: new_dist
476  INTEGER, OPTIONAL,INTENT(IN) :: up
477  INTEGER, OPTIONAL,INTENT(IN) :: down
478
479  REAL,POINTER,SAVE :: new_field(:,:,:)
480  TYPE(request) :: req
481 
482  !$OMP BARRIER
483  !$OMP MASTER   
484    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v,size(field,2),size(field,3)))
485    new_field=nan
486  !$OMP END MASTER
487  !$OMP BARRIER
488    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
489 
490    CALL SendRequest(req)
491
492  !$OMP BARRIER
493    CALL WaitRequest(req)     
494  !$OMP BARRIER
495   
496  !$OMP MASTER
497    DEALLOCATE(field)
498    field=>new_field
499  !$OMP END MASTER
500  !$OMP BARRIER
501    CALL barrier
502
503  END SUBROUTINE switch3d_v1d 
504
505
506
507
508
509
510
511
512
513
514
515
516  SUBROUTINE switch1d_u2d(field,old_dist,new_dist,up,down)
517  USE parallel_lmdz
518  USE mod_hallo
519  USE lmdz_dimensions
520  USE lmdz_paramet
521  IMPLICIT NONE
522  REAL,POINTER :: field(:,:)
523  TYPE(distrib),INTENT(IN) :: old_dist
524  TYPE(distrib),INTENT(IN) :: new_dist
525  INTEGER, OPTIONAL,INTENT(IN) :: up
526  INTEGER, OPTIONAL,INTENT(IN) :: down
527
528  REAL,POINTER,SAVE :: new_field(:,:)
529  TYPE(request) :: req
530 
531  !$OMP BARRIER
532  !$OMP MASTER   
533    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u))
534    new_field=nan
535  !$OMP END MASTER
536  !$OMP BARRIER
537    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
538 
539    CALL SendRequest(req)
540
541  !$OMP BARRIER
542    CALL WaitRequest(req)     
543  !$OMP BARRIER
544   
545  !$OMP MASTER
546    DEALLOCATE(field)
547    field=>new_field
548  !$OMP END MASTER
549  !$OMP BARRIER
550    CALL barrier
551
552  END SUBROUTINE switch1d_u2d 
553 
554  SUBROUTINE switch2d_u2d(field,old_dist,new_dist,up,down)
555  USE parallel_lmdz
556  USE mod_hallo
557  USE lmdz_dimensions
558  USE lmdz_paramet
559  IMPLICIT NONE
560  REAL,POINTER :: field(:,:,:)
561  TYPE(distrib),INTENT(IN) :: old_dist
562  TYPE(distrib),INTENT(IN) :: new_dist
563  INTEGER, OPTIONAL,INTENT(IN) :: up
564  INTEGER, OPTIONAL,INTENT(IN) :: down
565
566  REAL,POINTER,SAVE :: new_field(:,:,:)
567  TYPE(request) :: req
568 
569  !$OMP BARRIER
570  !$OMP MASTER   
571    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u,size(field,3)))
572    new_field=nan
573  !$OMP END MASTER
574  !$OMP BARRIER
575    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
576 
577    CALL SendRequest(req)
578
579  !$OMP BARRIER
580    CALL WaitRequest(req)     
581  !$OMP BARRIER
582   
583  !$OMP MASTER
584    DEALLOCATE(field)
585    field=>new_field
586  !$OMP END MASTER
587  !$OMP BARRIER
588    CALL barrier
589
590  END SUBROUTINE switch2d_u2d 
591
592  SUBROUTINE switch3d_u2d(field,old_dist,new_dist,up,down)
593  USE parallel_lmdz
594  USE mod_hallo
595  USE lmdz_dimensions
596  USE lmdz_paramet
597  IMPLICIT NONE
598  REAL,POINTER :: field(:,:,:,:)
599  TYPE(distrib),INTENT(IN) :: old_dist
600  TYPE(distrib),INTENT(IN) :: new_dist
601  INTEGER, OPTIONAL,INTENT(IN) :: up
602  INTEGER, OPTIONAL,INTENT(IN) :: down
603
604  REAL,POINTER,SAVE :: new_field(:,:,:,:)
605  TYPE(request) :: req
606 
607  !$OMP BARRIER
608  !$OMP MASTER   
609    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u,size(field,3),size(field,4)))
610    new_field=nan
611  !$OMP END MASTER
612  !$OMP BARRIER
613    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
614 
615    CALL SendRequest(req)
616
617  !$OMP BARRIER
618    CALL WaitRequest(req)     
619  !$OMP BARRIER
620   
621  !$OMP MASTER
622    DEALLOCATE(field)
623    field=>new_field
624  !$OMP END MASTER
625  !$OMP BARRIER
626    CALL barrier
627
628  END SUBROUTINE switch3d_u2d 
629
630
631
632
633  SUBROUTINE switch1d_v2d(field,old_dist,new_dist,up,down)
634  USE parallel_lmdz
635  USE mod_hallo
636  USE lmdz_dimensions
637  USE lmdz_paramet
638  IMPLICIT NONE
639  REAL,POINTER :: field(:,:)
640  TYPE(distrib),INTENT(IN) :: old_dist
641  TYPE(distrib),INTENT(IN) :: new_dist
642  INTEGER, OPTIONAL,INTENT(IN) :: up
643  INTEGER, OPTIONAL,INTENT(IN) :: down
644
645  REAL,POINTER,SAVE :: new_field(:,:)
646  TYPE(request) :: req
647 
648  !$OMP BARRIER
649  !$OMP MASTER   
650    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v))
651    new_field=nan
652  !$OMP END MASTER
653  !$OMP BARRIER
654    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
655 
656    CALL SendRequest(req)
657
658  !$OMP BARRIER
659    CALL WaitRequest(req)     
660  !$OMP BARRIER
661   
662  !$OMP MASTER
663    DEALLOCATE(field)
664    field=>new_field
665  !$OMP END MASTER
666  !$OMP BARRIER
667    CALL barrier
668
669  END SUBROUTINE switch1d_v2d 
670 
671  SUBROUTINE switch2d_v2d(field,old_dist,new_dist,up,down)
672  USE parallel_lmdz
673  USE mod_hallo
674  USE lmdz_dimensions
675  USE lmdz_paramet
676  IMPLICIT NONE
677  REAL,POINTER :: field(:,:,:)
678  TYPE(distrib),INTENT(IN) :: old_dist
679  TYPE(distrib),INTENT(IN) :: new_dist
680  INTEGER, OPTIONAL,INTENT(IN) :: up
681  INTEGER, OPTIONAL,INTENT(IN) :: down
682
683  REAL,POINTER,SAVE :: new_field(:,:,:)
684  TYPE(request) :: req
685 
686  !$OMP BARRIER
687  !$OMP MASTER   
688    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v,size(field,3)))
689    new_field=nan
690  !$OMP END MASTER
691  !$OMP BARRIER
692    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
693 
694    CALL SendRequest(req)
695
696  !$OMP BARRIER
697    CALL WaitRequest(req)     
698  !$OMP BARRIER
699   
700  !$OMP MASTER
701    DEALLOCATE(field)
702    field=>new_field
703  !$OMP END MASTER
704  !$OMP BARRIER
705
706    CALL barrier
707  END SUBROUTINE switch2d_v2d 
708
709  SUBROUTINE switch3d_v2d(field,old_dist,new_dist,up,down)
710  USE parallel_lmdz
711  USE mod_hallo
712  USE lmdz_dimensions
713  USE lmdz_paramet
714  IMPLICIT NONE
715  REAL,POINTER :: field(:,:,:,:)
716  TYPE(distrib),INTENT(IN) :: old_dist
717  TYPE(distrib),INTENT(IN) :: new_dist
718  INTEGER, OPTIONAL,INTENT(IN) :: up
719  INTEGER, OPTIONAL,INTENT(IN) :: down
720
721  REAL,POINTER,SAVE :: new_field(:,:,:,:)
722  TYPE(request) :: req
723 
724  !$OMP BARRIER
725  !$OMP MASTER   
726    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v,size(field,3),size(field,4)))
727    new_field=nan
728  !$OMP END MASTER
729  !$OMP BARRIER
730    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
731 
732    CALL SendRequest(req)
733
734  !$OMP BARRIER
735    CALL WaitRequest(req)     
736  !$OMP BARRIER
737   
738  !$OMP MASTER
739    DEALLOCATE(field)
740    field=>new_field
741  !$OMP END MASTER
742  !$OMP BARRIER
743
744    CALL barrier
745  END SUBROUTINE switch3d_v2d
746
747END MODULE allocate_field_mod
748 
749 
750 
751 
Note: See TracBrowser for help on using the repository browser.