20 private :: fstr_update_ndforce_mpc
35 integer(kind=kint),
intent(in) :: cstep
36 type(hecmwst_local_mesh),
intent(in) :: hecmesh
37 type(hecmwst_matrix),
intent(inout) :: hecmat
39 type(hecmwst_matrix),
intent(inout),
optional :: conmat
41 integer(kind=kint) :: ndof, idof
42 real(kind=kreal) :: factor
44 factor = fstrsolid%factor(2)
47 do idof=1, hecmesh%n_node* hecmesh%n_dof
48 hecmat%B(idof)=fstrsolid%GL(idof)-fstrsolid%QFORCE(idof)
58 call fstr_update_ndforce_mpc( hecmesh, hecmat%B )
65 call hecmw_update_r(hecmesh,hecmat%B,hecmesh%n_node, ndof)
68 subroutine fstr_update_ndforce_mpc( hecMESH, B )
70 type(hecmwst_local_mesh),
intent(in) :: hecmesh
71 real(kind=kreal),
intent(inout) :: b(:)
73 integer(kind=kint) ndof, ig0, is0, ie0, ik, in, idof
74 real(kind=kreal) :: rhs, lambda
77 outer:
do ig0=1,hecmesh%mpc%n_mpc
78 is0= hecmesh%mpc%mpc_index(ig0-1)+1
79 ie0= hecmesh%mpc%mpc_index(ig0)
81 if (hecmesh%mpc%mpc_dof(ik) > ndof) cycle outer
84 in = hecmesh%mpc%mpc_item(is0)
85 idof = hecmesh%mpc%mpc_dof(is0)
86 rhs = hecmesh%mpc%mpc_val(is0)
87 lambda = b(ndof*(in-1)+idof)/rhs
90 in = hecmesh%mpc%mpc_item(ik)
91 idof = hecmesh%mpc%mpc_dof(ik)
92 rhs = hecmesh%mpc%mpc_val(ik)
93 b(ndof*(in-1)+idof) = b(ndof*(in-1)+idof) - rhs*lambda
96 end subroutine fstr_update_ndforce_mpc
100 integer(kind=kint),
intent(in) :: cstep
101 type(hecmwst_local_mesh),
intent(in) :: hecmesh
103 real(kind=kreal),
intent(inout) :: b(:)
105 integer(kind=kint) ndof, ig0, ig, ityp, is0, ie0, ik, in, idof1, idof2, idof
106 integer(kind=kint) :: grpid
107 real(kind=kreal) :: rhs
110 fstrsolid%REACTION = 0.d0
112 do ig0= 1, fstrsolid%BOUNDARY_ngrp_tot
113 grpid = fstrsolid%BOUNDARY_ngrp_GRPID(ig0)
115 ig= fstrsolid%BOUNDARY_ngrp_ID(ig0)
116 rhs= fstrsolid%BOUNDARY_ngrp_val(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
131 fstrsolid%REACTION(ndof*(in-1)+idof) = fstrsolid%QFORCE(ndof*(in-1)+idof)
133 if(
associated(fstrsolid%EMBED_NFORCE) ) fstrsolid%REACTION(ndof*(in-1)+idof) = &
134 & fstrsolid%QFORCE(ndof*(in-1)+idof) - fstrsolid%EMBED_NFORCE(ndof*(in-1)+idof)
146 integer,
intent(in) :: cstep
147 type (hecmwST_local_mesh) :: hecMESH
148 type (hecmwST_matrix) :: hecMAT
149 type (fstr_solid) :: fstrSOLID
150 real(kind=kreal),
intent(in) :: ctime
151 real(kind=kreal),
intent(in) :: dtime
152 type (fstr_param) :: fstrPARAM
153 real(kind=kreal),
intent(in) :: tincr
154 integer(kind=kint) :: iter
160 if( fstrsolid%DLOAD_follow /= 0 .or. fstrsolid%CLOAD_ngrp_rot /= 0 ) &
161 &
call fstr_ass_load(cstep, ctime+dtime, hecmesh, hecmat, fstrsolid, fstrparam )
164 if( fstrsolid%elemact%ELEMACT_egrp_tot > 0 )
then
176 integer,
intent(in) :: cstep
177 type (hecmwST_local_mesh) :: hecMESH
178 type (hecmwST_matrix) :: hecMAT
179 type (fstr_solid) :: fstrSOLID
180 real(kind=kreal),
intent(in) :: ctime
181 real(kind=kreal),
intent(in) :: dtime
182 type (fstr_param) :: fstrPARAM
183 real(kind=kreal),
intent(in) :: tincr
184 integer(kind=kint) :: iter
187 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
189 do i=1, hecmat%ndof*hecmesh%n_node
190 dunode_bak(i) = fstrsolid%dunode(i)
191 fstrsolid%dunode(i) = fstrsolid%dunode(i) + hecmat%X(i)
194 do i=1, hecmat%ndof*hecmesh%n_node
195 fstrsolid%dunode(i) = dunode_bak(i)
202 real(kind=kreal),
intent(in) :: force(:)
203 type(hecmwst_local_mesh),
intent(in) :: hecmesh
212 real(kind=kreal),
intent(in) :: force(:), displacement(:)
213 type(hecmwst_local_mesh),
intent(in) :: hecmesh
216 call hecmw_innerproduct_r(hecmesh, ndof, force, displacement,
fstr_get_energy)
222 type(hecmwst_local_mesh),
intent(in) :: hecmesh
223 type(hecmwst_matrix),
intent(in) :: hecmat
225 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
226 character(len=13) :: flag
227 real(kind=kreal) :: tmp1, tmp2, bi
228 integer :: i, i0, ndof
229 if( flag==
'residualForce' )
then
231 call hecmw_innerproduct_r(hecmesh,ndof,hecmat%B,hecmat%B,tmp1)
233 i0 = hecmesh%n_node*ndof
234 do i=1,heclagmat%num_lagrange
238 call hecmw_allreduce_r1(hecmesh,tmp2,hecmw_sum)
240 elseif( flag==
' force' )
then
249 type(hecmwst_matrix),
intent(in) :: hecmat
250 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
251 type(hecmwst_matrix),
intent(in) :: conmat
252 type(hecmwst_local_mesh),
intent(in) :: hecmesh
254 real(kind=kreal) :: rhsb
255 integer(kind=kint) :: i,ndof,nndof,npndof,num_lagrange
256 real(kind=kreal),
allocatable :: rhs_con(:)
257 real(kind=kreal),
pointer :: rhs_lag(:)
260 nndof = conmat%N * ndof
261 npndof = conmat%NP * ndof
262 num_lagrange = heclagmat%num_lagrange
264 allocate(rhs_con(npndof))
266 rhs_con(i) = conmat%B(i)
268 call hecmw_assemble_r(hecmesh, rhs_con, conmat%NP, conmat%NDOF)
271 rhs_con(i) = rhs_con(i) + hecmat%B(i)
274 rhs_lag => conmat%B(npndof+1:npndof+num_lagrange)
276 rhsb = dot_product(rhs_con(1:nndof), rhs_con(1:nndof)) + dot_product(rhs_lag(:), rhs_lag(:))
277 call hecmw_allreduce_r1(hecmesh, rhsb, hecmw_sum)
285 type(hecmwst_matrix),
intent(in) :: hecmat
286 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
287 type(hecmwst_local_mesh),
intent(in) :: hecmesh
288 real(kind=kreal) :: rhsx
289 integer(kind=kint) :: nndof, npndof, i
291 nndof = hecmat%N * hecmat%NDOF
292 npndof = hecmat%NP * hecmat%NDOF
295 rhsx = rhsx + hecmat%X(i) ** 2
297 do i=1,heclagmat%num_lagrange
298 rhsx = rhsx + hecmat%X(npndof+i) ** 2
300 call hecmw_allreduce_r1(hecmesh, rhsx, hecmw_sum)
309 integer(kind=kint),
intent(in) :: cstep
310 type(hecmwst_local_mesh),
intent(in) :: hecmesh
311 type(hecmwst_matrix),
intent(inout) :: hecmat
313 integer(kind=kint),
intent(in) :: ptype
314 real(kind=kreal) :: potential
316 integer(kind=kint) :: ndof, i, icel, icel0, ig
317 real(kind=kreal),
allocatable :: totdisp(:), totload(:)
318 real(kind=kreal) :: factor
319 real(kind=kreal) :: extenal_work, internal_work
322 factor = fstrsolid%factor(2)
325 allocate(totload(ndof*hecmesh%n_node))
328 do i=1,ndof*hecmesh%n_node
329 totload(i) = 0.5d0*(fstrsolid%GL(i)+fstrsolid%GL0(i))
336 call fstr_update_ndforce_mpc( hecmesh, totload )
338 if( ptype == 1 )
then
341 do icel0=1,hecmesh%ne_internal
342 icel=hecmesh%elem_internal_list(icel0)
343 do ig=1,
size(fstrsolid%elements(icel)%gausses)
344 internal_work = internal_work + fstrsolid%elements(icel)%gausses(ig)%strain_energy
347 call hecmw_allreduce_r1(hecmesh, internal_work, hecmw_sum)
349 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
350 potential = internal_work - extenal_work
351 else if( ptype == 2 )
then
353 call hecmw_innerproduct_r(hecmesh,ndof,0.5d0*(fstrsolid%QFORCE+fstrsolid%QFORCE_bak),fstrsolid%dunode,internal_work)
355 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
356 potential = internal_work - extenal_work
357 else if( ptype == 3 )
then
359 totload(:) = fstrsolid%QFORCE(:) - totload(:)
363 call hecmw_innerproduct_r(hecmesh,ndof,totload,totload,potential)
364 potential = dsqrt(potential)
366 stop
"ptype error in fstr_get_potential"
376 integer(kind=kint),
intent(in) :: cstep
377 type(hecmwst_local_mesh),
intent(in) :: hecmesh
378 type(hecmwst_matrix),
intent(inout) :: hecmat
380 integer(kind=kint),
intent(in) :: ptype
381 real(kind=kreal) :: potential
384 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
386 do i=1, hecmat%ndof*hecmesh%n_node
387 dunode_bak(i) = fstrsolid%dunode(i)
388 fstrsolid%dunode(i) = fstrsolid%dunode(i) + hecmat%X(i)
391 do i=1, hecmat%ndof*hecmesh%n_node
392 fstrsolid%dunode(i) = dunode_bak(i)
397 restrt_step_num, sub_step, ctime, dtime, iter, tincr )
399 integer,
intent(in) :: cstep
400 type (hecmwST_local_mesh) :: hecMESH
401 type (hecmwST_matrix) :: hecMAT
402 type (fstr_solid) :: fstrSOLID
403 integer,
intent(in) :: sub_step
404 real(kind=kreal),
intent(in) :: ctime
405 real(kind=kreal),
intent(in) :: dtime
406 type (fstr_param) :: fstrPARAM
407 type (hecmwST_matrix_lagrange) :: hecLagMAT
408 integer(kind=kint) :: restrt_step_num
410 integer(kind=kint) :: iter, i, j
411 integer(kind=kint),
parameter :: ntot = 30
412 real(kind=kreal) :: tincr, alpha, dulen
413 real(kind=kreal) :: pot(3)
414 real(kind=kreal),
allocatable :: dunode_bak(:)
416 dulen = dsqrt(dot_product(fstrsolid%dunode(:),fstrsolid%dunode(:)))
417 write(
imsg,*)
"dulen",dulen
419 allocate(dunode_bak(
size(fstrsolid%dunode)))
420 do i=1, hecmat%ndof*hecmesh%n_node
421 dunode_bak(i) = fstrsolid%dunode(i)
425 alpha = 5.d-3*dble(i)/dble(ntot)
426 hecmat%X(:) = alpha*fstrsolid%dunode(:)
427 do j=1,
size(fstrsolid%dunode)
428 fstrsolid%dunode(j) = dunode_bak(j)+hecmat%X(j)
434 write(
imsg,
'(I4,5(",",1pE16.9))') i,alpha,alpha*dulen,pot(1:3)
437 do i=1,
size(fstrsolid%dunode)
438 fstrsolid%dunode(i) = dunode_bak(i)
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)
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.
real(kind=kreal) function, public fstr_get_x_norm_contact(hecMAT, hecLagMAT, hecMESH)
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
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.