13 private :: l_contact2mpc, l_tied2mpc
15 logical,
private :: active
17 real(kind=kreal),
save ::
mu=1.d10
18 real(kind=kreal),
save ::
mut=1.d6
19 real(kind=kreal),
save ::
cdotp=1.d3
21 real(kind=kreal),
save ::
cgn=1.d-5
22 real(kind=kreal),
save ::
cgt=1.d-3
24 real(kind=kreal),
save ::
gnt(2)
33 integer(kind=kint),
intent(in) :: file
34 type( hecmwst_contact_pair ),
intent(in) :: pair
36 integer(kind=kint) :: i
37 write(file,*)
"Number of contact pair", pair%n_pair
39 write(file,*) trim(pair%name(i)), pair%type(i), pair%slave_grp_id(i) &
40 ,pair%master_grp_id(i), pair%slave_orisgrp_id(i)
45 real(kind=kreal),
intent(in) :: maxv
56 logical,
intent(in) :: a
61 integer(kind=kint),
intent(in) :: ctalgo
63 type (hecmwst_local_mesh),
intent(in) :: hecmesh
64 integer(kind=kint) :: is_conv
67 if( infoctchange%contact2free+infoctchange%contact2neighbor+ &
68 infoctchange%contact2difflpos+infoctchange%free2contact == 0 ) &
73 call hecmw_allreduce_i1(hecmesh, is_conv, hecmw_min)
74 if (is_conv == 0)
then
84 if( infoctchange%contact2free+infoctchange%contact2neighbor+infoctchange%free2contact > 0 ) &
89 subroutine l_contact2mpc( contact, mpcs, nmpc )
91 type(
tcontact ),
intent(in) :: contact
92 type( hecmwst_mpc ),
intent(inout) :: mpcs
93 integer(kind=kint),
intent(out) :: nmpc
94 integer(kind=kint),
parameter :: ndof = 3
95 real(kind=kreal),
parameter :: tol =1.d-10
96 integer(kind=kint) :: i, j, k, nn, csurf, nenode, etype, tdof
97 integer(kind=kint) :: nodes(l_max_surface_node*ndof+ndof), dofs(l_max_surface_node*ndof+ndof)
98 real(kind=kreal) :: values(l_max_surface_node*ndof+ndof+1),val(l_max_surface_node*ndof+ndof+1)
100 do i=1,
size(contact%states)
101 if( contact%states(i)%state == -1 ) cycle
102 csurf = contact%states(i)%surface
103 if( csurf<=0 ) stop
"error in contact state"
104 etype = contact%master(csurf)%etype
105 nenode =
size(contact%master(csurf)%nodes)
106 tdof = nenode*ndof+ndof
107 call contact2mpcval( contact%states(i), etype, nenode, values(1:tdof+1) )
110 if( dabs(values(j))<tol ) cycle
112 nodes(tdof) = contact%slave(i)
114 val(tdof) = values(j)
117 nn = contact%master(csurf)%nodes(j)
118 nodes( j*ndof+1:j*ndof+ndof ) = nn
120 if( dabs(values(j*ndof+k)) < tol ) cycle
124 val(tdof)=values(j*ndof+k)
127 val(tdof+1) = values(nenode*ndof+ndof+1)
129 call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), val(1:tdof+1), mpcs )
132 end subroutine l_contact2mpc
135 subroutine l_tied2mpc( contact, mpcs, nmpc )
137 type(
tcontact ),
intent(in) :: contact
138 type( hecmwst_mpc ),
intent(inout) :: mpcs
139 integer(kind=kint),
intent(out) :: nmpc
140 integer(kind=kint) :: i, j, csurf, nenode, etype, tdof
141 integer(kind=kint) :: nodes(l_max_surface_node+1), dofs(l_max_surface_node+1)
142 real(kind=kreal) :: values(l_max_surface_node+2)
144 do i=1,
size(contact%slave)
145 csurf = contact%states(i)%surface
147 nenode =
size(contact%master(csurf)%nodes)
149 nodes(1) = contact%slave(i)
150 nodes( 2:tdof ) = contact%master(csurf)%nodes(:)
152 values(2:tdof) = 1.d0
153 values(tdof+1) = 0.d0
154 etype = contact%master(csurf)%etype
157 call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), values(1:tdof+1), mpcs )
161 end subroutine l_tied2mpc
166 type( hecmwst_mpc ),
intent(inout) :: mpcs
167 integer(kind=kint) :: i, nmpc
169 do i=1,
size(contacts)
170 if( contacts(i)%algtype == contactunknown ) cycle
171 if( contacts(i)%algtype == contactfslid )
then
172 print *,
"Cannot deal with finit slip problems by MPC!"
175 if( contacts(i)%algtype == contactsslid )
then
176 call l_contact2mpc( contacts(i), mpcs, nmpc )
178 elseif( contacts(i)%algtype == contacttied )
then
179 call l_tied2mpc( contacts(i), mpcs, nmpc )
188 type( hecmwst_mpc ),
intent(inout) :: mpcs
194 integer(kind=kint),
intent(in) :: file
195 type( hecmwst_mpc ),
intent(in) :: mpcs
197 integer(kind=kint) :: i,j,n0,n1
198 write(file, *)
"Number of equation", mpcs%n_mpc
200 write(file,*)
"--Equation",i
201 n0=mpcs%mpc_index(i-1)+1
204 write(file,
'(30i5)') (mpcs%mpc_item(j),j=n0,n1)
205 write(file,
'(30i5)') (mpcs%mpc_dof(j),j=n0,n1)
206 write(file,
'(30f7.2)') (mpcs%mpc_val(j),j=n0,n1),mpcs%mpc_const(i)
211 subroutine fstr_scan_contact_state( cstep, sub_step, cont_step, dt, ctAlgo, hecMESH, fstrSOLID, infoCTChange, B )
212 integer(kind=kint),
intent(in) :: cstep
213 integer(kind=kint),
intent(in) :: sub_step
214 integer(kind=kint),
intent(in) :: cont_step
215 real(kind=kreal),
intent(in) ::
dt
216 integer(kind=kint),
intent(in) :: ctAlgo
217 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
221 real(kind=kreal),
optional :: b(:)
222 character(len=9) :: flag_ctAlgo
223 integer(kind=kint) :: i, grpid
224 logical :: iactive, is_init
226 if(
associated( fstrsolid%CONT_RELVEL ) ) fstrsolid%CONT_RELVEL(:) = 0.d0
227 if(
associated( fstrsolid%CONT_STATE ) ) fstrsolid%CONT_STATE(:) = 0.d0
230 flag_ctalgo =
'SLagrange'
232 flag_ctalgo =
'ALagrange'
237 do i = 1,
size(fstrsolid%unode)
238 fstrsolid%ddunode(i) = hecmesh%node(i) + fstrsolid%unode(i) + fstrsolid%dunode(i)
242 infoctchange%contact2free = 0
243 infoctchange%contact2neighbor = 0
244 infoctchange%contact2diffLpos = 0
245 infoctchange%free2contact = 0
246 infoctchange%contactNode_current = 0
248 is_init = ( cstep == 1 .and. sub_step == 1 .and. cont_step == 0 )
250 do i=1,fstrsolid%n_contacts
251 grpid = fstrsolid%contacts(i)%group
255 if(
present(b) )
then
256 call scan_contact_state( flag_ctalgo, fstrsolid%contacts(i), fstrsolid%ddunode(:), fstrsolid%dunode(:), &
257 & fstrsolid%QFORCE(:), infoctchange, hecmesh%global_node_ID(:), hecmesh%global_elem_ID(:), is_init, iactive,
mu, b )
259 call scan_contact_state( flag_ctalgo, fstrsolid%contacts(i), fstrsolid%ddunode(:), fstrsolid%dunode(:), &
260 & fstrsolid%QFORCE(:), infoctchange, hecmesh%global_node_ID(:), hecmesh%global_elem_ID(:), is_init, iactive,
mu )
262 if( .not. active ) active = iactive
265 do i=1,fstrsolid%n_embeds
266 grpid = fstrsolid%embeds(i)%group
270 call scan_embed_state( flag_ctalgo, fstrsolid%embeds(i), fstrsolid%ddunode(:), fstrsolid%dunode(:), &
271 & fstrsolid%QFORCE(:), infoctchange, hecmesh%global_node_ID(:), hecmesh%global_elem_ID(:), is_init, iactive,
mu )
272 if( .not. active ) active = iactive
275 if( is_init .and. ctalgo ==
kcaslagrange .and. fstrsolid%n_contacts > 0 ) &
279 do i=1,fstrsolid%n_contacts
283 infoctchange%contactNode_current = infoctchange%contactNode_previous+infoctchange%free2contact-infoctchange%contact2free
284 infoctchange%contactNode_previous = infoctchange%contactNode_current
286 if( .not. active )
then
287 if(
associated( fstrsolid%CONT_NFORCE ) ) fstrsolid%CONT_NFORCE(:) = 0.d0
288 if(
associated( fstrsolid%CONT_FRIC ) ) fstrsolid%CONT_FRIC(:) = 0.d0
295 integer(kind=kint),
intent(in) :: cstep
296 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
300 integer(kind=kint) :: i, j, grpid, slave
301 integer(kind=kint) :: k, id, iSS
302 integer(kind=kint) :: ig0, ig, iS0, iE0
303 integer(kind=kint),
allocatable :: states(:)
305 allocate(states(hecmesh%n_node))
306 states(:) = contactfree
309 do ig0= 1, fstrsolid%BOUNDARY_ngrp_tot
310 grpid = fstrsolid%BOUNDARY_ngrp_GRPID(ig0)
312 ig= fstrsolid%BOUNDARY_ngrp_ID(ig0)
313 is0= hecmesh%node_group%grp_index(ig-1) + 1
314 ie0= hecmesh%node_group%grp_index(ig )
316 iss = hecmesh%node_group%grp_item(k)
321 do i=1,fstrsolid%n_contacts
322 if( fstrsolid%contacts(i)%algtype /= contacttied ) cycle
323 grpid = fstrsolid%contacts(i)%group
326 do j=1,
size(fstrsolid%contacts(i)%slave)
327 if( fstrsolid%contacts(i)%states(j)%state==contactfree ) cycle
328 slave = fstrsolid%contacts(i)%slave(j)
329 if( states(slave) == contactfree )
then
330 states(slave) = fstrsolid%contacts(i)%states(j)%state
331 id = fstrsolid%contacts(i)%states(j)%surface
332 do k=1,
size( fstrsolid%contacts(i)%master(id)%nodes )
333 iss = fstrsolid%contacts(i)%master(id)%nodes(k)
334 states(iss) = fstrsolid%contacts(i)%states(j)%state
337 fstrsolid%contacts(i)%states(j)%state = contactfree
338 infoctchange%free2contact = infoctchange%free2contact - 1
339 write(*,
'(A,i10,A,i6,A,i6,A)')
"Node",hecmesh%global_node_ID(slave), &
340 " in rank",hecmw_comm_get_rank(),
" freed due to duplication"
350 integer(kind=kint),
intent(in) :: cstep
351 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
355 integer(kind=kint) :: i
356 logical :: iactive, is_init
361 do i = 1,
size(fstrsolid%unode)
362 fstrsolid%ddunode(i) = hecmesh%node(i) + fstrsolid%unode(i) + fstrsolid%dunode(i)
364 infoctchange%active = .false.
366 infoctchange%contact2free = 0
367 infoctchange%contact2neighbor = 0
368 infoctchange%contact2diffLpos = 0
369 infoctchange%free2contact = 0
370 infoctchange%contactNode_current = 0
372 is_init = ( cstep == 1 )
374 do i=1,fstrsolid%n_contacts
381 & infoctchange, hecmesh%global_node_ID(:), hecmesh%global_elem_ID(:), is_init, iactive )
383 infoctchange%active = infoctchange%active .or. iactive
386 infoctchange%contactNode_current = infoctchange%contactNode_previous+infoctchange%free2contact-infoctchange%contact2free
387 infoctchange%contactNode_previous = infoctchange%contactNode_current
388 fstrsolid%ddunode = 0.d0
393 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
395 real(kind=kreal),
intent(inout) :: b(:)
397 integer(kind=kint) :: i, algtype
399 do i=1, fstrsolid%n_contacts
401 algtype = fstrsolid%contacts(i)%algtype
402 if( algtype == contactsslid .or. algtype == contactfslid )
then
404 , fstrsolid%dunode(:), fstrsolid%contacts(i)%fcoeff,
mu,
mut, b )
405 else if( algtype == contacttied )
then
406 call calcu_tied_force0( fstrsolid%contacts(i), fstrsolid%unode(:), fstrsolid%dunode(:),
mu, b )
410 do i=1, fstrsolid%n_embeds
411 call calcu_tied_force0( fstrsolid%embeds(i), fstrsolid%unode(:), fstrsolid%dunode(:),
mu, b )
418 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
420 logical,
intent(out) :: ctchanged
422 integer(kind=kint) :: i, nc, algtype
424 gnt = 0.d0; ctchanged = .false.
425 nc = fstrsolid%n_contacts+fstrsolid%n_embeds
426 do i=1, fstrsolid%n_contacts
427 algtype = fstrsolid%contacts(i)%algtype
428 if( algtype == contactsslid .or. algtype == contactfslid )
then
430 , fstrsolid%dunode(:), fstrsolid%contacts(i)%fcoeff,
mu,
mut,
gnt, ctchanged )
431 else if( algtype == contacttied )
then
437 do i=1, fstrsolid%n_embeds
447 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
449 real(kind=kreal),
intent(inout) :: b(:)
451 integer(kind=kint) :: i, algtype
453 do i = 1, fstrsolid%n_contacts
454 algtype = fstrsolid%contacts(i)%algtype
455 if( algtype == contactsslid .or. algtype == contactfslid )
then
456 call ass_contact_force( fstrsolid%contacts(i), hecmesh%node, fstrsolid%unode, b )
457 else if( algtype == contacttied )
then
458 call calcu_tied_force0( fstrsolid%contacts(i), fstrsolid%unode(:), fstrsolid%dunode(:),
mu, b )
462 do i = 1, fstrsolid%n_embeds
463 call calcu_tied_force0( fstrsolid%embeds(i), fstrsolid%unode(:), fstrsolid%dunode(:),
mu, b )
471 integer(kind=kint) :: i
473 do i=1, fstrsolid%n_contacts
479 subroutine fstr_contactbc( cstep, iter, hecMESH, hecMAT, fstrSOLID )
481 integer(kind=kint) :: cstep
482 integer(kind=kint),
intent(in) :: iter
483 type (hecmwST_local_mesh),
intent(inout) :: hecMESH
484 type (hecmwST_matrix),
intent(inout) :: hecMAT
487 integer(kind=kint),
parameter :: NDOF=3
489 integer(kind=kint) :: i, j, k, m, nnode, nd, etype, grpid
490 integer(kind=kint) :: ctsurf, ndLocal(l_max_surface_node+1)
491 integer(kind=kint) :: algtype
492 real(kind=kreal) :: factor, elecoord( 3, l_max_surface_node)
493 real(kind=kreal) :: stiff(l_max_surface_node*3+3, l_max_surface_node*3+3)
494 real(kind=kreal) :: nrlforce, force(l_max_surface_node*3+3)
496 factor = fstrsolid%FACTOR(2)
498 do i=1,fstrsolid%n_contacts
500 grpid = fstrsolid%contacts(i)%group
503 algtype = fstrsolid%contacts(i)%algtype
505 do j=1,
size(fstrsolid%contacts(i)%slave)
506 if( fstrsolid%contacts(i)%states(j)%state==contactfree ) cycle
507 ctsurf = fstrsolid%contacts(i)%states(j)%surface
508 etype = fstrsolid%contacts(i)%master(ctsurf)%etype
509 nnode =
size(fstrsolid%contacts(i)%master(ctsurf)%nodes)
510 ndlocal(1) = fstrsolid%contacts(i)%slave(j)
512 ndlocal(k+1) = fstrsolid%contacts(i)%master(ctsurf)%nodes(k)
513 elecoord(1:3,k)=hecmesh%node(3*ndlocal(k+1)-2:3*ndlocal(k+1))
515 if( algtype == contactsslid .or. algtype == contactfslid )
then
516 call contact2stiff( algtype, fstrsolid%contacts(i)%states(j), &
517 etype, nnode, elecoord(:,:),
mu,
mut, fstrsolid%contacts(i)%fcoeff, &
518 fstrsolid%contacts(i)%symmetric, stiff(:,:), force(:) )
519 else if( algtype == contacttied )
then
520 call tied2stiff( algtype, fstrsolid%contacts(i)%states(j), &
521 etype, nnode,
mu,
mut, stiff(:,:), force(:) )
524 call hecmw_mat_ass_elem(hecmat, nnode+1, ndlocal, stiff)
529 fstrsolid%contacts(i)%states(j)%wkdist = fstrsolid%contacts(i)%states(j)%distance
530 nrlforce = -
mu*fstrsolid%contacts(i)%states(j)%distance
531 force(1:nnode*ndof+ndof) = force(1:nnode*ndof+ndof)*nrlforce
535 hecmat%B(ndof*(nd-1)+k)=hecmat%B(ndof*(nd-1)+k)-force((m-1)*ndof+k)
542 do i=1,fstrsolid%n_embeds
543 grpid = fstrsolid%embeds(i)%group
545 do j=1,
size(fstrsolid%embeds(i)%slave)
546 if( fstrsolid%embeds(i)%states(j)%state==contactfree ) cycle
547 ctsurf = fstrsolid%embeds(i)%states(j)%surface
548 etype = fstrsolid%embeds(i)%master(ctsurf)%etype
549 nnode =
size(fstrsolid%embeds(i)%master(ctsurf)%nodes)
550 ndlocal(1) = fstrsolid%embeds(i)%slave(j)
552 ndlocal(k+1) = fstrsolid%embeds(i)%master(ctsurf)%nodes(k)
553 elecoord(1:3,k)=hecmesh%node(3*ndlocal(k+1)-2:3*ndlocal(k+1))
555 call tied2stiff( algtype, fstrsolid%embeds(i)%states(j), &
556 etype, nnode,
mu,
mut, stiff(:,:), force(:) )
558 call hecmw_mat_ass_elem(hecmat, nnode+1, ndlocal, stiff)
566 type(hecmwst_matrix) :: hecMAT
568 if( .not.
associated(fstrsolid%CONT_NFORCE) )
then
569 allocate( fstrsolid%CONT_NFORCE(hecmat%NP*3) )
570 fstrsolid%CONT_NFORCE(:) = 0.d0
573 if( .not.
associated(fstrsolid%CONT_FRIC) )
then
574 allocate( fstrsolid%CONT_FRIC(hecmat%NP*3) )
575 fstrsolid%CONT_FRIC(:) = 0.d0
578 if( .not.
associated(fstrsolid%CONT_RELVEL) )
then
579 allocate( fstrsolid%CONT_RELVEL(hecmat%NP*3) )
580 fstrsolid%CONT_RELVEL(:) = 0.d0
583 if( .not.
associated(fstrsolid%CONT_STATE) )
then
584 allocate( fstrsolid%CONT_STATE(hecmat%NP*1) )
585 fstrsolid%CONT_STATE(:) = 0.d0
588 if( .not.
associated(fstrsolid%CONT_AREA) )
then
589 allocate( fstrsolid%CONT_AREA(hecmat%NP) )
590 fstrsolid%CONT_AREA(:) = 0.d0
593 if( .not.
associated(fstrsolid%CONT_NTRAC) )
then
594 allocate( fstrsolid%CONT_NTRAC(hecmat%NP*3) )
595 fstrsolid%CONT_NTRAC(:) = 0.d0
598 if( .not.
associated(fstrsolid%CONT_FTRAC) )
then
599 allocate( fstrsolid%CONT_FTRAC(hecmat%NP*3) )
600 fstrsolid%CONT_FTRAC(:) = 0.d0
607 type(hecmwst_matrix) :: hecMAT
609 if( .not.
associated(fstrsolid%EMBED_NFORCE) )
then
610 allocate( fstrsolid%EMBED_NFORCE(hecmat%NP*3) )
611 fstrsolid%EMBED_NFORCE(:) = 0.d0
616 integer(kind=kint),
intent(in) :: cstep
617 type( hecmwst_local_mesh ),
intent(in) :: hecMESH
620 integer(kind=kint) :: i, j, k, sgrp_id, iS, iE, eid, sid, n_cdsurfs
621 logical,
pointer :: cdef_surf(:,:)
622 real(kind=kreal),
pointer :: coord(:)
624 if(
associated(fstrsolid%CONT_SGRP_ID) )
deallocate(fstrsolid%CONT_SGRP_ID)
626 allocate(cdef_surf(l_max_elem_surf,hecmesh%n_elem))
627 cdef_surf(:,:) = .false.
631 do i=1, fstrsolid%n_contacts
639 sgrp_id = fstrsolid%contacts(i)%surf_id1_sgrp
641 sgrp_id = fstrsolid%contacts(i)%surf_id2
644 if( sgrp_id <= 0 ) cycle
646 is = hecmesh%surf_group%grp_index(sgrp_id-1) + 1
647 ie = hecmesh%surf_group%grp_index(sgrp_id )
649 eid = hecmesh%surf_group%grp_item(2*j-1)
650 sid = hecmesh%surf_group%grp_item(2*j)
652 if( .not. cdef_surf(sid,eid) ) n_cdsurfs = n_cdsurfs + 1
653 cdef_surf(sid,eid) = .true.
659 allocate(fstrsolid%CONT_SGRP_ID(2*n_cdsurfs))
661 do i=1,hecmesh%n_elem
662 do j=1,l_max_elem_surf
663 if( cdef_surf(j,i) )
then
664 n_cdsurfs = n_cdsurfs + 1
665 fstrsolid%CONT_SGRP_ID(2*n_cdsurfs-1) = i
666 fstrsolid%CONT_SGRP_ID(2*n_cdsurfs ) = j
670 deallocate(cdef_surf)
675 type( hecmwst_local_mesh ),
intent(in) :: hecmesh
677 integer(kind=kint),
intent(in) :: flag
679 integer(kind=kint),
parameter :: NDOF=3
680 integer(kind=kint) :: i, isuf, icel, sid, etype, nn, iS, stype, idx
681 integer(kind=kint) :: ndlocal(l_max_elem_node)
682 real(kind=kreal),
pointer :: coord(:)
683 real(kind=kreal) :: ecoord(ndof,l_max_elem_node), vect(l_max_elem_node)
685 fstrsolid%CONT_AREA(:) = 0.d0
687 if( .not.
associated(fstrsolid%CONT_SGRP_ID) )
return
689 allocate(coord(ndof*hecmesh%n_node))
690 do i=1,ndof*hecmesh%n_node
691 coord(i) = hecmesh%node(i)+fstrsolid%unode(i)
694 do i=1,ndof*hecmesh%n_node
695 coord(i) = coord(i)+fstrsolid%dunode(i)
699 do isuf=1,
size(fstrsolid%CONT_SGRP_ID)/2
700 icel = fstrsolid%CONT_SGRP_ID(2*isuf-1)
701 sid = fstrsolid%CONT_SGRP_ID(2*isuf )
703 etype = hecmesh%elem_type(icel)
704 nn = hecmw_get_max_node(etype)
705 is = hecmesh%elem_node_index(icel-1)
706 ndlocal(1:nn) = hecmesh%elem_node_item (is+1:is+nn)
709 idx = ndof*(ndlocal(i)-1)
710 ecoord(1:ndof,i) = coord(idx+1:idx+ndof)
717 fstrsolid%CONT_AREA(idx) = fstrsolid%CONT_AREA(idx) + vect(i)
726 integer(kind=kint),
intent(in) :: etype
727 integer(kind=kint),
intent(in) :: nn
728 real(kind=kreal),
intent(in) :: ecoord(:,:)
729 integer(kind=kint),
intent(in) :: sid
730 real(kind=kreal),
intent(out) :: vect(:)
732 integer(kind=kint),
parameter :: NDOF=3
733 integer(kind=kint) :: nod(l_max_surface_node)
734 integer(kind=kint) :: nsur, stype, ig0, i
735 real(kind=kreal) :: localcoord(2), normal(3), area, wg
736 real(kind=kreal) :: scoord(ndof,l_max_surface_node), h(l_max_surface_node)
740 call getsubface( etype, sid, stype, nod )
741 nsur = getnumberofnodes( stype )
743 scoord(1:ndof,i) = ecoord(1:ndof,nod(i))
747 do ig0=1,numofquadpoints( stype )
748 call getquadpoint( stype, ig0, localcoord(1:2) )
749 call getshapefunc( stype, localcoord(1:2), h(1:nsur) )
751 wg=getweight( stype, ig0 )
753 normal(1:3) = surfacenormal( stype, nsur, localcoord(1:2), scoord(1:ndof,1:nsur) )
754 area = area + dsqrt(dot_product(normal,normal))*wg
756 area = area/dble(nsur)
766 type(hecmwst_local_mesh),
intent(in) :: hecmesh
767 integer(kind=kint),
intent(in) :: ndof
768 real(kind=kreal),
pointer,
intent(inout) :: vec(:)
769 integer(kind=kint),
intent(in) :: vtype
771 real(kind=kreal) :: rhsb
772 integer(kind=kint) :: i,j,n,i0,n_loc,nndof
773 integer(kind=kint) :: offset, pid, lid
774 integer(kind=kint),
allocatable :: displs(:)
775 real(kind=kreal),
allocatable :: vec_all(:)
778 n_loc = hecmesh%nn_internal
779 allocate(displs(0:
nprocs))
782 call hecmw_allreduce_i(hecmesh, displs,
nprocs+1, hecmw_sum)
784 displs(i) = displs(i-1) + displs(i)
789 allocate(vec_all(ndof*n))
791 if( vtype == 1 )
then
793 do i= hecmesh%nn_internal+1,hecmesh%n_node
794 pid = hecmesh%node_ID(i*2)
795 lid = hecmesh%node_ID(i*2-1)
796 i0 = (displs(pid) + (lid-1))*ndof
797 vec_all(i0+1:i0+ndof) = vec((i-1)*ndof+1:i*ndof)
798 vec((i-1)*ndof+1:i*ndof) = 0.d0
801 call hecmw_allreduce_r(hecmesh, vec_all, n*ndof, hecmw_sum)
804 vec(i) = vec(i) + vec_all(offset*ndof+i)
806 else if( vtype == 2 )
then
807 vec_all(:) = -1000.d0
808 do i= hecmesh%nn_internal+1,hecmesh%n_node
809 if( vec(i) == 0.d0 ) cycle
810 pid = hecmesh%node_ID(i*2)
811 lid = hecmesh%node_ID(i*2-1)
812 i0 = displs(pid) + lid
816 call hecmw_allreduce_r(hecmesh, vec_all, n, hecmw_max)
819 if( vec_all(offset+i) == -1000.d0 ) cycle
820 if( vec(i) < vec_all(offset+i) ) vec(i) = vec_all(offset+i)
824 deallocate(displs,vec_all)