1 | ! Overlap of IOIPSL functions for specific parallel use in ORCHIDEE. |
---|
2 | |
---|
3 | !- |
---|
4 | !< $HeadURL$ |
---|
5 | !< $Date$ |
---|
6 | !< $Author$ |
---|
7 | !< $Revision$ |
---|
8 | !- |
---|
9 | |
---|
10 | MODULE ioipsl_para |
---|
11 | USE ioipsl |
---|
12 | USE mod_orchidee_para_var |
---|
13 | USE mod_orchidee_transfert_para |
---|
14 | !- |
---|
15 | IMPLICIT NONE |
---|
16 | |
---|
17 | INTEGER, SAVE :: orch_domain_id |
---|
18 | !- |
---|
19 | INTEGER :: orch_ipslout=6, orch_ilv_cur=0, orch_ilv_max=0 |
---|
20 | !$OMP THREADPRIVATE( orch_ipslout, orch_ilv_cur, orch_ilv_max ) |
---|
21 | |
---|
22 | !- |
---|
23 | !- |
---|
24 | #include "src_parallel.h" |
---|
25 | !- |
---|
26 | INTERFACE getin_p |
---|
27 | MODULE PROCEDURE getin_p_c,getin_p_c1, & |
---|
28 | getin_p_i,getin_p_i1,getin_p_i2,& |
---|
29 | getin_p_r,getin_p_r1,getin_p_r2,& |
---|
30 | getin_p_l,getin_p_l1,getin_p_l2 |
---|
31 | END INTERFACE |
---|
32 | !- |
---|
33 | INTERFACE restput_p |
---|
34 | MODULE PROCEDURE & |
---|
35 | restput_p_r3d, restput_p_r2d, restput_p_r1d, & |
---|
36 | restput_p_opp_r2d, restput_p_opp_r1d |
---|
37 | END INTERFACE |
---|
38 | !- |
---|
39 | INTERFACE restget_p |
---|
40 | MODULE PROCEDURE & |
---|
41 | restget_p_r3d, restget_p_r2d, restget_p_r1d, & |
---|
42 | restget_p_opp_r2d, restget_p_opp_r1d |
---|
43 | END INTERFACE |
---|
44 | |
---|
45 | |
---|
46 | INTERFACE histwrite_p |
---|
47 | MODULE PROCEDURE & |
---|
48 | histwrite_r1d_p,histwrite_r2d_p,histwrite_r3d_p |
---|
49 | END INTERFACE |
---|
50 | |
---|
51 | CONTAINS |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | SUBROUTINE Init_ioipsl_para |
---|
56 | |
---|
57 | IMPLICIT NONE |
---|
58 | |
---|
59 | INTEGER,DIMENSION(2) :: ddid |
---|
60 | INTEGER,DIMENSION(2) :: dsg |
---|
61 | INTEGER,DIMENSION(2) :: dsl |
---|
62 | INTEGER,DIMENSION(2) :: dpf |
---|
63 | INTEGER,DIMENSION(2) :: dpl |
---|
64 | INTEGER,DIMENSION(2) :: dhs |
---|
65 | INTEGER,DIMENSION(2) :: dhe |
---|
66 | |
---|
67 | IF (is_omp_root) THEN |
---|
68 | ddid=(/ 1,2 /) |
---|
69 | dsg=(/ iim_g, jjm_g /) |
---|
70 | dsl=(/ iim_g, jj_nb /) |
---|
71 | dpf=(/ 1,jj_begin /) |
---|
72 | dpl=(/ iim_g, jj_end /) |
---|
73 | dhs=(/ ii_begin-1,0 /) |
---|
74 | if (mpi_rank==mpi_size-1) then |
---|
75 | dhe=(/0,0/) |
---|
76 | else |
---|
77 | dhe=(/ iim_g-ii_end,0 /) |
---|
78 | endif |
---|
79 | |
---|
80 | call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, & |
---|
81 | 'APPLE',orch_domain_id) |
---|
82 | ENDIF |
---|
83 | |
---|
84 | END SUBROUTINE Init_ioipsl_para |
---|
85 | |
---|
86 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
87 | !! Definition de ioconf_setatt_p !! |
---|
88 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
89 | |
---|
90 | SUBROUTINE ioconf_setatt_p (attname,attvalue) |
---|
91 | !--------------------------------------------------------------------- |
---|
92 | IMPLICIT NONE |
---|
93 | !- |
---|
94 | CHARACTER(LEN=*), INTENT(in) :: attname,attvalue |
---|
95 | !--------------------------------------------------------------------- |
---|
96 | |
---|
97 | IF (is_root_prc) THEN |
---|
98 | CALL ioconf_setatt(attname,attvalue) |
---|
99 | ENDIF |
---|
100 | |
---|
101 | END SUBROUTINE ioconf_setatt_p |
---|
102 | |
---|
103 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
104 | !! Definition de parallel ipslerr functions !! |
---|
105 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
106 | !=== |
---|
107 | SUBROUTINE ipslnlf_p (new_number,old_number) |
---|
108 | !!-------------------------------------------------------------------- |
---|
109 | !! The "ipslnlf" routine allows to know and modify |
---|
110 | !! the current logical number for the messages. |
---|
111 | !! |
---|
112 | !! SUBROUTINE ipslnlf (new_number,old_number) |
---|
113 | !! |
---|
114 | !! Optional INPUT argument |
---|
115 | !! |
---|
116 | !! (I) new_number : new logical number of the file |
---|
117 | !! |
---|
118 | !! Optional OUTPUT argument |
---|
119 | !! |
---|
120 | !! (I) old_number : current logical number of the file |
---|
121 | !!-------------------------------------------------------------------- |
---|
122 | IMPLICIT NONE |
---|
123 | !- |
---|
124 | INTEGER,OPTIONAL,INTENT(IN) :: new_number |
---|
125 | INTEGER,OPTIONAL,INTENT(OUT) :: old_number |
---|
126 | !--------------------------------------------------------------------- |
---|
127 | IF (PRESENT(old_number)) THEN |
---|
128 | #ifndef CPP_OMP |
---|
129 | CALL ipslnlf(old_number=orch_ipslout) |
---|
130 | #endif |
---|
131 | old_number = orch_ipslout |
---|
132 | ENDIF |
---|
133 | IF (PRESENT(new_number)) THEN |
---|
134 | orch_ipslout = new_number |
---|
135 | #ifndef CPP_OMP |
---|
136 | CALL ipslnlf(new_number=orch_ipslout) |
---|
137 | #endif |
---|
138 | ENDIF |
---|
139 | !--------------------- |
---|
140 | END SUBROUTINE ipslnlf_p |
---|
141 | !=== |
---|
142 | SUBROUTINE ipslerr_p (plev,pcname,pstr1,pstr2,pstr3) |
---|
143 | !--------------------------------------------------------------------- |
---|
144 | !! The "ipslerr_p" routine |
---|
145 | !! allows to handle the messages to the user. |
---|
146 | !! |
---|
147 | !! parallel version of IOIPSL ipslerr |
---|
148 | !! |
---|
149 | !! INPUT |
---|
150 | !! |
---|
151 | !! plev : Category of message to be reported to the user |
---|
152 | !! 1 = Note to the user |
---|
153 | !! 2 = Warning to the user |
---|
154 | !! 3 = Fatal error |
---|
155 | !! pcname : Name of subroutine which has called ipslerr |
---|
156 | !! pstr1 |
---|
157 | !! pstr2 : Strings containing the explanations to the user |
---|
158 | !! pstr3 |
---|
159 | !--------------------------------------------------------------------- |
---|
160 | IMPLICIT NONE |
---|
161 | !- |
---|
162 | INTEGER :: plev |
---|
163 | CHARACTER(LEN=*) :: pcname,pstr1,pstr2,pstr3 |
---|
164 | !- |
---|
165 | CHARACTER(LEN=30),DIMENSION(3) :: pemsg = & |
---|
166 | & (/ "NOTE TO THE USER FROM ROUTINE ", & |
---|
167 | & "WARNING FROM ROUTINE ", & |
---|
168 | & "FATAL ERROR FROM ROUTINE " /) |
---|
169 | !--------------------------------------------------------------------- |
---|
170 | IF ( (plev >= 1).AND.(plev <= 3) ) THEN |
---|
171 | orch_ilv_cur = plev |
---|
172 | orch_ilv_max = MAX(orch_ilv_max,plev) |
---|
173 | WRITE(orch_ipslout,'(/,A," ",A)') TRIM(pemsg(plev)),TRIM(pcname) |
---|
174 | WRITE(orch_ipslout,'(3(" --> ",A,/))') TRIM(pstr1),TRIM(pstr2),TRIM(pstr3) |
---|
175 | ENDIF |
---|
176 | IF (plev == 3) THEN |
---|
177 | WRITE(orch_ipslout,'("Fatal error from ORCHIDEE. STOP in ipslerr_p with code")') |
---|
178 | #ifdef CPP_PARA |
---|
179 | CALL MPI_ABORT(plev) |
---|
180 | #endif |
---|
181 | STOP 'Fatal error from ORCHIDEE' |
---|
182 | ENDIF |
---|
183 | !--------------------- |
---|
184 | END SUBROUTINE ipslerr_p |
---|
185 | |
---|
186 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
187 | !! Definition des getin -> bcast !! |
---|
188 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
189 | |
---|
190 | !! -- Les chaines de caracteres -- !! |
---|
191 | |
---|
192 | SUBROUTINE getin_p_c(VarIn,VarOut) |
---|
193 | IMPLICIT NONE |
---|
194 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
195 | CHARACTER(LEN=*),INTENT(INOUT) :: VarOut |
---|
196 | |
---|
197 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
198 | CALL bcast(VarOut) |
---|
199 | END SUBROUTINE getin_p_c |
---|
200 | |
---|
201 | |
---|
202 | SUBROUTINE getin_p_c1(VarIn,VarOut) |
---|
203 | IMPLICIT NONE |
---|
204 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
205 | CHARACTER(LEN=*),INTENT(INOUT) :: VarOut(:) |
---|
206 | |
---|
207 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
208 | CALL bcast(VarOut) |
---|
209 | END SUBROUTINE getin_p_c1 |
---|
210 | |
---|
211 | !! -- Les entiers -- !! |
---|
212 | |
---|
213 | SUBROUTINE getin_p_i(VarIn,VarOut) |
---|
214 | IMPLICIT NONE |
---|
215 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
216 | INTEGER,INTENT(INOUT) :: VarOut |
---|
217 | |
---|
218 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
219 | CALL bcast(VarOut) |
---|
220 | END SUBROUTINE getin_p_i |
---|
221 | |
---|
222 | SUBROUTINE getin_p_i1(VarIn,VarOut) |
---|
223 | IMPLICIT NONE |
---|
224 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
225 | INTEGER,INTENT(INOUT) :: VarOut(:) |
---|
226 | |
---|
227 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
228 | CALL bcast(VarOut) |
---|
229 | END SUBROUTINE getin_p_i1 |
---|
230 | |
---|
231 | SUBROUTINE getin_p_i2(VarIn,VarOut) |
---|
232 | IMPLICIT NONE |
---|
233 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
234 | INTEGER,INTENT(INOUT) :: VarOut(:,:) |
---|
235 | |
---|
236 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
237 | CALL bcast(VarOut) |
---|
238 | END SUBROUTINE getin_p_i2 |
---|
239 | |
---|
240 | !! -- Les flottants -- !! |
---|
241 | |
---|
242 | SUBROUTINE getin_p_r(VarIn,VarOut) |
---|
243 | IMPLICIT NONE |
---|
244 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
245 | REAL(r_std),INTENT(INOUT) :: VarOut |
---|
246 | |
---|
247 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
248 | CALL bcast(VarOut) |
---|
249 | END SUBROUTINE getin_p_r |
---|
250 | |
---|
251 | SUBROUTINE getin_p_r1(VarIn,VarOut) |
---|
252 | IMPLICIT NONE |
---|
253 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
254 | REAL(r_std),INTENT(INOUT) :: VarOut(:) |
---|
255 | |
---|
256 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
257 | CALL bcast(VarOut) |
---|
258 | END SUBROUTINE getin_p_r1 |
---|
259 | |
---|
260 | SUBROUTINE getin_p_r2(VarIn,VarOut) |
---|
261 | IMPLICIT NONE |
---|
262 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
263 | REAL(r_std),INTENT(INOUT) :: VarOut(:,:) |
---|
264 | |
---|
265 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
266 | CALL bcast(VarOut) |
---|
267 | END SUBROUTINE getin_p_r2 |
---|
268 | |
---|
269 | !! -- Les Booleens -- !! |
---|
270 | |
---|
271 | SUBROUTINE getin_p_l(VarIn,VarOut) |
---|
272 | IMPLICIT NONE |
---|
273 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
274 | LOGICAL,INTENT(INOUT) :: VarOut |
---|
275 | |
---|
276 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
277 | CALL bcast(VarOut) |
---|
278 | END SUBROUTINE getin_p_l |
---|
279 | |
---|
280 | SUBROUTINE getin_p_l1(VarIn,VarOut) |
---|
281 | IMPLICIT NONE |
---|
282 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
283 | LOGICAL,INTENT(INOUT) :: VarOut(:) |
---|
284 | |
---|
285 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
286 | CALL bcast(VarOut) |
---|
287 | END SUBROUTINE getin_p_l1 |
---|
288 | |
---|
289 | SUBROUTINE getin_p_l2(VarIn,VarOut) |
---|
290 | IMPLICIT NONE |
---|
291 | CHARACTER(LEN=*),INTENT(IN) :: VarIn |
---|
292 | LOGICAL,INTENT(INOUT) :: VarOut(:,:) |
---|
293 | |
---|
294 | IF (is_root_prc) CALL getin(VarIn,VarOut) |
---|
295 | CALL bcast(VarOut) |
---|
296 | END SUBROUTINE getin_p_l2 |
---|
297 | !- |
---|
298 | !----------------------------- |
---|
299 | !----------------------------- |
---|
300 | !----------------------------- |
---|
301 | !- |
---|
302 | SUBROUTINE restget_p_opp_r1d & |
---|
303 | (fid, vname_q, iim, jjm, llm, itau, def_beha, & |
---|
304 | var, MY_OPERATOR, nbindex, ijndex) |
---|
305 | ! DO NOT USE THIS FUNCTION WITH NON GRID VARIABLE ! |
---|
306 | IMPLICIT NONE |
---|
307 | !- |
---|
308 | INTEGER :: fid |
---|
309 | CHARACTER(LEN=*) :: vname_q |
---|
310 | INTEGER :: iim, jjm, llm, itau |
---|
311 | LOGICAL def_beha |
---|
312 | REAL(r_std) :: var(:) |
---|
313 | CHARACTER(LEN=*) :: MY_OPERATOR |
---|
314 | INTEGER :: nbindex, ijndex(nbindex) |
---|
315 | !----------------------------- |
---|
316 | REAL(r_std), ALLOCATABLE, DIMENSION(:) :: temp_g |
---|
317 | |
---|
318 | IF (is_root_prc) THEN |
---|
319 | ALLOCATE( temp_g(iim*jjm*llm) ) |
---|
320 | ELSE |
---|
321 | ALLOCATE( temp_g(1) ) |
---|
322 | ENDIF |
---|
323 | |
---|
324 | IF (is_root_prc) THEN |
---|
325 | CALL restget & |
---|
326 | (fid, vname_q, iim, jjm, llm, itau, def_beha, & |
---|
327 | temp_g, MY_OPERATOR, nbindex, ijndex) |
---|
328 | ENDIF |
---|
329 | CALL scatter(temp_g,var) |
---|
330 | DEALLOCATE(temp_g) |
---|
331 | END SUBROUTINE restget_p_opp_r1d |
---|
332 | !- |
---|
333 | !=== |
---|
334 | !- |
---|
335 | SUBROUTINE restget_p_opp_r2d & |
---|
336 | (fid, vname_q, iim, jjm, llm, itau, def_beha, & |
---|
337 | var, MY_OPERATOR, nbindex, ijndex) |
---|
338 | IMPLICIT NONE |
---|
339 | !- |
---|
340 | INTEGER :: fid |
---|
341 | CHARACTER(LEN=*) :: vname_q |
---|
342 | INTEGER :: iim, jjm, llm, itau |
---|
343 | LOGICAL def_beha |
---|
344 | REAL(r_std) :: var(:,:) |
---|
345 | CHARACTER(LEN=*) :: MY_OPERATOR |
---|
346 | INTEGER :: nbindex, ijndex(nbindex) |
---|
347 | !----------------------------- |
---|
348 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:) :: temp_g |
---|
349 | |
---|
350 | IF (is_root_prc) THEN |
---|
351 | ALLOCATE( temp_g(iim,jjm) ) |
---|
352 | ELSE |
---|
353 | ALLOCATE( temp_g(1,1) ) |
---|
354 | ENDIF |
---|
355 | |
---|
356 | IF (is_root_prc) THEN |
---|
357 | CALL restget & |
---|
358 | (fid, vname_q, iim, jjm, llm, itau, def_beha, & |
---|
359 | temp_g, MY_OPERATOR, nbindex, ijndex) |
---|
360 | ENDIF |
---|
361 | CALL scatter(temp_g,var) |
---|
362 | DEALLOCATE(temp_g) |
---|
363 | END SUBROUTINE restget_p_opp_r2d |
---|
364 | !- |
---|
365 | !=== |
---|
366 | !- |
---|
367 | SUBROUTINE restget_p_r1d & |
---|
368 | (fid,vname_q,iim,jjm,llm,itau,def_beha,var) |
---|
369 | ! DO NOT USE THIS FUNCTION WITH NON GRID VARIABLE ! |
---|
370 | IMPLICIT NONE |
---|
371 | !- |
---|
372 | INTEGER :: fid |
---|
373 | CHARACTER(LEN=*) :: vname_q |
---|
374 | INTEGER :: iim, jjm, llm, itau |
---|
375 | LOGICAL :: def_beha |
---|
376 | REAL(r_std) :: var(:) |
---|
377 | !------------------------- |
---|
378 | REAL(r_std), ALLOCATABLE, DIMENSION(:) :: temp_g |
---|
379 | |
---|
380 | IF (is_root_prc) THEN |
---|
381 | ALLOCATE( temp_g(iim*jjm*llm) ) |
---|
382 | ELSE |
---|
383 | ALLOCATE( temp_g(1) ) |
---|
384 | ENDIF |
---|
385 | |
---|
386 | IF (is_root_prc) THEN |
---|
387 | CALL restget & |
---|
388 | (fid,vname_q,iim,jjm,llm,itau,def_beha,temp_g) |
---|
389 | ENDIF |
---|
390 | CALL scatter(temp_g,var) |
---|
391 | DEALLOCATE(temp_g) |
---|
392 | END SUBROUTINE restget_p_r1d |
---|
393 | !- |
---|
394 | !=== |
---|
395 | !- |
---|
396 | SUBROUTINE restget_p_r2d & |
---|
397 | (fid,vname_q,iim,jjm,llm,itau,def_beha,var) |
---|
398 | IMPLICIT NONE |
---|
399 | !- |
---|
400 | INTEGER :: fid |
---|
401 | CHARACTER(LEN=*) :: vname_q |
---|
402 | INTEGER :: iim, jjm, llm, itau |
---|
403 | LOGICAL :: def_beha |
---|
404 | REAL(r_std) :: var(:,:) |
---|
405 | !------------------------- |
---|
406 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:) :: temp_g |
---|
407 | |
---|
408 | IF (is_root_prc) THEN |
---|
409 | ALLOCATE( temp_g(iim,jjm) ) |
---|
410 | ELSE |
---|
411 | ALLOCATE( temp_g(1,1) ) |
---|
412 | ENDIF |
---|
413 | IF (is_root_prc) THEN |
---|
414 | CALL restget & |
---|
415 | (fid,vname_q,iim,jjm,llm,itau,def_beha,temp_g) |
---|
416 | ENDIF |
---|
417 | CALL scatter(temp_g,var) |
---|
418 | DEALLOCATE(temp_g) |
---|
419 | END SUBROUTINE restget_p_r2d |
---|
420 | !- |
---|
421 | !=== |
---|
422 | !- |
---|
423 | SUBROUTINE restget_p_r3d & |
---|
424 | (fid,vname_q,iim,jjm,llm,itau,def_beha,var) |
---|
425 | IMPLICIT NONE |
---|
426 | !- |
---|
427 | INTEGER :: fid |
---|
428 | CHARACTER(LEN=*) :: vname_q |
---|
429 | INTEGER :: iim, jjm, llm, itau |
---|
430 | LOGICAL def_beha |
---|
431 | REAL(r_std) :: var(:,:,:) |
---|
432 | !------------------------- |
---|
433 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:,:) :: temp_g |
---|
434 | |
---|
435 | IF (is_root_prc) THEN |
---|
436 | ALLOCATE( temp_g(iim,jjm,llm) ) |
---|
437 | ELSE |
---|
438 | ALLOCATE( temp_g(1,1,1) ) |
---|
439 | ENDIF |
---|
440 | |
---|
441 | IF (is_root_prc) THEN |
---|
442 | CALL restget & |
---|
443 | (fid,vname_q,iim,jjm,llm,itau,def_beha,temp_g) |
---|
444 | ENDIF |
---|
445 | CALL scatter(temp_g,var) |
---|
446 | DEALLOCATE(temp_g) |
---|
447 | END SUBROUTINE restget_p_r3d |
---|
448 | !- |
---|
449 | !----------------------------- |
---|
450 | !----------------------------- |
---|
451 | !- |
---|
452 | SUBROUTINE restput_p_opp_r1d & |
---|
453 | (fid, vname_q, iim, jjm, llm, itau, var, MY_OPERATOR, nbindex, ijndex) |
---|
454 | IMPLICIT NONE |
---|
455 | !- |
---|
456 | INTEGER :: fid |
---|
457 | CHARACTER(LEN=*) :: vname_q |
---|
458 | INTEGER :: iim, jjm, llm, itau |
---|
459 | REAL(r_std) :: var(:) |
---|
460 | CHARACTER(LEN=*) :: MY_OPERATOR |
---|
461 | INTEGER :: nbindex, ijndex(nbindex) |
---|
462 | !----------------------------- |
---|
463 | REAL(r_std), ALLOCATABLE, DIMENSION(:) :: temp_g |
---|
464 | |
---|
465 | IF (is_root_prc) THEN |
---|
466 | ALLOCATE( temp_g(iim*jjm*llm) ) |
---|
467 | ELSE |
---|
468 | ALLOCATE ( temp_g(1) ) |
---|
469 | ENDIF |
---|
470 | |
---|
471 | CALL gather(var,temp_g) |
---|
472 | IF (is_root_prc) THEN |
---|
473 | CALL restput & |
---|
474 | (fid, vname_q, iim, jjm, llm, itau, temp_g, MY_OPERATOR, nbindex, ijndex) |
---|
475 | ENDIF |
---|
476 | |
---|
477 | DEALLOCATE( temp_g ) |
---|
478 | |
---|
479 | END SUBROUTINE restput_p_opp_r1d |
---|
480 | !- |
---|
481 | !=== |
---|
482 | !- |
---|
483 | SUBROUTINE restput_p_opp_r2d & |
---|
484 | (fid, vname_q, iim, jjm, llm, itau, var, MY_OPERATOR, nbindex, ijndex) |
---|
485 | IMPLICIT NONE |
---|
486 | !- |
---|
487 | INTEGER :: fid |
---|
488 | CHARACTER(LEN=*) :: vname_q |
---|
489 | INTEGER :: iim, jjm, llm, itau |
---|
490 | REAL(r_std) :: var(:,:) |
---|
491 | CHARACTER(LEN=*) :: MY_OPERATOR |
---|
492 | INTEGER :: nbindex, ijndex(nbindex) |
---|
493 | !----------------------------- |
---|
494 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:) :: temp_g |
---|
495 | |
---|
496 | IF (is_root_prc) THEN |
---|
497 | ALLOCATE( temp_g(iim,jjm) ) |
---|
498 | ELSE |
---|
499 | ALLOCATE( temp_g(1,1) ) |
---|
500 | ENDIF |
---|
501 | |
---|
502 | CALL gather(var,temp_g) |
---|
503 | IF (is_root_prc) THEN |
---|
504 | CALL restput & |
---|
505 | (fid, vname_q, iim, jjm, llm, itau, temp_g, MY_OPERATOR, nbindex, ijndex) |
---|
506 | ENDIF |
---|
507 | DEALLOCATE( temp_g ) |
---|
508 | |
---|
509 | END SUBROUTINE restput_p_opp_r2d |
---|
510 | !- |
---|
511 | !=== |
---|
512 | !- |
---|
513 | SUBROUTINE restput_p_r1d (fid,vname_q,iim,jjm,llm,itau,var) |
---|
514 | IMPLICIT NONE |
---|
515 | !- |
---|
516 | INTEGER :: fid |
---|
517 | CHARACTER(LEN=*) :: vname_q |
---|
518 | INTEGER :: iim, jjm, llm, itau |
---|
519 | REAL(r_std) :: var(:) |
---|
520 | !----------------------------- |
---|
521 | REAL(r_std), ALLOCATABLE, DIMENSION(:) :: temp_g |
---|
522 | |
---|
523 | IF (is_root_prc) THEN |
---|
524 | ALLOCATE( temp_g(iim*jjm*llm) ) |
---|
525 | ELSE |
---|
526 | ALLOCATE( temp_g(1) ) |
---|
527 | ENDIF |
---|
528 | |
---|
529 | CALL gather(var,temp_g) |
---|
530 | IF (is_root_prc) THEN |
---|
531 | CALL restput (fid,vname_q,iim,jjm,llm,itau,temp_g) |
---|
532 | ENDIF |
---|
533 | DEALLOCATE( temp_g ) |
---|
534 | |
---|
535 | END SUBROUTINE restput_p_r1d |
---|
536 | !- |
---|
537 | !=== |
---|
538 | !- |
---|
539 | SUBROUTINE restput_p_r2d (fid,vname_q,iim,jjm,llm,itau,var) |
---|
540 | IMPLICIT NONE |
---|
541 | !- |
---|
542 | INTEGER :: fid |
---|
543 | CHARACTER(LEN=*) :: vname_q |
---|
544 | INTEGER :: iim, jjm, llm, itau |
---|
545 | REAL(r_std) :: var(:,:) |
---|
546 | !------------------------- |
---|
547 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:) :: temp_g |
---|
548 | |
---|
549 | IF (is_root_prc) THEN |
---|
550 | ALLOCATE( temp_g(iim,jjm) ) |
---|
551 | ELSE |
---|
552 | ALLOCATE( temp_g(1,1) ) |
---|
553 | ENDIF |
---|
554 | |
---|
555 | CALL gather(var,temp_g) |
---|
556 | IF (is_root_prc) THEN |
---|
557 | CALL restput (fid,vname_q,iim,jjm,llm,itau,temp_g) |
---|
558 | ENDIF |
---|
559 | DEALLOCATE( temp_g ) |
---|
560 | |
---|
561 | END SUBROUTINE restput_p_r2d |
---|
562 | !- |
---|
563 | !=== |
---|
564 | !- |
---|
565 | SUBROUTINE restput_p_r3d (fid,vname_q,iim,jjm,llm,itau,var) |
---|
566 | IMPLICIT NONE |
---|
567 | !- |
---|
568 | INTEGER :: fid |
---|
569 | CHARACTER(LEN=*) :: vname_q |
---|
570 | INTEGER :: iim, jjm, llm, itau |
---|
571 | REAL(r_std) :: var(:,:,:) |
---|
572 | !------------------------- |
---|
573 | REAL(r_std), ALLOCATABLE, DIMENSION(:,:,:) :: temp_g |
---|
574 | |
---|
575 | IF (is_root_prc) THEN |
---|
576 | ALLOCATE( temp_g(iim,jjm,llm) ) |
---|
577 | ELSE |
---|
578 | ALLOCATE( temp_g(iim,jjm,llm) ) |
---|
579 | ENDIF |
---|
580 | |
---|
581 | CALL gather(var,temp_g) |
---|
582 | IF (is_root_prc) THEN |
---|
583 | CALL restput (fid,vname_q,iim,jjm,llm,itau,temp_g) |
---|
584 | ENDIF |
---|
585 | DEALLOCATE( temp_g ) |
---|
586 | |
---|
587 | END SUBROUTINE restput_p_r3d |
---|
588 | |
---|
589 | |
---|
590 | SUBROUTINE histwrite_r1d_p(pfileid,pvarname,pitau,pdata,nbindex,nindex) |
---|
591 | IMPLICIT NONE |
---|
592 | !- |
---|
593 | INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) |
---|
594 | REAL(r_std),DIMENSION(:),INTENT(IN) :: pdata |
---|
595 | CHARACTER(LEN=*),INTENT(IN) :: pvarname |
---|
596 | |
---|
597 | REAL(r_std),DIMENSION(nbp_mpi) :: pdata_mpi |
---|
598 | |
---|
599 | IF (pfileid > 0) THEN |
---|
600 | ! Continue only if the file is initilalized |
---|
601 | CALL gather_omp(pdata,pdata_mpi) |
---|
602 | IF (is_omp_root) THEN |
---|
603 | CALL histwrite(pfileid,pvarname,pitau,pdata_mpi,nbp_mpi,kindex_mpi) |
---|
604 | ENDIF |
---|
605 | END IF |
---|
606 | |
---|
607 | END SUBROUTINE histwrite_r1d_p |
---|
608 | |
---|
609 | |
---|
610 | SUBROUTINE histwrite_r2d_p(pfileid,pvarname,pitau,pdata,nbindex,nindex) |
---|
611 | IMPLICIT NONE |
---|
612 | !- |
---|
613 | INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) |
---|
614 | REAL(r_std),DIMENSION(:,:),INTENT(IN) :: pdata |
---|
615 | CHARACTER(LEN=*),INTENT(IN) :: pvarname |
---|
616 | |
---|
617 | IF (pfileid > 0) THEN |
---|
618 | ! Continue only if the file is initilalized |
---|
619 | CALL body(size(pdata,2),nindex) |
---|
620 | END IF |
---|
621 | |
---|
622 | CONTAINS |
---|
623 | |
---|
624 | SUBROUTINE body(dim,nindex) |
---|
625 | INTEGER :: dim |
---|
626 | INTEGER :: nindex(nbp_omp,dim) |
---|
627 | |
---|
628 | INTEGER :: nindex_mpi(nbp_mpi,dim) |
---|
629 | REAL(r_std) :: pdata_mpi(nbp_mpi,dim) |
---|
630 | |
---|
631 | CALL gather_omp(pdata,pdata_mpi) |
---|
632 | CALL gather_omp(nindex,nindex_mpi) |
---|
633 | |
---|
634 | IF (is_omp_root) THEN |
---|
635 | CALL histwrite(pfileid,pvarname,pitau,pdata_mpi,nbp_mpi*dim,reshape(nindex_mpi,(/nbp_mpi*dim/))) |
---|
636 | ENDIF |
---|
637 | END SUBROUTINE body |
---|
638 | |
---|
639 | END SUBROUTINE histwrite_r2d_p |
---|
640 | |
---|
641 | |
---|
642 | SUBROUTINE histwrite_r3d_p(pfileid,pvarname,pitau,pdata,nbindex,nindex) |
---|
643 | IMPLICIT NONE |
---|
644 | !- |
---|
645 | INTEGER,INTENT(IN) :: pfileid, pitau, nbindex, nindex(nbindex) |
---|
646 | REAL(r_std),DIMENSION(:,:,:),INTENT(IN) :: pdata |
---|
647 | CHARACTER(LEN=*),INTENT(IN) :: pvarname |
---|
648 | |
---|
649 | STOP 'histwrite_r3d_p !!!' |
---|
650 | |
---|
651 | END SUBROUTINE histwrite_r3d_p |
---|
652 | |
---|
653 | |
---|
654 | END MODULE ioipsl_para |
---|