35 integer(kind=kint) :: nn
36 integer(kind=kint) :: nodlocal(:)
37 real(kind=
kreal) :: stiffness(:, :)
39 integer(kind=kint) :: ndof, inod_e, jnod_e, inod, jnod
40 real(kind=
kreal) :: a(6,6)
45 inod = nodlocal(inod_e)
47 jnod = nodlocal(jnod_e)
57 real(kind=
kreal) :: stiffness(:, :), a(:, :)
58 integer(kind=kint) :: ndof, inod, jnod
60 integer(kind=kint) :: row_offset, col_offset, i, j
62 row_offset = ndof*(inod-1)
65 col_offset = ndof*(jnod-1)
68 a(i, j) = stiffness(i + row_offset, j + col_offset)
76 integer(kind=kint) :: inod, jnod
77 real(kind=
kreal) :: a(:, :)
79 integer(kind=kint) :: ndof, is, ie, k, idx_base, idx, idof, jdof
84 is = hecmat%indexU(inod-1)+1
85 ie = hecmat%indexU(inod)
88 if (k < is .or. ie < k)
then
90 write(*,*)
'###ERROR### : cannot find connectivity (1)'
96 idx_base = ndof**2 * (k-1)
101 hecmat%AU(idx) = hecmat%AU(idx) + a(idof, jdof)
103 idx_base = idx_base + ndof
106 else if (inod > jnod)
then
107 is = hecmat%indexL(inod-1)+1
108 ie = hecmat%indexL(inod)
111 if (k < is .or. ie < k)
then
113 write(*,*)
'###ERROR### : cannot find connectivity (2)'
119 idx_base = ndof**2 * (k-1)
122 idx = idx_base + jdof
124 hecmat%AL(idx) = hecmat%AL(idx) + a(idof, jdof)
126 idx_base = idx_base + ndof
130 idx_base = ndof**2 * (inod - 1)
133 idx = idx_base + jdof
135 hecmat%D(idx) = hecmat%D(idx) + a(idof, jdof)
137 idx_base = idx_base + ndof
151 integer(kind=kint) :: inod, jnod
153 integer(kind=kint) :: is, ie, k
155 if (inod < jnod)
then
156 is = hecmat%indexU(inod-1)+1
157 ie = hecmat%indexU(inod)
160 else if (inod > jnod)
then
161 is = hecmat%indexL(inod-1)+1
162 ie = hecmat%indexL(inod)
173 integer(kind=kint) :: array(:)
174 integer(kind=kint) :: is, ie, ival
176 integer(kind=kint) :: left, right, center, cval
181 if (left > right)
then
186 center = (left + right) / 2
189 if (ival < cval)
then
191 else if (cval < ival)
then
212 real(kind=
kreal),
pointer :: penalty
213 real(kind=
kreal) :: alpha, a1_2inv, ai, aj, factor
214 integer(kind=kint) :: impc, is, ie, i, j, inod, idof, jnod, jdof
215 logical :: is_internal_i
221 penalty => hecmat%Rarray(11)
223 if (penalty < 0.0) stop
"ERROR: negative penalty"
224 if (penalty < 1.0)
write(*,*)
"WARNING: penalty ", penalty,
" smaller than 1"
229 outer:
do impc = 1, hecmesh%mpc%n_mpc
230 is = hecmesh%mpc%mpc_index(impc-1) + 1
231 ie = hecmesh%mpc%mpc_index(impc)
234 if (hecmesh%mpc%mpc_dof(i) > hecmat%NDOF) cycle outer
237 a1_2inv = 1.0 / hecmesh%mpc%mpc_val(is)**2
241 inod = hecmesh%mpc%mpc_item(i)
244 if (.not. is_internal_i) cycle
246 idof = hecmesh%mpc%mpc_dof(i)
247 ai = hecmesh%mpc%mpc_val(i)
248 factor = ai * a1_2inv
251 jnod = hecmesh%mpc%mpc_item(j)
252 jdof = hecmesh%mpc%mpc_dof(j)
253 aj = hecmesh%mpc%mpc_val(j)
270 real(kind=
kreal) :: alpha, a1_2inv, ai, factor, ci
271 integer(kind=kint) :: ndof, impc, is, ie, i, inod, idof
276 if (alpha <= 0.0) stop
"ERROR: penalty applied on vector before matrix"
280 outer:
do impc = 1, hecmesh%mpc%n_mpc
281 is = hecmesh%mpc%mpc_index(impc-1) + 1
282 ie = hecmesh%mpc%mpc_index(impc)
285 if (hecmesh%mpc%mpc_dof(i) > ndof) cycle outer
288 a1_2inv = 1.0 / hecmesh%mpc%mpc_val(is)**2
291 inod = hecmesh%mpc%mpc_item(i)
293 idof = hecmesh%mpc%mpc_dof(i)
294 ai = hecmesh%mpc%mpc_val(i)
295 factor = ai * a1_2inv
297 ci = hecmesh%mpc%mpc_const(impc)
299 hecmat%B(ndof*(inod-1)+idof) = hecmat%B(ndof*(inod-1)+idof) + ci*factor*alpha
310 integer(kind=kint) :: inod, idof, jnod, jdof
311 real(kind=
kreal) :: val
313 integer(kind=kint) :: ndof, is, ie, k, idx
316 if (inod < jnod)
then
317 is = hecmat%indexU(inod-1)+1
318 ie = hecmat%indexU(inod)
321 if (k < is .or. ie < k)
then
322 write(*,*)
'###ERROR### : cannot find connectivity (3)'
328 idx = ndof**2 * (k-1) + ndof * (idof-1) + jdof
330 hecmat%AU(idx) = hecmat%AU(idx) + val
332 else if (inod > jnod)
then
333 is = hecmat%indexL(inod-1)+1
334 ie = hecmat%indexL(inod)
337 if (k < is .or. ie < k)
then
338 write(*,*)
'###ERROR### : cannot find connectivity (4)'
344 idx = ndof**2 * (k-1) + ndof * (idof-1) + jdof
346 hecmat%AL(idx) = hecmat%AL(idx) + val
349 idx = ndof**2 * (inod - 1) + ndof * (idof - 1) + jdof
351 hecmat%D(idx) = hecmat%D(idx) + val
363 integer(kind=kint) :: inode, idof
364 real(kind=
kreal) :: rhs, val
366 integer(kind=kint) :: ndof, in, i, ii, iii, ndof2, k, is, ie, iis, iie, ik, idx
369 if( ndof < idof )
return
373 hecmat%B(ndof*inode-(ndof-idof)) = rhs
374 if(
present(conmat)) conmat%B(ndof*inode-(ndof-idof)) = 0.0d0
379 if( i .NE. ndof-idof )
then
381 val = hecmat%D(ndof2*inode-ii)*rhs
383 hecmat%B(idx) = hecmat%B(idx) - val
384 if(
present(conmat))
then
385 val = conmat%D(ndof2*inode-ii)*rhs
387 conmat%B(idx) = conmat%B(idx) - val
394 ii = ndof2-1 - (idof-1)*ndof
397 hecmat%D(ndof2*inode-ii+i)=0.d0
398 if(
present(conmat)) conmat%D(ndof2*inode-ii+i)=0.d0
405 hecmat%D(ndof2*inode-ii) = 0.d0
406 if(
present(conmat)) conmat%D(ndof2*inode-ii) = 0.d0
408 hecmat%D(ndof2*inode-ii) = 1.d0
409 if(
present(conmat)) conmat%D(ndof2*inode-ii) = 0.d0
416 ii = ndof2-1 - (idof-1)*ndof
417 is = hecmat%indexL(inode-1) + 1
418 ie = hecmat%indexL(inode )
424 hecmat%AL(ndof2*k-ii+i) = 0.d0
425 if(
present(conmat)) conmat%AL(ndof2*k-ii+i) = 0.d0
430 iis = hecmat%indexU(in-1) + 1
431 iie = hecmat%indexU(in )
433 if (hecmat%itemU(ik) .eq. inode)
then
437 val = hecmat%AU(ndof2*ik-iii)*rhs
439 hecmat%B(idx) = hecmat%B(idx) - val
440 hecmat%AU(ndof2*ik-iii)= 0.d0
441 if(
present(conmat))
then
442 val = conmat%AU(ndof2*ik-iii)*rhs
444 conmat%B(idx) = conmat%B(idx) - val
445 conmat%AU(ndof2*ik-iii)= 0.d0
455 ii = ndof2-1 - (idof-1)*ndof
456 is = hecmat%indexU(inode-1) + 1
457 ie = hecmat%indexU(inode )
463 hecmat%AU(ndof2*k-ii+i) = 0.d0
464 if(
present(conmat)) conmat%AU(ndof2*k-ii+i) = 0.d0
469 iis = hecmat%indexL(in-1) + 1
470 iie = hecmat%indexL(in )
472 if (hecmat%itemL(ik) .eq. inode)
then
477 val = hecmat%AL(ndof2*ik-iii)*rhs
479 hecmat%B(idx) = hecmat%B(idx) - val
480 hecmat%AL(ndof2*ik-iii) = 0.d0
481 if(
present(conmat))
then
482 val = conmat%AL(ndof2*ik-iii)*rhs
484 conmat%B(idx) = conmat%B(idx) - val
485 conmat%AL(ndof2*ik-iii) = 0.d0
505 integer(kind=kint) :: inode, idof
506 integer(kind=kint) :: isu, ieu, isl, iel, i, l, k
507 real(kind=
kreal) :: rhs
509 isu = heclagmat%indexU_lagrange(inode-1)+1
510 ieu = heclagmat%indexU_lagrange(inode)
512 heclagmat%AU_lagrange((i-1)*3+idof) = 0.0d0
513 l = heclagmat%itemU_lagrange(i)
514 isl = heclagmat%indexL_lagrange(l-1)+1
515 iel = heclagmat%indexL_lagrange(l)
517 if(k < isl .or. k > iel) cycle
518 hecmat%B(hecmat%NP*hecmat%NDOF+l) = hecmat%B(hecmat%NP*hecmat%NDOF+l) - heclagmat%AL_lagrange((k-1)*3+idof)*rhs
519 heclagmat%AL_lagrange((k-1)*3+idof) = 0.0d0
529 integer(kind=kint) :: nnode, ndlocal(nnode + 1), id_lagrange
532 integer(kind=kint) :: i, j, inod, jnod, l
533 integer(kind=kint) :: isl, iel, idxl_base, kl, idxl, isu, ieu, idxu_base, ku, idxu
534 real(kind=
kreal) :: fcoeff
535 real(kind=
kreal) :: stiffness(:,:)
536 real(kind=
kreal) :: a(3, 3)
540 isl = heclagmat%indexL_lagrange(inod-1)+1
541 iel = heclagmat%indexL_lagrange(inod)
545 isu = heclagmat%indexU_lagrange(jnod-1)+1
546 ieu = heclagmat%indexU_lagrange(jnod)
549 if( kl<isl .or. kl>iel )
then
550 write(*,*)
'###ERROR### : cannot find connectivity (Lagrange1)'
554 if( ku<isu .or. ku>ieu )
then
555 write(*,*)
'###ERROR### : cannot find connectivity (Lagrange2)'
564 heclagmat%AL_lagrange(idxl) = heclagmat%AL_lagrange(idxl) + stiffness((i-1)*3+1,(j-1)*3+l)
566 heclagmat%AU_lagrange(idxu) = heclagmat%AU_lagrange(idxu) + stiffness((j-1)*3+l,(i-1)*3+1)
571 if(fcoeff /= 0.0d0)
then
577 call stf_get_block(stiffness(1:(nnode+1)*3,1:(nnode+1)*3), 3, i, j, a)
subroutine, public hecmw_mat_ass_contactlag(nnode, ndLocal, id_lagrange, fcoeff, stiffness, hecMAT, hecLagMAT)
This subroutine assembles contact stiffness matrix of a contact pair into global stiffness matrix.
subroutine, public hecmw_mat_ass_bc(hecMAT, inode, idof, RHS, conMAT)
subroutine, public hecmw_mat_ass_bc_contactlag(hecMAT, hecLagMAT, inode, idof, RHS)
Modify Lagrange multiplier-related part of stiffness matrix and right-hand side vector for dealing wi...
logical function, public hecmw_mat_profile_has_node(hecMAT, inod, jnod)
Read-only companion to hecmw_mat_add_node: report whether the (inod, jnod) block exists in the matrix...
integer(kind=kint) function, public hecmw_array_search_i(array, is, iE, ival)
subroutine, public hecmw_mat_add_dof(hecMAT, inod, idof, jnod, jdof, val)
subroutine, public hecmw_mat_ass_equation_rhs(hecMESH, hecMAT)
subroutine, public stf_get_block(stiffness, ndof, inod, jnod, a)
subroutine, public hecmw_mat_ass_elem(hecMAT, nn, nodLOCAL, stiffness)
subroutine, public hecmw_mat_ass_equation(hecMESH, hecMAT)
subroutine, public hecmw_mat_add_node(hecMAT, inod, jnod, a)
real(kind=kreal) function, public hecmw_mat_diag_max(hecMAT, hecMESH)
integer(kind=kint) function, public hecmw_mat_get_penalized(hecMAT)
subroutine, public hecmw_mat_set_penalized_b(hecMAT, penalized_b)
integer(kind=kint) function, public hecmw_mat_get_penalized_b(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_penalty_alpha(hecMAT)
subroutine, public hecmw_mat_set_penalty_alpha(hecMAT, alpha)
subroutine, public hecmw_mat_set_penalized(hecMAT, penalized)
subroutine hecmw_abort(comm, code)
integer(kind=kint) function hecmw_comm_get_comm()
integer(kind=4), parameter kreal
integer(kind=kint) function hecmw_comm_get_rank()
Structure for Lagrange multiplier-related part of stiffness matrix (Lagrange multiplier-related matri...