source: branches/publications/ORCHIDEE_gmd_mict_peat_ch4/src_parallel/mod_orchidee_para_var.F90 @ 7346

Last change on this file since 7346 was 3564, checked in by albert.jornet, 8 years ago

Merge: from [3313:3545/trunk/ORCHIDEE]
Clean: output subroutine variables compile warning messages are solved.

Done in branches/ORCHIDEE-MICT/ORCHIDEE_MICT_TRUNK

File size: 9.8 KB
Line 
1! ================================================================================================================================
2!  MODULE       : mod_orchidee_para_var
3!
4!  CONTACT      : orchidee-help _at_ ipsl.jussieu.fr
5!
6!  LICENCE      : IPSL (2006)
7!  This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8!
9!>\BRIEF   This module contains public variables for parallelization and domain decomposition
10!!
11!!\n DESCRIPTION: \n
12!!
13!! REFERENCE(S) : None
14!!
15!! SVN          :
16!! $HeadURL: $
17!! $Date: $
18!! $Revision: $
19!! \n
20!_ ================================================================================================================================
21
22MODULE mod_orchidee_para_var
23
24  USE defprec
25
26  !
27  ! 1. Variables related to the MPI parallelization and the MPI horizontal domain decompostion.
28  !    These variables were previously declared in mod_orchidee_mpi_data
29  !
30
31  ! Unit for output messages
32  INTEGER(i_std), SAVE :: numout = 6
33  !$OMP THREADPRIVATE(numout)
34
35  INTEGER,SAVE :: mpi_size                                            !! Number of parallel processes
36  INTEGER,SAVE :: mpi_rank                                            !! my rank num
37  INTEGER,SAVE :: mpi_rank_root                                       !! rank of MPI root
38  LOGICAL,SAVE :: is_mpi_root                                         !! Only MPI root proc is true
39  LOGICAL,SAVE :: is_ok_mpi                                           
40
41  INTEGER(i_std),SAVE              :: nbp_mpi                         !! number of local continental points in each mpi group
42  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para
43  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para_begin
44  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para_end 
45
46  INTEGER,SAVE :: nbp_mpi_begin
47  INTEGER,SAVE :: nbp_mpi_end
48
49  ! i x j 2D points (not land points) index
50  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_nb           ! Number of 2D points for each mpi_rank block
51  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_begin        ! First 2D point for each mpi_rank block
52  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_end          ! Last 2D point for each mpi_rank block
53  ! i 2D index
54  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_begin        ! First i index of 2D point for each mpi_rank block
55  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_end          ! Last i index of 2D point for each mpi_rank block
56  ! j 2D index
57  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb           ! Number of complete j lines for each mpi_rank block
58  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_begin        ! First j index of 2D point for each mpi_rank block
59  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_end          ! Last j index of 2D point for each mpi_rank block
60
61  INTEGER,SAVE :: ii_begin
62  INTEGER,SAVE :: ii_end
63  INTEGER,SAVE :: jj_begin
64  INTEGER,SAVE :: jj_end
65  INTEGER,SAVE :: jj_nb
66  INTEGER,SAVE :: ij_begin
67  INTEGER,SAVE :: ij_end
68  INTEGER,SAVE :: ij_nb
69
70  INTEGER,SAVE :: MPI_COMM_ORCH
71  INTEGER,SAVE :: MPI_REAL_ORCH
72  INTEGER,SAVE :: MPI_INT_ORCH
73  LOGICAL, SAVE :: cpl_lmdz
74
75  INTEGER,SAVE,ALLOCATABLE :: kindex_mpi (:)
76  INTEGER,SAVE             :: offset_mpi
77
78
79  !
80  ! 2. Variables related to the OpenMP paralelization and OpenMP horizontal domain decomposition
81  !    These variables were previously declared in mod_orchidee_omp_data
82  !
83
84  ! Check all OpenMP transferts in ORCHIDEE : use this flag to debug synchronism with OpenMP
85  LOGICAL, PARAMETER :: check_all_transfert=.FALSE.
86
87
88  INTEGER(i_std),SAVE :: omp_size
89  INTEGER(i_std),SAVE :: omp_rank
90  LOGICAL,SAVE :: is_omp_root
91  LOGICAL,SAVE :: is_ok_omp
92  !$OMP  THREADPRIVATE(omp_rank,is_omp_root)
93
94  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_nb
95  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_begin
96  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_end   
97
98  INTEGER(i_std),SAVE :: nbp_omp
99  INTEGER(i_std),SAVE :: nbp_omp_begin
100  INTEGER(i_std),SAVE :: nbp_omp_end
101  INTEGER(i_std),SAVE :: offset_omp
102  !$OMP  THREADPRIVATE(nbp_omp,nbp_omp_begin,nbp_omp_end,offset_omp)
103
104  ! Flag for each OMP process for ORCHIDEE to verify synchronization if function Synchro_Omp is used
105  LOGICAL,SAVE,ALLOCATABLE :: proc_synchro_omp(:)
106
107  INTEGER, SAVE :: numout_omp = -1
108  !$OMP  THREADPRIVATE(numout_omp)
109
110  ! For debugging OpenMP processes : id of OMP function for each task.
111  ! If one task is not in the same function, we can see it.
112  INTEGER(i_std),SAVE,ALLOCATABLE,DIMENSION(:) :: omp_function
113  ! It is not SHARED.
114  ! List of values :
115  CHARACTER(LEN=28), PARAMETER :: omp_fct_name(-1:72) = (/ &
116       "Initialization              ", &
117       "Synchro_Omp                 ", &
118       "check_buffer_i              ", &
119       "check_buffer_r              ", &
120       "check_buffer_l              ", &
121       "bcast_omp_c                 ", &
122       "bcast_omp_i                 ", &
123       "bcast_omp_i1                ", &
124       "bcast_omp_i2                ", &
125       "bcast_omp_i3                ", &
126       "bcast_omp_i4                ", &
127       "bcast_omp_r                 ", &
128       "bcast_omp_r1                ", &
129       "bcast_omp_r2                ", &
130       "bcast_omp_r3                ", &
131       "bcast_omp_r4                ", &
132       "bcast_omp_l                 ", &
133       "bcast_omp_l1                ", &
134       "bcast_omp_l2                ", &
135       "bcast_omp_l3                ", &
136       "bcast_omp_l4                ", &
137       "scatter_omp_i               ", &
138       "scatter_omp_i1              ", &
139       "scatter_omp_i2              ", &
140       "scatter_omp_i3              ", &
141       "scatter_omp_r               ", &
142       "scatter_omp_r1              ", &
143       "scatter_omp_r2              ", &
144       "scatter_omp_r3              ", &
145       "scatter_omp_l               ", &
146       "scatter_omp_l1              ", &
147       "scatter_omp_l2              ", &
148       "scatter_omp_l3              ", &
149       "gather_omp_i0               ", &
150       "gather_omp_i                ", &
151       "gather_omp_i1               ", &
152       "gather_omp_i2               ", &
153       "gather_omp_i3               ", &
154       "gather_omp_r0               ", &
155       "gather_omp_r                ", &
156       "gather_omp_r1               ", &
157       "gather_omp_r2               ", &
158       "gather_omp_r3               ", &
159       "gather_omp_l0               ", &
160       "gather_omp_l                ", &
161       "gather_omp_l1               ", &
162       "gather_omp_l2               ", &
163       "gather_omp_l3               ", &
164       "reduce_sum_omp_i            ", &
165       "reduce_sum_omp_i1           ", &
166       "reduce_sum_omp_i2           ", &
167       "reduce_sum_omp_i3           ", &
168       "reduce_sum_omp_i4           ", &
169       "reduce_sum_omp_r            ", &
170       "reduce_sum_omp_r1           ", &
171       "reduce_sum_omp_r2           ", &
172       "reduce_sum_omp_r3           ", &
173       "reduce_sum_omp_r4           ", &
174       "orch_bcast_omp_cgen         ", &
175       "orch_bcast_omp_igen         ", &
176       "orch_bcast_omp_rgen         ", &
177       "orch_bcast_omp_lgen         ", &
178       "orch_scatter_omp_igen       ", &
179       "orch_scatter_omp_rgen       ", &
180       "orch_scatter_omp_lgen       ", &
181       "orch_gather_omp_simple_igen ", &
182       "orch_gather_omp_igen        ", &
183       "orch_gather_omp_simple_rgen ", &
184       "orch_gather_omp_rgen        ", &
185       "orch_gather_omp_simple_lgen ", &
186       "orch_gather_omp_lgen        ", &
187       "orch_reduce_sum_omp_igen    ", &
188       "orch_reduce_sum_omp_rgen    ", &
189       "check_buffer_c              " /)
190
191  ! Previous value for own omp_function
192  INTEGER, SAVE :: omp_previous
193  !$OMP  THREADPRIVATE(omp_previous)
194
195  !
196  !! 3. Variables previously declared in mod_orchide_para
197  !
198
199  INTEGER,SAVE :: nbp_loc                                             !! number of local continental points
200  !$OMP THREADPRIVATE(nbp_loc)
201  INTEGER,SAVE :: offset
202  !$OMP THREADPRIVATE(offset)
203
204  LOGICAL,SAVE :: is_root_prc = .FALSE.                               !! Only root proc for MPI and OpenMP is true
205  !$OMP THREADPRIVATE(is_root_prc)
206  !
207  !! Global grid arrays used by stomate and sechiba and available on each processor
208  !! They need to be broadcasted after initilisation of the parallelisation
209  !-
210  ! Dimensions
211  INTEGER(i_std),SAVE              :: iim_g                           !! Dimension of global fields for longitude
212  INTEGER(i_std),SAVE              :: jjm_g                           !! Dimension of global fields for latitude
213  INTEGER(i_std),SAVE              :: nbp_glo                         !! number of global continental points
214  ! Fields
215  !! index of land points on the 2D map
216  INTEGER(i_std),ALLOCATABLE,DIMENSION(:),SAVE   :: index_g
217  !-
218  !! indices of the 4 neighbours of each grid point (1=N, 2=E, 3=S, 4=W)
219  INTEGER(i_std),ALLOCATABLE,DIMENSION(:,:),SAVE :: neighbours_g
220  !-
221  ! Heading of the direction out of the grid box either through the vertex
222  ! of the mid-segment of the polygon.
223  !
224  REAL(r_std), ALLOCATABLE, DIMENSION(:,:), SAVE      :: headings_g
225  !
226  ! Length of segments of the polygon.
227  !
228  REAL(r_std), ALLOCATABLE, DIMENSION(:,:), SAVE      :: seglength_g
229  !
230  ! Area of the grid box
231  !
232  REAL(r_std), ALLOCATABLE, DIMENSION(:), SAVE        :: area_g
233  !
234  ! Coordinats of the vertices
235  !
236  REAL(r_std), ALLOCATABLE, DIMENSION(:,:,:), SAVE    :: corners_g
237  !
238  ! TEMPORARY !!!!!
239  !
240  !! resolution at each grid point in m (1=E-W, 2=N-S)
241  REAL(r_std),ALLOCATABLE,DIMENSION(:,:),SAVE    :: resolution_g 
242  !-
243  !! Geographical coordinates
244  REAL(r_std),ALLOCATABLE,DIMENSION(:,:),SAVE    :: lalo_g
245  ! Global grid, for all process
246  REAL(r_std), ALLOCATABLE, DIMENSION(:,:), SAVE     :: lon_g, lat_g, zlev_g
247  !-
248  !! Fraction of continents
249  REAL(r_std),ALLOCATABLE,DIMENSION(:),SAVE      :: contfrac_g 
250  !
251END MODULE mod_orchidee_para_var
Note: See TracBrowser for help on using the repository browser.