2 SUBROUTINE DSOLPK
(NEQ
, Y
, SAVF
, X
, EWT
, WM
, IWM
, F
, PSOL
)
5 DOUBLE PRECISION Y
, SAVF
, X
, EWT
, WM
6 DIMENSION NEQ
(*), Y
(*), SAVF
(*), X
(*), EWT
(*), WM
(*), IWM
(*)
8 1 ICF
, IERPJ
, IERSL
, JCUR
, JSTART
, KFLAG
, L
,
9 2 LYH
, LEWT
, LACOR
, LSAVF
, LWM
, LIWM
, METH
, MITER
,
10 3 MAXORD
, MAXCOR
, MSBP
, MXNCF
, N
, NQ
, NST
, NFE
, NJE
, NQU
11 INTEGER JPRE
, JACFLG
, LOCWP
, LOCIWP
, LSAVX
, KMP
, MAXL
, MNEWT
,
12 1 NNI
, NLI
, NPS
, NCFN
, NCFL
13 DOUBLE PRECISION ROWNS
,
14 1 CCMAX
, EL0
, H
, HMIN
, HMXI
, HU
, RC
, TN
, UROUND
15 DOUBLE PRECISION DELT
, EPCON
, SQRTN
, RSQRTN
16 COMMON /DLS001
/ ROWNS
(209),
17 1 CCMAX
, EL0
, H
, HMIN
, HMXI
, HU
, RC
, TN
, UROUND
,
19 3 ICF
, IERPJ
, IERSL
, JCUR
, JSTART
, KFLAG
, L
,
20 4 LYH
, LEWT
, LACOR
, LSAVF
, LWM
, LIWM
, METH
, MITER
,
21 5 MAXORD
, MAXCOR
, MSBP
, MXNCF
, N
, NQ
, NST
, NFE
, NJE
, NQU
22 COMMON /DLPK01
/ DELT
, EPCON
, SQRTN
, RSQRTN
,
23 1 JPRE
, JACFLG
, LOCWP
, LOCIWP
, LSAVX
, KMP
, MAXL
, MNEWT
,
24 2 NNI
, NLI
, NPS
, NCFN
, NCFL
25 C-----------------------------------------------------------------------
26 C This routine interfaces to one of DSPIOM, DSPIGMR, DPCG, DPCGS, or
27 C DUSOL, for the solution of the linear system arising from a Newton
28 C iteration. It is called if MITER .ne. 0.
29 C In addition to variables described elsewhere,
30 C communication with DSOLPK uses the following variables:
31 C WM = real work space containing data for the algorithm
32 C (Krylov basis vectors, Hessenberg matrix, etc.)
33 C IWM = integer work space containing data for the algorithm
34 C X = the right-hand side vector on input, and the solution vector
35 C on output, of length N.
36 C IERSL = output flag (in Common):
37 C IERSL = 0 means no trouble occurred.
38 C IERSL = 1 means the iterative method failed to converge.
39 C If the preconditioner is out of date, the step
40 C is repeated with a new preconditioner.
41 C Otherwise, the stepsize is reduced (forcing a
42 C new evaluation of the preconditioner) and the
44 C IERSL = -1 means there was a nonrecoverable error in the
45 C iterative solver, and an error exit occurs.
46 C This routine also uses the Common variables TN, EL0, H, N, MITER,
47 C DELT, EPCON, SQRTN, RSQRTN, MAXL, KMP, MNEWT, NNI, NLI, NPS, NCFL,
49 C-----------------------------------------------------------------------
50 INTEGER IFLAG
, LB
, LDL
, LHES
, LIOM
, LGMR
, LPCG
, LP
, LQ
, LR
,
51 1 LV
, LW
, LWK
, LZ
, MAXLP1
, NPSL
52 DOUBLE PRECISION DELTA
, HL0
57 GO TO (100, 200, 300, 400, 900, 900, 900, 900, 900), MITER
58 C-----------------------------------------------------------------------
59 C Use the SPIOM algorithm to solve the linear system P*x = -f.
60 C-----------------------------------------------------------------------
65 LWK
= LHES
+ MAXL*MAXL
66 CALL DCOPY
(N
, X
, 1, WM
(LB
), 1)
67 CALL DSCAL
(N
, RSQRTN
, EWT
, 1)
68 CALL DSPIOM
(NEQ
, TN
, Y
, SAVF
, WM
(LB
), EWT
, N
, MAXL
, KMP
, DELTA
,
69 1 HL0
, JPRE
, MNEWT
, F
, PSOL
, NPSL
, X
, WM
(LV
), WM
(LHES
), IWM
,
70 2 LIOM
, WM
(LOCWP
), IWM
(LOCIWP
), WM
(LWK
), IFLAG
)
74 CALL DSCAL
(N
, SQRTN
, EWT
, 1)
75 IF (IFLAG
.NE
. 0) NCFL
= NCFL
+ 1
76 IF (IFLAG
.GE
. 2) IERSL
= 1
77 IF (IFLAG
.LT
. 0) IERSL
= -1
79 C-----------------------------------------------------------------------
80 C Use the SPIGMR algorithm to solve the linear system P*x = -f.
81 C-----------------------------------------------------------------------
87 LQ
= LHES
+ MAXL*MAXLP1
89 LDL
= LWK
+ MIN
(1,MAXL
-KMP
)*N
90 CALL DCOPY
(N
, X
, 1, WM
(LB
), 1)
91 CALL DSCAL
(N
, RSQRTN
, EWT
, 1)
92 CALL DSPIGMR
(NEQ
, TN
, Y
, SAVF
, WM
(LB
), EWT
, N
, MAXL
, MAXLP1
, KMP
,
93 1 DELTA
, HL0
, JPRE
, MNEWT
, F
, PSOL
, NPSL
, X
, WM
(LV
), WM
(LHES
),
94 2 WM
(LQ
), LGMR
, WM
(LOCWP
), IWM
(LOCIWP
), WM
(LWK
), WM
(LDL
), IFLAG
)
98 CALL DSCAL
(N
, SQRTN
, EWT
, 1)
99 IF (IFLAG
.NE
. 0) NCFL
= NCFL
+ 1
100 IF (IFLAG
.GE
. 2) IERSL
= 1
101 IF (IFLAG
.LT
. 0) IERSL
= -1
103 C-----------------------------------------------------------------------
104 C Use DPCG to solve the linear system P*x = -f
105 C-----------------------------------------------------------------------
112 CALL DCOPY
(N
, X
, 1, WM
(LR
), 1)
113 CALL DPCG
(NEQ
, TN
, Y
, SAVF
, WM
(LR
), EWT
, N
, MAXL
, DELTA
, HL0
,
114 1 JPRE
, MNEWT
, F
, PSOL
, NPSL
, X
, WM
(LP
), WM
(LW
), WM
(LZ
),
115 2 LPCG
, WM
(LOCWP
), IWM
(LOCIWP
), WM
(LWK
), IFLAG
)
119 IF (IFLAG
.NE
. 0) NCFL
= NCFL
+ 1
120 IF (IFLAG
.GE
. 2) IERSL
= 1
121 IF (IFLAG
.LT
. 0) IERSL
= -1
123 C-----------------------------------------------------------------------
124 C Use DPCGS to solve the linear system P*x = -f
125 C-----------------------------------------------------------------------
132 CALL DCOPY
(N
, X
, 1, WM
(LR
), 1)
133 CALL DPCGS
(NEQ
, TN
, Y
, SAVF
, WM
(LR
), EWT
, N
, MAXL
, DELTA
, HL0
,
134 1 JPRE
, MNEWT
, F
, PSOL
, NPSL
, X
, WM
(LP
), WM
(LW
), WM
(LZ
),
135 2 LPCG
, WM
(LOCWP
), IWM
(LOCIWP
), WM
(LWK
), IFLAG
)
139 IF (IFLAG
.NE
. 0) NCFL
= NCFL
+ 1
140 IF (IFLAG
.GE
. 2) IERSL
= 1
141 IF (IFLAG
.LT
. 0) IERSL
= -1
143 C-----------------------------------------------------------------------
144 C Use DUSOL, which interfaces to PSOL, to solve the linear system
145 C (no Krylov iteration).
146 C-----------------------------------------------------------------------
150 CALL DCOPY
(N
, X
, 1, WM
(LB
), 1)
151 CALL DUSOL
(NEQ
, TN
, Y
, SAVF
, WM
(LB
), EWT
, N
, DELTA
, HL0
, MNEWT
,
152 1 PSOL
, NPSL
, X
, WM
(LOCWP
), IWM
(LOCIWP
), WM
(LWK
), IFLAG
)
155 IF (IFLAG
.NE
. 0) NCFL
= NCFL
+ 1
156 IF (IFLAG
.EQ
. 3) IERSL
= 1
157 IF (IFLAG
.LT
. 0) IERSL
= -1
159 C----------------------- End of Subroutine DSOLPK ----------------------