19 private :: fstr_update_ndforce_mpc
34 integer(kind=kint),
intent(in) :: cstep
35 type(hecmwst_local_mesh),
intent(in) :: hecmesh
36 type(hecmwst_matrix),
intent(inout) :: hecmat
38 type(hecmwst_matrix),
intent(inout),
optional :: conmat
40 integer(kind=kint) :: ndof, idof
41 real(kind=kreal) :: factor
43 factor = fstrsolid%factor(2)
46 do idof=1, hecmesh%n_node* hecmesh%n_dof
47 hecmat%B(idof)=fstrsolid%GL(idof)-fstrsolid%QFORCE(idof)
57 call fstr_update_ndforce_mpc( hecmesh, hecmat%B )
64 call hecmw_update_r(hecmesh,hecmat%B,hecmesh%n_node, ndof)
67 subroutine fstr_update_ndforce_mpc( hecMESH, B )
69 type(hecmwst_local_mesh),
intent(in) :: hecmesh
70 real(kind=kreal),
intent(inout) :: b(:)
72 integer(kind=kint) ndof, ig0, is0, ie0, ik, in, idof
73 real(kind=kreal) :: rhs, lambda
76 outer:
do ig0=1,hecmesh%mpc%n_mpc
77 is0= hecmesh%mpc%mpc_index(ig0-1)+1
78 ie0= hecmesh%mpc%mpc_index(ig0)
80 if (hecmesh%mpc%mpc_dof(ik) > ndof) cycle outer
83 in = hecmesh%mpc%mpc_item(is0)
84 idof = hecmesh%mpc%mpc_dof(is0)
85 rhs = hecmesh%mpc%mpc_val(is0)
86 lambda = b(ndof*(in-1)+idof)/rhs
89 in = hecmesh%mpc%mpc_item(ik)
90 idof = hecmesh%mpc%mpc_dof(ik)
91 rhs = hecmesh%mpc%mpc_val(ik)
92 b(ndof*(in-1)+idof) = b(ndof*(in-1)+idof) - rhs*lambda
95 end subroutine fstr_update_ndforce_mpc
99 integer(kind=kint),
intent(in) :: cstep
100 type(hecmwst_local_mesh),
intent(in) :: hecmesh
102 real(kind=kreal),
intent(inout) :: b(:)
104 integer(kind=kint) ndof, ig0, ig, ityp, is0, ie0, ik, in, idof1, idof2, idof
105 integer(kind=kint) :: grpid
106 real(kind=kreal) :: rhs
109 fstrsolid%REACTION = 0.d0
111 do ig0= 1, fstrsolid%BOUNDARY_ngrp_tot
112 grpid = fstrsolid%BOUNDARY_ngrp_GRPID(ig0)
114 ig= fstrsolid%BOUNDARY_ngrp_ID(ig0)
115 rhs= fstrsolid%BOUNDARY_ngrp_val(ig0)
116 ityp= fstrsolid%BOUNDARY_ngrp_type(ig0)
117 is0= hecmesh%node_group%grp_index(ig-1) + 1
118 ie0= hecmesh%node_group%grp_index(ig )
120 in = hecmesh%node_group%grp_item(ik)
122 idof2 = ityp - idof1*10
123 if( fstrsolid%BOUNDARY_ngrp_rotID(ig0) > 0 )
then
128 b( ndof*(in-1) + idof ) = 0.d0
130 fstrsolid%REACTION(ndof*(in-1)+idof) = fstrsolid%QFORCE(ndof*(in-1)+idof)
132 if(
associated(fstrsolid%EMBED_NFORCE) ) fstrsolid%REACTION(ndof*(in-1)+idof) = &
133 & fstrsolid%QFORCE(ndof*(in-1)+idof) - fstrsolid%EMBED_NFORCE(ndof*(in-1)+idof)
145 integer,
intent(in) :: cstep
146 type (hecmwST_local_mesh) :: hecMESH
147 type (hecmwST_matrix) :: hecMAT
148 type (fstr_solid) :: fstrSOLID
149 real(kind=kreal),
intent(in) :: ctime
150 real(kind=kreal),
intent(in) :: dtime
151 type (fstr_param) :: fstrPARAM
152 real(kind=kreal),
intent(in) :: tincr
153 integer(kind=kint) :: iter
159 if( fstrsolid%DLOAD_follow /= 0 .or. fstrsolid%CLOAD_ngrp_rot /= 0 ) &
160 &
call fstr_ass_load(cstep, ctime+dtime, hecmesh, hecmat, fstrsolid, fstrparam )
169 integer,
intent(in) :: cstep
170 type (hecmwST_local_mesh) :: hecMESH
171 type (hecmwST_matrix) :: hecMAT
172 type (fstr_solid) :: fstrSOLID
173 real(kind=kreal),
intent(in) :: ctime
174 real(kind=kreal),
intent(in) :: dtime
175 type (fstr_param) :: fstrPARAM
176 real(kind=kreal),
intent(in) :: tincr
177 integer(kind=kint) :: iter
180 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
182 do i=1, hecmat%ndof*hecmesh%n_node
183 dunode_bak(i) = fstrsolid%dunode(i)
184 fstrsolid%dunode(i) = fstrsolid%dunode(i) + hecmat%X(i)
187 do i=1, hecmat%ndof*hecmesh%n_node
188 fstrsolid%dunode(i) = dunode_bak(i)
195 real(kind=kreal),
intent(in) :: force(:)
196 type(hecmwst_local_mesh),
intent(in) :: hecmesh
203 real(kind=kreal)
function fstr_get_energy( force, displacement, hecMESH )
205 real(kind=kreal),
intent(in) :: force(:), displacement(:)
206 type(hecmwst_local_mesh),
intent(in) :: hecmesh
209 call hecmw_innerproduct_r(hecmesh, ndof, force, displacement,
fstr_get_energy)
215 type(hecmwst_local_mesh),
intent(in) :: hecmesh
216 type(hecmwst_matrix),
intent(in) :: hecmat
218 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
219 character(len=13) :: flag
220 real(kind=kreal) :: tmp1, tmp2, bi
221 integer :: i, i0, ndof
222 if( flag==
'residualForce' )
then
224 call hecmw_innerproduct_r(hecmesh,ndof,hecmat%B,hecmat%B,tmp1)
226 i0 = hecmesh%n_node*ndof
227 do i=1,heclagmat%num_lagrange
231 call hecmw_allreduce_r1(hecmesh,tmp2,hecmw_sum)
233 elseif( flag==
' force' )
then
242 type(hecmwst_matrix),
intent(in) :: hecmat
243 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
244 type(hecmwst_matrix),
intent(in) :: conmat
245 type(hecmwst_local_mesh),
intent(in) :: hecmesh
247 real(kind=kreal) :: rhsb
248 integer(kind=kint) :: i,ndof,nndof,npndof,num_lagrange
249 real(kind=kreal),
allocatable :: rhs_con(:)
250 real(kind=kreal),
pointer :: rhs_lag(:)
253 nndof = conmat%N * ndof
254 npndof = conmat%NP * ndof
255 num_lagrange = heclagmat%num_lagrange
257 allocate(rhs_con(npndof))
259 rhs_con(i) = conmat%B(i)
261 call hecmw_assemble_r(hecmesh, rhs_con, conmat%NP, conmat%NDOF)
264 rhs_con(i) = rhs_con(i) + hecmat%B(i)
267 rhs_lag => conmat%B(npndof+1:npndof+num_lagrange)
269 rhsb = dot_product(rhs_con(1:nndof), rhs_con(1:nndof)) + dot_product(rhs_lag(:), rhs_lag(:))
270 call hecmw_allreduce_r1(hecmesh, rhsb, hecmw_sum)
278 type(hecmwst_matrix),
intent(in) :: hecmat
279 type(hecmwst_matrix_lagrange),
intent(in) :: heclagmat
280 type(hecmwst_local_mesh),
intent(in) :: hecmesh
281 real(kind=kreal) :: rhsx
282 integer(kind=kint) :: nndof, npndof, i
284 nndof = hecmat%N * hecmat%NDOF
285 npndof = hecmat%NP * hecmat%NDOF
288 rhsx = rhsx + hecmat%X(i) ** 2
290 do i=1,heclagmat%num_lagrange
291 rhsx = rhsx + hecmat%X(npndof+i) ** 2
293 call hecmw_allreduce_r1(hecmesh, rhsx, hecmw_sum)
302 integer(kind=kint),
intent(in) :: cstep
303 type(hecmwst_local_mesh),
intent(in) :: hecmesh
304 type(hecmwst_matrix),
intent(inout) :: hecmat
306 integer(kind=kint),
intent(in) :: ptype
307 real(kind=kreal) :: potential
309 integer(kind=kint) :: ndof, i, icel, icel0, ig
310 real(kind=kreal),
allocatable :: totdisp(:), totload(:)
311 real(kind=kreal) :: factor
312 real(kind=kreal) :: extenal_work, internal_work
315 factor = fstrsolid%factor(2)
318 allocate(totload(ndof*hecmesh%n_node))
321 do i=1,ndof*hecmesh%n_node
322 totload(i) = 0.5d0*(fstrsolid%GL(i)+fstrsolid%GL0(i))
329 call fstr_update_ndforce_mpc( hecmesh, totload )
331 if( ptype == 1 )
then
334 do icel0=1,hecmesh%ne_internal
335 icel=hecmesh%elem_internal_list(icel0)
336 do ig=1,
size(fstrsolid%elements(icel)%gausses)
337 internal_work = internal_work + fstrsolid%elements(icel)%gausses(ig)%strain_energy
340 call hecmw_allreduce_r1(hecmesh, internal_work, hecmw_sum)
342 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
343 potential = internal_work - extenal_work
344 else if( ptype == 2 )
then
346 call hecmw_innerproduct_r(hecmesh,ndof,0.5d0*(fstrsolid%QFORCE+fstrsolid%QFORCE_bak),fstrsolid%dunode,internal_work)
348 call hecmw_innerproduct_r(hecmesh,ndof,totload,fstrsolid%dunode,extenal_work)
349 potential = internal_work - extenal_work
350 else if( ptype == 3 )
then
352 totload(:) = fstrsolid%QFORCE(:) - totload(:)
356 call hecmw_innerproduct_r(hecmesh,ndof,totload,totload,potential)
357 potential = dsqrt(potential)
359 stop
"ptype error in fstr_get_potential"
369 integer(kind=kint),
intent(in) :: cstep
370 type(hecmwst_local_mesh),
intent(in) :: hecmesh
371 type(hecmwst_matrix),
intent(inout) :: hecmat
373 integer(kind=kint),
intent(in) :: ptype
374 real(kind=kreal) :: potential
377 real(kind=kreal) :: dunode_bak(hecmat%ndof*hecmesh%n_node)
379 do i=1, hecmat%ndof*hecmesh%n_node
380 dunode_bak(i) = fstrsolid%dunode(i)
381 fstrsolid%dunode(i) = fstrsolid%dunode(i) + hecmat%X(i)
384 do i=1, hecmat%ndof*hecmesh%n_node
385 fstrsolid%dunode(i) = dunode_bak(i)
390 restrt_step_num, sub_step, ctime, dtime, iter, tincr )
392 integer,
intent(in) :: cstep
393 type (hecmwST_local_mesh) :: hecMESH
394 type (hecmwST_matrix) :: hecMAT
395 type (fstr_solid) :: fstrSOLID
396 integer,
intent(in) :: sub_step
397 real(kind=kreal),
intent(in) :: ctime
398 real(kind=kreal),
intent(in) :: dtime
399 type (fstr_param) :: fstrPARAM
400 type (hecmwST_matrix_lagrange) :: hecLagMAT
401 integer(kind=kint) :: restrt_step_num
403 integer(kind=kint) :: iter, i, j
404 integer(kind=kint),
parameter :: ntot = 30
405 real(kind=kreal) :: tincr, alpha, dulen
406 real(kind=kreal) :: pot(3)
407 real(kind=kreal),
allocatable :: dunode_bak(:)
409 dulen = dsqrt(dot_product(fstrsolid%dunode(:),fstrsolid%dunode(:)))
410 write(
imsg,*)
"dulen",dulen
412 allocate(dunode_bak(
size(fstrsolid%dunode)))
413 do i=1, hecmat%ndof*hecmesh%n_node
414 dunode_bak(i) = fstrsolid%dunode(i)
418 alpha = 5.d-3*dble(i)/dble(ntot)
419 hecmat%X(:) = alpha*fstrsolid%dunode(:)
420 do j=1,
size(fstrsolid%dunode)
421 fstrsolid%dunode(j) = dunode_bak(j)+hecmat%X(j)
427 write(
imsg,
'(I4,5(",",1pE16.9))') i,alpha,alpha*dulen,pot(1:3)
430 do i=1,
size(fstrsolid%dunode)
431 fstrsolid%dunode(i) = dunode_bak(i)