File: findsurface.f

package info (click to toggle)
calculix-ccx 2.11-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 10,188 kB
  • sloc: fortran: 115,312; ansic: 34,480; sh: 374; makefile: 35; perl: 15
file content (256 lines) | stat: -rw-r--r-- 9,673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
!
!     CalculiX - A 3-dimensional finite element program
!              Copyright (C) 1998-2015 Guido Dhondt
!
!     This program is free software; you can redistribute it and/or
!     modify it under the terms of the GNU General Public License as
!     published by the Free Software Foundation(version 2);
!     
!
!     This program is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of 
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
!     GNU General Public License for more details.
!
!     You should have received a copy of the GNU General Public License
!     along with this program; if not, write to the Free Software
!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
      subroutine findsurface(ipoface,nodface,ne,ipkon,kon,lakon,ntie,
     &    tieset)
!
!     determining the external faces of the mesh and storing
!     them in fields ipoface and nodface
!
      implicit none
!
      character*8 lakon(*)
      character*81 tieset(3,*),slavset
!
      integer ipoface(*),nodface(5,*),nodes(4),
     &  ne,ipkon(*),kon(*),indexe,ifaceq(8,6),ifacet(6,4),index1,
     &  ifacew(8,5),ithree,ifour,iaux,kflag,i,j,k,m,
     &  ifree,index1old,ifreenew,ntie,ipos
!
!     nodes belonging to the element faces
!
      data ifaceq /4,3,2,1,11,10,9,12,
     &            5,6,7,8,13,14,15,16,
     &            1,2,6,5,9,18,13,17,
     &            2,3,7,6,10,19,14,18,
     &            3,4,8,7,11,20,15,19,
     &            4,1,5,8,12,17,16,20/
      data ifacet /1,3,2,7,6,5,
     &             1,2,4,5,9,8,
     &             2,3,4,6,10,9,
     &             1,4,3,8,10,7/
      data ifacew /1,3,2,9,8,7,0,0,
     &             4,5,6,10,11,12,0,0,
     &             1,2,5,4,7,14,10,13,
     &             2,3,6,5,8,15,11,14,
     &             4,6,3,1,12,15,9,13/
!
      do m=1,ntie
!
!        check for contact conditions
!
         if((tieset(1,m)(81:81).eq.'C').or.
     &      (tieset(1,m)(81:81).eq.'-')) then
            slavset=tieset(2,m)
!
!           check whether facial slave surface; 
!
            ipos=index(slavset,' ')-1
            if(slavset(ipos:ipos).eq.'S') then
               kflag=1
               ithree=3
               ifour=4
!     
!     determining the external element faces of the solid mesh; 
!     the faces are catalogued by the four lowest node numbers
!     in ascending order. 
!
!     ipoface(i) points to a face for which
!     node i is the lowest end node and nodface(1,ipoface(i)),
!     nodface(2,ipoface(i)) and nodface(3,ipoface(i)) are the next 
!     lower ones. If the face is triangular nodface(3,ipoface(i))
!     is zero. 
!
!     nodface(4,ipoface(i)) contains the face number 
!     (10*element number + local face number) and nodface(5,ipoface(i))
!     is a pointer to the next surface for which node i is the
!     lowest node; if there are no more such surfaces the pointer
!     has the value zero
!
!     An external element face is one which belongs to one element
!     only
!
               ifree=1
               do i=1,6*ne-1
                  nodface(5,i)=i+1
               enddo
               do i=1,ne
                  if(ipkon(i).lt.0) cycle
                  if(lakon(i)(1:1).ne.'C') cycle
                  indexe=ipkon(i)
!
!                 hexahedral element
!
                  if((lakon(i)(4:4).eq.'2').or.
     &               (lakon(i)(4:4).eq.'8')) then
                     do j=1,6
                        do k=1,4
                           nodes(k)=kon(indexe+ifaceq(k,j))
                        enddo
                        call isortii(nodes,iaux,ifour,kflag)
                        index1old=0
                        index1=ipoface(nodes(1))
                        do
