25 private :: calc_nodalarea_surfelement
31 type(hecmwst_matrix) :: hecmat
33 if( .not.
associated(fstrsolid%CONT_NFORCE) )
then
34 allocate( fstrsolid%CONT_NFORCE(hecmat%NP*3) )
35 fstrsolid%CONT_NFORCE(:) = 0.d0
38 if( .not.
associated(fstrsolid%CONT_FRIC) )
then
39 allocate( fstrsolid%CONT_FRIC(hecmat%NP*3) )
40 fstrsolid%CONT_FRIC(:) = 0.d0
43 if( .not.
associated(fstrsolid%CONT_RELVEL) )
then
44 allocate( fstrsolid%CONT_RELVEL(hecmat%NP*3) )
45 fstrsolid%CONT_RELVEL(:) = 0.d0
48 if( .not.
associated(fstrsolid%CONT_STATE) )
then
49 allocate( fstrsolid%CONT_STATE(hecmat%NP*1) )
50 fstrsolid%CONT_STATE(:) = 0.d0
53 if( .not.
associated(fstrsolid%CONT_AREA) )
then
54 allocate( fstrsolid%CONT_AREA(hecmat%NP) )
55 fstrsolid%CONT_AREA(:) = 0.d0
58 if( .not.
associated(fstrsolid%CONT_NTRAC) )
then
59 allocate( fstrsolid%CONT_NTRAC(hecmat%NP*3) )
60 fstrsolid%CONT_NTRAC(:) = 0.d0
63 if( .not.
associated(fstrsolid%CONT_FTRAC) )
then
64 allocate( fstrsolid%CONT_FTRAC(hecmat%NP*3) )
65 fstrsolid%CONT_FTRAC(:) = 0.d0
72 type(hecmwst_matrix) :: hecmat
74 if( .not.
associated(fstrsolid%EMBED_NFORCE) )
then
75 allocate( fstrsolid%EMBED_NFORCE(hecmat%NP*3) )
76 fstrsolid%EMBED_NFORCE(:) = 0.d0
81 type( hecmwst_local_mesh ),
intent(in) :: hecmesh
84 integer(kind=kint) :: i, j, k, sgrp_id, is, ie, eid, sid, n_cdsurfs
85 logical,
pointer :: cdef_surf(:,:)
87 if(
associated(fstrsolid%CONT_SGRP_ID) )
deallocate(fstrsolid%CONT_SGRP_ID)
89 allocate(cdef_surf(l_max_elem_surf,hecmesh%n_elem))
90 cdef_surf(:,:) = .false.
94 do i=1, fstrsolid%n_contacts
102 sgrp_id = fstrsolid%contacts(i)%surf_id1_sgrp
104 sgrp_id = fstrsolid%contacts(i)%surf_id2
107 if( sgrp_id <= 0 ) cycle
109 is = hecmesh%surf_group%grp_index(sgrp_id-1) + 1
110 ie = hecmesh%surf_group%grp_index(sgrp_id )
112 eid = hecmesh%surf_group%grp_item(2*j-1)
113 sid = hecmesh%surf_group%grp_item(2*j)
115 if( .not. cdef_surf(sid,eid) ) n_cdsurfs = n_cdsurfs + 1
116 cdef_surf(sid,eid) = .true.
122 allocate(fstrsolid%CONT_SGRP_ID(2*n_cdsurfs))
124 do i=1,hecmesh%n_elem
125 do j=1,l_max_elem_surf
126 if( cdef_surf(j,i) )
then
127 n_cdsurfs = n_cdsurfs + 1
128 fstrsolid%CONT_SGRP_ID(2*n_cdsurfs-1) = i
129 fstrsolid%CONT_SGRP_ID(2*n_cdsurfs ) = j
133 deallocate(cdef_surf)
138 type( hecmwst_local_mesh ),
intent(in) :: hecmesh
140 integer(kind=kint),
intent(in) :: flag
142 integer(kind=kint),
parameter :: ndof=3
143 integer(kind=kint) :: i, isuf, icel, sid, etype, nn, is, idx
144 integer(kind=kint) :: ndlocal(l_max_elem_node)
145 real(kind=kreal),
allocatable :: coord(:)
146 real(kind=kreal) :: ecoord(ndof,l_max_elem_node), vect(l_max_elem_node)
148 fstrsolid%CONT_AREA(:) = 0.d0
150 if( .not.
associated(fstrsolid%CONT_SGRP_ID) )
return
152 allocate(coord(ndof*hecmesh%n_node))
153 do i=1,ndof*hecmesh%n_node
154 coord(i) = hecmesh%node(i)+fstrsolid%unode(i)
157 do i=1,ndof*hecmesh%n_node
158 coord(i) = coord(i)+fstrsolid%dunode(i)
162 do isuf=1,
size(fstrsolid%CONT_SGRP_ID)/2
163 icel = fstrsolid%CONT_SGRP_ID(2*isuf-1)
164 sid = fstrsolid%CONT_SGRP_ID(2*isuf )
166 etype = hecmesh%elem_type(icel)
167 nn = hecmw_get_max_node(etype)
168 is = hecmesh%elem_node_index(icel-1)
169 ndlocal(1:nn) = hecmesh%elem_node_item (is+1:is+nn)
172 idx = ndof*(ndlocal(i)-1)
173 ecoord(1:ndof,i) = coord(idx+1:idx+ndof)
176 call calc_nodalarea_surfelement( etype, ecoord, sid, vect )
180 fstrsolid%CONT_AREA(idx) = fstrsolid%CONT_AREA(idx) + vect(i)
188 subroutine calc_nodalarea_surfelement( etype, ecoord, sid, vect )
189 integer(kind=kint),
intent(in) :: etype
190 real(kind=kreal),
intent(in) :: ecoord(:,:)
191 integer(kind=kint),
intent(in) :: sid
192 real(kind=kreal),
intent(out) :: vect(:)
194 integer(kind=kint),
parameter :: ndof=3
195 integer(kind=kint) :: nod(l_max_surface_node)
196 integer(kind=kint) :: nsur, stype, ig0, i
197 real(kind=kreal) :: localcoord(2), normal(3), area, wg
198 real(kind=kreal) :: scoord(ndof,l_max_surface_node), h(l_max_surface_node)
202 call getsubface( etype, sid, stype, nod )
203 nsur = getnumberofnodes( stype )
205 scoord(1:ndof,i) = ecoord(1:ndof,nod(i))
209 do ig0=1,numofquadpoints( stype )
210 call getquadpoint( stype, ig0, localcoord(1:2) )
211 call getshapefunc( stype, localcoord(1:2), h(1:nsur) )
213 wg=getweight( stype, ig0 )
215 normal(1:3) = surfacenormal( stype, nsur, localcoord(1:2), scoord(1:ndof,1:nsur) )
216 area = area + dsqrt(dot_product(normal,normal))*wg
218 area = area/dble(nsur)
228 type(hecmwst_local_mesh),
intent(in) :: hecmesh
229 integer(kind=kint),
intent(in) :: ndof
230 real(kind=kreal),
pointer,
intent(inout) :: vec(:)
231 integer(kind=kint),
intent(in) :: vtype
233 integer(kind=kint) :: i,n,i0,n_loc
234 integer(kind=kint) :: offset, pid, lid
235 integer(kind=kint),
allocatable :: displs(:)
236 real(kind=kreal),
allocatable :: vec_all(:)
239 n_loc = hecmesh%nn_internal
240 allocate(displs(0:
nprocs))
243 call hecmw_allreduce_i(hecmesh, displs,
nprocs+1, hecmw_sum)
245 displs(i) = displs(i-1) + displs(i)
250 allocate(vec_all(ndof*n))
252 if( vtype == 1 )
then
254 do i= 1, hecmesh%n_node
255 pid = hecmesh%node_ID(i*2)
256 lid = hecmesh%node_ID(i*2-1)
257 i0 = (displs(pid) + (lid-1))*ndof
258 vec_all(i0+1:i0+ndof) = vec((i-1)*ndof+1:i*ndof)
259 vec((i-1)*ndof+1:i*ndof) = 0.d0
262 call hecmw_allreduce_r(hecmesh, vec_all, n*ndof, hecmw_sum)
263 do i= 1, hecmesh%n_node
264 pid = hecmesh%node_ID(i*2)
265 lid = hecmesh%node_ID(i*2-1)
266 i0 = (displs(pid) + (lid-1))*ndof
267 if (dot_product(vec_all(i0+1:i0+ndof),vec_all(i0+1:i0+ndof)) == 0.d0) cycle
268 vec((i-1)*ndof+1:i*ndof) = vec_all(i0+1:i0+ndof)
271 vec(i) = vec_all(offset*ndof+i)
273 else if( vtype == 2 )
then
274 vec_all(:) = -1000.d0
275 do i= 1, hecmesh%n_node
276 if( vec(i) == 0.d0 ) cycle
277 pid = hecmesh%node_ID(i*2)
278 lid = hecmesh%node_ID(i*2-1)
279 i0 = displs(pid) + lid
283 call hecmw_allreduce_r(hecmesh, vec_all, n, hecmw_max)
284 do i= 1, hecmesh%n_node
285 pid = hecmesh%node_ID(i*2)
286 lid = hecmesh%node_ID(i*2-1)
287 i0 = displs(pid) + lid
288 if(vec_all(i0) == -1000.d0) cycle
293 deallocate(displs,vec_all)
298 type(
tcontact ),
intent(in) :: contact
299 real(kind=kreal),
intent(in) :: dt
300 real(kind=kreal),
intent(inout) :: relvel_vec(:)
301 real(kind=kreal),
intent(inout) :: state_vec(:)
303 integer(kind=kint) :: i, j, slave
311 do i = 1,
size(contact%slave_surf)
312 do j = 1,
size(contact%slave_surf(i)%nodes)
313 slave = contact%slave_surf(i)%nodes(j)
314 if( state_vec(slave) < 0.1d0 .or. contact%slave_surf(i)%state > 0 ) &
315 & state_vec(slave) = dble(contact%slave_surf(i)%state)
321 do i= 1,
size(contact%slave)
322 slave = contact%slave(i)
323 if( state_vec(slave) < 0.1d0 .or. contact%states(i)%state > 0 ) &
324 & state_vec(slave) = dble(contact%states(i)%state)
327 if( dt < 1.d-16 ) cycle
328 relvel_vec(3*slave-2:3*slave) = contact%states(i)%reldisp(1:3)/dt
This module defines common data and basic structures for analysis.
integer(kind=kint) myrank
PARALLEL EXECUTION.
integer(kind=kint) nprocs