| 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 SMOGS (X, Y, Z, numelb, nlink, idelb, link, |
| 9 |
$ isbnd, nelblk, NUMNP, NIT, EPS, R0, |
| 10 |
$ xscr, yscr, zscr, nscr, ndim) |
| 11 |
C======================================================================= |
| 12 |
C*********************************************************************** |
| 13 |
|
| 14 |
C SUBROUTINE SMOGS = MESH SMOOTHING BY LAPLACE-S USING GAUSS-SEIDEL |
| 15 |
|
| 16 |
C*********************************************************************** |
| 17 |
|
| 18 |
C VARIABLES USED: |
| 19 |
C NIT = THE MAX NUMBER OF ITERATIONS TO DO. |
| 20 |
C EPS = MINIMUM DISTANCE NODES MUST MOVE TO CONTINUE ITERATIONS |
| 21 |
C RO = AN UNDER- OR OVER-RELAXATION FACTOR (NORMALLY 1.0) |
| 22 |
|
| 23 |
C*********************************************************************** |
| 24 |
|
| 25 |
real x(*), y(*), z(*) |
| 26 |
integer numelb(*), nlink(*), idelb(*), link(*) |
| 27 |
logical isbnd(*) |
| 28 |
real xscr(*), yscr(*), zscr(*) |
| 29 |
integer nscr(*) |
| 30 |
LOGICAL BIG |
| 31 |
|
| 32 |
IF (R0 .LT. 0.01) R0 = 1. |
| 33 |
EPS2 = (EPS*R0)**2 |
| 34 |
|
| 35 |
C ITERATION LOOP |
| 36 |
|
| 37 |
DO 120 IT = 1, NIT |
| 38 |
call inirea (numnp, 0.0, xscr) |
| 39 |
call inirea (numnp, 0.0, yscr) |
| 40 |
if (ndim .eq. 3) call inirea (numnp, 0.0, zscr) |
| 41 |
call iniint (numnp, 0, nscr) |
| 42 |
ielnk = 0 |
| 43 |
BIG = .FALSE. |
| 44 |
|
| 45 |
C NODE LOOP |
| 46 |
|
| 47 |
do 110 iblk = 1, nelblk |
| 48 |
islnk = ielnk+1 |
| 49 |
ielnk = ielnk + nlink(iblk) * numelb(iblk) |
| 50 |
|
| 51 |
C SKIP CONTINUATION AND BOUNDARY LINES |
| 52 |
|
| 53 |
if (ndim .eq. 2) then |
| 54 |
call smogs2 (xscr, yscr, isbnd, x, y, numelb(iblk), |
| 55 |
$ link(islnk), nlink(iblk), numnp, nscr) |
| 56 |
else |
| 57 |
call smogs3 (xscr, yscr, zscr, isbnd, x, y, z, |
| 58 |
$ numelb(iblk), link(islnk), nlink(iblk), |
| 59 |
$ numnp, nscr) |
| 60 |
end if |
| 61 |
110 continue |
| 62 |
|
| 63 |
delmax = 0.0 |
| 64 |
do 130 i=1, numnp |
| 65 |
if (.not. isbnd(i)) then |
| 66 |
SUMX = xscr(i)/dble(nscr(i)) |
| 67 |
SUMY = yscr(i)/dble(nscr(i)) |
| 68 |
XDEL = r0*(SUMX - X(i)) |
| 69 |
YDEL = r0*(SUMY - Y(i)) |
| 70 |
X(I) = X(I) + XDEL |
| 71 |
Y(I) = Y(I) + YDEL |
| 72 |
if (ndim .eq. 3) then |
| 73 |
sumz = zscr(i)/dble(nscr(i)) |
| 74 |
zdel = r0*(sumz - z(i)) |
| 75 |
z(i) = z(i) + zdel |
| 76 |
else |
| 77 |
zdel = 0.0 |
| 78 |
end if |
| 79 |
del = xdel*xdel + ydel*ydel + zdel*zdel |
| 80 |
if (del .gt. delmax) then |
| 81 |
delmax = del |
| 82 |
idel = i |
| 83 |
end if |
| 84 |
|
| 85 |
C CHECK FOR CONVERGENCE |
| 86 |
|
| 87 |
end if |
| 88 |
|
| 89 |
130 continue |
| 90 |
IF (delmax .GT. EPS2) BIG = .TRUE. |
| 91 |
|
| 92 |
C IF NO SIGNIFICANT MOVEMENTS OCCURRED, RETURN |
| 93 |
|
| 94 |
write (*,*) 'Iteration = ', it, sqrt(delmax)/r0, idel |
| 95 |
IF (.NOT.BIG) RETURN |
| 96 |
120 CONTINUE |
| 97 |
call prterr ('INFO', 'Iterations exceeded in smogs') |
| 98 |
RETURN |
| 99 |
END |