!     
!     adding a surface which has not been 
!     catalogued so far
!     
                           if(index1.eq.0) then
                              ifreenew=nodface(5,ifree)
                              nodface(1,ifree)=nodes(2)
                              nodface(2,ifree)=nodes(3)
                              nodface(3,ifree)=nodes(4)
                              nodface(4,ifree)=10*i+j
                              nodface(5,ifree)=ipoface(nodes(1))
                              ipoface(nodes(1))=ifree
                              ifree=ifreenew
                              exit
                           endif
!     
!     removing a surface which has already
!     been catalogued
!     
                           if((nodface(1,index1).eq.nodes(2)).and.
     &                        (nodface(2,index1).eq.nodes(3)).and.
     &                        (nodface(3,index1).eq.nodes(4))) then
                              if(index1old.eq.0) then
                                 ipoface(nodes(1))=nodface(5,index1)
                              else
                                 nodface(5,index1old)=nodface(5,index1)
                              endif
                              nodface(5,index1)=ifree
                              ifree=index1
                              exit
                           endif
                           index1old=index1
                           index1=nodface(5,index1)
                        enddo
                     enddo
!
!                 tetrahedral element
!
                  elseif((lakon(i)(4:4).eq.'4').or.
     &                   (lakon(i)(4:5).eq.'10')) then
                     do j=1,4
                        do k=1,3
                           nodes(k)=kon(indexe+ifacet(k,j))
                        enddo
                        call isortii(nodes,iaux,ithree,kflag)
                        nodes(4)=0
                        index1old=0
                        index1=ipoface(nodes(1))
                        do
!     
!     adding a surface which has not been 
!     catalogues so far
!     
                           if(index1.eq.0) then
                              ifreenew=nodface(5,ifree)
                              nodface(1,ifree)=nodes(2)
                              nodface(2,ifree)=nodes(3)
                              nodface(3,ifree)=nodes(4)
                              nodface(4,ifree)=10*i+j
                              nodface(5,ifree)=ipoface(nodes(1))
                              ipoface(nodes(1))=ifree
                              ifree=ifreenew
                              exit
                           endif
!     
!     removing a surface which has already
!     been catalogued
!     
                           if((nodface(1,index1).eq.nodes(2)).and.
     &                        (nodface(2,index1).eq.nodes(3)).and.
     &                        (nodface(3,index1).eq.nodes(4))) then
                              if(index1old.eq.0) then
                                 ipoface(nodes(1))=nodface(5,index1)
                              else
                                 nodface(5,index1old)=nodface(5,index1)
                              endif
                              nodface(5,index1)=ifree
                              ifree=index1
                              exit
                           endif
                           index1old=index1
                           index1=nodface(5,index1)
                        enddo
                     enddo
                  else
!
!                 wedge element
!
                     do j=1,5
                        if(j.le.2) then
                           do k=1,3
                              nodes(k)=kon(indexe+ifacew(k,j))
                           enddo
                           call isortii(nodes,iaux,ithree,kflag)
                           nodes(4)=0
                        else
                           do k=1,4
                              nodes(k)=kon(indexe+ifacew(k,j))
                           enddo
                           call isortii(nodes,iaux,ifour,kflag)
                        endif
                        index1old=0
                        index1=ipoface(nodes(1))
                        do
!     
!     adding a surface which has not been 
!     catalogues so far
!     
                           if(index1.eq.0) then
                              ifreenew=nodface(5,ifree)
                              nodface(1,ifree)=nodes(2)
                              nodface(2,ifree)=nodes(3)
                              nodface(3,ifree)=nodes(4)
                              nodface(4,ifree)=10*i+j
                              nodface(5,ifree)=ipoface(nodes(1))
                              ipoface(nodes(1))=ifree
                              ifree=ifreenew
                              exit
                           endif
!     
!     removing a surface which has already
!     been catalogued
!     
                           if((nodface(1,index1).eq.nodes(2)).and.
     &                        (nodface(2,index1).eq.nodes(3)).and.
     &                        (nodface(3,index1).eq.nodes(4))) then
                              if(index1old.eq.0) then
                                 ipoface(nodes(1))=nodface(5,index1)
                              else
                                 nodface(5,index1old)=nodface(5,index1)
                              endif
                              nodface(5,index1)=ifree
                              ifree=index1
                              exit
                           endif
                           index1old=index1
                           index1=nodface(5,index1)
                        enddo
                     enddo
                  endif
               enddo
               exit
            endif
         endif
      enddo
!     
      return
      end