46
47
48
49#ifndef HYPERMESH_LIB
51#endif
53 USE format_mod , ONLY : fmt_i_3f
54
55
56
57
58#include "implicit_f.inc"
59
60
61
62#include "units_c.inc"
63#include "vect07_c.inc"
64#include "scr05_c.inc"
65#include "com04_c.inc"
66
67 INTEGER IWPENE,TAG(*),INACTI,NSV(*),NSN,MSEGTYP(*),IWPENE0,
68 . MVOISN(4,*),ILEV,KNOD2ELS(*),NOD2ELS(*),IPARTNS(*),NRTM
69
71 INTEGER IRECT(4,*), ITAB(*),CAND_E(*),CAND_N(*),IRTLM(2,*)
72 INTEGER IXS(NIXS,*),IXS10(6,*), IXS16(8,*), IXS20(12,*),ICONT_I(*),
73 . IRTSE(*) ,IS2SE(*)
74 my_real x(3,*),pmin(*),gap_n(12,*),penmax,penmin,pen_old(5,nsn),xfic(3,*)
75
76 INTEGER ID,IPEN0
77 CHARACTER(LEN=NCHARTITLE) ::
78
79
80
81 INTEGER II, I, J, K, L, JJ, NJ, IER,NS,IC,I0,IELIM,NI,ICONN,ip,NS1,
82 . IDEL,NN1,NN2,IE
83
85 . pen, alp,xx(4),yy(4),zz(4),ssc,ttc,dist,dist0,
86 . xi,yi,zi,xc,yc,zc,nn(3),tol,pen0,dpen,
norm,maxpen
87
88
89
90
91
92
93 IF (iresp==1.AND.penmin<=em06) penmin = two*em06
94 tol = penmin
95 alp = two*em06
96 IF (iresp==1) alp = two*em05
97 DO i=lft,llt
98 l = cand_e(i)
99 ni = cand_n(i)
100 ns = nsv(ni)
101 IF (ns >numnod) THEN
102 ns1 = ns -numnod
103 xi=xfic(1,ns1)
104 yi=xfic(2,ns1)
105 zi=xfic(3,ns1)
106 ELSE
107 xi=x(1,ns)
108 yi=x(2,ns)
109 zi=x(3,ns)
110 END IF
111 DO jj=1,4
112 nj=irect(jj,l)
113 xx(jj)=x(1,nj)
114 yy(jj)=x(2,nj)
115 zz(jj)=x(3,nj)
116 END DO
117
118 CALL ini_st3(xx,yy,zz,xi,yi,zi,nn,ssc,ttc,ier,alp,
119 2 xc,yc,zc)
120 IF(ier==-1)THEN
121#ifndef HYPERMESH_LIB
123 . msgtype=msgerror,
124 . anmode=aninfo,
126 . c1=titr,
127 . i2=itab(ns),
128 . i3=l,
129 . i4=l,
130 . i5=itab(irect(1,l)),
131 . i6=itab(irect(2,l)),
132 . i7=itab(irect(3,l)),
133 . i8=itab(irect(4,l)))
134#endif
135
136 ELSE IF(ier==1.AND.(msegtyp(l)/=0.AND.msegtyp(l)<=nrtm))THEN
137
138
139
140
141 ELSE
142
143
144
145 pen0=nn(1)*(xi-xc)+nn(2)*(yi-yc)+nn(3)*(zi-zc)
146 IF(ier==1) THEN
147 dist = sqrt((xi-xc)*(xi-xc)+(yi-yc)*(yi-yc)+(zi-zc)*(zi-zc))
148 ELSE
149 dist = abs(pen0)
150 END IF
151
152 idel = 1
153
154 IF (msegtyp(l)/=0.AND.msegtyp(l)<=nrtm) THEN
155 pen=gapv(i)-abs(pen0)
156 IF (pen > penmax ) idel = 0
157
158 IF (pen > zero) dist = abs(gapv(i)-pen0)
159
160 IF (pen0 < zero .OR. pen > penmax) pen=-abs(pen)-tol
161
162 ELSE
163 pen=gapv(i)-pen0
164
165 IF(ier==1) pen=-abs(pen)-tol
166 IF (pen > zero .OR. abs(pen) < tol) THEN
167 maxpen = gap_n(1,l)
168 IF (inacti /= 0) maxpen = penmax
169 CALL i24penmax(pen,maxpen ,mvoisn(1,l),mvoisn(2,l),
170 + ns ,ixs, ixs10, ixs16, ixs20 ,
171 + ielim)
172 iconn = 0
173 IF (ns>numnod) THEN
175 4 nn2 )
176 CALL iconnet(irect(1,l),ixs ,knod2els,nod2els,
177 . ixs10 ,ixs16 ,ixs20 ,nn1 ,iconn )
178 IF (iconn == 0)
179 .
CALL iconnet(irect(1,l),ixs ,knod2els,nod2els,
180 . ixs10 ,ixs16 ,ixs20 ,nn2 ,iconn )
181 ELSE
182 CALL iconnet(irect(1,l),ixs ,knod2els,nod2els,
183 . ixs10 ,ixs16 ,ixs20 ,ns ,iconn )
184 END IF
185 IF ((ielim+iconn) > 0) pen = -abs(pen)-tol
186 IF (pen < zero ) idel = 0
187 END IF
188
189 IF (inacti/=0.AND.(pen > zero .OR. abs(pen) < tol).AND.ilev/=3) THEN
190 norm = nn(1)*pen_old(1,ni)+nn(2)*pen_old(2,ni)
191 + +nn(3)*pen_old(3,ni)
192 IF (
norm >= zero)
THEN
193 pen = -abs(pen)-tol
194
195 idel = 0
196 END IF
197 END IF
198 END IF
199
200 IF (ipen0==0) THEN
201 IF (inacti/=0.AND.(pen > zero .OR. abs(pen) < tol)) THEN
202 IF (ipartns(ni) == mvoisn(3,l)) THEN
203 pen = -abs(pen)-tol
204 END IF
205 END IF
206 END IF
207
208 IF (ipartns(ni) == mvoisn(3,l)) idel = 0
209
210 IF (gapv(i)>zero.AND.(msegtyp(l)==0.OR.msegtyp(l)>nrtm))idel=0
211
212
213
214 IF(abs(pen) < tol .OR. (pen<zero.AND.idel>0)) THEN
215
216 IF (tag(ns)==0) THEN
217 pmin(ni)=-dist
218 tag(ns)=ni
219 ELSE
220 i0=tag(ns)
221 pen0=pmin(i0)
222 IF (dist <abs(pen0)) THEN
223
224 pmin(ni)=-dist
225 tag(ns)=ni
226 IF (pen0 > zero) THEN
227
228 irtlm(1,i0)=0
229 irtlm(2,i0)=0
230 pen_old(5,i0)=zero
231 END IF
232 END IF
233 END IF
234 ELSEIF(pen > penmax) THEN
235
236#ifndef HYPERMESH_LIB
237 WRITE(iout,1200)pen
238#endif
239 ELSEIF(pen > zero) THEN
240
241 IF (tag(ns)==0) iwpene=iwpene+1
242
243 IF(inacti ==0 .OR. inacti ==1) THEN
244
245 IF (tag(ns)>0) THEN
246 i0=tag(ns)
247 pen0=pmin(i0)
248
249 IF (pen < pen0) THEN
250 icont_i(ni)=-l
251 pmin(ni)=pen
252 tag(ns) = ni
253#ifdef HYPERMESH_LIB
254 pen_old(1:3,ni) = nn(1:3)
255#endif
256 ENDIF
257 ELSE
258 icont_i(ni)=-l
259 pmin(ni)=pen
260 tag(ns) = ni
261#ifdef HYPERMESH_LIB
262 pen_old(1:3,ni) = nn(1:3)
263#endif
264 END IF
265 ELSEIF(inacti ==-1) THEN
266
267 IF (tag(ns)>0) THEN
268 i0=tag(ns)
269 pen0=pmin(i0)
270 dist0 = abs(pmin(i0))
271 IF (dist < dist0) THEN
272 irtlm(1,ni)=l
273 irtlm(2,ni)=1
274 pmin(ni)=dist
275 pen_old(5,ni)=pen
276 tag(ns) = ni
277#ifdef HYPERMESH_LIB
278 pen_old(1:3,ni) = nn(1:3)
279#endif
280 ENDIF
281 ELSE
282 irtlm(1,ni)=l
283 irtlm(2,ni)=1
284 pmin(ni)=dist
285 pen_old(5,ni)=pen
286 tag(ns) = ni
287#ifdef HYPERMESH_LIB
288 pen_old(1:3,ni) = nn(1:3)
289#endif
290 END IF
291
292 ELSEIF(inacti ==3 ) THEN
293 IF (ilev ==3) THEN
294 dpen = pen + tol
295 ELSE
296 dpen = half*(pen + tol)
297 END IF
298
299 IF (tag(ns)==0) THEN
300 irtlm(1,ni)=l
301 irtlm(2,ni)=1
302 iwpene=iwpene+1
303 tag(ns)=ni
304#ifndef HYPERMESH_LIB
305 WRITE(iout,1000)pen
306#endif
307 IF (ns >numnod) THEN
308 ns1 = ns -numnod
309 xfic(1,ns1) = xi + dpen*nn(1)
310 xfic(2,ns1) = yi + dpen*nn(2)
311 xfic(3,ns1) = zi + dpen*nn(3)
312#ifndef HYPERMESH_LIB
313 WRITE(iout,fmt=fmt_i_3f)(itab(numnod)+ns1),xfic(1,ns1),xfic(2,ns1),xfic(3,ns1)
314#endif
315 ELSE
316 x(1,ns) = xi + dpen*nn(1)
317 x(2,ns) = yi + dpen*nn(2)
318 x(3,ns) = zi + dpen*nn(3)
319#ifndef HYPERMESH_LIB
320 WRITE(iout,fmt=fmt_i_3f)itab(ns),x(1,ns),x(2,ns),x(3,ns)
321#endif
322 END IF
323 END IF
324 ELSEIF(inacti ==5) THEN
325
326 IF (tag(ns)>0) THEN
327 i0=tag(ns)
328 pen0=pen_old(5,i0)
329 dist0 = abs(pmin(i0))
330 IF (dist < dist0) THEN
331 irtlm(1,ni)=l
332 irtlm(2,ni)=1
333 pen_old(5,ni)=pen
334 pmin(ni)=dist
335 tag(ns) = ni
336#ifdef HYPERMESH_LIB
337 pen_old(1:3,ni) = nn(1:3)
338#endif
339 ENDIF
340 ELSE
341 irtlm(1,ni)=l
342 irtlm(2,ni)=1
343 pen_old(5,ni)=pen
344 pmin(ni)=dist
345 tag(ns) = ni
346#ifdef HYPERMESH_LIB
347 pen_old(1:3,ni) = nn(1:3)
348#endif
349 END IF
350 END IF
351 END IF
352 END IF
353 END DO
354
355 RETURN
356 1000 FORMAT(2x,'** INITIAL PENETRATION =',1pg20.13,
357 . ' CHANGE COORDINATES OF SECONDARY NODE TO:')
358 1100 FORMAT(2x,'** INITIAL PENETRATION =',1pg20.13,
359 . ' CHANGE COORDINATES OF MAIN NODE TO:')
360 1200 FORMAT(2x,'** TOO HIGH INITIAL PENETRATION=, WILL BE IGNORED',
361 . 1pg20.13)
362
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
subroutine i24fic_getn(ns, irtse, is2se, ie, ns1, ns2)
integer, parameter nchartitle
subroutine ini_st3(xx, yy, zz, xi, yi, zi, nn, ssc, ttc, ier, alp, xc, yc, zc)
subroutine i24penmax(pen, penmax, etyp, el, ns, ixs, ixs10, ixs16, ixs20, ielim)
subroutine iconnet(irect, ixs, knod2els, nod2els, ixs10, ixs16, ixs20, ns, iconn)
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)