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_DO_UPDATE_3D_V_(f_addrsx,f_addrsy, domain, update_x, update_y, &
21 d_type, ke, gridtype, flags)
22 !updates data domain of 3D
field whose computational domains have been computed
24 type(domain2d), intent(in) :: domain
25 type(overlapSpec), intent(in) :: update_x, update_y
27 MPP_TYPE_, intent(in) :: d_type ! creates unique interface
29 integer, intent(in), optional :: flags
31 MPP_TYPE_ :: fieldx(update_x%xbegin:update_x%xend, update_x%ybegin:update_x%yend,ke)
32 MPP_TYPE_ :: fieldy(update_y%xbegin:update_y%xend, update_y%ybegin:update_y%yend,ke)
33 pointer(ptr_fieldx, fieldx)
34 pointer(ptr_fieldy, fieldy)
37 integer :: l_size, l,
i,
j,
k,
is,
ie,
js,
je,
n,
m 42 integer :: send_start_pos, nsend
43 integer :: send_msgsize(2*MAXLIST)
46 logical ::
send(8),
recv(8), update_edge_only
51 integer :: buffer_recv_size, shift
52 integer :: rank_x, rank_y, ind_x, ind_y, cur_rank
57 if( PRESENT(flags) ) then
59 ! The following
test is so that SCALAR_PAIR can be used alone with the
60 ! same default update pattern as without.
68 if( BTEST(
update_flags,NORTH) .AND. BTEST(domain%fold,NORTH) .AND. BTEST(gridtype,SOUTH) ) &
69 call
mpp_error( FATAL,
'MPP_DO_UPDATE_V: Incompatible grid offset and fold.' )
77 if( update_edge_only ) then
93 l_size =
size(f_addrsx,1)
94 nlist =
size(domain%list(:))
95 ptr = LOC(mpp_domains_stack)
98 nsend_x = update_x%nsend
99 nsend_y = update_y%nsend
100 nrecv_x = update_x%nrecv
101 nrecv_y = update_y%nrecv
104 allocate(msg1(0:nlist-1), msg2(0:nlist-1), msg3(0:nlist-1) )
108 cur_rank = get_rank_recv(domain, update_x, update_y, rank_x, rank_y, ind_x, ind_y)
110 do while (ind_x .LE. nrecv_x .OR. ind_y .LE. nrecv_y)
112 if(cur_rank == rank_x) then
114 do
n = 1, update_x%
recv(ind_x)%count
115 dir = update_x%
recv(ind_x)%dir(
n)
123 if(ind_x .LE. nrecv_x) then
124 rank_x = update_x%
recv(ind_x)%
pe - domain%
pe 125 if(rank_x .LE.0) rank_x = rank_x + nlist
130 if(cur_rank == rank_y) then
132 do
n = 1, update_y%
recv(ind_y)%count
133 dir = update_y%
recv(ind_y)%dir(
n)
141 if(ind_y .LE. nrecv_y) then
142 rank_y = update_y%
recv(ind_y)%
pe - domain%
pe 143 if(rank_y .LE.0) rank_y = rank_y + nlist
148 cur_rank =
max(rank_x, rank_y)
153 cur_rank = get_rank_send(domain, update_x, update_y, rank_x, rank_y, ind_x, ind_y)
154 do while (ind_x .LE. nsend_x .OR. ind_y .LE. nsend_y)
156 if(cur_rank == rank_x) then
158 do
n = 1, update_x%
send(ind_x)%count
159 dir = update_x%
send(ind_x)%dir(
n)
167 if(ind_x .LE. nsend_x) then
168 rank_x = update_x%
send(ind_x)%
pe - domain%
pe 169 if(rank_x .LT.0) rank_x = rank_x + nlist
174 if(cur_rank == rank_y) then
176 do
n = 1, update_y%
send(ind_y)%count
177 dir = update_y%
send(ind_y)%dir(
n)
185 if(ind_y .LE. nsend_y) then
186 rank_y = update_y%
send(ind_y)%
pe - domain%
pe 187 if(rank_y .LT.0) rank_y = rank_y + nlist
194 cur_rank =
min(rank_x, rank_y)
196 call mpp_alltoall(msg3, 1, msg1, 1)
197 ! call mpp_sync_self(
check=EVENT_RECV)
199 if(msg1(
m) .NE. msg2(
m)) then
200 print*, "My
pe = ", mpp_pe(), ",domain
name =", trim(domain%
name), ",from
pe=", &
206 ! call mpp_sync_self()
207 write(
outunit,*)"NOTE from mpp_do_updateV: message sizes are matched between
send and
recv for domain " &
209 deallocate(msg1, msg2, msg3)
214 cur_rank = get_rank_recv(domain, update_x, update_y, rank_x, rank_y, ind_x, ind_y)
216 do while (ind_x .LE. nrecv_x .OR. ind_y .LE. nrecv_y)
218 select
case(gridtype)
219 case(BGRID_NE, BGRID_SW, AGRID)
220 if(cur_rank == rank_x) then
222 do
n = 1, update_x%
recv(ind_x)%count
223 dir = update_x%
recv(ind_x)%dir(
n)
225 tMe = update_x%
recv(ind_x)%tileMe(
n)
234 if(ind_x .LE. nrecv_x) then
235 rank_x = update_x%
recv(ind_x)%
pe - domain%
pe 236 if(rank_x .LE.0) rank_x = rank_x + nlist
242 case(CGRID_NE, CGRID_SW)
243 if(cur_rank == rank_x) then
245 do
n = 1, update_x%
recv(ind_x)%count
246 dir = update_x%
recv(ind_x)%dir(
n)
254 if(ind_x .LE. nrecv_x) then
255 rank_x = update_x%
recv(ind_x)%
pe - domain%
pe 256 if(rank_x .LE.0) rank_x = rank_x + nlist
261 if(cur_rank == rank_y) then
263 do
n = 1, update_y%
recv(ind_y)%count
264 dir = update_y%
recv(ind_y)%dir(
n)
272 if(ind_y .LE. nrecv_y) then
273 rank_y = update_y%
recv(ind_y)%
pe - domain%
pe 274 if(rank_y .LE.0) rank_y = rank_y + nlist
280 cur_rank =
max(rank_x, rank_y)
287 call
mpp_error( FATAL, 'MPP_DO_UPDATE_V: mpp_domains_stack overflow, '
288 'call mpp_domains_set_stack_size('
291 buffer_pos = buffer_pos +
msgsize 295 buffer_recv_size = buffer_pos
296 send_start_pos = buffer_pos
299 cur_rank = get_rank_send(domain, update_x, update_y, rank_x, rank_y, ind_x, ind_y)
302 do while (ind_x .LE. nsend_x .OR. ind_y .LE. nsend_y)
304 !--- make sure the domain stack
size is big enough
306 if(cur_rank == rank_x) then
307 do
n = 1, update_x%
send(ind_x)%count
308 dir = update_x%
send(ind_x)%dir(
n)
312 if(cur_rank == rank_y) then
313 do
n = 1, update_y%
send(ind_y)%count
314 dir = update_y%
send(ind_y)%dir(
n)
324 call
mpp_error( FATAL, 'MPP_DO_UPDATE_V: mpp_domains_stack overflow, '
325 'call mpp_domains_set_stack_size('
328 select
case( gridtype )
329 case(BGRID_NE, BGRID_SW, AGRID)
330 if(cur_rank == rank_x) then
332 do
n = 1, update_x%
send(ind_x)%count
333 dir = update_x%
send(ind_x)%dir(
n)
335 tMe = update_x%
send(ind_x)%tileMe(
n)
339 select
case( update_x%
send(ind_x)%rotation(
n) )
341 do l=1,l_size ! loop over number of
fields 342 ptr_fieldx = f_addrsx(l,tMe)
343 ptr_fieldy = f_addrsy(l,tMe)
348 buffer(
pos-1) = fieldx(
i,
j,
k)
349 buffer(
pos) = fieldy(
i,
j,
k)
356 do l=1,l_size ! loop over number of
fields 357 ptr_fieldx = f_addrsx(l,tMe)
358 ptr_fieldy = f_addrsy(l,tMe)
363 buffer(
pos-1) = fieldy(
i,
j,
k)
364 buffer(
pos) = fieldx(
i,
j,
k)
370 do l=1,l_size ! loop over number of
fields 371 ptr_fieldx = f_addrsx(l,tMe)
372 ptr_fieldy = f_addrsy(l,tMe)
377 buffer(
pos-1) = -fieldy(
i,
j,
k)
378 buffer(
pos) = fieldx(
i,
j,
k)
386 do l=1,l_size ! loop over number of
fields 387 ptr_fieldx = f_addrsx(l,tMe)
388 ptr_fieldy = f_addrsy(l,tMe)
393 buffer(
pos-1) = fieldy(
i,
j,
k)
394 buffer(
pos) = fieldx(
i,
j,
k)
400 do l=1,l_size ! loop over number of
fields 401 ptr_fieldx = f_addrsx(l,tMe)
402 ptr_fieldy = f_addrsy(l,tMe)
407 buffer(
pos-1) = fieldy(
i,
j,
k)
408 buffer(
pos) = -fieldx(
i,
j,
k)
414 case( ONE_HUNDRED_EIGHTY )
416 do l=1,l_size ! loop over number of
fields 417 ptr_fieldx = f_addrsx(l,tMe)
418 ptr_fieldy = f_addrsy(l,tMe)
423 buffer(
pos-1) = fieldx(
i,
j,
k)
424 buffer(
pos) = fieldy(
i,
j,
k)
430 do l=1,l_size ! loop over number of
fields 431 ptr_fieldx = f_addrsx(l,tMe)
432 ptr_fieldy = f_addrsy(l,tMe)
437 buffer(
pos-1) = -fieldx(
i,
j,
k)
438 buffer(
pos) = -fieldy(
i,
j,
k)
444 end select ! select
case( rotation(
n) )
446 end do ! do
n = 1, update_x%
send(ind_x)%count
449 if(ind_x .LE. nsend_x) then
450 rank_x = update_x%
send(ind_x)%
pe - domain%
pe 451 if(rank_x .LT.0) rank_x = rank_x + nlist
457 case(CGRID_NE, CGRID_SW)
458 if(cur_rank == rank_x) then
460 do
n = 1, update_x%
send(ind_x)%count
461 dir = update_x%
send(ind_x)%dir(
n)
463 tMe = update_x%
send(ind_x)%tileMe(
n)
466 select
case( update_x%
send(ind_x)%rotation(
n) )
468 do l=1,l_size ! loop over number of
fields 469 ptr_fieldx = f_addrsx(l, tMe)
470 ptr_fieldy = f_addrsy(l, tMe)
475 buffer(
pos) = fieldx(
i,
j,
k)
482 do l=1,l_size ! loop over number of
fields 483 ptr_fieldx = f_addrsx(l, tMe)
484 ptr_fieldy = f_addrsy(l, tMe)
489 buffer(
pos) = fieldy(
i,
j,
k)
495 do l=1,l_size ! loop over number of
fields 496 ptr_fieldx = f_addrsx(l, tMe)
497 ptr_fieldy = f_addrsy(l, tMe)
502 buffer(
pos) = -fieldy(
i,
j,
k)
509 do l=1,l_size ! loop over number of
fields 510 ptr_fieldx = f_addrsx(l, tMe)
511 ptr_fieldy = f_addrsy(l, tMe)
516 buffer(
pos) = fieldy(
i,
j,
k)
521 case(ONE_HUNDRED_EIGHTY)
523 do l=1,l_size ! loop over number of
fields 524 ptr_fieldx = f_addrsx(l, tMe)
525 ptr_fieldy = f_addrsy(l, tMe)
530 buffer(
pos) = fieldx(
i,
j,
k)
536 do l=1,l_size ! loop over number of
fields 537 ptr_fieldx = f_addrsx(l, tMe)
538 ptr_fieldy = f_addrsy(l, tMe)
543 buffer(
pos) = -fieldx(
i,
j,
k)
553 if(ind_x .LE. nsend_x) then
554 rank_x = update_x%
send(ind_x)%
pe - domain%
pe 555 if(rank_x .LT.0) rank_x = rank_x + nlist
560 if(cur_rank == rank_y) then
562 do
n = 1, update_y%
send(ind_y)%count
563 dir = update_y%
send(ind_y)%dir(
n)
565 tMe = update_y%
send(ind_y)%tileMe(
n)
568 select
case( update_y%
send(ind_y)%rotation(
n) )
570 do l=1,l_size ! loop over number of
fields 571 ptr_fieldx = f_addrsx(l, tMe)
572 ptr_fieldy = f_addrsy(l, tMe)
577 buffer(
pos) = fieldy(
i,
j,
k)
583 do l=1,l_size ! loop over number of
fields 584 ptr_fieldx = f_addrsx(l, tMe)
585 ptr_fieldy = f_addrsy(l, tMe)
590 buffer(
pos) = fieldx(
i,
j,
k)
597 do l=1,l_size ! loop over number of
fields 598 ptr_fieldx = f_addrsx(l, tMe)
599 ptr_fieldy = f_addrsy(l, tMe)
604 buffer(
pos) = fieldx(
i,
j,
k)
610 do l=1,l_size ! loop over number of
fields 611 ptr_fieldx = f_addrsx(l, tMe)
612 ptr_fieldy = f_addrsy(l, tMe)
617 buffer(
pos) = -fieldx(
i,
j,
k)
623 case(ONE_HUNDRED_EIGHTY)
625 do l=1,l_size ! loop over number of
fields 626 ptr_fieldx = f_addrsx(l, tMe)
627 ptr_fieldy = f_addrsy(l, tMe)
632 buffer(
pos) = fieldy(
i,
j,
k)
638 do l=1,l_size ! loop over number of
fields 639 ptr_fieldx = f_addrsx(l, tMe)
640 ptr_fieldy = f_addrsy(l, tMe)
645 buffer(
pos) = -fieldy(
i,
j,
k)
655 if(ind_y .LE. nsend_y) then
656 rank_y = update_y%
send(ind_y)%
pe - domain%
pe 657 if(rank_y .LT.0) rank_y = rank_y + nlist
663 cur_rank =
min(rank_x, rank_y)
665 send_pe(nsend) =
to_pe 666 send_msgsize(nsend) =
pos - buffer_pos
670 buffer_pos = send_start_pos
676 call mpp_send( buffer(buffer_pos+1), plen=
msgsize,
to_pe=send_pe(
m), tag=COMM_TAG_2 )
677 buffer_pos = buffer_pos +
msgsize 685 call mpp_sync_self(
check=EVENT_RECV)
687 buffer_pos = buffer_recv_size
688 cur_rank = get_rank_unpack(domain, update_x, update_y, rank_x, rank_y, ind_x, ind_y)
691 do while (ind_x > 0 .OR. ind_y > 0)
693 select
case ( gridtype )
694 case(BGRID_NE, BGRID_SW, AGRID)
695 if(cur_rank == rank_x) then
696 do
n = update_x%
recv(ind_x)%count, 1, -1
697 dir = update_x%
recv(ind_x)%dir(
n)
699 tMe = update_x%
recv(ind_x)%tileMe(
n)
705 do l=1, l_size ! loop over number of
fields 706 ptr_fieldx = f_addrsx(l, tMe)
707 ptr_fieldy = f_addrsy(l, tMe)
712 fieldx(
i,
j,
k) = buffer(
pos-1)
713 fieldy(
i,
j,
k) = buffer(
pos)
719 end do ! do dir=8,1,-1
722 if(ind_x .GT. 0) then
723 rank_x = update_x%
recv(ind_x)%
pe - domain%
pe 724 if(rank_x .LE.0) rank_x = rank_x + nlist
730 case(CGRID_NE, CGRID_SW)
731 if(cur_rank == rank_y) then
732 do
n = update_y%
recv(ind_y)%count, 1, -1
733 dir = update_y%
recv(ind_y)%dir(
n)
735 tMe = update_y%
recv(ind_y)%tileMe(
n)
741 do l=1,l_size ! loop over number of
fields 742 ptr_fieldx = f_addrsx(l, tMe)
743 ptr_fieldy = f_addrsy(l, tMe)
748 fieldy(
i,
j,
k) = buffer(
pos)
756 if(ind_y .GT. 0) then
757 rank_y = update_y%
recv(ind_y)%
pe - domain%
pe 758 if(rank_y .LE.0) rank_y = rank_y + nlist
763 if(cur_rank == rank_x) then
764 do
n = update_x%
recv(ind_x)%count, 1, -1
765 dir = update_x%
recv(ind_x)%dir(
n)
767 tMe = update_x%
recv(ind_x)%tileMe(
n)
773 do l=1,l_size ! loop over number of
fields 774 ptr_fieldx = f_addrsx(l, tMe)
775 ptr_fieldy = f_addrsy(l, tMe)
780 fieldx(
i,
j,
k) = buffer(
pos)
788 if(ind_x .GT. 0) then
789 rank_x = update_x%
recv(ind_x)%
pe - domain%
pe 790 if(rank_x .LE.0) rank_x = rank_x + nlist
796 cur_rank =
min(rank_x, rank_y)
800 ! ---northern boundary fold
802 if(domain%symmetry) shift = 1
803 if( BTEST(domain%fold,NORTH) .AND. (.NOT.BTEST(
update_flags,SCALAR_BIT)) )then
804 isd = domain%x(1)%compute%
begin - update_x%whalo;
805 ied = domain%x(1)%compute%
end + update_x%ehalo;
806 jsd = domain%y(1)%compute%
begin - update_y%shalo;
807 jed = domain%y(1)%compute%
end + update_y%nhalo;
810 if(
jsd .LE.
j .AND.
j.LE.
jed+shift )then !fold
is within domain
811 !poles
set to 0: BGRID only
812 if( gridtype.EQ.BGRID_NE )then
816 if( .NOT. domain%symmetry )
is =
is - 1
817 do
i =
is ,
ie, midpoint
820 ptr_fieldx = f_addrsx(l, 1)
821 ptr_fieldy = f_addrsy(l, 1)
831 ! the following code code block correct an
error where the data in your halo coming from
832 ! other
half may have the wrong sign
836 select
case(gridtype)
838 if(domain%symmetry) then
844 if( 2*
is-domain%x(1)%data%
begin.GT.domain%x(1)%data%
end+shift ) &
847 ptr_fieldx = f_addrsx(l, 1)
848 ptr_fieldy = f_addrsy(l, 1)
860 if( 2*
is-domain%x(1)%data%
begin-1.GT.domain%x(1)%data%
end ) &
863 ptr_fieldy = f_addrsy(l, 1)
866 fieldy(
i,
j,
k) = fieldy(2*
is-
i-1,
j,
k)
879 select
case(gridtype)
884 ptr_fieldx = f_addrsx(l, 1)
885 ptr_fieldy = f_addrsy(l, 1)
888 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
889 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
895 ptr_fieldy = f_addrsy(l, 1)
898 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
905 else
if( BTEST(domain%fold,SOUTH) .AND. (.NOT.BTEST(
update_flags,SCALAR_BIT)) )then ! ---southern boundary fold
906 ! NOTE: symmetry
is assumed for fold-
south boundary
908 if( domain%y(1)%data%
begin.LE.
j .AND.
j.LE.domain%y(1)%data%
end+shift )then !fold
is within domain
910 !poles
set to 0: BGRID only
911 if( gridtype.EQ.BGRID_NE )then
914 do
i =
is ,
ie, midpoint
915 if( domain%x(1)%data%
begin.LE.
i .AND.
i.LE. domain%x(1)%data%
end+shift )then
917 ptr_fieldx = f_addrsx(l, 1)
918 ptr_fieldy = f_addrsy(l, 1)
928 ! the following code code block correct an
error where the data in your halo coming from
929 ! other
half may have the wrong sign
933 select
case(gridtype)
938 if( 2*
is-domain%x(1)%data%
begin.GT.domain%x(1)%data%
end+shift ) &
941 ptr_fieldx = f_addrsx(l, 1)
942 ptr_fieldy = f_addrsy(l, 1)
954 if( 2*
is-domain%x(1)%data%
begin-1.GT.domain%x(1)%data%
end ) &
957 ptr_fieldy = f_addrsy(l, 1)
960 fieldy(
i,
j,
k) = fieldy(2*
is-
i-1,
j,
k)
971 ie = domain%x(1)%data%
end 973 select
case(gridtype)
978 ptr_fieldx = f_addrsx(l, 1)
979 ptr_fieldy = f_addrsy(l, 1)
982 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
983 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
989 ptr_fieldy = f_addrsy(l, 1)
992 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
999 else
if( BTEST(domain%fold,WEST) .AND. (.NOT.BTEST(
update_flags,SCALAR_BIT)) )then ! ---eastern boundary fold
1000 ! NOTE: symmetry
is assumed for fold-
west boundary
1002 if( domain%x(1)%data%
begin.LE.
i .AND.
i.LE.domain%x(1)%data%
end+shift )then !fold
is within domain
1004 !poles
set to 0: BGRID only
1005 if( gridtype.EQ.BGRID_NE )then
1008 do
j =
js ,
je, midpoint
1009 if( domain%y(1)%data%
begin.LE.
j .AND.
j.LE. domain%y(1)%data%
end+shift )then
1011 ptr_fieldx = f_addrsx(l, 1)
1012 ptr_fieldy = f_addrsy(l, 1)
1022 ! the following code code block correct an
error where the data in your halo coming from
1023 ! other
half may have the wrong sign
1027 select
case(gridtype)
1032 if( 2*
js-domain%y(1)%data%
begin.GT.domain%y(1)%data%
end+shift ) &
1035 ptr_fieldx = f_addrsx(l, 1)
1036 ptr_fieldy = f_addrsy(l, 1)
1048 if( 2*
js-domain%y(1)%data%
begin-1.GT.domain%y(1)%data%
end ) &
1051 ptr_fieldx = f_addrsx(l, 1)
1054 fieldx(
i,
j,
k) = fieldx(
i, 2*
js-
j-1,
k)
1064 if(domain%y(1)%
cyclic .AND.
js.LT.domain%y(1)%data%
end )then
1065 je = domain%y(1)%data%
end 1067 select
case(gridtype)
1072 ptr_fieldx = f_addrsx(l, 1)
1073 ptr_fieldy = f_addrsy(l, 1)
1076 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
1077 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
1083 ptr_fieldx = f_addrsx(l, 1)
1086 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
1093 else
if( BTEST(domain%fold,EAST) .AND. (.NOT.BTEST(
update_flags,SCALAR_BIT)) )then ! ---eastern boundary fold
1094 ! NOTE: symmetry
is assumed for fold-
west boundary
1096 if( domain%x(1)%data%
begin.LE.
i .AND.
i.LE.domain%x(1)%data%
end+shift )then !fold
is within domain
1098 !poles
set to 0: BGRID only
1099 if( gridtype.EQ.BGRID_NE )then
1102 do
j =
js ,
je, midpoint
1103 if( domain%y(1)%data%
begin.LE.
j .AND.
j.LE. domain%y(1)%data%
end+shift )then
1105 ptr_fieldx = f_addrsx(l, 1)
1106 ptr_fieldy = f_addrsy(l, 1)
1116 ! the following code code block correct an
error where the data in your halo coming from
1117 ! other
half may have the wrong sign
1121 select
case(gridtype)
1126 if( 2*
js-domain%y(1)%data%
begin.GT.domain%y(1)%data%
end+shift ) &
1129 ptr_fieldx = f_addrsx(l, 1)
1130 ptr_fieldy = f_addrsy(l, 1)
1142 if( 2*
js-domain%y(1)%data%
begin-1.GT.domain%y(1)%data%
end ) &
1145 ptr_fieldx = f_addrsx(l, 1)
1148 fieldx(
i,
j,
k) = fieldx(
i, 2*
js-
j-1,
k)
1158 if(domain%y(1)%
cyclic .AND.
js.LT.domain%y(1)%data%
end )then
1159 je = domain%y(1)%data%
end 1161 select
case(gridtype)
1166 ptr_fieldx = f_addrsx(l, 1)
1167 ptr_fieldy = f_addrsy(l, 1)
1170 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
1171 fieldy(
i,
j,
k) = -fieldy(
i,
j,
k)
1177 ptr_fieldx = f_addrsx(l, 1)
1180 fieldx(
i,
j,
k) = -fieldx(
i,
j,
k)
1190 call mpp_sync_self( )
1195 end subroutine MPP_DO_UPDATE_3D_V_
integer mpp_domains_stack_hwm
real(fp), parameter, public half
************************************************************************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
l_size ! loop over number of fields ke do je do 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:! ***********************************************************************subroutine MPP_WRITE_UNLIMITED_AXIS_1D_(unit, field, domain, data, nelems_io) integer, intent(in) ::unit type(fieldtype), intent(inout) ::field type(domain2D), intent(inout) ::domain MPP_TYPE_, intent(inout) ::data(:) integer, intent(in) ::nelems_io(:) ! number of compressed elements from each ! member of the io_domain. It MUST have the ! same order as the io_domain pelist. integer, allocatable ::pelist(:) integer ::i, j, nelems, npes type(domain2d), pointer ::io_domain=> allocatable
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
integer(long), parameter true
type(field_mgr_type), dimension(max_fields), private fields
*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 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 j
integer, parameter, public west
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
l_size ! loop over number of fields ke do je do ie to to_pe
character(len=128) version
l_size ! loop over number of fields ke do je do ie to is
integer, parameter, public global
************************************************************************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
l_size ! loop over number of fields ke do je do ie to je msgsize
************************************************************************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
integer, parameter, public east
integer mpp_domains_stack_size
real(fvprc) function, dimension(size(a, 1), size(a, 2)) reverse(A)
logical function received(this, seqno)
logical debug_message_passing
*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_flags
************************************************************************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)
integer, parameter, public north
************************************************************************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
integer, parameter, public cyclic
l_size ! loop over number of fields ke do je do ie pos
integer, parameter, public order
integer, parameter, public south
l_size ! loop over number of fields ke do je do ie to js
************************************************************************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) MPP_BROADCAST begin