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)
55 real(kind=kreal) :: distance
56 real(kind=kreal) :: wkdist
57 real(kind=kreal) :: lpos(3)
58 real(kind=kreal) :: gpos(3)
59 real(kind=kreal) :: direction(3)
60 real(kind=kreal) :: multiplier(3)
62 real(kind=kreal) :: tangentforce(3)
63 real(kind=kreal) :: tangentforce1(3)
64 real(kind=kreal) :: tangentforce_trial(3)
65 real(kind=kreal) :: tangentforce_final(3)
66 real(kind=kreal) :: reldisp(3)
68 real(kind=kreal) :: shrink_factor
69 real(kind=kreal) :: time_factor
70 real(kind=kreal) :: init_pos
71 real(kind=kreal) :: end_pos
72 integer :: interference_flag
78 character(len=HECMW_NAME_LEN) :: name
81 character(len=HECMW_NAME_LEN) :: pair_name
82 integer :: surf_id1, surf_id2
83 integer :: surf_id1_sgrp
85 integer,
pointer :: slave(:)=>null()
86 real(kind=kreal) :: fcoeff
87 real(kind=kreal) :: npenalty
88 real(kind=kreal) :: tpenalty
89 real(kind=kreal) :: refstiff
91 real(kind=kreal) :: ctime
92 integer(kind=kint) :: if_type
93 real(kind=kreal) :: if_etime
94 real(kind=kreal) :: initial_pos
95 real(kind=kreal) :: end_pos
110 type(hecmwst_contact_comm) :: comm
111 type(bucketdb) :: master_bktdb
113 type(tcontactparam),
pointer :: cparam=>null()
118 integer(kind=kint) :: contact2free
119 integer(kind=kint) :: contact2neighbor
120 integer(kind=kint) :: contact2difflpos
121 integer(kind=kint) :: free2contact
122 integer(kind=kint) :: contactnode_previous
123 integer(kind=kint) :: contactnode_current
126 private :: is_mpc_available
127 private :: is_active_contact
136 cstate%distance = 0.0d0
137 cstate%wkdist = 0.0d0
138 cstate%lpos(:) = 0.0d0
139 cstate%gpos(:) = 0.0d0
140 cstate%direction(:) = 0.0d0
141 cstate%multiplier(:) = 0.0d0
142 cstate%tangentForce(:) = 0.0d0
143 cstate%tangentForce1(:) = 0.0d0
144 cstate%tangentForce_trial(:) = 0.0d0
145 cstate%tangentForce_final(:) = 0.0d0
146 cstate%reldisp(:) = 0.0d0
147 cstate%shrink_factor = 0.0d0
148 cstate%time_factor = 0.0d0
149 cstate%init_pos = 0.0d0
150 cstate%end_pos = 0.0d0
151 cstate%interference_flag = 0
163 integer,
intent(in) :: fnum
165 write(fnum, *)
"--Contact state=",cstate%state
166 write(fnum, *) cstate%surface, cstate%distance
167 write(fnum, *) cstate%lpos
168 write(fnum, *) cstate%direction
169 write(fnum, *) cstate%multiplier
173 logical function is_mpc_available( contact )
174 type(
tcontact),
intent(in) :: contact
175 is_mpc_available = .true.
176 if( contact%fcoeff/=0.d0 ) is_mpc_available = .false.
181 integer(kind=kint),
intent(in) :: file
182 type(
tcontact),
intent(in) :: contact
184 write(file,*)
"CONTACT:", contact%ctype,contact%group,trim(contact%pair_name),contact%fcoeff
185 write(file,*)
"---Slave----"
186 write(file,*)
"num.slave",
size(contact%slave)
187 if(
associated(contact%slave) )
then
188 do i=1,
size(contact%slave)
189 write(file, *) contact%slave(i)
192 write(file,*)
"----master---"
193 write(file,*)
"num.master",
size(contact%master)
194 if(
associated(contact%master) )
then
195 do i=1,
size(contact%master)
203 type(
tcontact),
intent(inout) :: contact
205 if(
associated( contact%slave ) )
deallocate(contact%slave)
206 if(
associated( contact%master ) )
then
207 do i=1,
size( contact%master )
210 deallocate(contact%master)
212 if(
associated(contact%states) )
deallocate(contact%states)
219 type(
tcontact),
intent(inout) :: contact
220 type(hecmwst_local_mesh),
pointer :: hecmesh
229 do i=1,hecmesh%contact_pair%n_pair
230 if( hecmesh%contact_pair%name(i) == contact%pair_name )
then
231 contact%ctype = hecmesh%contact_pair%type(i)
232 contact%surf_id1 = hecmesh%contact_pair%slave_grp_id(i)
233 contact%surf_id2 = hecmesh%contact_pair%master_grp_id(i)
234 contact%surf_id1_sgrp = hecmesh%contact_pair%slave_orisgrp_id(i)
238 if( .not. isfind ) return;
239 if( contact%fcoeff<=0.d0 ) contact%fcoeff=0.d0
240 if( contact%ctype < 1 .and. contact%ctype > 3 )
return
241 if( contact%group<=0 )
return
248 type(
tcontact),
intent(inout) :: contact
249 type(hecmwst_local_mesh),
pointer :: hecmesh
250 type(tcontactparam),
target :: cparam
251 integer(kint),
intent(in),
optional :: myrank
253 integer :: i, j, is, ie, cgrp, nsurf, nslave, ic, ic_type, iss, nn, ii
254 integer :: count,nodeid
258 contact%cparam => cparam
261 cgrp = contact%surf_id2
263 is= hecmesh%surf_group%grp_index(cgrp-1) + 1
264 ie= hecmesh%surf_group%grp_index(cgrp )
266 if(
present(myrank))
then
270 ic = hecmesh%surf_group%grp_item(2*i-1)
271 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
274 allocate( contact%master(count) )
277 ic = hecmesh%surf_group%grp_item(2*i-1)
278 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
280 nsurf = hecmesh%surf_group%grp_item(2*i)
281 ic_type = hecmesh%elem_type(ic)
283 iss = hecmesh%elem_node_index(ic-1)
284 do j=1,
size( contact%master(count)%nodes )
285 nn = contact%master(count)%nodes(j)
286 contact%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
292 allocate( contact%master(ie-is+1) )
294 ic = hecmesh%surf_group%grp_item(2*i-1)
295 nsurf = hecmesh%surf_group%grp_item(2*i)
296 ic_type = hecmesh%elem_type(ic)
298 iss = hecmesh%elem_node_index(ic-1)
299 do j=1,
size( contact%master(i-is+1)%nodes )
300 nn = contact%master(i-is+1)%nodes(j)
301 contact%master(i-is+1)%nodes(j) = hecmesh%elem_node_item( iss+nn )
309 cgrp = contact%surf_id1
311 is= hecmesh%node_group%grp_index(cgrp-1) + 1
312 ie= hecmesh%node_group%grp_index(cgrp )
315 nodeid = hecmesh%global_node_ID(hecmesh%node_group%grp_item(i))
316 if(
present(myrank))
then
321 if( hecmesh%node_group%grp_item(i) <= hecmesh%nn_internal)
then
326 allocate( contact%slave(nslave) )
329 if(.not.
present(myrank))
then
331 if( hecmesh%node_group%grp_item(i) > hecmesh%nn_internal) cycle
334 contact%slave(ii) = hecmesh%node_group%grp_item(i)
338 allocate( contact%states(nslave) )
352 contact%symmetric = .true.
358 type(
tcontact),
intent(inout) :: embed
359 type(hecmwst_local_mesh),
pointer :: hecmesh
360 type(tcontactparam),
target :: cparam
361 integer(kint),
intent(in),
optional :: myrank
363 integer :: i, j, is, ie, cgrp, nsurf, nslave, ic, ic_type, iss, nn, ii
364 integer :: count,nodeid
368 embed%cparam => cparam
371 cgrp = embed%surf_id2
373 is= hecmesh%elem_group%grp_index(cgrp-1) + 1
374 ie= hecmesh%elem_group%grp_index(cgrp )
376 if(
present(myrank))
then
380 ic = hecmesh%elem_group%grp_item(i)
381 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
384 allocate( embed%master(count) )
387 ic = hecmesh%elem_group%grp_item(i)
388 if(hecmesh%elem_ID(ic*2) /= myrank) cycle
390 ic_type = hecmesh%elem_type(ic)
392 iss = hecmesh%elem_node_index(ic-1)
393 do j=1,
size( embed%master(count)%nodes )
394 nn = embed%master(count)%nodes(j)
395 embed%master(count)%nodes(j) = hecmesh%elem_node_item( iss+nn )
401 allocate( embed%master(ie-is+1) )
403 ic = hecmesh%elem_group%grp_item(i)
404 ic_type = hecmesh%elem_type(ic)
406 iss = hecmesh%elem_node_index(ic-1)
407 do j=1,
size( embed%master(i-is+1)%nodes )
408 nn = embed%master(i-is+1)%nodes(j)
409 embed%master(i-is+1)%nodes(j) = hecmesh%elem_node_item( iss+nn )
416 cgrp = embed%surf_id1
418 is= hecmesh%node_group%grp_index(cgrp-1) + 1
419 ie= hecmesh%node_group%grp_index(cgrp )
422 nodeid = hecmesh%global_node_ID(hecmesh%node_group%grp_item(i))
423 if(
present(myrank))
then
428 if( hecmesh%node_group%grp_item(i) <= hecmesh%nn_internal)
then
433 allocate( embed%slave(nslave) )
436 if(.not.
present(myrank))
then
438 if( hecmesh%node_group%grp_item(i) > hecmesh%nn_internal) cycle
441 embed%slave(ii) = hecmesh%node_group%grp_item(i)
445 allocate( embed%states(nslave) )
460 embed%nPenalty = 1.0d0
461 embed%tPenalty = 0.1d0
462 embed%refStiff = 0.0d0
464 embed%symmetric = .true.
469 type(tcontactinterference),
intent(inout) :: contact_if
479 do i = 1,
size(contacts)
480 if( contacts(i)%pair_name == contact_if%cp_name )
then
481 contacts(i)%if_type = contact_if%if_type
482 contacts(i)%if_etime = contact_if%etime
483 contacts(i)%initial_pos = contact_if%initial_pos
484 contacts(i)%end_pos = contact_if%end_pos
485 do j = 1,
size(contacts(i)%states)
486 contacts(i)%states(j)%interference_flag = contact_if%if_type
487 contacts(i)%states(j)%init_pos = contact_if%initial_pos
488 contacts(i)%states(j)%end_pos = contact_if%end_pos
490 contacts(i)%states(j)%time_factor = (contact_if%end_pos - contact_if%initial_pos) / contact_if%etime
492 contacts(i)%states(j)%time_factor = contact_if%etime
499 if( .not. isfind ) return;
506 type(
tcontact),
intent(inout) :: contact
508 if( .not.
associated(contact%states) )
return
509 do i=1,
size( contact%states )
510 contact%states(i)%state = -1
515 logical function is_active_contact( acgrp, contact )
516 integer,
intent(in) :: acgrp(:)
517 type(
tcontact),
intent(in) :: contact
518 if( any( acgrp==contact%group ) )
then
519 is_active_contact = .true.
521 is_active_contact = .false.
527 integer(kind=kint),
intent(in) :: file
528 type( hecmwst_contact_pair ),
intent(in) :: pair
530 integer(kind=kint) :: i
531 write(file,*)
"Number of contact pair", pair%n_pair
533 write(file,*) trim(pair%name(i)), pair%type(i), pair%slave_grp_id(i) &
534 ,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.