18 implicit real*8 (a-h,o-z)
19 integer(kind=kint),
dimension(:),
allocatable :: WR, WS
20 integer(kind=kint),
dimension(:),
allocatable :: IW1, IW2
21 integer(kind=kint),
dimension(:),
allocatable :: IW3, IW4
23 type (hecmwST_local_mesh) :: hecMESH
30 hecmesh%n_adapt_elem_cur= hecmesh%n_elem
31 hecmesh%n_adapt_elem_old= hecmesh%n_elem
33 hecmesh%n_adapt_elem_341_cur= hecmesh%n_adapt_elem_341
34 hecmesh%n_adapt_elem_351_cur= hecmesh%n_adapt_elem_351
38 allocate (hecmesh%adapt_children_local(8*hecmesh%ne_array))
39 hecmesh%adapt_children_local= 0
48 & hecmesh%n_adapt_elem_341_cur)
50 & hecmesh%n_adapt_elem_351_cur)
58 hecmesh%n_elem = hecmesh%n_adapt_elem_cur
59 hecmesh%n_adapt_elem_341= hecmesh%n_adapt_elem_341_cur
60 hecmesh%n_adapt_elem_351= hecmesh%n_adapt_elem_351_cur
68 nnn1= hecmesh%ne_internal + icoun
70 call mpi_allreduce (hecmesh%ne_internal, iceltotg_old, 1, &
71 & mpi_integer, mpi_sum, hecmesh%MPI_COMM, ierr)
72 call mpi_allreduce (nnn1 , iceltotg_cur, 1, &
73 & mpi_integer, mpi_sum, hecmesh%MPI_COMM, ierr)
75 if (hecmesh%my_rank.eq.0)
then
76 write (*,
'(" total cell number (before)", i8 )') iceltotg_old
77 write (*,
'(" total cell number (curr. )", i8,/)') iceltotg_cur
86 len= max(hecmesh%n_adapt_elem_old, &
87 & hecmesh%adapt_import_elem_index(hecmesh%n_neighbor_pe), &
88 & hecmesh%adapt_export_elem_index(hecmesh%n_neighbor_pe))
92 do icel= 1, hecmesh%n_adapt_elem_old
93 ityp = hecmesh%adapt_type (icel)
94 is = hecmesh%adapt_children_index(icel-1)
105 if (hecmesh%elem_type(icel).eq.341)
then
107 iw1(8*icel-7)= hecmesh%adapt_children_item(2*is1-1)
108 iw1(8*icel-6)= hecmesh%adapt_children_item(2*is2-1)
110 iw1(8*icel-5)= hecmesh%adapt_children_item(2*is3-1)
111 iw1(8*icel-4)= hecmesh%adapt_children_item(2*is4-1)
113 iw1(8*icel-3)= hecmesh%adapt_children_item(2*is5-1)
114 iw1(8*icel-2)= hecmesh%adapt_children_item(2*is6-1)
115 iw1(8*icel-1)= hecmesh%adapt_children_item(2*is7-1)
116 iw1(8*icel )= hecmesh%adapt_children_item(2*is8-1)
123 if (hecmesh%elem_type(icel).eq.351)
then
125 iw1(8*icel-7)= hecmesh%adapt_children_item(2*is1-1)
126 iw1(8*icel-6)= hecmesh%adapt_children_item(2*is2-1)
128 iw1(8*icel-5)= hecmesh%adapt_children_item(2*is3-1)
129 iw1(8*icel-4)= hecmesh%adapt_children_item(2*is4-1)
135 allocate (ws(8*len), wr(8*len))
139 & ( len, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
140 & hecmesh%adapt_import_elem_index, &
141 & hecmesh%adapt_import_elem_item , &
142 & hecmesh%adapt_export_elem_index, &
143 & hecmesh%adapt_export_elem_item , &
144 & ws, wr, iw1, hecmesh%MPI_COMM, hecmesh%my_rank, 8, len)
147 do icel= 1, hecmesh%n_adapt_elem_old
148 ityp = hecmesh%adapt_type (icel)
149 is = hecmesh%adapt_children_index(icel-1)
158 if (ityp.ne.0 .and. &
159 & hecmesh%elem_ID(2*icel).ne.hecmesh%my_rank)
then
162 if (hecmesh%elem_type(icel).eq.341)
then
163 hecmesh%adapt_children_item(2*is1-1)= iw1(8*icel-7)
164 hecmesh%adapt_children_item(2*is2-1)= iw1(8*icel-6)
166 hecmesh%adapt_children_item(2*is3-1)= iw1(8*icel-5)
167 hecmesh%adapt_children_item(2*is4-1)= iw1(8*icel-4)
169 hecmesh%adapt_children_item(2*is5-1)= iw1(8*icel-3)
170 hecmesh%adapt_children_item(2*is6-1)= iw1(8*icel-2)
171 hecmesh%adapt_children_item(2*is7-1)= iw1(8*icel-1)
172 hecmesh%adapt_children_item(2*is8-1)= iw1(8*icel )
178 if (hecmesh%elem_type(icel).eq.351)
then
179 hecmesh%adapt_children_item(2*is1-1)= iw1(8*icel-7)
180 hecmesh%adapt_children_item(2*is2-1)= iw1(8*icel-6)
182 hecmesh%adapt_children_item(2*is3-1)= iw1(8*icel-5)
183 hecmesh%adapt_children_item(2*is4-1)= iw1(8*icel-4)
190 allocate (iw1(len*8))
192 do icel= 1, hecmesh%n_adapt_elem_old
193 ityp= hecmesh%adapt_type(icel)
194 is= hecmesh%adapt_children_index(icel-1)
205 if (hecmesh%elem_type(icel).eq.341)
then
207 iw1(8*icel-7)= hecmesh%adapt_children_item(2*is1)
208 iw1(8*icel-6)= hecmesh%adapt_children_item(2*is2)
210 iw1(8*icel-5)= hecmesh%adapt_children_item(2*is3)
211 iw1(8*icel-4)= hecmesh%adapt_children_item(2*is4)
213 iw1(8*icel-3)= hecmesh%adapt_children_item(2*is5)
214 iw1(8*icel-2)= hecmesh%adapt_children_item(2*is6)
215 iw1(8*icel-1)= hecmesh%adapt_children_item(2*is7)
216 iw1(8*icel )= hecmesh%adapt_children_item(2*is8)
223 if (hecmesh%elem_type(icel).eq.351)
then
225 iw1(8*icel-7)= hecmesh%adapt_children_item(2*is1)
226 iw1(8*icel-6)= hecmesh%adapt_children_item(2*is2)
228 iw1(8*icel-5)= hecmesh%adapt_children_item(2*is3)
229 iw1(8*icel-4)= hecmesh%adapt_children_item(2*is4)
235 allocate (ws(8*len), wr(8*len))
239 & ( len, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
240 & hecmesh%adapt_import_elem_index, &
241 & hecmesh%adapt_import_elem_item , &
242 & hecmesh%adapt_export_elem_index, &
243 & hecmesh%adapt_export_elem_item , &
244 & ws, wr, iw1, hecmesh%MPI_COMM, hecmesh%my_rank, 8, len)
247 do icel= 1, hecmesh%n_adapt_elem_old
248 ityp= hecmesh%adapt_type(icel)
249 is= hecmesh%adapt_children_index(icel-1)
258 if (ityp.ne.0 .and. &
259 & hecmesh%elem_ID(2*icel) .ne. hecmesh%my_rank)
then
262 if (hecmesh%elem_type(icel).eq.341)
then
263 hecmesh%adapt_children_item(2*is1)= iw1(8*icel-7)
264 hecmesh%adapt_children_item(2*is2)= iw1(8*icel-6)
266 hecmesh%adapt_children_item(2*is3)= iw1(8*icel-5)
267 hecmesh%adapt_children_item(2*is4)= iw1(8*icel-4)
269 hecmesh%adapt_children_item(2*is5)= iw1(8*icel-3)
270 hecmesh%adapt_children_item(2*is6)= iw1(8*icel-2)
271 hecmesh%adapt_children_item(2*is7)= iw1(8*icel-1)
272 hecmesh%adapt_children_item(2*is8)= iw1(8*icel )
279 if (hecmesh%elem_type(icel).eq.351)
then
280 hecmesh%adapt_children_item(2*is1)= iw1(8*icel-7)
281 hecmesh%adapt_children_item(2*is2)= iw1(8*icel-6)
283 hecmesh%adapt_children_item(2*is3)= iw1(8*icel-5)
284 hecmesh%adapt_children_item(2*is4)= iw1(8*icel-4)
297 deallocate (hecmesh%elem_internal_list)
299 do icel= 1, hecmesh%n_elem
300 if (hecmesh%elem_ID(2*icel).eq.hecmesh%my_rank) icou= icou + 1
303 hecmesh%ne_internal= icou
304 allocate (hecmesh%elem_internal_list(icou))
306 do icel= 1, hecmesh%n_elem
307 if (hecmesh%elem_ID(2*icel).eq.hecmesh%my_rank)
then
309 hecmesh%elem_internal_list(icou)= icel
319 allocate (hecmesh%adapt_OLDtoNEW_elem(hecmesh%n_elem))
320 allocate (hecmesh%adapt_NEWtoOLD_elem(hecmesh%n_elem))
321 allocate (iw2(hecmesh%n_elem))
322 allocate (iw3(hecmesh%n_elem))
323 hecmesh%adapt_OLDtoNEW_elem= 0
324 hecmesh%adapt_NEWtoOLD_elem= 0
331 do icel= 1, hecmesh%n_elem
332 ityp= hecmesh%elem_type(icel)
333 if (ityp.eq.341)
then
334 icou_341= icou_341 + 1
339 do icel= 1, hecmesh%n_elem
340 ityp= hecmesh%elem_type(icel)
341 if (ityp.eq.351)
then
342 icou_351= icou_351 + 1
343 iw3(icou_341+icou_351)= icel
347 do ic0= 1, hecmesh%n_elem
349 hecmesh%adapt_OLDtoNEW_elem(icel)= ic0
350 hecmesh%adapt_NEWtoOLD_elem(ic0 )= icel
353 hecmesh%elem_type_index(1)= icou_341
354 hecmesh%elem_type_index(2)= icou_341 + icou_351
356 deallocate (iw2, iw3)
subroutine hecmw_adapt_new_cell(hecMESH)
Adaptive Mesh Refinement.
subroutine hecmw_adapt_new_cell_341(hecMESH, icouN)
Adaptive Mesh Refinement.
subroutine hecmw_adapt_new_cell_351(hecMESH, icouN)
Adaptive Mesh Refinement.
Adaptive Mesh Refinement.
subroutine hecmw_adapt_int_send_recv(N, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank, NB, m)