2 !***********************************************************************
3 !* GNU Lesser General Public License
5 !* This file
is part of the GFDL Flexible Modeling System (FMS).
7 !* FMS
is free software: you can redistribute it and/or modify it under
8 !* the terms of the GNU Lesser General Public License as published by
9 !* the Free Software Foundation, either
version 3 of the License, or (at
10 !* your option) any later
version.
12 !* FMS
is distributed in the hope that it
will be useful, but WITHOUT
13 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 !* You should have
received a copy of the GNU Lesser General Public
18 !* License along with FMS. If
not, see <http:
19 !***********************************************************************
20 subroutine MPP_UPDATE_DOMAINS_2D_(
field, domain, flags, complete, position, &
21 whalo, ehalo, shalo, nhalo,
name, tile_count)
22 !updates data domain of 2D
field whose computational domains have been computed
24 type(domain2D), intent(inout) :: domain
25 integer, intent(in), optional :: flags
26 logical, intent(in), optional :: complete
27 integer, intent(in), optional :: position
28 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
29 character(
len=*), intent(in), optional ::
name 30 integer, intent(in), optional :: tile_count
33 pointer( ptr, field3D )
35 call mpp_update_domains( field3D, domain, flags, complete, position, &
36 whalo, ehalo, shalo, nhalo,
name, tile_count )
38 end subroutine MPP_UPDATE_DOMAINS_2D_
40 subroutine MPP_UPDATE_DOMAINS_3D_(
field, domain, flags, complete, position, &
41 whalo, ehalo, shalo, nhalo,
name, tile_count)
42 !updates data domain of 3D
field whose computational domains have been computed
44 type(domain2D), intent(inout) :: domain
45 integer, intent(in), optional :: flags
46 logical, intent(in), optional :: complete
47 integer, intent(in), optional :: position
48 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo ! specify halo region to be updated.
49 character(
len=*), intent(in), optional ::
name 50 integer, intent(in), optional :: tile_count
52 integer :: update_position, update_whalo, update_ehalo, update_shalo, update_nhalo, ntile
57 logical :: set_mismatch, is_complete
60 integer, save ::
pos, whalosz, ehalosz, shalosz, nhalosz
62 type(overlapSpec), pointer :: update =>
NULL()
65 if(present(whalo)) then
67 if(abs(update_whalo) > domain%whalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D: " 68 "optional argument whalo should not be larger than the whalo when define domain.")
70 update_whalo = domain%whalo
72 if(present(ehalo)) then
74 if(abs(update_ehalo) > domain%ehalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D: " 75 "optional argument ehalo should not be larger than the ehalo when define domain.")
77 update_ehalo = domain%ehalo
79 if(present(shalo)) then
81 if(abs(update_shalo) > domain%shalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D: " 82 "optional argument shalo should not be larger than the shalo when define domain.")
84 update_shalo = domain%shalo
86 if(present(nhalo)) then
88 if(abs(update_nhalo) > domain%nhalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D: " 89 "optional argument nhalo should not be larger than the nhalo when define domain.")
91 update_nhalo = domain%nhalo
94 !--- when there
is NINETY or MINUS_NINETY rotation for
some contact, the salar data can
not be on E or N-cell,
95 if(present(position)) then
96 if(domain%rotated_ninety .AND. ( position == EAST .OR. position == NORTH ) ) &
97 call
mpp_error(FATAL,
'MPP_UPDATE_3D: hen there is NINETY or MINUS_NINETY rotation, ' 98 'can not use scalar version update_domain for data on E or N-cell' )
101 max_ntile = domain%max_ntile_pe
102 ntile =
size(domain%x(:))
104 if(PRESENT(complete)) then
105 is_complete = complete
110 if(ntile>MAX_TILES) then
111 write(
text,
'(i2)' ) MAX_TILES
112 call
mpp_error(FATAL,
'MPP_UPDATE_3D: MAX_TILES=' 114 if(.NOT. present(tile_count) ) call
mpp_error(FATAL,
"MPP_UPDATE_3D: " 115 "optional argument tile_count should be present when number of tiles on this pe is more than 1")
118 do_update = (
tile == ntile) .AND. is_complete
120 if(list > MAX_DOMAIN_FIELDS)then
121 write(
text,
'(i2)' ) MAX_DOMAIN_FIELDS
122 call
mpp_error(FATAL,
'MPP_UPDATE_3D: MAX_DOMAIN_FIELDS=' 125 update_position = CENTER
126 if(present(position)) update_position = position
127 if(list == 1 .AND.
tile == 1 )then
129 whalosz = update_whalo; ehalosz = update_ehalo; shalosz = update_shalo; nhalosz = update_nhalo
131 set_mismatch = .false.
134 set_mismatch = set_mismatch .OR. (ke /=
size(
field,3))
135 set_mismatch = set_mismatch .OR. (update_position /=
pos)
136 set_mismatch = set_mismatch .OR. (update_whalo /= whalosz)
137 set_mismatch = set_mismatch .OR. (update_ehalo /= ehalosz)
138 set_mismatch = set_mismatch .OR. (update_shalo /= shalosz)
139 set_mismatch = set_mismatch .OR. (update_nhalo /= nhalosz)
141 write(
text,
'(i2)' ) list
142 call
mpp_error(FATAL,'MPP_UPDATE_3D: Incompatible
field at count '
150 if( domain_update_is_needed(domain, update_whalo, update_ehalo, update_shalo, update_nhalo) )then
152 check => search_check_overlap(domain, update_position)
154 call mpp_do_check(f_addrs(1:l_size,1:ntile), domain,
check, d_type, ke, flags,
name )
157 update => search_update_overlap(domain, update_whalo, update_ehalo, update_shalo, update_nhalo, update_position)
159 !call mpp_do_update( f_addrs(1:l_size,1:ntile), domain, update, d_type, ke, &
160 ! b_addrs(1:l_size,1:ntile), bsize, flags)
162 if ( PRESENT ( flags ) ) then
163 call mpp_do_update( f_addrs(1:l_size,1:ntile), domain, update, d_type, ke, flags )
165 call mpp_do_update( f_addrs(1:l_size,1:ntile), domain, update, d_type, ke )
170 l_size=0; f_addrs=-9999;
isize=0;
jsize=0; ke=0
174 end subroutine MPP_UPDATE_DOMAINS_3D_
176 subroutine MPP_UPDATE_DOMAINS_4D_(
field, domain, flags, complete, position, &
177 whalo, ehalo, shalo, nhalo,
name, tile_count )
178 !updates data domain of 4D
field whose computational domains have been computed
180 type(domain2D), intent(inout) :: domain
181 integer, intent(in), optional :: flags
182 logical, intent(in), optional :: complete
183 integer, intent(in), optional :: position
184 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
185 character(
len=*), intent(in), optional ::
name 186 integer, intent(in), optional :: tile_count
189 pointer( ptr, field3D )
191 call mpp_update_domains( field3D, domain, flags, complete, position, &
192 whalo, ehalo, shalo, nhalo,
name, tile_count)
194 end subroutine MPP_UPDATE_DOMAINS_4D_
196 subroutine MPP_UPDATE_DOMAINS_5D_(
field, domain, flags, complete, position, &
197 whalo, ehalo, shalo, nhalo,
name, tile_count )
198 !updates data domain of 5D
field whose computational domains have been computed
200 type(domain2D), intent(inout) :: domain
201 integer, intent(in), optional :: flags
202 logical, intent(in), optional :: complete
203 integer, intent(in), optional :: position
204 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
205 character(
len=*), intent(in), optional ::
name 206 integer, intent(in), optional :: tile_count
210 pointer( ptr, field3D )
212 call mpp_update_domains( field3D, domain, flags, complete, position, &
213 whalo, ehalo, shalo, nhalo,
name, tile_count )
215 end subroutine MPP_UPDATE_DOMAINS_5D_
217 subroutine MPP_REDISTRIBUTE_2D_(
domain_in, field_in,
domain_out, field_out, complete, free, list_size, dc_handle, position )
221 logical, intent(in), optional :: complete, free
222 integer, intent(in), optional :: list_size
223 integer, intent(in), optional :: position
226 type(DomainCommunicator2D),pointer,optional :: dc_handle
227 pointer( ptr_in, field3D_in )
228 pointer( ptr_out, field3D_out )
234 call mpp_redistribute(
domain_in, field3D_in,
domain_out, field3D_out, complete, free, list_size, dc_handle, position )
237 end subroutine MPP_REDISTRIBUTE_2D_
240 subroutine MPP_REDISTRIBUTE_3D_(
domain_in, field_in,
domain_out, field_out, complete, free, list_size, dc_handle, position )
242 MPP_TYPE_, intent(in) :: field_in (:,:,:)
244 logical, intent(in), optional :: complete, free
245 integer, intent(in), optional :: list_size
246 integer, intent(in), optional :: position
247 type(DomainCommunicator2D),pointer,optional :: dc_handle
249 logical :: do_redist,free_comm
252 integer, save :: isize_in=0,jsize_in=0,ke_in=0,l_size=0
253 integer, save :: isize_out=0,jsize_out=0,ke_out=0
254 logical :: set_mismatch
265 if(present(position)) then
267 'MPP_REDISTRIBUTE_3Dold_: only position = CENTER
is implemented, contact
author')
270 do_redist=.
true.;
if(PRESENT(complete))do_redist=complete
271 free_comm=.
false.;
if(PRESENT(free))free_comm=free
273 l_addrs_in(1) = floc_in; l_addrs_out(1) = floc_out
274 if(l_addrs_out(1)>0)then
275 ke =
size(field_out,3)
277 ke =
size(field_in,3)
279 lsize=1;
if(PRESENT(list_size))lsize=list_size
280 call mpp_redistribute_free_comm(
domain_in,l_addrs_in(1),
domain_out,l_addrs_out(1),ke,lsize)
283 if(l_size > MAX_DOMAIN_FIELDS)then
284 write(
text,'(i2)' ) MAX_DOMAIN_FIELDS
285 call
mpp_error(FATAL,'MPP_REDISTRIBUTE_3D: MAX_DOMAIN_FIELDS='
287 l_addrs_in(l_size) = floc_in; l_addrs_out(l_size) = floc_out
289 if(l_addrs_in(l_size) > 0)then
290 isize_in=
size(field_in,1); jsize_in=
size(field_in,2); ke_in =
size(field_in,3)
292 if(l_addrs_out(l_size) > 0)then
293 isize_out=
size(field_out,1); jsize_out=
size(field_out,2); ke_out =
size(field_out,3)
296 set_mismatch = .
false.
297 set_mismatch = l_addrs_in(l_size) == 0 .AND. l_addrs_in(l_size-1) /= 0
298 set_mismatch = set_mismatch .OR. (l_addrs_in(l_size) > 0 .AND. l_addrs_in(l_size-1) == 0)
299 set_mismatch = set_mismatch .OR. (l_addrs_out(l_size) == 0 .AND. l_addrs_out(l_size-1) /= 0)
300 set_mismatch = set_mismatch .OR. (l_addrs_out(l_size) > 0 .AND. l_addrs_out(l_size-1) == 0)
301 if(l_addrs_in(l_size) > 0)then
302 set_mismatch = set_mismatch .OR. (isize_in /=
size(field_in,1))
303 set_mismatch = set_mismatch .OR. (jsize_in /=
size(field_in,2))
304 set_mismatch = set_mismatch .OR. (ke_in /=
size(field_in,3))
306 if(l_addrs_out(l_size) > 0)then
307 set_mismatch = set_mismatch .OR. (isize_out /=
size(field_out,1))
308 set_mismatch = set_mismatch .OR. (jsize_out /=
size(field_out,2))
309 set_mismatch = set_mismatch .OR. (ke_out /=
size(field_out,3))
312 write(
text,'(i2)' ) l_size
313 call
mpp_error(FATAL,'MPP_REDISTRIBUTE_3D: Incompatible
field at count '
317 if(PRESENT(dc_handle))
d_comm =>dc_handle ! User has kept pointer to
d_comm 320 isize_in,jsize_in,ke_in,isize_out,jsize_out,ke_out)
321 if(PRESENT(dc_handle))dc_handle =>
d_comm ! User wants to keep pointer to
d_comm 323 call mpp_do_redistribute( l_addrs_in(1:l_size), l_addrs_out(1:l_size),
d_comm, d_type )
324 l_size=0; l_addrs_in=-9999; l_addrs_out=-9999
325 isize_in=0; jsize_in=0; ke_in=0
326 isize_out=0; jsize_out=0; ke_out=0
331 end subroutine MPP_REDISTRIBUTE_3D_
334 subroutine MPP_REDISTRIBUTE_4D_(
domain_in, field_in,
domain_out, field_out, complete, free, list_size, dc_handle, position )
336 MPP_TYPE_, intent(in) :: field_in (:,:,:,:)
338 logical, intent(in), optional :: complete, free
339 integer, intent(in), optional :: list_size
340 integer, intent(in), optional :: position
343 type(DomainCommunicator2D),pointer,optional :: dc_handle
344 pointer( ptr_in, field3D_in )
345 pointer( ptr_out, field3D_out )
351 call mpp_redistribute(
domain_in, field3D_in,
domain_out, field3D_out, complete, free, list_size, dc_handle, position )
354 end subroutine MPP_REDISTRIBUTE_4D_
356 subroutine MPP_REDISTRIBUTE_5D_(
domain_in, field_in,
domain_out, field_out, complete, free, list_size, dc_handle, position )
358 MPP_TYPE_, intent(in) :: field_in (:,:,:,:,:)
360 logical, intent(in), optional :: complete, free
361 integer, intent(in), optional :: list_size
362 integer, intent(in), optional :: position
366 type(DomainCommunicator2D),pointer,optional :: dc_handle
367 pointer( ptr_in, field3D_in )
368 pointer( ptr_out, field3D_out )
374 call mpp_redistribute(
domain_in, field3D_in,
domain_out, field3D_out, complete, free, list_size, dc_handle, position )
377 end subroutine MPP_REDISTRIBUTE_5D_
383 subroutine MPP_UPDATE_DOMAINS_2D_V_( fieldx, fieldy, domain, flags, gridtype, complete, &
384 whalo, ehalo, shalo, nhalo,
name, tile_count)
385 !updates data domain of 2D
field whose computational domains have been computed
386 MPP_TYPE_, intent(inout) :: fieldx(:,:), fieldy(:,:)
387 type(domain2D), intent(inout) :: domain
388 integer, intent(in), optional :: flags, gridtype
389 logical, intent(in), optional :: complete
390 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
391 character(
len=*), intent(in), optional ::
name 392 integer, intent(in), optional :: tile_count
396 pointer( ptrx, field3Dx )
397 pointer( ptry, field3Dy )
400 call mpp_update_domains( field3Dx, field3Dy, domain, flags, gridtype, complete, &
401 whalo, ehalo, shalo, nhalo,
name, tile_count)
403 end subroutine MPP_UPDATE_DOMAINS_2D_V_
406 subroutine MPP_UPDATE_DOMAINS_3D_V_( fieldx, fieldy, domain, flags, gridtype, complete, &
407 whalo, ehalo, shalo, nhalo,
name, tile_count)
408 !updates data domain of 3D
field whose computational domains have been computed
409 MPP_TYPE_, intent(inout) :: fieldx(:,:,:), fieldy(:,:,:)
410 type(domain2D), intent(inout) :: domain
411 integer, intent(in), optional :: flags, gridtype
412 logical, intent(in), optional :: complete
413 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
414 character(
len=*), intent(in), optional ::
name 415 integer, intent(in), optional :: tile_count
417 integer :: update_whalo, update_ehalo, update_shalo, update_nhalo, ntile
419 logical :: exchange_uv
422 logical :: do_update, is_complete
424 integer, save :: whalosz, ehalosz, shalosz, nhalosz
426 integer :: position_x, position_y
427 logical :: set_mismatch
430 type(overlapSpec), pointer :: updatex =>
NULL()
431 type(overlapSpec), pointer :: updatey =>
NULL()
432 type(overlapSpec), pointer :: checkx =>
NULL()
433 type(overlapSpec), pointer :: checky =>
NULL()
435 if(present(whalo)) then
437 if(abs(update_whalo) > domain%whalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D_V: " 438 "optional argument whalo should not be larger than the whalo when define domain.")
440 update_whalo = domain%whalo
442 if(present(ehalo)) then
444 if(abs(update_ehalo) > domain%ehalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D_V: " 445 "optional argument ehalo should not be larger than the ehalo when define domain.")
447 update_ehalo = domain%ehalo
449 if(present(shalo)) then
451 if(abs(update_shalo) > domain%shalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D_V: " 452 "optional argument shalo should not be larger than the shalo when define domain.")
454 update_shalo = domain%shalo
456 if(present(nhalo)) then
458 if(abs(update_nhalo) > domain%nhalo ) call
mpp_error(FATAL,
"MPP_UPDATE_3D_V: " 459 "optional argument nhalo should not be larger than the nhalo when define domain.")
461 update_nhalo = domain%nhalo
464 grid_offset_type = AGRID
465 if( PRESENT(gridtype) ) grid_offset_type = gridtype
467 exchange_uv = .
false.
468 if(grid_offset_type == DGRID_NE) then
470 grid_offset_type = CGRID_NE
471 else
if( grid_offset_type == DGRID_SW ) then
473 grid_offset_type = CGRID_SW
476 max_ntile = domain%max_ntile_pe
477 ntile =
size(domain%x(:))
480 if(PRESENT(complete)) then
481 is_complete = complete
486 if(ntile>MAX_TILES) then
487 write(
text,
'(i2)' ) MAX_TILES
488 call
mpp_error(FATAL,
'MPP_UPDATE_3D_V: MAX_TILES=' 490 if(.NOT. present(tile_count) ) call
mpp_error(FATAL,
"MPP_UPDATE_3D_V: " 491 "optional argument tile_count should be present when number of tiles on some pe is more than 1")
495 do_update = (
tile == ntile) .AND. is_complete
497 if(list > MAX_DOMAIN_FIELDS)then
498 write(
text,
'(i2)' ) MAX_DOMAIN_FIELDS
499 call
mpp_error(FATAL,
'MPP_UPDATE_3D_V: MAX_DOMAIN_FIELDS=' 502 f_addrsx(list,
tile) = LOC(fieldx)
503 f_addrsy(list,
tile) = LOC(fieldy)
505 if(list == 1 .AND.
tile == 1)then
508 offset_type = grid_offset_type
509 whalosz = update_whalo; ehalosz = update_ehalo; shalosz = update_shalo; nhalosz = update_nhalo
511 set_mismatch = .
false.
512 set_mismatch = set_mismatch .OR. (
isize(1) /=
size(fieldx,1))
513 set_mismatch = set_mismatch .OR. (
jsize(1) /=
size(fieldx,2))
514 set_mismatch = set_mismatch .OR. (ke /=
size(fieldx,3))
515 set_mismatch = set_mismatch .OR. (
isize(2) /=
size(fieldy,1))
516 set_mismatch = set_mismatch .OR. (
jsize(2) /=
size(fieldy,2))
517 set_mismatch = set_mismatch .OR. (ke /=
size(fieldy,3))
518 set_mismatch = set_mismatch .OR. (grid_offset_type /= offset_type)
519 set_mismatch = set_mismatch .OR. (update_whalo /= whalosz)
520 set_mismatch = set_mismatch .OR. (update_ehalo /= ehalosz)
521 set_mismatch = set_mismatch .OR. (update_shalo /= shalosz)
522 set_mismatch = set_mismatch .OR. (update_nhalo /= nhalosz)
524 write(
text,'(i2)' ) list
525 call
mpp_error(FATAL,'MPP_UPDATE_3D_V: Incompatible
field at count '
533 if( domain_update_is_needed(domain, update_whalo, update_ehalo, update_shalo, update_nhalo) )then
534 select
case(grid_offset_type)
538 case (BGRID_NE, BGRID_SW)
541 case (CGRID_NE, CGRID_SW)
545 call
mpp_error(FATAL, "mpp_update_domains2D.h: invalid value of grid_offset_type")
549 checkx => search_check_overlap(domain, position_x)
550 checky => search_check_overlap(domain, position_y)
551 if(ASSOCIATED(checkx)) then
553 call mpp_do_check(f_addrsx(1:l_size,1:ntile),f_addrsy(1:l_size,1:ntile), domain, &
554 checky, checkx, d_type, ke, flags,
name)
556 call mpp_do_check(f_addrsx(1:l_size,1:ntile),f_addrsy(1:l_size,1:ntile), domain, &
557 checkx, checky, d_type, ke, flags,
name)
561 updatex => search_update_overlap(domain, update_whalo, update_ehalo, update_shalo, update_nhalo, position_x)
562 updatey => search_update_overlap(domain, update_whalo, update_ehalo, update_shalo, update_nhalo, position_y)
564 call mpp_do_update(f_addrsx(1:l_size,1:ntile),f_addrsy(1:l_size,1:ntile), domain, updatey, updatex, &
565 d_type,ke, grid_offset_type, flags)
567 call mpp_do_update(f_addrsx(1:l_size,1:ntile),f_addrsy(1:l_size,1:ntile), domain, updatex, updatey, &
568 d_type,ke,grid_offset_type, flags)
571 l_size=0; f_addrsx=-9999; f_addrsy=-9999;
isize=0;
jsize=0; ke=0
575 end subroutine MPP_UPDATE_DOMAINS_3D_V_
578 subroutine MPP_UPDATE_DOMAINS_4D_V_( fieldx, fieldy, domain, flags, gridtype, complete, &
579 whalo, ehalo, shalo, nhalo,
name, tile_count )
580 !updates data domain of 4D
field whose computational domains have been computed
581 MPP_TYPE_, intent(inout) :: fieldx(:,:,:,:), fieldy(:,:,:,:)
582 type(domain2D), intent(inout) :: domain
583 integer, intent(in), optional :: flags, gridtype
584 logical, intent(in), optional :: complete
585 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
586 character(
len=*), intent(in), optional ::
name 587 integer, intent(in), optional :: tile_count
592 pointer( ptrx, field3Dx )
593 pointer( ptry, field3Dy )
596 call mpp_update_domains( field3Dx, field3Dy, domain, flags, gridtype, complete, &
597 whalo, ehalo, shalo, nhalo,
name, tile_count)
599 end subroutine MPP_UPDATE_DOMAINS_4D_V_
601 subroutine MPP_UPDATE_DOMAINS_5D_V_( fieldx, fieldy, domain, flags, gridtype, complete, &
602 whalo, ehalo, shalo, nhalo,
name, tile_count )
603 !updates data domain of 5D
field whose computational domains have been computed
604 MPP_TYPE_, intent(inout) :: fieldx(:,:,:,:,:), fieldy(:,:,:,:,:)
605 type(domain2D), intent(inout) :: domain
606 integer, intent(in), optional :: flags, gridtype
607 logical, intent(in), optional :: complete
608 integer, intent(in), optional :: whalo, ehalo, shalo, nhalo
609 character(
len=*), intent(in), optional ::
name 610 integer, intent(in), optional :: tile_count
614 pointer( ptrx, field3Dx )
615 pointer( ptry, field3Dy )
618 call mpp_update_domains( field3Dx, field3Dy, domain, flags, gridtype, complete, &
619 whalo, ehalo, shalo, nhalo,
name, tile_count)
622 end subroutine MPP_UPDATE_DOMAINS_5D_V_
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version will
type(ext_fieldtype), dimension(:), pointer, save, private field
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> set_mismatch integer ::tile update_position nbuffersz l_size integer
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_DOMAINS_2D_(field, domain, flags, complete, position, &whalo, ehalo, shalo, nhalo, name, tile_count)!updates data domain of 2D field whose computational domains have been computed MPP_TYPE_, intent(inout) ::field(:,:) type(domain2D), intent(inout) ::domain integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::whalo, ehalo, shalo, nhalo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) pointer(ptr, field3D) ptr=LOC(field) call mpp_update_domains(field3D, domain, flags, complete, position, &whalo, ehalo, shalo, nhalo, name, tile_count) return end subroutine MPP_UPDATE_DOMAINS_2D_ subroutine MPP_UPDATE_DOMAINS_3D_(field, domain, flags, complete, position, &whalo, ehalo, shalo, nhalo, name, tile_count)!updates data domain of 3D field whose computational domains have been computed MPP_TYPE_, intent(inout) ::field(:,:,:) type(domain2D), intent(inout) ::domain integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::whalo, ehalo, shalo, nhalo ! specify halo region to be updated. character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count integer ::update_position, update_whalo, update_ehalo, update_shalo, update_nhalo, ntile integer(LONG_KIND), dimension(MAX_DOMAIN_FIELDS, MAX_TILES), save ::f_addrs=-9999 integer ::tile, max_ntile character(len=3) ::text logical ::set_mismatch, is_complete logical ::do_update integer, save ::isize=0, jsize=0, ke=0, l_size=0, list=0 integer, save ::pos, whalosz, ehalosz, shalosz, nhalosz MPP_TYPE_ ::d_type type(overlapSpec), pointer ::update=> NULL() type(overlapSpec)
subroutine, public copy(self, rhs)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT end
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If not
integer(long), parameter true
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_DO_REDISTRIBUTE_3D_(f_in, f_out, d_comm, d_type) integer(LONG_KIND), intent(in) ::f_in(:), f_out(:) type(DomainCommunicator2D), intent(in) ::d_comm MPP_TYPE_, intent(in) ::d_type MPP_TYPE_ ::field_in(d_comm%domain_in%x(1)%data%begin:d_comm%domain_in%x(1)%data%end, &d_comm%domain_in%y(1)%data%begin:d_comm%domain_in%y(1)%data%end, d_comm%ke) pointer(ptr_field_in, field_in) MPP_TYPE_ ::field_out(d_comm%domain_out%x(1)%data%begin:d_comm%domain_out%x(1)%data%end, &d_comm%domain_out%y(1)%data%begin:d_comm%domain_out%y(1)%data%end, d_comm%ke) pointer(ptr_field_out, field_out) type(domain2D), pointer ::domain_in, domain_out integer ::i, j, k, l, n, l_size integer ::is, ie, js, je integer ::ke integer ::list, pos, msgsize integer ::to_pe, from_pe MPP_TYPE_ ::buffer(size(mpp_domains_stack(:))) pointer(ptr, buffer) integer ::buffer_pos, wordlen, errunit!fix ke errunit=stderr() l_size=size(f_out(:)) ! equal to size(f_in(:)) ke=d_comm%ke domain_in=> d_comm domain_in
type(field_mgr_type), dimension(max_fields), private fields
integer(long), parameter false
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible MPP_TYPE_
l_size ! loop over number of fields ke do je do ie to je n if(.NOT. d_comm%R_do_buf(list)) cycle from_pe
character(len=128) version
l_size ! loop over number of fields ke do je do ie to is
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_GLOBAL_FIELD_2D_(domain, local, global, flags, position, tile_count, default_data) type(domain2D), intent(in) ::domain MPP_TYPE_, intent(in) ::local(:,:) MPP_TYPE_, intent(out) ::global(:,:) integer, intent(in), optional ::flags integer, intent(in), optional ::position integer, intent(in), optional ::tile_count MPP_TYPE_, intent(in), optional ::default_data MPP_TYPE_ ::local3D(size(local, 1), size(local, 2), 1) MPP_TYPE_ ::global3D(size(global, 1), size(global, 2), 1) pointer(lptr, local3D) pointer(gptr, global3D) lptr=LOC(local) gptr=LOC(global) call mpp_global_field(domain, local3D, global3D, flags, position, tile_count, default_data) end subroutine MPP_GLOBAL_FIELD_2D_ subroutine MPP_GLOBAL_FIELD_3D_(domain, local, global, flags, position, tile_count, default_data)!get a global field from a local field!local field may be on compute OR data domain type(domain2D), intent(in) ::domain MPP_TYPE_, intent(in) ::local(:,:,:) MPP_TYPE_, intent(out) ::global(:,:,:) integer, intent(in), optional ::flags integer, intent(in), optional ::position integer, intent(in), optional ::tile_count MPP_TYPE_, intent(in), optional ::default_data integer ::ishift, jshift integer ::tile integer ::isize, jsize tile=1;if(PRESENT(tile_count)) tile=tile_count call mpp_get_domain_shift(domain, ishift, jshift, position) ! The alltoallw method requires that local and global be contiguous. ! We presume that `local` is contiguous if it matches the data domain;! `global` is presumed to always be contiguous. ! Ideally we would use the F2015 function IS_CONTIGUOUS() to validate ! contiguity, but it is not yet suppored in many compilers. ! Also worth noting that many of the nD-> conversion also assumes so there many be other issues here isize
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call mpp_error(FATAL, 'MPP_TRANSMIT:you cannot transmit to ANY_PE using MPI.') else if(to_pe.NE.NULL_PE) then !no other valid cases except NULL_PE call mpp_error(FATAL
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this case
logical function received(this, seqno)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this ! since that attempts to gather all data on PE size(field%axes(:)) axsiz(i)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible intent(inout) a
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> dimension(MAX_DOMAIN_FIELDS)
type(domaincommunicator2d), dimension(:), allocatable, target, save d_comm
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> set_mismatch integer ::tile update_position nbuffersz jsize
l_size ! loop over number of fields ke do je do ie pos
subroutine, public some(xmap, some_arr, grid_id)
integer debug_update_level