Debian Codegraph @

packages/seacas/applications/explore/exp_ckess.f

raw
1 C Copyright(C) 1999-2021 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6 C=======================================================================
7 SUBROUTINE CKESS (NUMESS, LESSEL, LESSNL, NUMEL, NUMNP,
8 & IDESS, NEESS, NNESS, IXEESS, IXNESS,
9 & LTEESS, LTSESS, FACESS, NSCR, ICHECK, RCHECK, NDIM,
10 * MAPEL, MAPND)
11 C=======================================================================
12
13 C --*** CKESS *** (EXPLORE) Check database element side sets
14 C --
15 C --CKESS checks the element side set information.
16 C --An error message is displayed if the end of file is read.
17 C --
18 C --Parameters:
19 C -- NUMESS - IN - the number of element side sets
20 C -- LESSEL - IN - the number of elements for all sets
21 C -- LESSNL - IN - the number of nodes for all sets
22 C -- NUMEL - IN - the number of elements
23 C -- NUMNP - IN - the number of nodes
24 C -- IDESS - IN - the element side set ID for each set
25 C -- NEESS - IN - the number of elements for each set
26 C -- NNESS - IN - the number of nodes for each set
27 C -- IXEESS - IN - the index of the first element for each set
28 C -- IXNESS - IN - the index of the first node for each set
29 C -- LTEESS - IN - the elements for all sets
30 C -- LTSESS - IN - the element faces for all sets
31 C -- FACESS - IN - the distribution factors for all sets
32 C -- NSCR - SCRATCH - size = LESSEL (not all used)
33 C -- ICHECK - SCRATCH - size = MAX (NUMESS, LESSEL, LESSNL)
34 C -- RCHECK - SCRATCH - size = NUMNP
35
36 include 'exodusII.inc'
37 INCLUDE 'exp_dbase.blk'
38
39 INTEGER IDESS(*)
40 INTEGER NEESS(*)
41 INTEGER NNESS(*)
42 INTEGER IXEESS(*)
43 INTEGER IXNESS(*)
44 INTEGER LTEESS(*)
45 INTEGER LTSESS(*)
46 REAL FACESS(*)
47 INTEGER ICHECK(*)
48 INTEGER NSCR(*)
49 REAL RCHECK(*)
50 INTEGER MAPEL(*)
51 INTEGER MAPND(*)
52 LOGICAL DIDHEAD, ALLSAM
53
54 CHARACTER*1024 STRA
55
56 C --Check for unique identifier
57
58 DO 100 IESS = 1, NUMESS
59 IF (LOCINT (IDESS(IESS), IESS-1, IDESS) .GT. 0) THEN
60 CALL INTSTR (1, 0, IDESS(IESS), STRA, LSTRA)
61 CALL PRTERR ('WARNING', 'Element side set ID '
62 & // STRA(:LSTRA) // ' is not unique')
63 END IF
64 100 CONTINUE
65
66 C --Check number of elements in element side sets
67
68 NESS = 0
69 DO 110 IESS = 1, NUMESS
70 NESS = MAX (NESS, IXEESS(IESS) + NEESS(IESS) - 1)
71 110 CONTINUE
72
73 IF (NESS .NE. LESSEL) THEN
74 CALL PRTERR ('WARNING', 'Maximum element index'
75 & // ' in all element side sets does not match total')
76 END IF
77
78 C --Check all elements in element side sets are within element range
79
80 CALL CHKRNG (LTEESS, LESSEL, NUMEL, NZERO, NERR)
81 IF (NERR .GT. 0) THEN
82 CALL PRTERR ('FATAL',
83 & 'Element side set element ids are out of range')
84 END IF
85 IF (NZERO .GT. 0) THEN
86 CALL PRTERR ('FATAL',
87 & 'Element side set element ids are zero')
88 END IF
89
90 C --Check all element faces in element side sets are within range
91 C ... Since we don't know (or don't want to expend the effort...) the
92 C the number of faces for each element, we assume that the maximum
93 C number of faces is 4 for 2D and 6 for 3D
94 CALL CHKRNG (LTSESS, LESSEL, 2*NDIM, NZERO, NERR)
95 IF (NERR .GT. 0) THEN
96 CALL PRTERR ('FATAL',
97 & 'Element side set faces are out of range')
98 END IF
99 IF (NZERO .GT. 0) THEN
100 CALL PRTERR ('FATAL',
101 & 'Element side set faces are zero')
102 END IF
103
104 C ... Check for duplicate element/sides in a sideset. This causes
105 C problems with some analysis codes
106 do iess = 1, numess
107 call iniint(numel, 0, icheck)
108 nel = neess(iess)
109 indx = ixeess(iess)
110 do j = 0, nel-1
111 iel = lteess(indx+j)
112 ifa = ltsess(indx+j)
113 if (iel .gt. 0 .and. iel .le. numel) then
114 if (btest(icheck(iel), ifa)) then
115 write (stra, 10000) iel, ifa, idess(iess)
116 10000 FORMAT('SIDESET ERROR: The element face pair ',
117 $ I12,'.',I1,
118 $ ' is duplicated in sideset ', I12,'.')
119 call sqzstr(stra, lstra)
120 CALL PRTERR ('WARNING', STRA(:lstra))
121 else
122 icheck(iel) = ibset(icheck(iel), ifa)
123 end if
124 end if
125 end do
126 end do
127
128 c ... Check that the distribution factor count matches the number of nodes
129 C in the sideset...
130 do iess = 1, numess
131 call exgsp(ndb, idess(iess), nsess, ndfss, ierr)
132 if (nness(iess) .ne. ndfss .and. ndfss .gt. 0) then
133 write (stra, 10002) idess(iess), ndfss, nness(iess)
134 10002 FORMAT('SIDESET ERROR: In sideset ', I12,
135 * ' the number of distribution factors (', I12,
136 * ') does not match the sideset node count (', I12, ')')
137 call sqzstr(stra, lstra)
138 CALL PRTERR ('WARNING', STRA(:lstra))
139 end if
140 if (ndfss .gt. 0) then
141 call exgssc(ndb, idess(iess), nscr, ierr)
142 numnod = 0
143 do i = 1, neess(iess)
144 numnod = numnod + nscr(i)
145 end do
146 if (ndfss .ne. numnod) then
147 write (stra, 10001) idess(iess), ndfss, numnod
148 10001 FORMAT('SIDESET ERROR: In sideset ', I12,
149 * ' the number of distribution factors (', I12,
150 * ') does not match the computed sideset node count (',
151 * I12, ')')
152 call sqzstr(stra, lstra)
153 CALL PRTERR ('WARNING', STRA(:lstra))
154 endif
155 end if
156 end do
157
158 c ... Check for discontinuous sideset distribution factors on a sideset.
159 C That is, if node 42 on side 15 has a different df value than node 42 on side 11.
160 C This is allowed for in exodus, but most users want a c1 continuous field defined.
161 do iess = 1, numess
162 call inirea(numnp, 0.0, rcheck)
163 didhead = .false.
164 IF (NNESS(IESS) .GT. 0) THEN
165 IS = IXNESS(IESS)
166 IE = IS + NNESS(IESS) - 1
167 C ... See if all values are the same
168 val = facess(is)
169 allsam = .TRUE.
170 do i=is+1, ie
171 if (facess(i) .ne. val) then
172 allsam = .FALSE.
173 go to 90
174 end if
175 end do
176 90 continue
177
178 if (.not. allsam) then
179 C ... Get the number of df/nodes per face and the nodes on the face
180 C ... NOTE: facess is contiguous over all sidesets,
181 C nscr is the number of nodes/df per face
182 C icheck is the nodes for the faces.
183 call exgssn(ndb, idess(iess), nscr, icheck, ierr)
184 ISE = IXEESS(IESS)
185 IEE = ISE + NEESS(IESS) - 1
186 IDS = IS
187 idf = 1
188 idn = 1
189 do i=ise, iee
190 NDFPE = nscr(idf)
191 idf=idf+1
192 do j=1,ndfpe
193 node = icheck(j+idn-1)
194 if (rcheck(node) .ne. 0.0 .and.
195 * rcheck(node) .ne. facess(j+ids-1)) then
196 iel = lteess(i)
197 isid = ltsess(i)
198 if (.not. didhead) then
199 WRITE (*, 10040, IOSTAT=IDUM) idess(iess)
200 didhead = .true.
201 end if
202 write (stra, 10050) mapel(iel), isid,
203 * mapnd(node), rcheck(node), facess(j+ids-1)
204 CALL PRTERR ('CMDSPEC', stra(:lenstr(stra)))
205 else
206 rcheck(node) = facess(j+ids-1)
207 endif
208 end do
209 ids = ids + ndfpe
210 idn = idn + ndfpe
211 end do
212 end if
213 END IF
214 end do
215 10040 FORMAT('SIDESET DF CONTINUITY ERRORS For Sideset ',I12)
216 10050 FORMAT('Element ',I12,', Side ',I1, ', Node ',I12,
217 * ': Previous Value = ',1PE11.4,' Current Value = ',1PE11.4)
218
219 RETURN
220 END