FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_contact_mpc.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
10  use hecmw
11  use m_fstr
12  use mcontactdef
14  implicit none
15 
16  private
17  public :: contact2mpcval
18  public :: l_contact2mpc
19  public :: l_tied2mpc
20  public :: fstr_contact2mpc
21  public :: fstr_del_contactmpc
22  public :: fstr_write_mpc
23 
24  integer(kind=kint), save :: n_contact_mpc
25 
26 contains
27 
28  subroutine contact2mpcval( cstate, etype, nnode, mpcval )
29  type(tcontactstate), intent(in) :: cstate
30  integer, intent(in) :: etype
31  integer, intent(in) :: nnode
32  real(kind=kreal), intent(out) :: mpcval(nnode*3 + 4)
33 
34  integer :: i,j
35  real(kind=kreal) :: shapefunc(nnode)
36 
37  call getshapefunc( etype, cstate%lpos(1:2), shapefunc )
38  mpcval(1:3) = cstate%direction(1:3)
39  do i=1,nnode
40  do j=1,3
41  mpcval( i*3+j ) = -cstate%direction(j)*shapefunc(i)
42  enddo
43  enddo
44  mpcval( 3*nnode+4 )=cstate%distance
45  end subroutine
46 
47  subroutine l_contact2mpc( contact, mpcs, nmpc )
49  type( tcontact ), intent(in) :: contact
50  type( hecmwst_mpc ), intent(inout) :: mpcs
51  integer(kind=kint), intent(out) :: nmpc
52  integer(kind=kint), parameter :: ndof = 3 ! 3D problem only, currently
53  real(kind=kreal), parameter :: tol =1.d-10
54  integer(kind=kint) :: i, j, k, nn, csurf, nenode, etype, tdof
55  integer(kind=kint) :: nodes(l_max_surface_node*ndof+ndof), dofs(l_max_surface_node*ndof+ndof)
56  real(kind=kreal) :: values(l_max_surface_node*ndof+ndof+1),val(l_max_surface_node*ndof+ndof+1)
57  nmpc=0
58  do i=1,size(contact%states)
59  if( contact%states(i)%state == -1 ) cycle ! in free
60  csurf = contact%states(i)%surface
61  if( csurf<=0 ) stop "error in contact state"
62  etype = contact%master(csurf)%etype
63  nenode = size(contact%master(csurf)%nodes)
64  tdof = nenode*ndof+ndof
65  call contact2mpcval( contact%states(i), etype, nenode, values(1:tdof+1) )
66  tdof = 0
67  do j=1,ndof
68  if( dabs(values(j))<tol ) cycle
69  tdof = tdof+1
70  nodes(tdof) = contact%slave(i)
71  dofs(tdof) = j
72  val(tdof) = values(j)
73  enddo
74  do j=1,nenode
75  nn = contact%master(csurf)%nodes(j)
76  nodes( j*ndof+1:j*ndof+ndof ) = nn
77  do k=1,ndof
78  if( dabs(values(j*ndof+k)) < tol ) cycle
79  tdof=tdof+1
80  nodes(tdof)=nn
81  dofs(tdof ) = k
82  val(tdof)=values(j*ndof+k)
83  enddo
84  enddo
85  val(tdof+1) = values(nenode*ndof+ndof+1)
86 
87  call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), val(1:tdof+1), mpcs )
88  nmpc=nmpc+1
89  enddo
90  end subroutine l_contact2mpc
91 
93  subroutine l_tied2mpc( contact, mpcs, nmpc )
95  type( tcontact ), intent(in) :: contact
96  type( hecmwst_mpc ), intent(inout) :: mpcs
97  integer(kind=kint), intent(out) :: nmpc
98  integer(kind=kint) :: i, j, csurf, nenode, etype, tdof
99  integer(kind=kint) :: nodes(l_max_surface_node+1), dofs(l_max_surface_node+1)
100  real(kind=kreal) :: values(l_max_surface_node+2)
101  nmpc=0
102  do i=1,size(contact%slave)
103  csurf = contact%states(i)%surface
104  if( csurf<=0 ) cycle ! contactor not exists
105  nenode = size(contact%master(csurf)%nodes)
106  tdof = nenode+1
107  nodes(1) = contact%slave(i)
108  nodes( 2:tdof ) = contact%master(csurf)%nodes(:)
109  values(1) = -1.d0
110  values(2:tdof) = 1.d0
111  values(tdof+1) = 0.d0
112  etype = contact%master(csurf)%etype
113  do j=1,3
114  dofs(1:tdof) = j
115  call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), values(1:tdof+1), mpcs )
116  nmpc=nmpc+1
117  enddo
118  enddo
119  end subroutine l_tied2mpc
120 
122  subroutine fstr_contact2mpc( contacts, mpcs )
123  type( tcontact ), intent(in) :: contacts(:)
124  type( hecmwst_mpc ), intent(inout) :: mpcs
125  integer(kind=kint) :: i, nmpc
126  n_contact_mpc = 0
127  do i=1,size(contacts)
128  if( contacts(i)%algtype == contactunknown ) cycle ! not initialized
129  if( contacts(i)%algtype == contactfslid ) then
130  print *, "Cannot deal with finit slip problems by MPC!"
131  cycle
132  endif
133  if( contacts(i)%algtype == contactsslid ) then
134  call l_contact2mpc( contacts(i), mpcs, nmpc )
135  n_contact_mpc = n_contact_mpc + nmpc
136  elseif( contacts(i)%algtype == contacttied ) then
137  call l_tied2mpc( contacts(i), mpcs, nmpc )
138  n_contact_mpc = n_contact_mpc + nmpc
139  endif
140  enddo
141  end subroutine
142 
144  subroutine fstr_del_contactmpc( mpcs )
146  type( hecmwst_mpc ), intent(inout) :: mpcs
147  call fstr_delete_mpc( n_contact_mpc, mpcs )
148  end subroutine
149 
151  subroutine fstr_write_mpc( file, mpcs )
152  integer(kind=kint), intent(in) :: file
153  type( hecmwst_mpc ), intent(in) :: mpcs
154 
155  integer(kind=kint) :: i,j,n0,n1
156  write(file, *) "Number of equation", mpcs%n_mpc
157  do i=1,mpcs%n_mpc
158  write(file,*) "--Equation",i
159  n0=mpcs%mpc_index(i-1)+1
160  n1=mpcs%mpc_index(i)
161  write(file, *) n0,n1
162  write(file,'(30i5)') (mpcs%mpc_item(j),j=n0,n1)
163  write(file,'(30i5)') (mpcs%mpc_dof(j),j=n0,n1)
164  write(file,'(30f7.2)') (mpcs%mpc_val(j),j=n0,n1),mpcs%mpc_const(i)
165  enddo
166  end subroutine
167 
168 end module m_fstr_contact_mpc
This module provides functions to modify MPC conditions.
subroutine fstr_delete_mpc(np, mpcs)
Delete last n equation conditions from current mpc condition.
subroutine fstr_append_mpc(np, nodes, dofs, values, mpcs)
Append new equation condition at end of existing mpc conditions.
Definition: hecmw.f90:6
Contact mechanics calculations at element level (single contact pair)
MPC (Multi-Point Constraint) processing for contact analysis.
subroutine, public fstr_contact2mpc(contacts, mpcs)
Contact states to equation conditions.
subroutine, public fstr_del_contactmpc(mpcs)
Delete mpcs derived from contact conditions.
subroutine, public l_contact2mpc(contact, mpcs, nmpc)
subroutine, public fstr_write_mpc(file, mpcs)
Print out mpc conditions.
subroutine, public l_tied2mpc(contact, mpcs, nmpc)
Rigid connect condition to equation conditions.
subroutine, public contact2mpcval(cstate, etype, nnode, mpcval)
This module defines common data and basic structures for analysis.
Definition: m_fstr.f90:15
This module manages the data structure for contact calculation.
integer, parameter contactsslid
integer, parameter contactunknown
integer, parameter contacttied
contact type or algorithm definition
integer, parameter contactfslid
Structure to includes all info needed by contact calculation.
This structure records contact status.