1!$Id:$
2      subroutine ckbrk8 ( n, ix, xl, ndm, nel, shp )
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: Check 8-node brick for bad data.
11!               Write message to file on errors located.
12
13!      Inputs:
14!         n         - Number of element being checked
15!         ix(*)     - List of nodes for element
16!         xl(ndm,*) - Coordinate array
17!         ndm       - Spatial dimension of mesh
18!         nel       - Number of nodes on element
19
20!      Outputs:
21!         None
22
23!      Scratch:
24!         shp(*)    - Array to store shape functions
25!-----[--.----+----.----+----.-----------------------------------------]
26      implicit  none
27
28      include  'fdata.h'
29      include  'iofile.h'
30      include  'pointer.h'
31      include  'comblk.h'
32
33      integer   ndm, nel, i, l, n, ineg
34      real*8    detj
35
36      integer   ix(*)
37      integer   ic(16)
38      real*8    rst(3,8), xl(ndm,*), shp(*)
39
40      save
41
42      data      rst/-1.d0,-1.d0,-1.d0,   1.d0,-1.d0,-1.d0,
43     &               1.d0, 1.d0,-1.d0,  -1.d0, 1.d0,-1.d0,
44     &              -1.d0,-1.d0, 1.d0,   1.d0,-1.d0, 1.d0,
45     &               1.d0, 1.d0, 1.d0,  -1.d0, 1.d0, 1.d0/
46
47!     Check element for input errors
48
49      ineg = 0
50      do l = 1,nel
51        if(ix(l).gt.0) then
52          if(mr(np(190)-1+ix(l)).lt.0) then
53            ic(ineg+1) = l
54            ic(ineg+2) = abs(ix(l))
55            ineg = ineg + 2
56          endif
57        endif
58      end do
59
60!     Node numbering errors
61
62      if(ineg.gt.0) then
63        write(iow,2000) n,(ic(i),i=1,ineg)
64        if(ior.lt.0) write(*,2000) n,(ic(i),i=1,ineg)
65
66!     Compute jacobian at each corner of element
67
68      else
69        do l = 1,nel
70          call bjac3d ( rst(1,l) , xl, ndm, shp, detj )
71          if(detj.le.0.0d0) then
72            ic(ineg+1) = l
73            ic(ineg+2) = abs(ix(l))
74            ineg = ineg + 2
75          endif
76        end do
77        if(ineg.gt.0 .and. pfr) then
78          write(iow,2001) n,(ic(i),i=1,ineg)
79          if(ior.lt.0) write(*,2001) n,(ic(i),i=1,ineg)
80        endif
81        if(nel.eq.8 .and. ineg.eq.2*nel) then
82          do l = 1,4
83            ineg    = ix(l)
84            ix(l  ) = ix(l+4)
85            ix(l+4) = ineg
86          end do
87        end if
88      endif
89
902000  format(' >Element',i4,' coordinates not input for nodes:'/
91     &      ('                Local =',i3,' Global =',i4))
92
932001  format(' >Element',i4,' has negative jacobian at nodes:'/
94     &      ('                Local =',i3,' Global =',i4))
95
96      end
97