Debian Codegraph @

packages/seacas/applications/gen3d/g3_newel1.f

raw
1 C Copyright(C) 1999-2020 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
7 C=======================================================================
8 SUBROUTINE NEWEL1 (BLKTYP, NUMELB, NELB3, NRSTRT, NREND,
9 & NUMLNK, NUMLN3, NUMATR, NATRDM, NUMNP, NUMNP3,
10 & LINK, LINK3, ATRIB, ATRIB3,
11 & IXEL, INCEL, NREL, IELCOL, IXNP, NRNP)
12 C=======================================================================
13
14 C --*** NEWEL1 *** (GEN3D) Write 3D element block misc.
15 C -- Written by Amy Gilkey - revised 05/05/86
16 C --
17 C --NEWEL1 calculates and writes the element block connectivity and
18 C --attributes for the 3D database. It may write only a section of the
19 C --element block (depending on NRSTRT and NREND).
20 C --
21 C --Parameters:
22 C -- BLKTYP - IN - the element block type
23 C -- NUMELB - IN - the number of elements in the block
24 C -- NELB3 - IN - the number of elements in the 3D block
25 C -- NRSTRT, NREND - IN - the starting and ending translation/rotation
26 C -- NUMLNK - IN - the number of nodes in the element (always 4)
27 C Note: skip 3,4 for bars
28 C -- NUMLN3 - IN - the number of nodes in the 3D element
29 C -- NUMATR - IN - the number of attributes
30 C -- NUMNP - IN - the number of nodes
31 C -- NUMNP3 - IN - the number of 3D nodes
32 C -- LINK - IN - the 2D connectivity array for the block
33 C -- LINK3 - OUT - the 3D connectivity array (packed) for the block section
34 C -- ATRIB - IN - the 2D attribute array (packed) for the block
35 C -- ATRIB3 - OUT - the 3D attribute array (packed) for the block section
36 C -- IXEL - IN - the new index for each element
37 C -- INCEL - IN - the increment for each element, needed for blocks
38 C -- that become multiple blocks
39 C -- NREL - IN - the number of new elements generated for each element
40 C -- IELCOL - IN - the row number for each element, 0 if not needed
41 C -- IXNP - IN - the new index for each node
42 C -- NRNP - IN - the number of new nodes generated for each node
43 C --
44 C --Common Variables:
45 C -- Uses NDBOUT of /DBASE/
46 C -- Uses NNREPL, NEREPL, DIM3 of /PARAMS/
47 C -- Uses IX1, IX2, IX3, IX4 of /CENPAR/
48
49 INCLUDE 'g3_dbase.blk'
50 INCLUDE 'g3_params.blk'
51 INCLUDE 'g3_cenpar.blk'
52
53 CHARACTER*(*) BLKTYP
54 INTEGER LINK(4,NUMELB)
55 INTEGER LINK3(NUMLN3,NELB3)
56 REAL ATRIB(NATRDM,NUMELB)
57 REAL ATRIB3(NATRDM,NELB3)
58 INTEGER IXEL(*), INCEL(*), NREL(*), IELCOL(*)
59 INTEGER IXNP(*), NRNP(*)
60
61 LOGICAL ROT360
62
63 ROT360 = (NEREPL .EQ. NNREPL)
64
65 N4 = NINT (DIM3 / 90)
66
67 C --Connectivity - add on nodes for next plane/slice for bottom face
68 C --(1-2-3-4-5-6-7-8), repeat for each plate/slice
69
70 C --Find smallest element offset for block
71
72 JELOFF = IXEL(1)
73 DO IEL = 1, NUMELB
74 JELOFF = MIN (JELOFF, IXEL(IEL))
75 end do
76 JELOFF = JELOFF - 1
77
78 DO IEL = 1, NUMELB
79 JEL = IXEL(IEL) - JELOFF
80
81 IF (IELCOL(IEL) .EQ. 0) THEN
82
83 C --Handle non-center elements
84
85 DO NR = NRSTRT, NREND
86 IF (NUMLNK .EQ. 2) THEN
87 C ... Bars to shells
88 INP1 = LINK(2,IEL)
89 INP2 = LINK(1,IEL)
90 JNP1 = IXNP(INP1)
91 JNP2 = IXNP(INP2)
92 IF (NR .LT. NNREPL) THEN
93 LINK3(1,JEL) = JNP1 + NR
94 LINK3(2,JEL) = JNP1 + NR - 1
95 LINK3(3,JEL) = JNP2 + NR - 1
96 LINK3(4,JEL) = JNP2 + NR
97 ELSE
98 LINK3(1,JEL) = JNP1
99 LINK3(2,JEL) = JNP1 + NR - 1
100 LINK3(3,JEL) = JNP2 + NR - 1
101 LINK3(4,JEL) = JNP2
102 END IF
103 ELSE
104 DO J = 1, NUMLNK
105 INP = LINK(J,IEL)
106 JNP = IXNP(INP)
107 IF (NR .LT. NNREPL) THEN
108 LINK3(J,JEL) = JNP + NR
109 ELSE
110 LINK3(J,JEL) = JNP
111 END IF
112 LINK3(J+NUMLNK,JEL) = JNP + NR-1
113 end do
114 END IF
115 JEL = JEL + INCEL(IEL)
116 end do
117
118 ELSE
119
120 C --Handle center element, different for corner elements
121 C --NOTE: assumes LINK(IX1,i) and LINK(IX4,i) in same column
122 C -- and LINK(IX2,i) and LINK(IX3,i) in next column
123
124 IF (NUMLNK .NE. 4) THEN
125 CALL PRTERR('FATAL',
126 $ 'Option not implemented in NEWEL1')
127 STOP 'Unimplemented Option'
128 END IF
129 NE4 = NREL(IEL) / N4
130 NCORN = INT (NE4/2) + 1
131 INP1 = LINK(IX1,IEL)
132 JNP1 = IXNP(INP1)
133 INP2 = LINK(IX2,IEL)
134 JNP2 = IXNP(INP2)
135 INP3 = LINK(IX3,IEL)
136 JNP3 = IXNP(INP3)
137 INP4 = LINK(IX4,IEL)
138 JNP4 = IXNP(INP4)
139 I1 = 0
140 I2 = 0
141 DO NR = 1, NREL(IEL)
142 IF (NR .EQ. NCORN) THEN
143 I3 = I2 + 2
144 IF (ROT360 .AND. I3 .GE. NRNP(INP2)) I3 = 0
145 LINK3(IX1,JEL) = JNP2 + I3
146 LINK3(IX4,JEL) = JNP3 + I3
147 ELSE
148 I3 = I1 + 1
149 IF (ROT360 .AND. I3 .GE. NRNP(INP1)) I3 = 0
150 LINK3(IX1,JEL) = JNP1 + I3
151 LINK3(IX4,JEL) = JNP4 + I3
152 END IF
153 I4 = I2 + 1
154 IF (ROT360 .AND. I4 .GE. NRNP(INP2)) I4 = 0
155 LINK3(IX2,JEL) = JNP2 + I4
156 LINK3(IX3,JEL) = JNP3 + I4
157 LINK3(IX1+4,JEL) = JNP1 + I1
158 LINK3(IX2+4,JEL) = JNP2 + I2
159 LINK3(IX3+4,JEL) = JNP3 + I2
160 LINK3(IX4+4,JEL) = JNP4 + I1
161 IF (NR .EQ. NCORN) THEN
162 NCORN = NCORN + NE4
163 I1 = I1
164 I2 = I2 + 2
165 ELSE
166 I1 = I1 + 1
167 I2 = I2 + 1
168 END IF
169 JEL = JEL + 1
170 end do
171 END IF
172 end do
173
174 C --Attributes - repeat attributes for the next plates/slices
175
176 DO IEL = 1, NUMELB
177 JEL = IXEL(IEL) - JELOFF
178 DO NR = NRSTRT, NREND
179 CALL CPYREA (NUMATR, ATRIB(1,IEL), ATRIB3(1,JEL))
180 JEL = JEL + INCEL(IEL)
181 end do
182 end do
183
184 RETURN
185 END