16 type (hecmwST_local_mesh) :: hecMESH
18 integer(kind=kint),
pointer :: WORKaI(:)
19 real(kind=
kreal),
pointer :: workar(:)
29 if (hecmesh%n_elem_mat_ID.ne.hecmesh%n_elem) &
38 call mpi_barrier (hecmesh%MPI_COMM, ierr)
39 write (*,
'(a,i5,4i8)')
'PE#', hecmesh%my_rank, &
40 & hecmesh%n_node, hecmesh%nn_internal, &
41 & hecmesh%n_elem, hecmesh%ne_internal
43 hecmesh%nn_array= 9 * hecmesh%n_node + 1
44 hecmesh%ne_array= 9 * hecmesh%n_elem + 1
45 hecmesh%nx_array= max(hecmesh%nn_array,hecmesh%ne_array)
47 if (hecmesh%hecmw_flag_adapt.eq.0)
then
48 allocate (hecmesh%when_i_was_refined_node (hecmesh%nn_array))
49 allocate (hecmesh%when_i_was_refined_elem (hecmesh%ne_array))
51 allocate (hecmesh%adapt_parent (2*hecmesh%ne_array))
52 allocate (hecmesh%adapt_parent_type ( hecmesh%ne_array))
53 allocate (hecmesh%adapt_type ( hecmesh%ne_array))
54 allocate (hecmesh%adapt_level ( hecmesh%ne_array))
56 allocate (hecmesh%adapt_children_item (2*8*hecmesh%ne_array))
57 allocate (hecmesh%adapt_children_index (0:hecmesh%ne_array))
59 hecmesh%when_i_was_refined_node= 0
60 hecmesh%when_i_was_refined_elem= 0
62 hecmesh%adapt_parent = 0
63 hecmesh%adapt_parent_type = 0
64 hecmesh%adapt_type = 0
65 hecmesh%adapt_level = 0
67 hecmesh%adapt_children_item = 0
68 hecmesh%adapt_children_index= 0
70 do icel= 1, hecmesh%n_elem
71 hecmesh%adapt_parent ( 2*icel)= -1
72 hecmesh%adapt_children_index( icel)= 8 * icel
75 hecmesh%adapt_children_item (is+ 2)= -1
76 hecmesh%adapt_children_item (is+ 4)= -1
77 hecmesh%adapt_children_item (is+ 6)= -1
78 hecmesh%adapt_children_item (is+ 8)= -1
79 hecmesh%adapt_children_item (is+10)= -1
80 hecmesh%adapt_children_item (is+12)= -1
81 hecmesh%adapt_children_item (is+14)= -1
82 hecmesh%adapt_children_item (is+16)= -1
95 allocate (workar(3*hecmesh%n_node))
96 do i= 1, hecmesh%n_node
97 workar(3*i-2)= hecmesh%node(3*i-2)
98 workar(3*i-1)= hecmesh%node(3*i-1)
99 workar(3*i )= hecmesh%node(3*i )
102 deallocate (hecmesh%node)
103 allocate (hecmesh%node(3*hecmesh%nn_array))
105 do i= 1, hecmesh%n_node
106 hecmesh%node(3*i-2)= workar(3*i-2)
107 hecmesh%node(3*i-1)= workar(3*i-1)
108 hecmesh%node(3*i )= workar(3*i )
114 allocate (workai(2*hecmesh%n_node))
115 do i= 1, hecmesh%n_node
116 workai(2*i-1)= hecmesh%node_ID(2*i-1)
117 workai(2*i )= hecmesh%node_ID(2*i )
120 deallocate (hecmesh%node_ID)
121 allocate (hecmesh%node_ID(2*hecmesh%nn_array))
123 do i= 1, hecmesh%n_node
124 hecmesh%node_ID(2*i-1)= workai(2*i-1)
125 hecmesh%node_ID(2*i )= workai(2*i )
131 allocate (workai(hecmesh%n_node))
132 do i= 1, hecmesh%n_node
133 workai(i)= hecmesh%global_node_ID(i)
136 deallocate (hecmesh%global_node_ID)
137 allocate (hecmesh%global_node_ID(hecmesh%nn_array))
138 hecmesh%global_node_ID= 0
139 do i= 1, hecmesh%n_node
140 hecmesh%global_node_ID(i)= workai(i)
153 allocate (workai(2*hecmesh%n_elem))
154 do i= 1, hecmesh%n_elem
155 workai(2*i-1)= hecmesh%elem_type (i)
156 workai(2*i )= hecmesh%section_ID(i)
159 deallocate (hecmesh%elem_type, hecmesh%section_ID)
160 allocate (hecmesh%elem_type (hecmesh%ne_array))
161 allocate (hecmesh%section_ID(hecmesh%ne_array))
162 hecmesh%elem_type = 0
163 hecmesh%section_ID= 0
164 do i= 1, hecmesh%n_elem
165 hecmesh%elem_type (i)= workai(2*i-1)
166 hecmesh%section_ID(i)= workai(2*i )
170 allocate (workai(hecmesh%n_elem))
171 do i= 1, hecmesh%n_elem
172 workai(i)= hecmesh%global_elem_ID(i)
175 deallocate (hecmesh%global_elem_ID)
176 allocate (hecmesh%global_elem_ID(hecmesh%ne_array))
177 hecmesh%global_elem_ID= 0
178 do i= 1, hecmesh%n_elem
179 hecmesh%global_elem_ID(i)= workai(i)
185 allocate (workai(2*hecmesh%n_elem))
186 do i= 1, hecmesh%n_elem
187 workai(2*i-1)= hecmesh%elem_ID(2*i-1)
188 workai(2*i )= hecmesh%elem_ID(2*i )
191 deallocate (hecmesh%elem_ID)
192 allocate (hecmesh%elem_ID(2*hecmesh%ne_array))
194 do i= 1, hecmesh%n_elem
195 hecmesh%elem_ID(2*i-1)= workai(2*i-1)
196 hecmesh%elem_ID(2*i )= workai(2*i )
202 allocate (workai(hecmesh%n_elem))
203 do i= 1, hecmesh%n_elem
204 workai(i)= hecmesh%elem_node_index(i)
207 deallocate (hecmesh%elem_node_index)
208 allocate (hecmesh%elem_node_index(0:hecmesh%ne_array))
209 hecmesh%elem_node_index= 0
210 do i= 1, hecmesh%n_elem
211 hecmesh%elem_node_index (i)= workai(i)
217 nnn= hecmesh%elem_node_index(hecmesh%n_elem)
218 allocate (workai(nnn))
220 workai(i)= hecmesh%elem_node_item(i)
223 deallocate (hecmesh%elem_node_item)
224 allocate (hecmesh%elem_node_item(6*hecmesh%ne_array))
225 hecmesh%elem_node_item= 0
227 hecmesh%elem_node_item (i)= workai(i)
233 allocate (workai(hecmesh%n_elem))
234 do i= 1, hecmesh%n_elem
235 workai(i)= hecmesh%elem_mat_ID_index(i)
238 deallocate (hecmesh%elem_mat_ID_index)
239 allocate (hecmesh%elem_mat_ID_index(0:hecmesh%ne_array))
240 hecmesh%elem_mat_ID_index= 0
242 hecmesh%elem_mat_ID_index (i)= i
249 allocate (workai(nnn))
251 workai(i)= hecmesh%elem_mat_ID_item(i)
254 deallocate (hecmesh%elem_mat_ID_item)
255 allocate (hecmesh%elem_mat_ID_item(hecmesh%ne_array*nnn/hecmesh%n_elem))
256 hecmesh%elem_mat_ID_item= 0
258 hecmesh%elem_mat_ID_item (i)= workai(i)
263 if (hecmesh%hecmw_flag_adapt.eq.1)
then
272 allocate (workai(hecmesh%n_elem))
273 do i= 1, hecmesh%n_elem
274 workai(i)= hecmesh%when_i_was_refined_elem(i)
277 deallocate (hecmesh%when_i_was_refined_elem)
278 allocate (hecmesh%when_i_was_refined_elem(hecmesh%ne_array))
279 hecmesh%when_i_was_refined_elem= 0
280 do i= 1, hecmesh%n_elem
281 hecmesh%when_i_was_refined_elem(i)= workai(i)
285 allocate (workai(hecmesh%n_node))
286 do i= 1, hecmesh%n_node
287 workai(i)= hecmesh%when_i_was_refined_node(i)
290 deallocate (hecmesh%when_i_was_refined_node)
291 allocate (hecmesh%when_i_was_refined_node(hecmesh%nn_array))
292 hecmesh%when_i_was_refined_node= 0
293 do i= 1, hecmesh%n_node
294 hecmesh%when_i_was_refined_node(i)= workai(i)
301 allocate (workai(5*hecmesh%n_elem))
302 do i= 1, hecmesh%n_elem
303 workai(5*i-4)= hecmesh%adapt_parent (2*i-1)
304 workai(5*i-3)= hecmesh%adapt_parent (2*i )
305 workai(5*i-2)= hecmesh%adapt_parent_type( i)
306 workai(5*i-1)= hecmesh%adapt_type ( i)
307 workai(4*i )= hecmesh%adapt_level ( i)
310 deallocate (hecmesh%adapt_parent, hecmesh%adapt_parent_type)
311 deallocate (hecmesh%adapt_type , hecmesh%adapt_level )
313 allocate (hecmesh%adapt_parent (2*hecmesh%ne_array))
314 allocate (hecmesh%adapt_parent_type( hecmesh%ne_array))
315 allocate (hecmesh%adapt_type ( hecmesh%ne_array))
316 allocate (hecmesh%adapt_level ( hecmesh%ne_array))
317 hecmesh%adapt_parent = 0
318 hecmesh%adapt_parent_type= 0
319 hecmesh%adapt_type = 0
320 hecmesh%adapt_level = 0
322 do i= 1, hecmesh%n_elem
323 hecmesh%adapt_parent (2*i-1)= workai(5*i-4)
324 hecmesh%adapt_parent (2*i )= workai(5*i-3)
325 hecmesh%adapt_parent_type( i )= workai(5*i-2)
326 hecmesh%adapt_type ( i )= workai(5*i-1)
327 hecmesh%adapt_level ( i )= workai(5*i )
333 allocate (workai(hecmesh%n_elem))
334 do i= 1, hecmesh%n_elem
335 workai(i)= hecmesh%adapt_children_index(i)
338 deallocate (hecmesh%adapt_children_index)
339 allocate (hecmesh%adapt_children_index(0:hecmesh%ne_array))
340 hecmesh%adapt_children_index= 0
341 do i= 1, hecmesh%n_elem
342 hecmesh%adapt_children_index(i)= workai(i)
348 nnn= hecmesh%adapt_children_index(hecmesh%n_elem)
349 allocate (workai(2*nnn))
351 workai(2*i-1)= hecmesh%adapt_children_item(2*i-1)
352 workai(2*i )= hecmesh%adapt_children_item(2*i )
355 deallocate (hecmesh%adapt_children_item)
356 allocate (hecmesh%adapt_children_item(2*8*hecmesh%ne_array))
357 hecmesh%adapt_children_item= 0
359 hecmesh%adapt_children_item(2*i-1)= workai(2*i-1)
360 hecmesh%adapt_children_item(2*i )= workai(2*i )
366 hecmesh%hecmw_flag_adapt= 1
369 if (hecmesh%my_rank.eq.0)
write (*,
'(/,a)')
'#RE-ALLOCATE'
378 if (hecmesh%node_group%n_grp.ne.0)
then
379 if (hecmesh%node_group%grp_index(hecmesh%node_group%n_grp).ne.0)
then
380 nnn= hecmesh%node_group%grp_index(hecmesh%node_group%n_grp)
381 allocate (workai(nnn))
383 workai(i)= hecmesh%node_group%grp_item(i)
386 deallocate (hecmesh%node_group%grp_item)
387 allocate (hecmesh%node_group%grp_item(hecmesh%nx_array))
388 hecmesh%node_group%grp_item= 0
390 hecmesh%node_group%grp_item(i)= workai(i)
398 if (hecmesh%elem_group%n_grp.ne.0)
then
399 if (hecmesh%elem_group%grp_index(hecmesh%elem_group%n_grp).ne.0)
then
400 nnn= hecmesh%elem_group%grp_index(hecmesh%elem_group%n_grp)
401 allocate (workai(nnn))
403 workai(i)= hecmesh%elem_group%grp_item(i)
406 deallocate (hecmesh%elem_group%grp_item)
407 allocate (hecmesh%elem_group%grp_item(hecmesh%nx_array))
408 hecmesh%elem_group%grp_item= 0
410 hecmesh%elem_group%grp_item(i)= workai(i)
419 if (hecmesh%surf_group%n_grp.ne.0)
then
420 if (hecmesh%surf_group%grp_index(hecmesh%surf_group%n_grp).ne.0)
then
421 nnn= hecmesh%surf_group%grp_index(hecmesh%surf_group%n_grp)
422 allocate (workai(2*nnn))
424 workai(2*i-1)= hecmesh%surf_group%grp_item(2*i-1)
425 workai(2*i )= hecmesh%surf_group%grp_item(2*i )
428 deallocate (hecmesh%surf_group%grp_item)
429 allocate (hecmesh%surf_group%grp_item(2*hecmesh%nx_array))
430 hecmesh%surf_group%grp_item= 0
432 hecmesh%surf_group%grp_item(2*i-1)= workai(2*i-1)
433 hecmesh%surf_group%grp_item(2*i )= workai(2*i )
440 if (hecmesh%my_rank.eq.0)
write (*,
'(a)')
'#EDGE-INFO'
446 ne= max(hecmesh%n_node, hecmesh%n_elem)
449 allocate(hecmesh%adapt_edge_node(2*ne))
450 hecmesh%adapt_edge_node= 0
451 hecmesh%n_adapt_edge = 0
453 do icel= 1, hecmesh%n_elem
454 if (hecmesh%adapt_type(icel).eq.0)
then
455 ityp= hecmesh%elem_type(icel)
458 if (ityp.eq.341)
then
459 is = hecmesh%elem_node_index(icel-1)
460 in1= hecmesh%elem_node_item (is+1)
461 in2= hecmesh%elem_node_item (is+2)
462 in3= hecmesh%elem_node_item (is+3)
463 in4= hecmesh%elem_node_item (is+4)
475 if (ityp.eq.351)
then
476 is = hecmesh%elem_node_index(icel-1)
477 in1= hecmesh%elem_node_item (is+1)
478 in2= hecmesh%elem_node_item (is+2)
479 in3= hecmesh%elem_node_item (is+3)
480 in4= hecmesh%elem_node_item (is+4)
481 in5= hecmesh%elem_node_item (is+5)
482 in6= hecmesh%elem_node_item (is+6)
495 if (hecmesh%n_adapt_edge.ge.ne-6 .and. icel.lt.hecmesh%n_elem)
then
496 iii= hecmesh%n_elem/icel + 1
498 deallocate(hecmesh%adapt_edge_node)
506 call mpi_barrier (hecmesh%MPI_COMM, ierr)
508 allocate(hecmesh%adapt_IWK(hecmesh%n_adapt_edge))
513 hecmesh%n_adapt_elem_341= 0
514 hecmesh%n_adapt_elem_351= 0
516 do icel= 1, hecmesh%n_elem
517 ityp= hecmesh%elem_type(icel)
518 if (ityp.eq.341)
then
519 hecmesh%n_adapt_elem_341= hecmesh%n_adapt_elem_341 + 1
521 if (ityp.eq.351)
then
522 hecmesh%n_adapt_elem_351= hecmesh%n_adapt_elem_351 + 1