00001 SUBROUTINE DRCHEK (JOB, G, NG, NEQ, TN, TOUT, Y, YP, PHI, PSI,
00002 * KOLD, G0, G1, GX, JROOT, IRT, UROUND, INFO3, RWORK, IWORK,
00003 * RPAR, IPAR)
00004
00005
00006
00007
00008
00009
00010
00011
00012 IMPLICIT DOUBLE PRECISION(A-H,O-Z)
00013 PARAMETER (LNGE=16, LIRFND=18, LLAST=19, LIMAX=20,
00014 * LT0=41, LTLAST=42, LALPHR=43, LX2=44)
00015 EXTERNAL G
00016 INTEGER JOB, NG, NEQ, KOLD, JROOT, IRT, INFO3, IWORK, IPAR
00017 DOUBLE PRECISION TN, TOUT, Y, YP, PHI, PSI, G0, G1, GX, UROUND,
00018 * RWORK, RPAR
00019 DIMENSION Y(*), YP(*), PHI(NEQ,*), PSI(*),
00020 1 G0(*), G1(*), GX(*), JROOT(*), RWORK(*), IWORK(*)
00021 INTEGER I, JFLAG
00022 DOUBLE PRECISION H
00023 DOUBLE PRECISION HMING, T1, TEMP1, TEMP2, X
00024 LOGICAL ZROOT
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
00057
00058
00059
00060
00061
00062
00063
00064 H = PSI(1)
00065 IRT = 0
00066 DO 10 I = 1,NG
00067 10 JROOT(I) = 0
00068 HMING = (DABS(TN) + DABS(H))*UROUND*100.0D0
00069
00070 GO TO (100, 200, 300), JOB
00071
00072
00073
00074 100 CONTINUE
00075 CALL DDATRP(TN,RWORK(LT0),Y,YP,NEQ,KOLD,PHI,PSI)
00076 CALL G (NEQ, RWORK(LT0), Y, NG, G0, RPAR, IPAR)
00077 IWORK(LNGE) = 1
00078 ZROOT = .FALSE.
00079 DO 110 I = 1,NG
00080 110 IF (DABS(G0(I)) .LE. 0.0D0) ZROOT = .TRUE.
00081 IF (.NOT. ZROOT) GO TO 190
00082
00083 TEMP1 = DSIGN(HMING,H)
00084 RWORK(LT0) = RWORK(LT0) + TEMP1
00085 TEMP2 = TEMP1/H
00086 DO 120 I = 1,NEQ
00087 120 Y(I) = Y(I) + TEMP2*PHI(I,2)
00088 CALL G (NEQ, RWORK(LT0), Y, NG, G0, RPAR, IPAR)
00089 IWORK(LNGE) = IWORK(LNGE) + 1
00090 ZROOT = .FALSE.
00091 DO 130 I = 1,NG
00092 130 IF (DABS(G0(I)) .LE. 0.0D0) ZROOT = .TRUE.
00093 IF (.NOT. ZROOT) GO TO 190
00094
00095 IRT = -1
00096 RETURN
00097
00098 190 CONTINUE
00099 RETURN
00100
00101
00102 200 CONTINUE
00103 IF (IWORK(LIRFND) .EQ. 0) GO TO 260
00104
00105 CALL DDATRP (TN, RWORK(LT0), Y, YP, NEQ, KOLD, PHI, PSI)
00106 CALL G (NEQ, RWORK(LT0), Y, NG, G0, RPAR, IPAR)
00107 IWORK(LNGE) = IWORK(LNGE) + 1
00108 ZROOT = .FALSE.
00109 DO 210 I = 1,NG
00110 210 IF (DABS(G0(I)) .LE. 0.0D0) ZROOT = .TRUE.
00111 IF (.NOT. ZROOT) GO TO 260
00112
00113 TEMP1 = DSIGN(HMING,H)
00114 RWORK(LT0) = RWORK(LT0) + TEMP1
00115 IF ((RWORK(LT0) - TN)*H .LT. 0.0D0) GO TO 230
00116 TEMP2 = TEMP1/H
00117 DO 220 I = 1,NEQ
00118 220 Y(I) = Y(I) + TEMP2*PHI(I,2)
00119 GO TO 240
00120 230 CALL DDATRP (TN, RWORK(LT0), Y, YP, NEQ, KOLD, PHI, PSI)
00121 240 CALL G (NEQ, RWORK(LT0), Y, NG, G0, RPAR, IPAR)
00122 IWORK(LNGE) = IWORK(LNGE) + 1
00123 ZROOT = .FALSE.
00124 DO 250 I = 1,NG
00125 IF (DABS(G0(I)) .GT. 0.0D0) GO TO 250
00126 JROOT(I) = 1
00127 ZROOT = .TRUE.
00128 250 CONTINUE
00129 IF (.NOT. ZROOT) GO TO 260
00130
00131 IRT = 1
00132 RETURN
00133
00134
00135 260 IF (TN .EQ. RWORK(LTLAST)) GO TO 390
00136
00137 300 CONTINUE
00138
00139 IF (INFO3 .EQ. 1) GO TO 310
00140 IF ((TOUT - TN)*H .GE. 0.0D0) GO TO 310
00141 T1 = TOUT
00142 IF ((T1 - RWORK(LT0))*H .LE. 0.0D0) GO TO 390
00143 CALL DDATRP (TN, T1, Y, YP, NEQ, KOLD, PHI, PSI)
00144 GO TO 330
00145 310 T1 = TN
00146 DO 320 I = 1,NEQ
00147 320 Y(I) = PHI(I,1)
00148 330 CALL G (NEQ, T1, Y, NG, G1, RPAR, IPAR)
00149 IWORK(LNGE) = IWORK(LNGE) + 1
00150
00151 JFLAG = 0
00152 350 CONTINUE
00153 CALL DROOTS (NG, HMING, JFLAG, RWORK(LT0), T1, G0, G1, GX, X,
00154 * JROOT, IWORK(LIMAX), IWORK(LLAST), RWORK(LALPHR),
00155 * RWORK(LX2))
00156 IF (JFLAG .GT. 1) GO TO 360
00157 CALL DDATRP (TN, X, Y, YP, NEQ, KOLD, PHI, PSI)
00158 CALL G (NEQ, X, Y, NG, GX, RPAR, IPAR)
00159 IWORK(LNGE) = IWORK(LNGE) + 1
00160 GO TO 350
00161 360 RWORK(LT0) = X
00162 CALL DCOPY (NG, GX, 1, G0, 1)
00163 IF (JFLAG .EQ. 4) GO TO 390
00164
00165 CALL DDATRP (TN, X, Y, YP, NEQ, KOLD, PHI, PSI)
00166 IRT = 1
00167 RETURN
00168
00169 390 CONTINUE
00170 RETURN
00171
00172 END