26 subroutine computetm_tt(ctState, tSurf, fcoeff, Tm, Tt, smoothing_type, Bn)
31 type(tsurfelement),
intent(in) :: tsurf
32 real(kind=kreal),
intent(in) :: fcoeff
33 integer(kind=kint),
optional,
intent(in) :: smoothing_type
36 real(kind=kreal),
intent(out) :: tm(3, 3*(l_max_surface_node+1))
37 real(kind=kreal),
intent(out) :: tt(3, 3*(l_max_surface_node+1))
38 real(kind=kreal),
optional,
intent(out) :: bn(:)
41 integer(kind=kint) :: i, j
42 integer(kind=kint) :: nnode
43 integer(kind=kint) :: smoothing
44 real(kind=kreal) :: shapefunc(l_max_surface_node)
45 real(kind=kreal) :: p_matrix(3, 3*l_max_surface_node)
46 real(kind=kreal) :: normal(3)
47 real(kind=kreal) :: pt(3,3)
52 nnode =
size(tsurf%nodes)
53 normal(1:3) = ctstate%direction(1:3)
57 if (
present(smoothing_type)) smoothing = smoothing_type
60 if ( smoothing ==
kcsnone )
then
71 tm(1, i*3+1) = -shapefunc(i)
72 tm(2, i*3+2) = -shapefunc(i)
73 tm(3, i*3+3) = -shapefunc(i)
79 tsurf%vertex_normals, p_matrix)
85 tm(1:3, 4:3*(nnode+1)) = -p_matrix(1:3, 1:3*nnode)
92 bn(1:3*(nnode+1)) = matmul(transpose(tm(1:3, 1:3*(nnode+1))), normal(1:3))
96 if (fcoeff /= 0.0d0)
then
101 pt(i,j) = 1.0d0 - normal(i)*normal(j)
103 pt(i,j) = -normal(i)*normal(j)
109 tt(1:3, 1:3*(l_max_surface_node+1)) = matmul(pt(1:3,1:3), tm(1:3, 1:3*(l_max_surface_node+1)))
124 Bn, metric, Ht, Gt, smoothing_type)
129 type(tsurfelement),
intent(in) :: tsurf
130 real(kind=kreal),
intent(in) :: ele(:,:)
131 integer(kind=kint),
optional,
intent(in) :: smoothing_type
134 real(kind=kreal),
intent(out) :: bn(:)
135 real(kind=kreal),
intent(out) :: metric(2,2)
136 real(kind=kreal),
intent(out) :: ht(:,:)
137 real(kind=kreal),
intent(out) :: gt(:,:)
140 integer(kind=kint) :: nnode, ndof
141 real(kind=kreal) :: tangent(3,2)
142 real(kind=kreal) :: tm(3, 3*(l_max_surface_node+1))
143 real(kind=kreal) :: tt(3, 3*(l_max_surface_node+1))
151 nnode =
size(tsurf%nodes)
156 call computetm_tt(ctstate, tsurf, 0.0d0, tm, tt, smoothing_type, bn=bn)
160 call dispincrematrix(ctstate%lpos(1:2), tsurf%etype, nnode, ele(1:3,1:nnode), &
161 tangent, metric, ht(1:2,1:ndof))
165 gt(1:2,1:ndof) = matmul(metric(1:2,1:2), ht(1:2,1:ndof))
196 mut, update_multiplier, slave_id, ctchanged, &
197 norm_trial, alpha, that, jump_ratio)
201 real(kind=kreal),
intent(in) :: fcoeff
202 real(kind=kreal),
intent(in) :: lambda_n
203 real(kind=kreal),
intent(in) :: metric(2,2)
204 real(kind=kreal),
intent(in) :: ht(:,:)
205 real(kind=kreal),
intent(in) :: gt(:,:)
206 real(kind=kreal),
intent(in) :: edisp(:)
207 integer(kind=kint),
intent(in) :: edof
208 real(kind=kreal),
intent(out) :: cttforce(:)
209 real(kind=kreal),
intent(in) :: mut
210 logical,
optional,
intent(in) :: update_multiplier
211 integer(kind=kint),
optional,
intent(in) :: slave_id
212 logical,
optional,
intent(inout) :: ctchanged
213 real(kind=kreal),
optional,
intent(out) :: norm_trial
214 real(kind=kreal),
optional,
intent(out) :: alpha
215 real(kind=kreal),
optional,
intent(out) :: that(2)
216 real(kind=kreal),
optional,
intent(out) :: jump_ratio
218 real(kind=kreal) :: dxy(2)
219 real(kind=kreal) :: fric(2)
220 real(kind=kreal) :: f3(edof)
221 real(kind=kreal) :: invmetric(2,2)
222 real(kind=kreal) :: det
223 real(kind=kreal) :: norm_fric
224 real(kind=kreal) :: tmp(2)
225 real(kind=kreal) :: alpha_local
230 if(
present(jump_ratio)) jump_ratio = 0.0d0
231 if(
present(update_multiplier)) do_update = update_multiplier
234 det = metric(1,1)*metric(2,2) - metric(1,2)*metric(2,1)
235 if( abs(det) < 1.0d-20 )
then
240 invmetric(1,1) = metric(2,2) / det
241 invmetric(2,2) = metric(1,1) / det
242 invmetric(1,2) = -metric(1,2) / det
243 invmetric(2,1) = -metric(2,1) / det
246 dxy(1:2) = matmul( gt(1:2,1:edof), edisp(1:edof) )
249 fric(1:2) = ctstate%multiplier(2:3) + mut*dxy(1:2)
252 tmp(1:2) = matmul(invmetric(1:2,1:2), fric(1:2))
253 norm_fric = dsqrt( dot_product(fric(1:2), tmp(1:2)) )
256 if(
present(norm_trial)) norm_trial = norm_fric
257 if(
present(that) .and. norm_fric > 1.0d-20)
then
258 that(1:2) = fric(1:2) / norm_fric
259 else if(
present(that))
then
264 if( lambda_n > 0.0d0 .and. norm_fric > 1.0d-20 )
then
265 alpha_local = min(1.0d0, fcoeff*lambda_n / norm_fric)
269 if(
present(alpha)) alpha = alpha_local
272 if( do_update .and. lambda_n > 0.0d0 )
then
274 if( alpha_local < 1.0d0 )
then
277 if(
present(ctchanged)) ctchanged = .true.
278 if(
present(slave_id)) print *,
"Node", slave_id,
"to slip state", norm_fric, fcoeff*lambda_n
279 if(
present(jump_ratio) .and. lambda_n > 1.0e-20 .and. norm_fric > 1.0e-20) &
280 & jump_ratio = norm_fric / (fcoeff*lambda_n)
283 fric(1:2) = fric(1:2) * alpha_local
287 if(
present(ctchanged)) ctchanged = .true.
288 if(
present(slave_id)) print *,
"Node", slave_id,
"to stick state", norm_fric, fcoeff*lambda_n
293 ctstate%multiplier(2:3) = fric(1:2)
294 else if( lambda_n <= 0.0d0 )
then
299 if( alpha_local < 1.0d0 )
then
300 fric(1:2) = fric(1:2) * alpha_local
305 f3(1:edof) = matmul( transpose(ht(1:2,1:edof)), fric(1:2) )
308 cttforce(1:edof) = -f3(1:edof)
316 real(kind=kreal) :: fcoeff, tpenalty
317 real(kind=kreal) :: lagrange
319 integer(kind=kint) :: i
320 real(kind=kreal) :: tf_yield
323 ctstate%tangentForce_trial(i) = ctstate%tangentForce1(i) + tpenalty*ctstate%reldisp(i)
326 tf_yield = fcoeff*dabs(lagrange)
327 if(ctstate%state ==
contactslip) tf_yield =0.99d0*tf_yield
328 if( dsqrt(dot_product(ctstate%tangentForce_trial,ctstate%tangentForce_trial)) <= tf_yield )
then
338 integer,
intent(in) :: etype
339 integer,
intent(in) :: nn
340 real(kind=kreal),
intent(in) :: elemt0(3,nn)
341 real(kind=kreal),
intent(in) :: elemt(3,nn)
345 real(kind=kreal) :: tangent0(3,2), tangent(3,2)
346 real(kind=kreal) :: coeff(2), norm, norm_tmp
347 real(kind=kreal) :: tangentforce_tmp(3)
349 call tangentbase( etype, nn, cstate%lpos(1:2), elemt0, tangent0 )
350 call tangentbase( etype, nn, cstate%lpos(1:2), elemt, tangent )
354 coeff(i) = dot_product(cstate%tangentForce(1:3),tangent0(1:3,i))
355 coeff(i) = coeff(i)/dot_product(tangent0(1:3,i),tangent0(1:3,i))
357 tangentforce_tmp(1:3) = coeff(1)*tangent0(1:3,1) + coeff(2)*tangent0(1:3,2)
358 norm_tmp = dsqrt(dot_product(tangentforce_tmp,tangentforce_tmp))
360 if( norm_tmp > 1.d-6 )
then
361 norm = dsqrt(dot_product(cstate%tangentForce,cstate%tangentForce))
362 coeff(1:2) = (norm/norm_tmp)*coeff(1:2)
366 cstate%tangentForce1(1:3) = coeff(1)*tangent(1:3,1) + coeff(2)*tangent(1:3,2)
This module encapsulate the basic functions of all elements provide by this software.
subroutine getshapefunc(fetype, localcoord, func)
Calculate the shape function in natural coordinate system.
subroutine tangentbase(fetype, nn, localcoord, elecoord, tangent)
Calculate base vector of tangent space of 3d surface.