Debian Codegraph @

packages/seacas/libraries/mapvarlib/frge.f

raw
1 C Copyright(C) 1999-2020, 2023 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 FRGE(N,S,L,G)
9
10 C**********************************************************************
11
12 C Subroutine BS does the back substitution for the solution of the
13 C local least squares extrapolation technique for element variables
14 C from their element centroid location to a nodal location.
15 C The least squares solution is started by a Gauss elimination in
16 C subroutine FRGE. The process is started in subroutines EXTQ for
17 C 4-node quads or EXTH for 8-node hexes.
18
19 C Called by EXTQ & EXTH
20
21 C**********************************************************************
22
23 C N INT number of equations - 1 + the number of dimensions
24 C S REAL the coefficient matrix
25 C G REAL dummy array
26 C L INT dummy array - placeholder for subscripts
27 C X REAL the solution vector - coefficients of the equation
28 C SMAX REAL dummy variable - used in the solution scheme
29 C RMAX REAL dummy variable - used in the solution scheme
30 C XMULT REAL dummy variable - used in the solution scheme
31 C R REAL dummy variable - used in the solution scheme
32
33 C**********************************************************************
34 DOUBLE PRECISION S(N,N),G(N),SMAX,RMAX,XMULT,R
35 INTEGER L(N)
36
37 DO 3 I = 1,N
38 L(I) = I
39 SMAX = 0.D+00
40 DO 2 J = 1,N
41 SMAX = MAX(SMAX,DABS(S(I,J)))
42 2 CONTINUE
43 G(I) = SMAX
44 3 CONTINUE
45
46 DO 7 K = 1,N-1
47 RMAX = 0.D+00
48 JJ = 0
49 DO 4 I = K,N
50 R = DABS(S(L(I),K)) / G(L(I))
51 IF (R .LE. RMAX) GO TO 4
52 JJ = I
53 RMAX = R
54 4 CONTINUE
55 if (jj .ne. 0) then
56 LK = L(JJ)
57 L(JJ) = L(K)
58 L(K) = LK
59 end if
60 DO 6 I = K+1,N
61 XMULT = S(L(I),K)/S(L(K),K)
62 DO 5 J = K+1,N
63 S(L(I),J) = S(L(I),J) - XMULT * S(L(K),J)
64 5 CONTINUE
65 S(L(I),K) = XMULT
66 6 CONTINUE
67 7 CONTINUE
68 RETURN
69 END