43
44
45
49 USE intbufdef_mod
52
53
54
55 USE spmd_comm_world_mod, ONLY : spmd_comm_world
56#include "implicit_f.inc"
57
58
59
60#include "spmd.inc"
61
62
63
64#include "com01_c.inc"
65#include "com04_c.inc"
66#include "param_c.inc"
67#include "task_c.inc"
68
69
70
71 INTEGER , INTENT(IN) ::
72 . NBINTC,ISLEN7, IRLEN7,IRLEN7T, ISLEN7T,
73 . IRLEN20, ISLEN20, IRLEN20T, ISLEN20T,
74 . IPARI(NPARI,NINTER), INTLIST()
75 TYPE(INTBUF_STRUCT_),INTENT(IN) :: INTBUF_TAB(NINTER)
76 TYPE(H3D_DATABASE), INTENT(IN) :: H3D_DATA
77
78
79
80#ifdef MPI
81 INTEGER P, L, ADD, LL, NB, LEN, SIZ, KFI, LOC_PROC, MULTIMP, II,
82 . NIN, IDEB, N, MSGTYP, IERROR, NI, NOD, I,
83 . NTY, IALLOCS, IALLOCR, MSGOFF,INTERFRIC,
84 . STATUS(MPI_STATUS_SIZE),DEBUT(NINTER),
85 . ADDS(NSPMD+1), ADDR(NSPMD+1),
86 . REQ_SI(NSPMD),REQ_RI(NSPMD),INTCOMM(NBINTC)
87 DATA msgoff/190/
88 LOGICAL ITEST
89 my_real ,
DIMENSION(:),
ALLOCATABLE :: bbufs, bbufr
90 LOGICAL :: IS_EFRIC_COM_NEEDED
91
92
93
94 loc_proc = ispmd + 1
95
96 len = 3
97
98
99
100 is_efric_com_needed = .false.
101 intcomm(1:nbintc) = 0
102 DO ii = 1, nbintc
103 nin = intlist(ii)
104 nty = ipari(7,nin)
105 IF(nty==7.OR.nty==24.OR.nty==25) THEN
106 interfric = h3d_data%N_CSE_FRIC_INTER(nin)
107 IF(h3d_data%N_SCAL_CSE_FRIC > 0) THEN
108 intcomm(ii) = 1
109 is_efric_com_needed = .true.
110 ELSEIF(interfric > 0)THEN
111 intcomm(ii) = 1
112 is_efric_com_needed = .true.
113 ENDIF
114 ENDIF
115 debut(nin) = 0
116 ENDDO
117
118 IF(is_efric_com_needed) THEN
119
121 ierror=0
122 IF(iallocs>0)
123 + ALLOCATE(bbufs(iallocs+nbintc*nspmd),stat=ierror)
124 IF(ierror/=0) THEN
125 CALL ancmsg(msgid=20,anmode=aninfo)
127 END IF
129 ierror=0
130 IF(iallocr>0)
131 + ALLOCATE(bbufr(iallocr+nbintc*nspmd),stat=ierror)
132 IF(ierror/=0) THEN
133 CALL ancmsg(msgid=20,anmode=aninfo)
135 END IF
136
137
138
139 l = 0
140 DO p = 1, nspmd
141 add = l+1
142 addr(p) = add
143 siz = 0
144 IF(p/=loc_proc)THEN
145 DO ii = 1, nbintc
146 nin = intlist(ii)
148 IF(intcomm(ii) > 0 ) THEN
149 IF(nb>0) THEN
150 l = l + 1 + nb*len
151 ENDIF
152 ENDIF
153 ENDDO
154 siz = l+1-add
155 IF(siz>0)THEN
156 msgtyp = msgoff
158 . bbufr(add),siz,real ,it_spmd(p),msgtyp,
159 . spmd_comm_world,req_ri(p),ierror )
160 ENDIF
161 ENDIF
162 ENDDO
163 addr(nspmd+1) = addr(nspmd)+siz
164
165
166
167 l = 0
168 DO p = 1, nspmd
169 add = l+1
170 adds(p) = add
171 siz = 0
172 IF(p/=loc_proc)THEN
173 DO ii = 1, nbintc
174 nin = intlist(ii)
175 ideb = debut(nin)
177 interfric
178 IF(intcomm(ii) > 0) THEN
179 IF(nb>0) THEN
180 ll = l+1
181 l = l + 1
182 DO n = 1, nb
183 bbufs(l+1) = abs(
nsvfi(nin)%P(ideb+n))
184 IF(interfric>0) THEN
185 bbufs(l+2) =
efricfi(nin)%P(ideb+n)
187 ELSE
188 bbufs(l+2) = zero
189 ENDIF
190 IF(h3d_data%N_SCAL_CSE_FRIC>0) THEN
191 bbufs(l+3) =
efricgfi(nin)%P(ideb+n)
193 ELSE
194 bbufs(l+3) = zero
195 ENDIF
196 l = l + len
197 ENDDO
198 bbufs(ll) = (l-ll)/len
199 debut(nin) = debut(nin) + nb
200 END IF
201 END IF
202 ENDDO
203 siz = l+1-add
204 IF(siz>0)THEN
205 msgtyp = msgoff
207 . bbufs(add),siz,real ,it_spmd(p),msgtyp,
208 . spmd_comm_world,req_si(p),ierror )
209 ENDIF
210 ENDIF
211 ENDDO
212 adds(nspmd+1)=adds(nspmd)+siz
213
214
215
216
217 DO p = 1, nspmd
218 IF(addr(p+1)-addr(p)>0) THEN
219 CALL mpi_wait(req_ri(p),status,ierror)
220 l = addr(p)
221 DO ii = 1, nbintc
222 nin = intlist(ii)
223 IF(
nsnsi(nin)%P(p)>0)
THEN
224 interfric = h3d_data%N_CSE_FRIC_INTER(nin)
225 IF(intcomm(ii) > 0) THEN
226 nb = nint(bbufr(l))
227 l = l + 1
228 DO i = 1, nb
229 n = nint(bbufr(l+len*(i-1)))
230 nod = intbuf_tab(nin)%NSV(n)
231 IF(nod<=numnod)THEN
232 IF(interfric>0) efric(interfric,nod)= efric(interfric,nod)+ bbufr(l+len*(i-1)+1)
233 IF(h3d_data%N_SCAL_CSE_FRIC>0) efricg(nod)= efricg(nod)+ bbufr(l+len*(i-1)+2)
234 ENDIF
235 ENDDO
236 l = l + nb*len
237 END IF
238 ENDIF
239 ENDDO
240 ENDIF
241 ENDDO
242
243 IF(iallocr>0) THEN
244 DEALLOCATE(bbufr)
245 END IF
246
247
248
249 DO p = 1, nspmd
250 IF(adds(p+1)-adds(p)>0) THEN
251 CALL mpi_wait(req_si(p),status,ierror)
252 ENDIF
253 ENDDO
254
255 IF(iallocs>0) THEN
256 DEALLOCATE(bbufs)
257 END IF
258
259 ENDIF
260
261#endif
262 RETURN
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
subroutine mpi_wait(ireq, status, ierr)
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
type(real_pointer), dimension(:), allocatable efricgfi
type(int_pointer), dimension(:), allocatable nsnsi
type(int_pointer), dimension(:), allocatable nsvfi
type(real_pointer), dimension(:), allocatable efricfi
type(int_pointer), dimension(:), allocatable nsnfi
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)