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 
21 contains
22 
23  subroutine contact2mpcval( cstate, etype, nnode, mpcval )
24  type(tcontactstate), intent(in) :: cstate
25  integer, intent(in) :: etype
26  integer, intent(in) :: nnode
27  real(kind=kreal), intent(out) :: mpcval(nnode*3 + 4)
28 
29  integer :: i,j
30  real(kind=kreal) :: shapefunc(nnode)
31 
32  call getshapefunc( etype, cstate%lpos(1:2), shapefunc )
33  mpcval(1:3) = cstate%direction(1:3)
34  do i=1,nnode
35  do j=1,3
36  mpcval( i*3+j ) = -cstate%direction(j)*shapefunc(i)
37  enddo
38  enddo
39  mpcval( 3*nnode+4 )=cstate%distance
40  end subroutine
41 
42  subroutine l_contact2mpc( contact, mpcs, nmpc )
44  type( tcontact ), intent(in) :: contact
45  type( hecmwst_mpc ), intent(inout) :: mpcs
46  integer(kind=kint), intent(out) :: nmpc
47  integer(kind=kint), parameter :: ndof = 3 ! 3D problem only, currently
48  real(kind=kreal), parameter :: tol =1.d-10
49  integer(kind=kint) :: i, j, k, nn, csurf, nenode, etype, tdof
50  integer(kind=kint) :: nodes(l_max_surface_node*ndof+ndof), dofs(l_max_surface_node*ndof+ndof)
51  real(kind=kreal) :: values(l_max_surface_node*ndof+ndof+1),val(l_max_surface_node*ndof+ndof+1)
52  nmpc=0
53  do i=1,size(contact%states)
54  if( contact%states(i)%state == -1 ) cycle ! in free
55  csurf = contact%states(i)%surface
56  if( csurf<=0 ) stop "error in contact state"
57  etype = contact%master(csurf)%etype
58  nenode = size(contact%master(csurf)%nodes)
59  tdof = nenode*ndof+ndof
60  call contact2mpcval( contact%states(i), etype, nenode, values(1:tdof+1) )
61  tdof = 0
62  do j=1,ndof
63  if( dabs(values(j))<tol ) cycle
64  tdof = tdof+1
65  nodes(tdof) = contact%slave(i)
66  dofs(tdof) = j
67  val(tdof) = values(j)
68  enddo
69  do j=1,nenode
70  nn = contact%master(csurf)%nodes(j)
71  nodes( j*ndof+1:j*ndof+ndof ) = nn
72  do k=1,ndof
73  if( dabs(values(j*ndof+k)) < tol ) cycle
74  tdof=tdof+1
75  nodes(tdof)=nn
76  dofs(tdof ) = k
77  val(tdof)=values(j*ndof+k)
78  enddo
79  enddo
80  val(tdof+1) = values(nenode*ndof+ndof+1)
81 
82  call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), val(1:tdof+1), mpcs )
83  nmpc=nmpc+1
84  enddo
85  end subroutine l_contact2mpc
86 
88  subroutine l_tied2mpc( contact, mpcs, nmpc )
90  type( tcontact ), intent(in) :: contact
91  type( hecmwst_mpc ), intent(inout) :: mpcs
92  integer(kind=kint), intent(out) :: nmpc
93  integer(kind=kint) :: i, j, csurf, nenode, etype, tdof
94  integer(kind=kint) :: nodes(l_max_surface_node+1), dofs(l_max_surface_node+1)
95  real(kind=kreal) :: values(l_max_surface_node+2)
96  nmpc=0
97  do i=1,size(contact%slave)
98  csurf = contact%states(i)%surface
99  if( csurf<=0 ) cycle ! contactor not exists
100  nenode = size(contact%master(csurf)%nodes)
101  tdof = nenode+1
102  nodes(1) = contact%slave(i)
103  nodes( 2:tdof ) = contact%master(csurf)%nodes(:)
104  values(1) = -1.d0
105  values(2:tdof) = 1.d0
106  values(tdof+1) = 0.d0
107  etype = contact%master(csurf)%etype
108  do j=1,3
109  dofs(1:tdof) = j
110  call fstr_append_mpc( tdof, nodes(1:tdof), dofs(1:tdof), values(1:tdof+1), mpcs )
111  nmpc=nmpc+1
112  enddo
113  enddo
114  end subroutine l_tied2mpc
115 
116 end module m_fstr_contact_mpc
This module provides functions to modify MPC conditions.
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 l_contact2mpc(contact, mpcs, nmpc)
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.
Structure to includes all info needed by contact calculation.
This structure records contact status.