| 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 MSGEOM (A, CURPRO, ISTEP, |
| 9 |
& LENF, NLNKF, KLINKF, KXN, KYN, KZN, |
| 10 |
& KIF2EL, NEWELB, IELBST, NEWFAC, FIXFAC) |
| 11 |
C======================================================================= |
| 12 |
|
| 13 |
C --*** MSGEOM *** (MESH) Correct the mesh faces |
| 14 |
C -- Written by Amy Gilkey - revised 05/27/88 |
| 15 |
C -- |
| 16 |
C --MSGEOM determines the new face array, if it has changed. |
| 17 |
C --It handles new displayed element blocks, a new "cut" through the mesh, |
| 18 |
C --and element birth/death (for the time step). A flag is set if the |
| 19 |
C --faces are changed. |
| 20 |
C -- |
| 21 |
C --This routine reserves and sets the following dynamic memory arrays: |
| 22 |
C -- IX2NP - the node number for each mesh index |
| 23 |
C -- |
| 24 |
C --This routine uses MDFIND to find the following dynamic memory arrays: |
| 25 |
C -- IF2EL2 - the secondary element number of each face |
| 26 |
C -- IE2ELB - the element block for each element |
| 27 |
C -- XN, YN, ZN - IN - the full set of nodal coordinates (ZN for 3D only) |
| 28 |
C -- LENE - the cumulative element counts by element block |
| 29 |
C -- ISEVOK - the element block variable truth table; |
| 30 |
C -- variable i of block j exists iff ISEVOK(j,i) |
| 31 |
C -- |
| 32 |
C --Parameters: |
| 33 |
C -- A - IN - the dynamic memory base array |
| 34 |
C -- CURPRO - IN - the name of the program that changed the faces |
| 35 |
C -- ISTEP - IN - the time step number |
| 36 |
C -- LENF - IN/OUT - the cumulative face counts by element block |
| 37 |
C -- LENF(0) is always 0 |
| 38 |
C -- LENF(1..NELBLK) is the end of the surface faces of element block (i) |
| 39 |
C -- LENF(NELBLK+1) is the end of the interior faces |
| 40 |
C -- LENF(NELBLK+2) is the end of the faces that are dead |
| 41 |
C -- LENF(NELBLK+3) is the end of the faces outside a cut |
| 42 |
C -- LENF(NELBLK+4) is the end of the faces in a non-selected block |
| 43 |
C -- NLNKF - IN - the number of nodes per face |
| 44 |
C -- KLINKF - IN/OUT - the index of LINKF - the connectivity for all faces |
| 45 |
C -- KXN, KYN, KZN - IN - the indices of XN, YN, ZN - |
| 46 |
C -- the nodal coordinates (ZN for 3D only) |
| 47 |
C -- KIF2EL - IN/OUT - the index of IF2EL - the element number of each face |
| 48 |
C -- NEWELB - IN/OUT - the new element blocks flag: |
| 49 |
C -- 0 = no new element blocks |
| 50 |
C -- 1 = new selected element blocks |
| 51 |
C -- 2 = new displayed element blocks (implies new selected blocks) |
| 52 |
C -- IELBST - IN - the element block status: |
| 53 |
C -- -1 = OFF, 0 = ON, but not selected, 1 = selected |
| 54 |
C -- NEWFAC - OUT - set true if the faces are changed, else false |
| 55 |
C -- FIXFAC - OUT - set true if the program that last set the faces is |
| 56 |
C -- not the current program (some program-specific values may need |
| 57 |
C -- to be reset), else false |
| 58 |
C -- |
| 59 |
C --Common Variables: |
| 60 |
C -- Uses NDIM, NUMEL, NELBLK of /DBNUMS/ |
| 61 |
C -- Uses IS3DIM of /D3NUMS/ |
| 62 |
C -- Uses NALVAR of /MSHOPT/ |
| 63 |
C -- Sets and uses NEWROT, ROTMAT, ROTCEN of /ROTOPT/ |
| 64 |
C -- Sets and uses NEWCUT, ISCUT, CUTPT, CUTNRM of /CUTOPT/ |
| 65 |
|
| 66 |
include 'dbnums.blk' |
| 67 |
include 'd3nums.blk' |
| 68 |
include 'mshopt.blk' |
| 69 |
include 'rotopt.blk' |
| 70 |
include 'cutopt.blk' |
| 71 |
|
| 72 |
DIMENSION A(*) |
| 73 |
CHARACTER*(*) CURPRO |
| 74 |
INTEGER LENF(0:NELBLK+4) |
| 75 |
INTEGER NLNKF(NELBLK) |
| 76 |
INTEGER NEWELB |
| 77 |
INTEGER IELBST(NELBLK) |
| 78 |
LOGICAL NEWFAC |
| 79 |
LOGICAL FIXFAC |
| 80 |
|
| 81 |
LOGICAL FIRST |
| 82 |
SAVE FIRST |
| 83 |
C --FIRST - true iff first time through routine |
| 84 |
|
| 85 |
CHARACTER*8 LSTPRO |
| 86 |
SAVE LSTPRO |
| 87 |
C --LSTPRO - the last program to set the faces |
| 88 |
|
| 89 |
INTEGER NALOLD |
| 90 |
SAVE NALOLD |
| 91 |
C --NALOLD - the last setting of NALVAR |
| 92 |
|
| 93 |
DATA FIRST / .TRUE. / |
| 94 |
DATA NALOLD / 0 / |
| 95 |
DATA LSTPRO / ' ' / |
| 96 |
|
| 97 |
C --Figure out if new face set needs to be calculated |
| 98 |
|
| 99 |
NEWFAC = .FALSE. |
| 100 |
|
| 101 |
IF (FIRST) THEN |
| 102 |
LSTPRO = CURPRO |
| 103 |
END IF |
| 104 |
|
| 105 |
IF (IS3DIM .AND. (NEWELB .EQ. 2)) THEN |
| 106 |
NEWFAC = .TRUE. |
| 107 |
END IF |
| 108 |
|
| 109 |
IF (IS3DIM .AND. NEWCUT) THEN |
| 110 |
NEWFAC = .TRUE. |
| 111 |
END IF |
| 112 |
|
| 113 |
IF ((NALOLD .GT. 0) .AND. (NALVAR .LE. 0)) THEN |
| 114 |
NEWFAC = .TRUE. |
| 115 |
END IF |
| 116 |
|
| 117 |
IF ((NALVAR .GT. 0) .AND. (ISTEP .GE. 1)) THEN |
| 118 |
NEWFAC = .TRUE. |
| 119 |
END IF |
| 120 |
|
| 121 |
C --Compute new face set if element blocks have been turned on/off |
| 122 |
|
| 123 |
IF (IS3DIM .AND. (NEWELB .EQ. 2)) THEN |
| 124 |
|
| 125 |
C --Determine new face set for new element blocks |
| 126 |
|
| 127 |
NSETS = NELBLK + 4 |
| 128 |
CALL MDRSRV ('NEWELB', KNEWB, LENF(NSETS)) |
| 129 |
IF (IS3DIM) CALL MDFIND ('IF2EL2', KIF2E2, IDUM) |
| 130 |
CALL MDFIND ('IE2ELB', KE2ELB, IDUM) |
| 131 |
CALL MDSTAT (NERR, MEM) |
| 132 |
IF (NERR .GT. 0) GOTO 100 |
| 133 |
|
| 134 |
CALL FIXELB (IELBST, LENF, A(KIF2EL), A(KIF2E2), A(KE2ELB), |
| 135 |
& A(KNEWB)) |
| 136 |
|
| 137 |
C --Adjust the face connectivity |
| 138 |
|
| 139 |
CALL SORLNK (A, NSETS, A(KNEWB), |
| 140 |
& LENF, NLNKF, A(KLINKF), A(KIF2EL), A(KIF2E2), A(KE2ELB)) |
| 141 |
|
| 142 |
CALL MDDEL ('NEWELB') |
| 143 |
|
| 144 |
C --If no faces are ON, print error message |
| 145 |
C --and go back for more commands with NEWELB set |
| 146 |
|
| 147 |
IF (LENF(NELBLK) .EQ. 0) THEN |
| 148 |
CALL PRTERR ('ERROR', 'No element blocks are displayed') |
| 149 |
NEWELB = 2 |
| 150 |
GOTO 100 |
| 151 |
END IF |
| 152 |
|
| 153 |
C --Force the re-calculation of the cut, if cut |
| 154 |
IF (ISCUT) NEWCUT = .TRUE. |
| 155 |
|
| 156 |
C --All faces are now alive |
| 157 |
NALOLD = 0 |
| 158 |
|
| 159 |
C --Force the re-calculation of connected element count, if needed |
| 160 |
NEWELB = 1 |
| 161 |
END IF |
| 162 |
|
| 163 |
C --Compute new face set if the object has been cut |
| 164 |
|
| 165 |
IF (IS3DIM .AND. NEWCUT) THEN |
| 166 |
|
| 167 |
C --Compute new face set for cut |
| 168 |
|
| 169 |
NSETS = NELBLK + 3 |
| 170 |
CALL MDRSRV ('NEWELB', KNEWB, LENF(NSETS)) |
| 171 |
IF (IS3DIM) CALL MDFIND ('IF2EL2', KIF2E2, IDUM) |
| 172 |
CALL MDFIND ('IE2ELB', KE2ELB, IDUM) |
| 173 |
CALL MDSTAT (NERR, MEM) |
| 174 |
IF (NERR .GT. 0) GOTO 100 |
| 175 |
|
| 176 |
IF (ISCUT) THEN |
| 177 |
CALL MDRSRV ('SCRFAC', KFSTAT, LENF(NELBLK+3)) |
| 178 |
CALL MDRSRV ('ROUTEL', KESTAT, NUMEL) |
| 179 |
CALL MDRSRV ('ROUTZC', KZC, NUMNP) |
| 180 |
C --Get the full set of coordinates |
| 181 |
CALL MDFIND ('XN', KX, IDUM) |
| 182 |
CALL MDFIND ('YN', KY, IDUM) |
| 183 |
CALL MDFIND ('ZN', KZ, IDUM) |
| 184 |
CALL MDSTAT (NERR, MEM) |
| 185 |
IF (NERR .GT. 0) GOTO 100 |
| 186 |
|
| 187 |
CALL FIXCUT (CUTPT, CUTNRM, A(KX), A(KY), A(KZ), |
| 188 |
& LENF, NLNKF, A(KLINKF), |
| 189 |
& A(KIF2EL), A(KIF2E2), A(KE2ELB), |
| 190 |
& A(KFSTAT), A(KESTAT), A(KZC), A(KNEWB)) |
| 191 |
|
| 192 |
CALL MDDEL ('SCRFAC') |
| 193 |
CALL MDDEL ('ROUTEL') |
| 194 |
CALL MDDEL ('ROUTZC') |
| 195 |
|
| 196 |
ELSE |
| 197 |
CALL ALLCUT (A(KE2ELB), LENF, A(KIF2EL), A(KIF2E2), |
| 198 |
& A(KNEWB)) |
| 199 |
END IF |
| 200 |
|
| 201 |
C --Adjust the face connectivity |
| 202 |
|
| 203 |
CALL SORLNK (A, NSETS, A(KNEWB), |
| 204 |
& LENF, NLNKF, A(KLINKF), A(KIF2EL), A(KIF2E2), A(KE2ELB)) |
| 205 |
|
| 206 |
CALL MDDEL ('NEWELB') |
| 207 |
|
| 208 |
C --If no faces are defined by cut, delete cut, print error message |
| 209 |
C --and go back for more commands with NEWCUT set |
| 210 |
|
| 211 |
IF (LENF(NELBLK) .EQ. 0) THEN |
| 212 |
CALL PRTERR ('ERROR', |
| 213 |
& 'No elements are defined by the cutting plane') |
| 214 |
NEWCUT = .TRUE. |
| 215 |
GOTO 100 |
| 216 |
END IF |
| 217 |
|
| 218 |
C --All faces are now alive |
| 219 |
NALOLD = 0 |
| 220 |
|
| 221 |
NEWCUT = .FALSE. |
| 222 |
END IF |
| 223 |
|
| 224 |
C --Compute new face set (and line set for 2D) for birth/death turned off |
| 225 |
|
| 226 |
IF ((NALOLD .GT. 0) .AND. (NALVAR .LE. 0)) THEN |
| 227 |
|
| 228 |
C --Compute new face set for birth/death turned off |
| 229 |
|
| 230 |
NSETS = NELBLK + 2 |
| 231 |
CALL MDRSRV ('NEWELB', KNEWB, LENF(NSETS)) |
| 232 |
IF (IS3DIM) CALL MDFIND ('IF2EL2', KIF2E2, IDUM) |
| 233 |
CALL MDFIND ('IE2ELB', KE2ELB, IDUM) |
| 234 |
CALL MDSTAT (NERR, MEM) |
| 235 |
IF (NERR .GT. 0) GOTO 100 |
| 236 |
|
| 237 |
IF (.NOT. IS3DIM) THEN |
| 238 |
CALL ALLAL2 (LENF, A(KIF2EL), A(KE2ELB), A(KNEWB)) |
| 239 |
ELSE |
| 240 |
CALL ALLAL3 (LENF, A(KIF2EL), A(KIF2E2), A(KE2ELB), |
| 241 |
& A(KNEWB)) |
| 242 |
END IF |
| 243 |
|
| 244 |
C --Adjust the face connectivity |
| 245 |
|
| 246 |
CALL SORLNK (A, NSETS, A(KNEWB), |
| 247 |
& LENF, NLNKF, A(KLINKF), A(KIF2EL), A(KIF2E2), A(KE2ELB)) |
| 248 |
|
| 249 |
CALL MDDEL ('NEWELB') |
| 250 |
|
| 251 |
NALOLD = NALVAR |
| 252 |
END IF |
| 253 |
|
| 254 |
C --Compute new face set (and line set for 2D) for birth/death for step |
| 255 |
|
| 256 |
IF ((NALVAR .GT. 0) .AND. (ISTEP .GE. 1)) THEN |
| 257 |
|
| 258 |
C --Compute new face set for birth/death for step |
| 259 |
|
| 260 |
NSETS = NELBLK + 2 |
| 261 |
CALL MDRSRV ('NEWELB', KNEWB, LENF(NSETS)) |
| 262 |
IF (IS3DIM) CALL MDFIND ('IF2EL2', KIF2E2, IDUM) |
| 263 |
CALL MDFIND ('IE2ELB', KE2ELB, IDUM) |
| 264 |
|
| 265 |
CALL MDRSRV ('ROUTEL', KALIVE, NUMEL) |
| 266 |
CALL MDFIND ('LENE', KLENE, IDUM) |
| 267 |
CALL MDFIND ('ISEVOK', KIEVOK, IDUM) |
| 268 |
CALL MDSTAT (NERR, MEM) |
| 269 |
IF (NERR .GT. 0) GOTO 100 |
| 270 |
|
| 271 |
CALL GETALV (A, NALVAR, ALIVAL, ISTEP, A(KLENE), A(KIEVOK), |
| 272 |
& A(KALIVE), A(KALIVE)) |
| 273 |
|
| 274 |
IF (.NOT. IS3DIM) THEN |
| 275 |
CALL FIXAL2 (A(KALIVE), |
| 276 |
& LENF, A(KIF2EL), A(KE2ELB), A(KNEWB)) |
| 277 |
ELSE |
| 278 |
CALL FIXAL3 (A(KALIVE), |
| 279 |
& LENF, A(KIF2EL), A(KIF2E2), A(KE2ELB), A(KNEWB)) |
| 280 |
END IF |
| 281 |
|
| 282 |
CALL MDDEL ('ROUTEL') |
| 283 |
|
| 284 |
C --Adjust the face connectivity |
| 285 |
|
| 286 |
CALL SORLNK (A, NSETS, A(KNEWB), |
| 287 |
& LENF, NLNKF, A(KLINKF), A(KIF2EL), A(KIF2E2), A(KE2ELB)) |
| 288 |
|
| 289 |
CALL MDDEL ('NEWELB') |
| 290 |
|
| 291 |
C --If no faces are alive, print error message |
| 292 |
C --and skip time step |
| 293 |
|
| 294 |
IF (LENF(NELBLK) .EQ. 0) THEN |
| 295 |
CALL PRTERR ('ERROR', 'No elements are alive') |
| 296 |
GOTO 100 |
| 297 |
END IF |
| 298 |
|
| 299 |
NALOLD = NALVAR |
| 300 |
END IF |
| 301 |
|
| 302 |
100 CONTINUE |
| 303 |
|
| 304 |
IF (NEWFAC) THEN |
| 305 |
|
| 306 |
C --Force the re-calculation of which nodes are on the surface |
| 307 |
NNPSUR = -999 |
| 308 |
END IF |
| 309 |
|
| 310 |
IF (NEWFAC) LSTPRO = CURPRO |
| 311 |
FIXFAC = (CURPRO .NE. LSTPRO) |
| 312 |
|
| 313 |
FIRST = .FALSE. |
| 314 |
|
| 315 |
RETURN |
| 316 |
END |