source: LMDZ6/branches/Amaury_dev/libf/phy_common/lmdz_phys_para.f90 @ 5204

Last change on this file since 5204 was 5118, checked in by abarral, 4 months ago

Replace iniprint.h by lmdz_iniprint.f90
(lint) along the way

  • 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
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1
2! $Id: lmdz_phys_para.f90 5118 2024-07-24 14:39:59Z fairhead $
3
4MODULE lmdz_phys_para
5  USE lmdz_phys_transfert_para
6  USE lmdz_phys_mpi_data
7  USE lmdz_phys_omp_data
8   
9  INTEGER,SAVE :: klon_loc
10  LOGICAL,SAVE :: is_sequential
11  LOGICAL,SAVE :: is_parallel
12  LOGICAL,SAVE :: is_master
13
14 
15!$OMP THREADPRIVATE(klon_loc,is_master)
16 
17CONTAINS
18
19  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,nbp_lev,grid_type, nvertex,communicator)
20  IMPLICIT NONE
21    INTEGER,INTENT(IN) :: nbp
22    INTEGER,INTENT(IN) :: nbp_lon
23    INTEGER,INTENT(IN) :: nbp_lat
24    INTEGER,INTENT(IN) :: nbp_lev
25    INTEGER,INTENT(IN) :: communicator
26    INTEGER,INTENT(IN) :: grid_type
27    INTEGER,INTENT(IN) :: nvertex
28
29    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,nbp_lev, grid_type, nvertex,communicator)
30!$OMP PARALLEL
31    CALL Init_phys_lmdz_omp_data(klon_mpi)
32    klon_loc=klon_omp
33    IF (is_mpi_root .AND. is_omp_root) THEN
34       is_master=.TRUE.
35     ELSE
36       is_master=.FALSE.
37     ENDIF
38!ym     CALL Test_transfert
39!$OMP END PARALLEL   
40     IF (is_using_mpi .OR. is_using_omp) THEN
41       is_sequential=.FALSE.
42       is_parallel=.TRUE.
43     ELSE
44       is_sequential=.TRUE.
45       is_parallel=.FALSE.
46     ENDIF
47
48
49     
50  END SUBROUTINE Init_phys_lmdz_para
51
52  SUBROUTINE Test_transfert
53  USE lmdz_grid_phy
54  USE lmdz_print_control, ONLY: lunout
55  IMPLICIT NONE
56    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
57    REAL :: tmp1d_glo(klon_glo,nbp_lev)
58    REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)
59    REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)
60    REAL :: Test_Field1d_loc(klon_loc,nbp_lev)
61    REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)
62    REAL :: CheckSum
63   
64    INTEGER :: i,l
65 
66    Test_Field1d_glo = 0.
67    Test_Field2d_glo = 0.
68    Test_Field1d_loc = 0.
69    Test_Field2d_loc = 0.
70 
71    IF (is_mpi_root) THEN
72!$OMP MASTER
73      DO l=1,nbp_lev
74        DO i=1,klon_glo
75!          Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)
76           Test_Field1d_glo(i,l)=1
77        ENDDO
78      ENDDO
79!$OMP END MASTER 
80    ENDIF
81 
82    CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)
83    CALL Gather(Test_Field1d_loc,tmp1d_glo)
84 
85    IF (is_mpi_root) THEN
86!$OMP MASTER 
87      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
88      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
89!$OMP END MASTER
90    ENDIF
91   
92    CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)
93    CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)
94    CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)
95    CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)
96
97    IF (is_mpi_root) THEN
98!$OMP MASTER 
99      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
100      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
101!$OMP END MASTER
102    ENDIF
103
104    CALL bcast(Test_Field1d_glo)
105    CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)
106
107    IF (is_mpi_root) THEN
108!$OMP MASTER 
109      Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
110      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
111!$OMP END MASTER
112    ENDIF
113   
114     
115   END SUBROUTINE Test_transfert
116 
117END MODULE lmdz_phys_para
118   
Note: See TracBrowser for help on using the repository browser.