00001 SUBROUTINE SPREPJ (NEQ, Y, YH, NYH, EWT, FTEM, SAVF, WM, IWM,
00002 1 F, JAC)
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 EXTERNAL F, JAC
00057 INTEGER NEQ, NYH, IWM
00058 REAL Y, YH, EWT, FTEM, SAVF, WM
00059 DIMENSION NEQ(*), Y(*), YH(NYH,*), EWT(*), FTEM(*), SAVF(*),
00060 1 WM(*), IWM(*)
00061 INTEGER IOWND, IOWNS,
00062 1 ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L,
00063 2 LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER,
00064 3 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU
00065 REAL ROWNS,
00066 1 CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND
00067 COMMON /SLS001/ ROWNS(209),
00068 1 CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND,
00069 2 IOWND(6), IOWNS(6),
00070 3 ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L,
00071 4 LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER,
00072 5 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU
00073 INTEGER I, I1, I2, IER, II, J, J1, JJ, LENP,
00074 1 MBA, MBAND, MEB1, MEBAND, ML, ML3, MU, NP1
00075 REAL CON, DI, FAC, HL0, R, R0, SRUR, YI, YJ, YJJ,
00076 1 SVNORM
00077
00078
00079 NJE = NJE + 1
00080 IERPJ = 0
00081 JCUR = 1
00082 HL0 = H*EL0
00083 GO TO (100, 200, 300, 400, 500), MITER
00084
00085 100 LENP = N*N
00086 DO 110 I = 1,LENP
00087 110 WM(I+2) = 0.0E0
00088 CALL JAC (NEQ, TN, Y, 0, 0, WM(3), N)
00089 CON = -HL0
00090 DO 120 I = 1,LENP
00091 120 WM(I+2) = WM(I+2)*CON
00092 GO TO 240
00093
00094 200 FAC = SVNORM (N, SAVF, EWT)
00095 R0 = 1000.0E0*ABS(H)*UROUND*N*FAC
00096 IF (R0 .EQ. 0.0E0) R0 = 1.0E0
00097 SRUR = WM(1)
00098 J1 = 2
00099 DO 230 J = 1,N
00100 YJ = Y(J)
00101 R = MAX(SRUR*ABS(YJ),R0/EWT(J))
00102 Y(J) = Y(J) + R
00103 FAC = -HL0/R
00104 CALL F (NEQ, TN, Y, FTEM)
00105 DO 220 I = 1,N
00106 220 WM(I+J1) = (FTEM(I) - SAVF(I))*FAC
00107 Y(J) = YJ
00108 J1 = J1 + N
00109 230 CONTINUE
00110 NFE = NFE + N
00111
00112 240 J = 3
00113 NP1 = N + 1
00114 DO 250 I = 1,N
00115 WM(J) = WM(J) + 1.0E0
00116 250 J = J + NP1
00117
00118 CALL SGETRF (N, N, WM(3), N, IWM(21), IER)
00119 IF (IER .NE. 0) IERPJ = 1
00120 RETURN
00121
00122 300 WM(2) = HL0
00123 R = EL0*0.1E0
00124 DO 310 I = 1,N
00125 310 Y(I) = Y(I) + R*(H*SAVF(I) - YH(I,2))
00126 CALL F (NEQ, TN, Y, WM(3))
00127 NFE = NFE + 1
00128 DO 320 I = 1,N
00129 R0 = H*SAVF(I) - YH(I,2)
00130 DI = 0.1E0*R0 - H*(WM(I+2) - SAVF(I))
00131 WM(I+2) = 1.0E0
00132 IF (ABS(R0) .LT. UROUND/EWT(I)) GO TO 320
00133 IF (ABS(DI) .EQ. 0.0E0) GO TO 330
00134 WM(I+2) = 0.1E0*R0/DI
00135 320 CONTINUE
00136 RETURN
00137 330 IERPJ = 1
00138 RETURN
00139
00140 400 ML = IWM(1)
00141 MU = IWM(2)
00142 ML3 = ML + 3
00143 MBAND = ML + MU + 1
00144 MEBAND = MBAND + ML
00145 LENP = MEBAND*N
00146 DO 410 I = 1,LENP
00147 410 WM(I+2) = 0.0E0
00148 CALL JAC (NEQ, TN, Y, ML, MU, WM(ML3), MEBAND)
00149 CON = -HL0
00150 DO 420 I = 1,LENP
00151 420 WM(I+2) = WM(I+2)*CON
00152 GO TO 570
00153
00154 500 ML = IWM(1)
00155 MU = IWM(2)
00156 MBAND = ML + MU + 1
00157 MBA = MIN(MBAND,N)
00158 MEBAND = MBAND + ML
00159 MEB1 = MEBAND - 1
00160 SRUR = WM(1)
00161 FAC = SVNORM (N, SAVF, EWT)
00162 R0 = 1000.0E0*ABS(H)*UROUND*N*FAC
00163 IF (R0 .EQ. 0.0E0) R0 = 1.0E0
00164 DO 560 J = 1,MBA
00165 DO 530 I = J,N,MBAND
00166 YI = Y(I)
00167 R = MAX(SRUR*ABS(YI),R0/EWT(I))
00168 530 Y(I) = Y(I) + R
00169 CALL F (NEQ, TN, Y, FTEM)
00170 DO 550 JJ = J,N,MBAND
00171 Y(JJ) = YH(JJ,1)
00172 YJJ = Y(JJ)
00173 R = MAX(SRUR*ABS(YJJ),R0/EWT(JJ))
00174 FAC = -HL0/R
00175 I1 = MAX(JJ-MU,1)
00176 I2 = MIN(JJ+ML,N)
00177 II = JJ*MEB1 - ML + 2
00178 DO 540 I = I1,I2
00179 540 WM(II+I) = (FTEM(I) - SAVF(I))*FAC
00180 550 CONTINUE
00181 560 CONTINUE
00182 NFE = NFE + MBA
00183
00184 570 II = MBAND + 2
00185 DO 580 I = 1,N
00186 WM(II) = WM(II) + 1.0E0
00187 580 II = II + MEBAND
00188
00189 CALL SGBTRF ( N, N, ML, MU, WM(3), MEBAND, IWM(21), IER)
00190 IF (IER .NE. 0) IERPJ = 1
00191 RETURN
00192
00193 END