17 public :: hecmwst_matrix_lagrange
22 integer(kind=kint),
save :: NPL_org, NPU_org
23 type(nodeRelated),
pointer,
save :: list_nodeRelated_org(:) => null()
25 type(nodeRelated),
pointer :: list_nodeRelated(:) => null()
27 logical :: permission = .false.
32 integer(kind=kint) :: algtype
33 if( algtype == contactsslid .or. algtype == contactfslid )
then
35 else if( algtype == contacttied )
then
43 type(hecmwst_matrix) :: hecmat
45 if(
associated(list_noderelated_org) )
return
46 call hecmw_construct_noderelated_from_hecmat(hecmat, npl_org, npu_org, list_noderelated_org)
52 subroutine fstr_mat_con_contact(cstep,contact_algo,hecMAT,fstrSOLID,hecLagMAT,infoCTChange,conMAT,is_contact_active)
54 integer(kind=kint) :: cstep
55 integer(kind=kint) :: contact_algo
56 type(hecmwst_matrix) :: hecmat
58 type(hecmwst_matrix_lagrange) :: heclagmat
59 type(fstr_info_contactchange) :: infoctchange
61 integer(kind=kint) :: num_lagrange
62 integer(kind=kint) :: countnon0lu_node, countnon0lu_lagrange
63 integer(kind=kint) :: numnon0_node, numnon0_lagrange
65 type (hecmwst_matrix) :: conmat
66 logical,
intent(in) :: is_contact_active
68 integer(kind=kint) :: i, j, grpid
69 integer(kind=kint) :: nlag
73 do i = 1, fstrsolid%n_contacts
74 grpid = fstrsolid%contacts(i)%group
77 do j = 1,
size(fstrsolid%contacts(i)%slave)
78 if( fstrsolid%contacts(i)%states(j)%state == contactfree ) cycle
79 num_lagrange = num_lagrange + nlag
83 do i = 1, fstrsolid%n_embeds
84 grpid = fstrsolid%embeds(i)%group
87 do j = 1,
size(fstrsolid%embeds(i)%slave)
88 if( fstrsolid%embeds(i)%states(j)%state == contactfree ) cycle
89 num_lagrange = num_lagrange + nlag
95 call hecmw_init_noderelated_from_org(hecmat%NP,num_lagrange,is_contact_active,list_noderelated_org,list_noderelated)
98 countnon0lu_node = npl_org + npu_org
99 countnon0lu_lagrange = 0
100 if( is_contact_active )
call getnewlistofrelatednodesandlagrangemultipliers(cstep,contact_algo, &
101 & hecmat%NP,fstrsolid,countnon0lu_node,countnon0lu_lagrange,list_noderelated)
104 numnon0_node = countnon0lu_node/2
105 numnon0_lagrange = countnon0lu_lagrange/2
106 call hecmw_construct_hecmat_from_noderelated(hecmat%N, hecmat%NP, hecmat%NDOF, &
107 & numnon0_node, num_lagrange, list_noderelated, hecmat)
108 call hecmw_construct_hecmat_from_noderelated(hecmat%N, hecmat%NP, hecmat%NDOF, &
109 & numnon0_node, num_lagrange, list_noderelated, conmat)
110 if( contact_algo ==
kcaslagrange )
call hecmw_construct_heclagmat_from_noderelated(hecmat%NP, &
111 & hecmat%NDOF, num_lagrange, numnon0_lagrange, is_contact_active, list_noderelated, heclagmat)
112 call hecmw_finalize_noderelated(list_noderelated)
115 if( is_contact_active .and. contact_algo ==
kcaslagrange ) &
116 call fstr_copy_lagrange_contact(fstrsolid,heclagmat)
121 subroutine getnewlistofrelatednodesandlagrangemultipliers( &
122 & cstep, contact_algo, np, fstrSOLID, countNon0LU_node, countNon0LU_lagrange, list_nodeRelated )
123 integer(kind=kint),
intent(in) :: cstep
124 integer(kind=kint),
intent(in) :: contact_algo
125 integer(kind=kint),
intent(in) :: np
127 integer(kind=kint),
intent(inout) :: countnon0lu_node, countnon0lu_lagrange
128 type(noderelated),
pointer,
intent(inout) :: list_noderelated(:)
130 integer(kind=kint) :: grpid
131 integer(kind=kint) :: count_lagrange
132 integer(kind=kint) :: ctsurf, etype, nnode, ndlocal(l_max_surface_node + 1)
133 integer(kind=kint) :: i, j, k, nlag, algtype
134 real(kind=kreal) :: fcoeff
135 logical :: necessary_to_insert_node
138 do i = 1, fstrsolid%n_contacts
140 grpid = fstrsolid%contacts(i)%group
143 fcoeff = fstrsolid%contacts(i)%fcoeff
144 necessary_to_insert_node = ( fcoeff /= 0.0d0 .or. contact_algo ==
kcaalagrange )
146 algtype = fstrsolid%contacts(i)%algtype
149 if( algtype == contacttied ) permission = .true.
151 do j = 1,
size(fstrsolid%contacts(i)%slave)
153 if( fstrsolid%contacts(i)%states(j)%state == contactfree ) cycle
154 ctsurf = fstrsolid%contacts(i)%states(j)%surface
155 etype = fstrsolid%contacts(i)%master(ctsurf)%etype
157 stop
" ##Error: This element type is not supported in contact analysis !!! "
158 nnode =
size(fstrsolid%contacts(i)%master(ctsurf)%nodes)
159 ndlocal(1) = fstrsolid%contacts(i)%slave(j)
160 ndlocal(2:nnode+1) = fstrsolid%contacts(i)%master(ctsurf)%nodes(1:nnode)
163 if( contact_algo ==
kcaslagrange ) count_lagrange = count_lagrange + 1
164 call hecmw_ass_noderelated_from_contact_pair(np, nnode, ndlocal, count_lagrange, permission, &
165 & necessary_to_insert_node, list_noderelated_org, list_noderelated, countnon0lu_node, countnon0lu_lagrange )
171 do i = 1, fstrsolid%n_embeds
173 grpid = fstrsolid%embeds(i)%group
176 necessary_to_insert_node = ( contact_algo ==
kcaalagrange )
182 do j = 1,
size(fstrsolid%embeds(i)%slave)
184 if( fstrsolid%embeds(i)%states(j)%state == contactfree ) cycle
185 ctsurf = fstrsolid%embeds(i)%states(j)%surface
186 etype = fstrsolid%embeds(i)%master(ctsurf)%etype
187 nnode =
size(fstrsolid%embeds(i)%master(ctsurf)%nodes)
188 ndlocal(1) = fstrsolid%embeds(i)%slave(j)
189 ndlocal(2:nnode+1) = fstrsolid%embeds(i)%master(ctsurf)%nodes(1:nnode)
192 if( contact_algo ==
kcaslagrange ) count_lagrange = count_lagrange + 1
193 call hecmw_ass_noderelated_from_contact_pair(np, nnode, ndlocal, count_lagrange, permission, &
194 & necessary_to_insert_node, list_noderelated_org, list_noderelated, countnon0lu_node, countnon0lu_lagrange )
200 end subroutine getnewlistofrelatednodesandlagrangemultipliers
203 subroutine fstr_copy_lagrange_contact(fstrSOLID,hecLagMAT)
206 type(hecmwst_matrix_lagrange) :: heclagmat
207 integer (kind=kint) :: id_lagrange, algtype, i, j, k, nlag
211 do i = 1, fstrsolid%n_contacts
213 algtype = fstrsolid%contacts(i)%algtype
216 do j = 1,
size(fstrsolid%contacts(i)%slave)
217 if( fstrsolid%contacts(i)%states(j)%state == contactfree ) cycle
219 id_lagrange = id_lagrange + 1
220 heclagmat%Lagrange(id_lagrange)=fstrsolid%contacts(i)%states(j)%multiplier(k)
225 do i = 1, fstrsolid%n_embeds
227 do j = 1,
size(fstrsolid%embeds(i)%slave)
228 if( fstrsolid%embeds(i)%states(j)%state == contactfree ) cycle
230 id_lagrange = id_lagrange + 1
231 heclagmat%Lagrange(id_lagrange)=fstrsolid%embeds(i)%states(j)%multiplier(k)
236 end subroutine fstr_copy_lagrange_contact
242 type(hecmwst_local_mesh) :: hecmesh
243 integer (kind=kint) :: is_in_contact
246 if( fstrsolid%n_contacts>0 )
then
247 if( any(fstrsolid%contacts(:)%fcoeff /= 0.0d0) ) is_in_contact = 1
249 call hecmw_allreduce_i1(hecmesh, is_in_contact, hecmw_max)