source: LMDZ6/trunk/libf/dyn3dmem/allocate_field_mod.f90 @ 5452

Last change on this file since 5452 was 5285, checked in by abarral, 2 months ago

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