24 real(kind=kreal),
save ::
cgn=1.d-5
25 real(kind=kreal),
save ::
cgt=1.d-3
27 real(kind=kreal),
save ::
gnt(2)
61 real(kind=kreal) :: distance
62 real(kind=kreal) :: wkdist
63 real(kind=kreal) :: lpos(3)
64 real(kind=kreal) :: gpos(3)
65 real(kind=kreal) :: direction(3)
66 real(kind=kreal) :: multiplier(3)
68 real(kind=kreal) :: tangentforce(3)
69 real(kind=kreal) :: tangentforce1(3)
70 real(kind=kreal) :: tangentforce_trial(3)
71 real(kind=kreal) :: tangentforce_final(3)
72 real(kind=kreal) :: reldisp(3)
74 real(kind=kreal) :: shrink_factor
75 real(kind=kreal) :: time_factor
76 real(kind=kreal) :: init_pos
77 real(kind=kreal) :: end_pos
78 integer :: interference_flag
84 character(len=HECMW_NAME_LEN) :: name
87 character(len=HECMW_NAME_LEN) :: pair_name
88 integer :: surf_id1, surf_id2
89 integer :: surf_id1_sgrp
91 integer,
pointer :: slave(:)=>null()
92 real(kind=kreal) :: fcoeff
93 real(kind=kreal) :: npenalty
94 real(kind=kreal) :: tpenalty
95 real(kind=kreal) :: refstiff
96 real(kind=kreal) :: damp_alpha
97 real(kind=kreal) :: damp_gact
99 real(kind=kreal) :: ctime
100 integer(kind=kint) :: if_type
101 real(kind=kreal) :: if_etime
102 real(kind=kreal) :: initial_pos
103 real(kind=kreal) :: end_pos
119 type(hecmwst_contact_comm) :: comm
120 type(bucketdb) :: master_bktdb
122 type(tcontactparam),
pointer :: cparam=>null()
127 integer(kind=kint) :: contact2free
128 integer(kind=kint) :: contact2neighbor
129 integer(kind=kint) :: contact2difflpos
130 integer(kind=kint) :: free2contact
131 integer(kind=kint) :: contactnode_previous
132 integer(kind=kint) :: contactnode_current
135 private :: is_mpc_available
136 private :: is_active_contact
145 cstate%distance = 0.0d0
146 cstate%wkdist = 0.0d0
147 cstate%lpos(:) = 0.0d0
148 cstate%gpos(:) = 0.0d0
149 cstate%direction(:) = 0.0d0
150 cstate%multiplier(:) = 0.0d0
151 cstate%tangentForce(:) = 0.0d0
152 cstate%tangentForce1(:) = 0.0d0
153 cstate%tangentForce_trial(:) = 0.0d0
154 cstate%tangentForce_final(:) = 0.0d0
155 cstate%reldisp(:) = 0.0d0
156 cstate%shrink_factor = 0.0d0
157 cstate%time_factor = 0.0d0
158 cstate%init_pos = 0.0d0
159 cstate%end_pos = 0.0d0
160 cstate%interference_flag = 0
172 integer,
intent(in) :: state
178 integer,
intent(in) :: state
184 integer,
intent(in) :: state
190 integer,
intent(in) :: fnum
192 write(fnum, *)
"--Contact state=",cstate%state
193 write(fnum, *) cstate%surface, cstate%distance
194 write(fnum, *) cstate%lpos
195 write(fnum, *) cstate%direction
196 write(fnum, *) cstate%multiplier
200 logical function is_mpc_available( contact )
201 type(
tcontact),
intent(in) :: contact
202 is_mpc_available = .true.
203 if( contact%fcoeff/=0.d0 ) is_mpc_available = .false.
208 integer(kind=kint),
intent(in) :: file
209 type(
tcontact),
intent(in) :: contact
211 write(file,*)
"CONTACT:", contact%ctype,contact%group,trim(contact%pair_name),contact%fcoeff
212 write(file,*)
"---Slave----"
213 write(file,*)
"num.slave",
size(contact%slave)
214 if(
associated(contact%slave) )
then
215 do i=1,
size(contact%slave)
216 write(file, *) contact%slave(i)
219 write(file,*)
"----master---"
220 write(file,*)
"num.master",
size(contact%master)
221 if(
associated(contact%master) )
then
222 do i=1,
size(contact%master)
230 type(
tcontact),
intent(inout) :: contact
232 if(
associated( contact%slave ) )
deallocate(contact%slave)
233 if(
associated( contact%master ) )
then
234 do i=1,
size( contact%master )
237 deallocate(contact%master)
239 if(
associated(contact%states) )
deallocate(contact%states)
246 type(
tcontact),
intent(inout) :: contact
247 type(hecmwst_local_mesh),
pointer :: hecmesh
256 do i=1,hecmesh%contact_pair%n_pair
257 if( hecmesh%contact_pair%name(i) == contact%pair_name )
then
258 contact%ctype = hecmesh%contact_pair%type(i)
259 contact%surf_id1 = hecmesh%contact_pair%slave_grp_id(i)
260 contact%surf_id2 = hecmesh%contact_pair%master_grp_id(i)
261 contact%surf_id1_sgrp = hecmesh%contact_pair%slave_orisgrp_id(i)
265 if( .not. isfind ) return;
266 if( contact%fcoeff<=0.d0 ) contact%fcoeff=0.d0
267 if( contact%ctype < 1 .and. contact%ctype > 3 )
return
268 if( contact%group<=0 )
return
275 type(
tcontact),
intent(inout) :: contact
276 type(hecmwst_local_mesh),
pointer :: hecmesh
277 type(tcontactparam),
target :: cparam
278 integer(kint),
intent(in),
optional :: myrank
280 integer :: i, j, is, ie, cgrp, nsurf, nslave, ic, ic_type, iss, nn, ii
281 integer :: count,nodeid
285 contact%cparam => cparam
288 cgrp = contact%surf_id2
290 is= hecmesh%surf_group%grp_index(cgrp-1) + 1
291 ie= hecmesh%surf_group%grp_index(cgrp )
293 if(
present(myrank))
then
297 ic = hecmesh%surf_group%grp_item(2*i-1)
298 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
301 allocate( contact%master(count) )
304 ic = hecmesh%surf_group%grp_item(2*i-1)
305 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
307 nsurf = hecmesh%surf_group%grp_item(2*i)
308 ic_type = hecmesh%elem_type(ic)
310 iss = hecmesh%elem_node_index(ic-1)
311 do j=1,
size( contact%master(count)%nodes )
312 nn = contact%master(count)%nodes(j)
313 contact%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
319 allocate( contact%master(ie-is+1) )
321 ic = hecmesh%surf_group%grp_item(2*i-1)
322 nsurf = hecmesh%surf_group%grp_item(2*i)
323 ic_type = hecmesh%elem_type(ic)
325 iss = hecmesh%elem_node_index(ic-1)
326 do j=1,
size( contact%master(i-is+1)%nodes )
327 nn = contact%master(i-is+1)%nodes(j)
328 contact%master(i-is+1)%nodes(j) = hecmesh%elem_node_item( iss+nn )
336 cgrp = contact%surf_id1
338 is= hecmesh%node_group%grp_index(cgrp-1) + 1
339 ie= hecmesh%node_group%grp_index(cgrp )
342 nodeid = hecmesh%global_node_ID(hecmesh%node_group%grp_item(i))
343 if(
present(myrank))
then
348 if( hecmesh%node_group%grp_item(i) <= hecmesh%nn_internal)
then
353 allocate( contact%slave(nslave) )
356 if(.not.
present(myrank))
then
358 if( hecmesh%node_group%grp_item(i) > hecmesh%nn_internal) cycle
361 contact%slave(ii) = hecmesh%node_group%grp_item(i)
365 allocate( contact%states(nslave) )
379 contact%symmetric = .true.
385 type(
tcontact),
intent(inout) :: embed
386 type(hecmwst_local_mesh),
pointer :: hecmesh
387 type(tcontactparam),
target :: cparam
388 integer(kint),
intent(in),
optional :: myrank
390 integer :: i, j, is, ie, cgrp, nsurf, nslave, ic, ic_type, iss, nn, ii
391 integer :: count,nodeid
395 embed%cparam => cparam
398 cgrp = embed%surf_id2
400 is= hecmesh%elem_group%grp_index(cgrp-1) + 1
401 ie= hecmesh%elem_group%grp_index(cgrp )
403 if(
present(myrank))
then
407 ic = hecmesh%elem_group%grp_item(i)
408 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
411 allocate( embed%master(count) )
414 ic = hecmesh%elem_group%grp_item(i)
415 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
417 ic_type = hecmesh%elem_type(ic)
419 iss = hecmesh%elem_node_index(ic-1)
420 do j=1,
size( embed%master(count)%nodes )
421 nn = embed%master(count)%nodes(j)
422 embed%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
428 allocate( embed%master(ie-is+1) )
430 ic = hecmesh%elem_group%grp_item(i)
431 ic_type = hecmesh%elem_type(ic)
433 iss = hecmesh%elem_node_index(ic-1)
434 do j=1,
size( embed%master(i-is+1)%nodes )
435 nn = embed%master(i-is+1)%nodes(j)
436 embed%master(i-is+1)%nodes(j) = hecmesh%elem_node_item( iss+nn )
443 cgrp = embed%surf_id1
445 is= hecmesh%node_group%grp_index(cgrp-1) + 1
446 ie= hecmesh%node_group%grp_index(cgrp )
449 nodeid = hecmesh%global_node_ID(hecmesh%node_group%grp_item(i))
450 if(
present(myrank))
then
455 if( hecmesh%node_group%grp_item(i) <= hecmesh%nn_internal)
then
460 allocate( embed%slave(nslave) )
463 if(.not.
present(myrank))
then
465 if( hecmesh%node_group%grp_item(i) > hecmesh%nn_internal) cycle
468 embed%slave(ii) = hecmesh%node_group%grp_item(i)
472 allocate( embed%states(nslave) )
487 embed%nPenalty = 1.0d0
488 embed%tPenalty = 0.1d0
489 embed%refStiff = 0.0d0
490 embed%damp_alpha = 0.0d0
491 embed%damp_gact = 0.0d0
493 embed%symmetric = .true.
498 type(tcontactinterference),
intent(inout) :: contact_if
508 do i = 1,
size(contacts)
509 if( contacts(i)%pair_name == contact_if%cp_name )
then
510 contacts(i)%if_type = contact_if%if_type
511 contacts(i)%if_etime = contact_if%etime
512 contacts(i)%initial_pos = contact_if%initial_pos
513 contacts(i)%end_pos = contact_if%end_pos
514 do j = 1,
size(contacts(i)%states)
515 contacts(i)%states(j)%interference_flag = contact_if%if_type
516 contacts(i)%states(j)%init_pos = contact_if%initial_pos
517 contacts(i)%states(j)%end_pos = contact_if%end_pos
519 contacts(i)%states(j)%time_factor = (contact_if%end_pos - contact_if%initial_pos) / contact_if%etime
521 contacts(i)%states(j)%time_factor = contact_if%etime
528 if( .not. isfind ) return;
535 type(
tcontact),
intent(inout) :: contact
537 if( .not.
associated(contact%states) )
return
538 do i=1,
size( contact%states )
539 contact%states(i)%state = -1
544 logical function is_active_contact( acgrp, contact )
545 integer,
intent(in) :: acgrp(:)
546 type(
tcontact),
intent(in) :: contact
547 if( any( acgrp==contact%group ) )
then
548 is_active_contact = .true.
550 is_active_contact = .false.
556 integer(kind=kint),
intent(in) :: file
557 type( hecmwst_contact_pair ),
intent(in) :: pair
559 integer(kind=kint) :: i
560 write(file,*)
"Number of contact pair", pair%n_pair
562 write(file,*) trim(pair%name(i)), pair%type(i), pair%slave_grp_id(i) &
563 ,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.