22 private :: fstr_update_ndforce_mpc
37 integer(kind=kint),
intent(in) :: cstep
38 type(hecmwst_local_mesh),
intent(in) :: hecmesh
39 type(hecmwst_matrix),
intent(inout) :: hecmat
41 type(hecmwst_matrix),
intent(inout),
optional :: conmat
43 integer(kind=kint) :: ndof, idof
44 real(kind=kreal) :: factor
46 factor = fstrsolid%factor(2)
49 do idof=1, hecmesh%n_node* hecmesh%n_dof
50 hecmat%B(idof)=fstrsolid%GL(idof)-fstrsolid%QFORCE(idof)
60 call fstr_update_ndforce_mpc( hecmesh, hecmat%B )
67 call hecmw_update_r(hecmesh,hecmat%B,hecmesh%n_node, ndof)
70 subroutine fstr_update_ndforce_mpc( hecMESH, B )
72 type(hecmwst_local_mesh),
intent(in) :: hecmesh
73 real(kind=kreal),
intent(inout) :: b(:)
75 integer(kind=kint) ndof, ig0, is0, ie0, ik, in, idof
76 real(kind=kreal) :: rhs, lambda
79 outer:
do ig0=1,hecmesh%mpc%n_mpc
80 is0= hecmesh%mpc%mpc_index(ig0-1)+1
81 ie0= hecmesh%mpc%mpc_index(ig0)
83 if (hecmesh%mpc%mpc_dof(ik) > ndof) cycle outer
86 in = hecmesh%mpc%mpc_item(is0)
87 idof = hecmesh%mpc%mpc_dof(is0)
88 rhs = hecmesh%mpc%mpc_val(is0)
89 lambda = b(ndof*(in-1)+idof)/rhs
92 in = hecmesh%mpc%mpc_item(ik)
93 idof = hecmesh%mpc%mpc_dof(ik)
94 rhs = hecmesh%mpc%mpc_val(ik)
95 b(ndof*(in-1)+idof) = b(ndof*(in-1)+idof) - rhs*lambda
98 end subroutine fstr_update_ndforce_mpc
102 integer(kind=kint),
intent(in) :: cstep
103 type(hecmwst_local_mesh),
intent(in) :: hecmesh
105 real(kind=kreal),
intent(inout) :: b(:)
107 integer(kind=kint) ndof, ig0, ig, ityp, is0, ie0, ik, in, idof1, idof2, idof
108 integer(kind=kint) :: grpid
113 do ig0= 1, fstrsolid%BOUNDARY_ngrp_tot
114 grpid = fstrsolid%BOUNDARY_ngrp_GRPID(ig0)
116 ig= fstrsolid%BOUNDARY_ngrp_ID(ig0)
117 ityp= fstrsolid%BOUNDARY_ngrp_type(ig0)
118 is0= hecmesh%node_group%grp_index(ig-1) + 1
119 ie0= hecmesh%node_group%grp_index(ig )
121 in = hecmesh%node_group%grp_item(ik)
123 idof2 = ityp - idof1*10
124 if( fstrsolid%BOUNDARY_ngrp_rotID(ig0) > 0 )
then
129 b( ndof*(in-1) + idof ) = 0.d0
142 integer(kind=kint),
intent(in) :: cstep
143 type(hecmwst_local_mesh),
intent(in) :: hecmesh
146 integer(kind=kint) :: ndof, ig0, ig, ityp, is0, ie0, ik, in, idof1, idof2, idof
147 integer(kind=kint) :: grpid
150 fstrsolid%REACTION = 0.d0
153 do ig0= 1, fstrsolid%BOUNDARY_ngrp_tot
154 grpid = fstrsolid%BOUNDARY_ngrp_GRPID(ig0)
156 ig= fstrsolid%BOUNDARY_ngrp_ID(ig0)
157 ityp= fstrsolid%BOUNDARY_ngrp_type(ig0)
158 is0= hecmesh%node_group%grp_index(ig-1) + 1
159 ie0= hecmesh%node_group%grp_index(ig )
161 in = hecmesh%node_group%grp_item(ik)
163 idof2 = ityp - idof1*10
164 if( fstrsolid%BOUNDARY_ngrp_rotID(ig0) > 0 )
then
169 fstrsolid%REACTION(ndof*(in-1)+idof) = fstrsolid%QFORCE(ndof*(in-1)+idof)
171 if(
associated(fstrsolid%EMBED_NFORCE) ) fstrsolid%REACTION(ndof*(in-1)+idof) = &
172 & fstrsolid%QFORCE(ndof*(in-1)+idof) - fstrsolid%EMBED_NFORCE(ndof*(in-1)+idof)
178 if( fstrsolid%VELOCITY_type /=
kbcinitial )
then
179 do ig0= 1, fstrsolid%VELOCITY_ngrp_tot
180 grpid = fstrsolid%VELOCITY_ngrp_GRPID(ig0)
182 ig= fstrsolid%VELOCITY_ngrp_ID(ig0)
183 ityp= fstrsolid%VELOCITY_ngrp_type(ig0)
184 is0= hecmesh%node_group%grp_index(ig-1) + 1
185 ie0= hecmesh%node_group%grp_index(ig )
187 idof2 = ityp - idof1*10
189 in = hecmesh%node_group%grp_item(ik)
191 fstrsolid%REACTION(ndof*(in-1)+idof) = fstrsolid%QFORCE(ndof*(in-1)+idof)
198 if( fstrsolid%ACCELERATION_type /=
kbcinitial )
then
199 do ig0= 1, fstrsolid%ACCELERATION_ngrp_tot
200 grpid = fstrsolid%ACCELERATION_ngrp_GRPID(ig0)
202 ig= fstrsolid%ACCELERATION_ngrp_ID(ig0)
203 ityp= fstrsolid%ACCELERATION_ngrp_type(ig0)
204 is0= hecmesh%node_group%grp_index(ig-1) + 1
205 ie0= hecmesh%node_group%grp_index(ig )
207 idof2 = ityp - idof1*10
209 in = hecmesh%node_group%grp_item(ik)
211 fstrsolid%REACTION(ndof*(in-1)+idof) = fstrsolid%QFORCE(ndof*(in-1)+idof)
224 integer,
intent(in) :: cstep
225 type (hecmwST_local_mesh) :: hecMESH
226 type (hecmwST_matrix) :: hecMAT
227 type (fstr_solid) :: fstrSOLID
228 real(kind=kreal),
intent(in) :: ctime
229 real(kind=kreal),
intent(in) :: dtime
230 type (fstr_param) :: fstrPARAM
231 real(kind=kreal),
intent(in) :: tincr
232 integer(kind=kint) :: iter
238 if( fstrsolid%DLOAD_follow /= 0 .or. fstrsolid%CLOAD_ngrp_rot /= 0 ) &
239 &
call fstr_ass_load(cstep, ctime+dtime, hecmesh, hecmat, fstrsolid, fstrparam )
242 if( fstrsolid%elemact%ELEMACT_egrp_tot > 0 )
then
255 integer,
intent(in) :: cstep
256 type (hecmwST_local_mesh) :: hecMESH
257 type (hecmwST_matrix) :: hecMAT
258 type (fstr_solid) :: fstrSOLID
259 real(kind=kreal),
intent(in) :: ctime
260 real(kind=kreal),
intent(in) :: dtime
261 type (fstr_param) :: fstrPARAM
262 real(kind=kreal),
intent(in) :: tincr
263 integer(kind=kint) :: iter
266 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
267 real(kind=kreal),
allocatable :: shell_dtriad_bak(:), shell_ddrill_bak(:)
269 do i=1, hecmat%ndof*hecmesh%n_node
270 dunode_bak(i) = fstrsolid%dunode(i)
272 if(
associated(fstrsolid%shell_dtriad) )
then
273 allocate(shell_dtriad_bak(
size(fstrsolid%shell_dtriad)))
274 shell_dtriad_bak(:) = fstrsolid%shell_dtriad(:)
276 if(
associated(fstrsolid%shell_ddrill) )
then
277 allocate(shell_ddrill_bak(
size(fstrsolid%shell_ddrill)))
278 shell_ddrill_bak(:) = fstrsolid%shell_ddrill(:)
282 do i=1, hecmat%ndof*hecmesh%n_node
283 fstrsolid%dunode(i) = dunode_bak(i)
285 if(
allocated(shell_dtriad_bak) )
then
286 fstrsolid%shell_dtriad(:) = shell_dtriad_bak(:)
287 deallocate(shell_dtriad_bak)
289 if(
allocated(shell_ddrill_bak) )
then
290 fstrsolid%shell_ddrill(:) = shell_ddrill_bak(:)
291 deallocate(shell_ddrill_bak)
298 real(kind=kreal),
intent(in) :: force(:)
299 type(hecmwst_local_mesh),
intent(in) :: hecmesh
308 real(kind=kreal),
intent(in) :: force(:), displacement(:)
309 type(hecmwst_local_mesh),
intent(in) :: hecmesh
312 call hecmw_innerproduct_r(hecmesh, ndof, force, displacement,
fstr_get_energy)
318 type(hecmwst_local_mesh),
intent(in) :: hecmesh
319 type(hecmwst_matrix),
intent(in) :: hecmat
321 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
322 character(len=13) :: flag
323 real(kind=kreal) :: tmp1, tmp2, bi
324 integer :: i, i0, ndof
325 if( flag==
'residualForce' )
then
327 call hecmw_innerproduct_r(hecmesh,ndof,hecmat%B,hecmat%B,tmp1)
329 i0 = hecmesh%n_node*ndof
330 do i=1,heclagmat%num_lagrange
334 call hecmw_allreduce_r1(hecmesh,tmp2,hecmw_sum)
336 elseif( flag==
' force' )
then
349 type(hecmwst_matrix),
intent(in) :: hecmat
350 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
351 type(hecmwst_matrix),
intent(in) :: conmat
352 type(hecmwst_local_mesh),
intent(in) :: hecmesh
353 real(kind=kreal),
intent(out) :: resid_vec(:)
354 integer(kind=kint),
intent(out) :: nresid
356 integer(kind=kint) :: i, ndof, nndof, npndof, num_lagrange
359 nndof = conmat%N * ndof
360 npndof = conmat%NP * ndof
361 num_lagrange = heclagmat%num_lagrange
362 nresid = nndof + num_lagrange
366 resid_vec(i) = conmat%B(i)
368 call hecmw_assemble_r(hecmesh, resid_vec, conmat%NP, conmat%NDOF)
372 resid_vec(i) = resid_vec(i) + hecmat%B(i)
376 do i = 1, num_lagrange
377 resid_vec(nndof + i) = conmat%B(npndof + i)
386 type(hecmwst_matrix),
intent(in) :: hecmat
387 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
388 type(hecmwst_matrix),
intent(in) :: conmat
389 type(hecmwst_local_mesh),
intent(in) :: hecmesh
391 real(kind=kreal) :: rhsb
392 integer(kind=kint) :: i,ndof,nndof,npndof,num_lagrange
393 real(kind=kreal),
allocatable :: rhs_con(:)
394 real(kind=kreal),
pointer :: rhs_lag(:)
397 nndof = conmat%N * ndof
398 npndof = conmat%NP * ndof
399 num_lagrange = heclagmat%num_lagrange
401 allocate(rhs_con(npndof))
403 rhs_con(i) = conmat%B(i)
405 call hecmw_assemble_r(hecmesh, rhs_con, conmat%NP, conmat%NDOF)
408 rhs_con(i) = rhs_con(i) + hecmat%B(i)
411 rhs_lag => conmat%B(npndof+1:npndof+num_lagrange)
413 rhsb = dot_product(rhs_con(1:nndof), rhs_con(1:nndof)) + dot_product(rhs_lag(:), rhs_lag(:))
414 call hecmw_allreduce_r1(hecmesh, rhsb, hecmw_sum)
422 type(hecmwst_matrix),
intent(in) :: hecmat
423 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
424 type(hecmwst_local_mesh),
intent(in) :: hecmesh
425 real(kind=kreal) :: rhsx
426 integer(kind=kint) :: nndof, npndof, i
428 nndof = hecmat%N * hecmat%NDOF
429 npndof = hecmat%NP * hecmat%NDOF
432 rhsx = rhsx + hecmat%X(i) ** 2
434 do i=1,heclagmat%num_lagrange
435 rhsx = rhsx + hecmat%X(npndof+i) ** 2
437 call hecmw_allreduce_r1(hecmesh, rhsx, hecmw_sum)
446 integer(kind=kint),
intent(in) :: cstep
447 type(hecmwst_local_mesh),
intent(in) :: hecmesh
448 type(hecmwst_matrix),
intent(inout) :: hecmat
450 integer(kind=kint),
intent(in) :: ptype
451 real(kind=kreal) :: potential
453 integer(kind=kint) :: ndof, i, icel, icel0, ig
454 real(kind=kreal),
allocatable :: totdisp(:), totload(:)
455 real(kind=kreal) :: factor
456 real(kind=kreal) :: extenal_work, internal_work
459 factor = fstrsolid%factor(2)
462 allocate(totload(ndof*hecmesh%n_node))
465 do i=1,ndof*hecmesh%n_node
466 totload(i) = 0.5d0*(fstrsolid%GL(i)+fstrsolid%GL0(i))
473 call fstr_update_ndforce_mpc( hecmesh, totload )
475 if( ptype == 1 )
then
478 do icel0=1,hecmesh%ne_internal
479 icel=hecmesh%elem_internal_list(icel0)
480 do ig=1,
size(fstrsolid%elements(icel)%gausses)
481 internal_work = internal_work + fstrsolid%elements(icel)%gausses(ig)%strain_energy
484 call hecmw_allreduce_r1(hecmesh, internal_work, hecmw_sum)
486 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
487 potential = internal_work - extenal_work
488 else if( ptype == 2 )
then
490 call hecmw_innerproduct_r(hecmesh,ndof,0.5d0*(fstrsolid%QFORCE+fstrsolid%QFORCE_bak),fstrsolid%dunode,internal_work)
492 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
493 potential = internal_work - extenal_work
494 else if( ptype == 3 )
then
496 totload(:) = fstrsolid%QFORCE(:) - totload(:)
500 call hecmw_innerproduct_r(hecmesh,ndof,totload,totload,potential)
501 potential = dsqrt(potential)
503 stop
"ptype error in fstr_get_potential"
514 integer(kind=kint),
intent(in) :: cstep
515 type(hecmwst_local_mesh),
intent(in) :: hecmesh
516 type(hecmwst_matrix),
intent(inout) :: hecmat
518 integer(kind=kint),
intent(in) :: ptype
519 real(kind=kreal) :: potential
522 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
523 real(kind=kreal),
allocatable :: shell_dtriad_bak(:), shell_ddrill_bak(:)
525 do i=1, hecmat%ndof*hecmesh%n_node
526 dunode_bak(i) = fstrsolid%dunode(i)
528 if(
associated(fstrsolid%shell_dtriad) )
then
529 allocate(shell_dtriad_bak(
size(fstrsolid%shell_dtriad)))
530 shell_dtriad_bak(:) = fstrsolid%shell_dtriad(:)
532 if(
associated(fstrsolid%shell_ddrill) )
then
533 allocate(shell_ddrill_bak(
size(fstrsolid%shell_ddrill)))
534 shell_ddrill_bak(:) = fstrsolid%shell_ddrill(:)
538 do i=1, hecmat%ndof*hecmesh%n_node
539 fstrsolid%dunode(i) = dunode_bak(i)
541 if(
allocated(shell_dtriad_bak) )
then
542 fstrsolid%shell_dtriad(:) = shell_dtriad_bak(:)
543 deallocate(shell_dtriad_bak)
545 if(
allocated(shell_ddrill_bak) )
then
546 fstrsolid%shell_ddrill(:) = shell_ddrill_bak(:)
547 deallocate(shell_ddrill_bak)
552 restrt_step_num, sub_step, ctime, dtime, iter, tincr )
555 integer,
intent(in) :: cstep
556 type (hecmwST_local_mesh) :: hecMESH
557 type (hecmwST_matrix) :: hecMAT
558 type (fstr_solid) :: fstrSOLID
559 integer,
intent(in) :: sub_step
560 real(kind=kreal),
intent(in) :: ctime
561 real(kind=kreal),
intent(in) :: dtime
562 type (fstr_param) :: fstrPARAM
563 type (hecmwST_matrix_lagrange) :: hecLagMAT
564 integer(kind=kint) :: restrt_step_num
566 integer(kind=kint) :: iter, i, j
567 integer(kind=kint),
parameter :: ntot = 30
568 real(kind=kreal) :: tincr, alpha, dulen
569 real(kind=kreal) :: pot(3)
570 real(kind=kreal),
allocatable :: dunode_bak(:)
571 real(kind=kreal),
allocatable :: shell_dtriad_bak(:), shell_ddrill_bak(:)
573 dulen = dsqrt(dot_product(fstrsolid%dunode(:),fstrsolid%dunode(:)))
574 write(
imsg,*)
"dulen",dulen
576 allocate(dunode_bak(
size(fstrsolid%dunode)))
577 do i=1, hecmat%ndof*hecmesh%n_node
578 dunode_bak(i) = fstrsolid%dunode(i)
580 if(
associated(fstrsolid%shell_dtriad) )
then
581 allocate(shell_dtriad_bak(
size(fstrsolid%shell_dtriad)))
582 shell_dtriad_bak(:) = fstrsolid%shell_dtriad(:)
584 if(
associated(fstrsolid%shell_ddrill) )
then
585 allocate(shell_ddrill_bak(
size(fstrsolid%shell_ddrill)))
586 shell_ddrill_bak(:) = fstrsolid%shell_ddrill(:)
590 alpha = 5.d-3*dble(i)/dble(ntot)
591 hecmat%X(:) = alpha*fstrsolid%dunode(:)
592 fstrsolid%dunode(:) = dunode_bak(:)
593 if(
allocated(shell_dtriad_bak) ) fstrsolid%shell_dtriad(:) = shell_dtriad_bak(:)
594 if(
allocated(shell_ddrill_bak) ) fstrsolid%shell_ddrill(:) = shell_ddrill_bak(:)
600 write(
imsg,
'(I4,5(",",1pE16.9))') i,alpha,alpha*dulen,pot(1:3)
603 do i=1,
size(fstrsolid%dunode)
604 fstrsolid%dunode(i) = dunode_bak(i)
606 if(
allocated(shell_dtriad_bak) )
then
607 fstrsolid%shell_dtriad(:) = shell_dtriad_bak(:)
608 deallocate(shell_dtriad_bak)
610 if(
allocated(shell_ddrill_bak) )
then
611 fstrsolid%shell_ddrill(:) = shell_ddrill_bak(:)
612 deallocate(shell_ddrill_bak)
This module provides functions to take into account external load.
subroutine fstr_ass_load(cstep, ctime, hecMESH, hecMAT, fstrSOLID, fstrPARAM)
This subroutine assmble following external force into fstrSOLIDGL and hecMATB afterwards.
This module provide a function to elemact elements.
subroutine fstr_update_elemact_solid_by_value(hecMESH, fstrSOLID, cstep, ctime)
Finite-rotation nodal kinematics for NLGEOM.
subroutine, public fstr_apply_solution_increment(hecMESH, fstrSOLID, ndof, x)
Apply the linear-solver solution increment x to the step displacement dunode.
This module provides function to calculate residual of nodal force.
subroutine, public fstr_update_ndforce_spc(cstep, hecMESH, fstrSOLID, B)
subroutine, public fstr_update_ndforce(cstep, hecMESH, hecMAT, fstrSOLID, conMAT)
subroutine plot_potential_graph(cstep, hecMESH, hecMAT, fstrSOLID, fstrPARAM, restrt_step_num, sub_step, ctime, dtime, iter, tincr)
real(kind=kreal) function, public fstr_get_norm_para_contact(hecMAT, hecLagMAT, conMAT, hecMESH)
real(kind=kreal) function, public fstr_get_residual(force, hecMESH)
Calculate magnitude of a real vector.
real(kind=kreal) function, public fstr_get_potential(cstep, hecMESH, hecMAT, fstrSOLID, ptype)
subroutine fstr_calc_residual_vector(hecMESH, hecMAT, fstrSOLID, ctime, tincr, iter, cstep, dtime, fstrPARAM)
\breaf This subroutine calculate residual vector
subroutine fstr_calc_residual_vector_with_x(hecMESH, hecMAT, fstrSOLID, ctime, tincr, iter, cstep, dtime, fstrPARAM)
\breaf This subroutine calculate residual vector
real(kind=kreal) function fstr_get_potential_with_x(cstep, hecMESH, hecMAT, fstrSOLID, ptype)
real(kind=kreal) function, public fstr_get_norm_contact(flag, hecMESH, hecMAT, fstrSOLID, hecLagMAT)
Calculate square norm.
real(kind=kreal) function fstr_get_energy(force, displacement, hecMESH)
Calculate magnitude of a real vector.
subroutine, public fstr_assemble_residual_contact(hecMAT, hecLagMAT, conMAT, hecMESH, resid_vec, nresid)
Assemble contact residual vector (hecMATB + conMATB + Lagrange) into a single vector.
real(kind=kreal) function, public fstr_get_x_norm_contact(hecMAT, hecLagMAT, hecMESH)
subroutine, public fstr_update_reaction_spc(cstep, hecMESH, fstrSOLID)
Set fstrSOLIDREACTION at constrained DOFs using current fstrSOLIDQFORCE. Constrained DOFs are enumera...
This module provides functions to deal with spring force.
subroutine fstr_update_ndforce_spring(cstep, hecMESH, fstrSOLID, B)
This module provides function to calculate to do updates.
subroutine fstr_updatenewton(hecMESH, hecMAT, fstrSOLID, time, tincr, iter, strainEnergy)
Update displacement, stress, strain and internal forces.
This module defines common data and basic structures for analysis.
integer(kind=kint), parameter imsg
integer(kind=kint), parameter kbcinitial
logical function fstr_isboundaryactive(fstrSOLID, nbc, cstep)
This subroutine read in used-defined loading tangent.
subroutine uresidual(cstep, factor, residual)
This subroutine take consider of user-defined external loading.