23 real(kind=kreal),
save ::
cgn=1.d-5
24 real(kind=kreal),
save ::
cgt=1.d-3
26 real(kind=kreal),
save ::
gnt(2)
60 real(kind=kreal) :: distance
61 real(kind=kreal) :: wkdist
62 real(kind=kreal) :: lpos(3)
63 real(kind=kreal) :: gpos(3)
64 real(kind=kreal) :: direction(3)
65 real(kind=kreal) :: multiplier(3)
67 real(kind=kreal) :: tangentforce(3)
68 real(kind=kreal) :: tangentforce1(3)
69 real(kind=kreal) :: tangentforce_trial(3)
70 real(kind=kreal) :: tangentforce_final(3)
71 real(kind=kreal) :: reldisp(3)
73 real(kind=kreal) :: shrink_factor
74 real(kind=kreal) :: time_factor
75 real(kind=kreal) :: init_pos
76 real(kind=kreal) :: end_pos
77 integer :: interference_flag
83 character(len=HECMW_NAME_LEN) :: name
86 character(len=HECMW_NAME_LEN) :: pair_name
87 integer :: surf_id1, surf_id2
88 integer :: surf_id1_sgrp
90 integer,
pointer :: slave(:)=>null()
91 real(kind=kreal) :: fcoeff
92 real(kind=kreal) :: npenalty
93 real(kind=kreal) :: tpenalty
94 real(kind=kreal) :: refstiff
95 real(kind=kreal) :: damp_alpha
96 real(kind=kreal) :: damp_gact
98 real(kind=kreal) :: ctime
99 integer(kind=kint) :: if_type
100 real(kind=kreal) :: if_etime
101 real(kind=kreal) :: initial_pos
102 real(kind=kreal) :: end_pos
118 type(hecmwst_contact_comm) :: comm
119 type(bucketdb) :: master_bktdb
121 type(tcontactparam),
pointer :: cparam=>null()
126 integer(kind=kint) :: contact2free
127 integer(kind=kint) :: contact2neighbor
128 integer(kind=kint) :: contact2difflpos
129 integer(kind=kint) :: free2contact
130 integer(kind=kint) :: contactnode_previous
131 integer(kind=kint) :: contactnode_current
134 private :: is_mpc_available
135 private :: is_active_contact
144 cstate%distance = 0.0d0
145 cstate%wkdist = 0.0d0
146 cstate%lpos(:) = 0.0d0
147 cstate%gpos(:) = 0.0d0
148 cstate%direction(:) = 0.0d0
149 cstate%multiplier(:) = 0.0d0
150 cstate%tangentForce(:) = 0.0d0
151 cstate%tangentForce1(:) = 0.0d0
152 cstate%tangentForce_trial(:) = 0.0d0
153 cstate%tangentForce_final(:) = 0.0d0
154 cstate%reldisp(:) = 0.0d0
155 cstate%shrink_factor = 0.0d0
156 cstate%time_factor = 0.0d0
157 cstate%init_pos = 0.0d0
158 cstate%end_pos = 0.0d0
159 cstate%interference_flag = 0
171 integer,
intent(in) :: state
177 integer,
intent(in) :: state
183 integer,
intent(in) :: state
189 integer,
intent(in) :: fnum
191 write(fnum, *)
"--Contact state=",cstate%state
192 write(fnum, *) cstate%surface, cstate%distance
193 write(fnum, *) cstate%lpos
194 write(fnum, *) cstate%direction
195 write(fnum, *) cstate%multiplier
199 logical function is_mpc_available( contact )
200 type(
tcontact),
intent(in) :: contact
201 is_mpc_available = .true.
202 if( contact%fcoeff/=0.d0 ) is_mpc_available = .false.
207 integer(kind=kint),
intent(in) :: file
208 type(
tcontact),
intent(in) :: contact
210 write(file,*)
"CONTACT:", contact%ctype,contact%group,trim(contact%pair_name),contact%fcoeff
211 write(file,*)
"---Slave----"
212 write(file,*)
"num.slave",
size(contact%slave)
213 if(
associated(contact%slave) )
then
214 do i=1,
size(contact%slave)
215 write(file, *) contact%slave(i)
218 write(file,*)
"----master---"
219 write(file,*)
"num.master",
size(contact%master)
220 if(
associated(contact%master) )
then
221 do i=1,
size(contact%master)
229 type(
tcontact),
intent(inout) :: contact
231 if(
associated( contact%slave ) )
deallocate(contact%slave)
232 if(
associated( contact%master ) )
then
233 do i=1,
size( contact%master )
236 deallocate(contact%master)
238 if(
associated(contact%states) )
deallocate(contact%states)
245 type(
tcontact),
intent(inout) :: contact
246 type(hecmwst_local_mesh),
pointer :: hecmesh
255 do i=1,hecmesh%contact_pair%n_pair
256 if( hecmesh%contact_pair%name(i) == contact%pair_name )
then
257 contact%ctype = hecmesh%contact_pair%type(i)
258 contact%surf_id1 = hecmesh%contact_pair%slave_grp_id(i)
259 contact%surf_id2 = hecmesh%contact_pair%master_grp_id(i)
260 contact%surf_id1_sgrp = hecmesh%contact_pair%slave_orisgrp_id(i)
264 if( .not. isfind ) return;
265 if( contact%fcoeff<=0.d0 ) contact%fcoeff=0.d0
266 if( contact%ctype < 1 .and. contact%ctype > 3 )
return
267 if( contact%group<=0 )
return
274 type(
tcontact),
intent(in) :: contact
275 type(hecmwst_local_mesh),
pointer :: hecmesh
277 integer :: i, is, ie, cgrp
281 cgrp = contact%surf_id1
283 is= hecmesh%node_group%grp_index(cgrp-1) + 1
284 ie= hecmesh%node_group%grp_index(cgrp )
286 if( hecmesh%node_group%grp_item(i) <= hecmesh%nn_internal )
then
294 type(
tcontact),
intent(inout) :: contact
295 type(hecmwst_local_mesh),
pointer :: hecmesh
296 type(tcontactparam),
target :: cparam
298 integer :: i, j, is, ie, cgrp, nsurf, nslave, ic, ic_type, iss, nn, ii
299 integer :: count, id_area
300 logical :: slave_owner, take_master
304 contact%cparam => cparam
306 slave_owner = hecmw_partcontact_get_owner( hecmesh%hecmw_flag_partcontact ) == hecmw_flag_partcontact_owner_slave
315 cgrp = contact%surf_id2
317 is= hecmesh%surf_group%grp_index(cgrp-1) + 1
318 ie= hecmesh%surf_group%grp_index(cgrp )
321 if( take_master )
then
323 ic = hecmesh%surf_group%grp_item(2*i-1)
324 id_area = hecmesh%elem_ID(ic*2)
325 if( .not. slave_owner .and. id_area /= hecmesh%my_rank ) cycle
329 allocate( contact%master(count) )
331 if( take_master )
then
333 ic = hecmesh%surf_group%grp_item(2*i-1)
334 id_area = hecmesh%elem_ID(ic*2)
335 if( .not. slave_owner .and. id_area /= hecmesh%my_rank ) cycle
337 nsurf = hecmesh%surf_group%grp_item(2*i)
338 ic_type = hecmesh%elem_type(ic)
340 iss = hecmesh%elem_node_index(ic-1)
341 do j=1,
size( contact%master(count)%nodes )
342 nn = contact%master(count)%nodes(j)
343 contact%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
350 cgrp = contact%surf_id1
352 is= hecmesh%node_group%grp_index(cgrp-1) + 1
353 ie= hecmesh%node_group%grp_index(cgrp )
356 if( slave_owner .and. hecmesh%node_group%grp_item(i) > hecmesh%nn_internal ) cycle
359 allocate( contact%slave(nslave) )
362 if( slave_owner .and. hecmesh%node_group%grp_item(i) > hecmesh%nn_internal ) cycle
364 contact%slave(ii) = hecmesh%node_group%grp_item(i)
368 allocate( contact%states(nslave) )
382 contact%symmetric = .true.
388 type(
tcontact),
intent(inout) :: embed
389 type(hecmwst_local_mesh),
pointer :: hecmesh
390 type(tcontactparam),
target :: cparam
392 integer :: i, j, is, ie, cgrp, nslave, ic, ic_type, iss, nn, ii
393 integer :: count, id_area
394 logical :: slave_owner, take_master
398 embed%cparam => cparam
400 slave_owner = hecmw_partcontact_get_owner( hecmesh%hecmw_flag_partcontact ) == hecmw_flag_partcontact_owner_slave
406 cgrp = embed%surf_id2
408 is= hecmesh%elem_group%grp_index(cgrp-1) + 1
409 ie= hecmesh%elem_group%grp_index(cgrp )
412 if( take_master )
then
414 ic = hecmesh%elem_group%grp_item(i)
415 id_area = hecmesh%elem_ID(ic*2)
416 if( .not. slave_owner .and. id_area /= hecmesh%my_rank ) cycle
420 allocate( embed%master(count) )
422 if( take_master )
then
424 ic = hecmesh%elem_group%grp_item(i)
425 id_area = hecmesh%elem_ID(ic*2)
426 if( .not. slave_owner .and. id_area /= hecmesh%my_rank ) cycle
428 ic_type = hecmesh%elem_type(ic)
430 iss = hecmesh%elem_node_index(ic-1)
431 do j=1,
size( embed%master(count)%nodes )
432 nn = embed%master(count)%nodes(j)
433 embed%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
439 cgrp = embed%surf_id1
441 is= hecmesh%node_group%grp_index(cgrp-1) + 1
442 ie= hecmesh%node_group%grp_index(cgrp )
445 if( slave_owner .and. hecmesh%node_group%grp_item(i) > hecmesh%nn_internal ) cycle
448 allocate( embed%slave(nslave) )
451 if( slave_owner .and. hecmesh%node_group%grp_item(i) > hecmesh%nn_internal ) cycle
453 embed%slave(ii) = hecmesh%node_group%grp_item(i)
457 allocate( embed%states(nslave) )
472 embed%nPenalty = 1.0d0
473 embed%tPenalty = 0.1d0
474 embed%refStiff = 0.0d0
475 embed%damp_alpha = 0.0d0
476 embed%damp_gact = 0.0d0
478 embed%symmetric = .true.
483 type(tcontactinterference),
intent(inout) :: contact_if
493 do i = 1,
size(contacts)
494 if( contacts(i)%pair_name == contact_if%cp_name )
then
495 contacts(i)%if_type = contact_if%if_type
496 contacts(i)%if_etime = contact_if%etime
497 contacts(i)%initial_pos = contact_if%initial_pos
498 contacts(i)%end_pos = contact_if%end_pos
499 do j = 1,
size(contacts(i)%states)
500 contacts(i)%states(j)%interference_flag = contact_if%if_type
501 contacts(i)%states(j)%init_pos = contact_if%initial_pos
502 contacts(i)%states(j)%end_pos = contact_if%end_pos
504 contacts(i)%states(j)%time_factor = (contact_if%end_pos - contact_if%initial_pos) / contact_if%etime
506 contacts(i)%states(j)%time_factor = contact_if%etime
513 if( .not. isfind ) return;
520 type(
tcontact),
intent(inout) :: contact
522 if( .not.
associated(contact%states) )
return
523 do i=1,
size( contact%states )
524 contact%states(i)%state = -1
529 logical function is_active_contact( acgrp, contact )
530 integer,
intent(in) :: acgrp(:)
531 type(
tcontact),
intent(in) :: contact
532 if( any( acgrp==contact%group ) )
then
533 is_active_contact = .true.
535 is_active_contact = .false.
541 integer(kind=kint),
intent(in) :: file
542 type( hecmwst_contact_pair ),
intent(in) :: pair
544 integer(kind=kint) :: i
545 write(file,*)
"Number of contact pair", pair%n_pair
547 write(file,*) trim(pair%name(i)), pair%type(i), pair%slave_grp_id(i) &
548 ,pair%master_grp_id(i), pair%slave_orisgrp_id(i)
This module provides bucket-search functionality It provides definition of bucket info and its access...
subroutine, public bucketdb_finalize(bktdb)
Finalizer.
subroutine, public bucketdb_init(bktdb)
Initializer.
This module encapsulate the basic functions of all elements provide by this software.
This module manages surface elements in 3D It provides basic definition of surface elements (triangla...
subroutine initialize_surf(eid, etype, nsurf, surf)
Initializer.
subroutine update_surface_reflen(surf, coord)
Compute reference length of surface elements.
subroutine write_surf(file, surf)
Write out elemental surface.
subroutine update_surface_box_info(surf, currpos)
Update info of cubic box including surface elements.
subroutine find_surface_neighbor(surf, bktDB)
Find neighboring surface elements.
subroutine update_surface_bucket_info(surf, bktDB)
Update bucket info for searching surface elements.
subroutine finalize_surf(surf)
Memory management subroutine.
Structure to define surface group.