1 SUBROUTINE STEPS
(F
,NEQN
,Y
,X
,H
,EPS
,WT
,START
,HOLD
,K
,KOLD
,CRASH
,PHI
,
2 1 P
,YP
,ALPHA
,W
,G
,KSTEPS
,XOLD
,IVC
,IV
,KGI
,GI
, FPWA1
,FPWA2
,FPWA3
,
3 2 FPWA4
,FPWA5
,IFPWA1
,IFPC1
,IFPC2
,PAR
,IPAR
)
7 C WRITTEN BY L. F. SHAMPINE AND M. K. GORDON
11 C SUBROUTINE STEPS IS NORMALLY USED INDIRECTLY THROUGH SUBROUTINE
12 C DEABM . BECAUSE DEABM SUFFICES FOR MOST PROBLEMS AND IS MUCH
13 C EASIER TO USE, USING IT SHOULD BE CONSIDERED BEFORE USING STEPS
16 C SUBROUTINE STEPS INTEGRATES A SYSTEM OF NEQN FIRST ORDER ORDINARY
17 C DIFFERENTIAL EQUATIONS ONE STEP, NORMALLY FROM X TO X+H, USING A
18 C MODIFIED DIVIDED DIFFERENCE FORM OF THE ADAMS PECE FORMULAS. LOCAL
19 C EXTRAPOLATION IS USED TO IMPROVE ABSOLUTE STABILITY AND ACCURACY.
20 C THE CODE ADJUSTS ITS ORDER AND STEP SIZE TO CONTROL THE LOCAL ERROR
21 C PER UNIT STEP IN A GENERALIZED SENSE. SPECIAL DEVICES ARE INCLUDED
22 C TO CONTROL ROUNDOFF ERROR AND TO DETECT WHEN THE USER IS REQUESTING
25 C THIS CODE IS COMPLETELY EXPLAINED AND DOCUMENTED IN THE TEXT,
26 C COMPUTER SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS, THE INITIAL
27 C VALUE PROBLEM BY L. F. SHAMPINE AND M. K. GORDON.
28 C FURTHER DETAILS ON USE OF THIS CODE ARE AVAILABLE IN *SOLVING
29 C ORDINARY DIFFERENTIAL EQUATIONS WITH ODE, STEP, AND INTRP*,
30 C BY L. F. SHAMPINE AND M. K. GORDON, SLA-73-1060.
33 C THE PARAMETERS REPRESENT --
34 C F -- SUBROUTINE TO EVALUATE DERIVATIVES
35 C NEQN -- NUMBER OF EQUATIONS TO BE INTEGRATED
36 C Y(*) -- SOLUTION VECTOR AT X
37 C X -- INDEPENDENT VARIABLE
38 C H -- APPROPRIATE STEP SIZE FOR NEXT STEP. NORMALLY DETERMINED BY
40 C EPS -- LOCAL ERROR TOLERANCE
41 C WT(*) -- VECTOR OF WEIGHTS FOR ERROR CRITERION
42 C START -- LOGICAL VARIABLE SET .TRUE. FOR FIRST STEP, .FALSE.
44 C HOLD -- STEP SIZE USED FOR LAST SUCCESSFUL STEP
45 C K -- APPROPRIATE ORDER FOR NEXT STEP (DETERMINED BY CODE)
46 C KOLD -- ORDER USED FOR LAST SUCCESSFUL STEP
47 C CRASH -- LOGICAL VARIABLE SET .TRUE. WHEN NO STEP CAN BE TAKEN,
49 C YP(*) -- DERIVATIVE OF SOLUTION VECTOR AT X AFTER SUCCESSFUL
51 C KSTEPS -- COUNTER ON ATTEMPTED STEPS
53 C THE VARIABLES X,XOLD,KOLD,KGI AND IVC AND THE ARRAYS Y,PHI,ALPHA,G,
54 C W,P,IV AND GI ARE REQUIRED FOR THE INTERPOLATION SUBROUTINE SINTRP.
55 C THE ARRAYS FPWA* AND IFPWA1 AND INTEGER CONSTANTS IFPC* ARE
56 C WORKING STORAGE PASSED DIRECTLY THROUGH TO FODE. THE ARRAYS
57 C PAR AND IPAR ARE USER PARAMETERS PASSED THROUGH TO RHOA AND RHOJAC.
63 C THE USER MUST PROVIDE STORAGE IN HIS CALLING PROGRAM FOR ALL ARRAYS
64 C IN THE CALL LIST, NAMELY
66 C DIMENSION Y(NEQN),WT(NEQN),PHI(NEQN,16),P(NEQN),YP(NEQN),
67 C 1 ALPHA(12),W(12),G(13),GI(11),IV(10), FPWA1(NEQN),
68 C 2 FPWA2(NEQN-1),FPWA3(NEQN-1,NEQN),FPWA4(NEQN-1),
69 C 3 FPWA5(NEQN),IFPWA1(NEQN)
72 C THE USER MUST ALSO DECLARE START AND CRASH
73 C LOGICAL VARIABLES AND F AN EXTERNAL SUBROUTINE, SUPPLY THE
74 C SUBROUTINE F(X,Y,YP,FPWA1,FPWA2,FPWA3,FPWA4,FPWA5,IFPWA1,IFPC1,
75 C NEQN-1,IFPC2,PAR,IPAR) TO EVALUATE
76 C DY(I)/DX = YP(I) = F(X,Y(1),Y(2),...,Y(NEQN))
77 C AND INITIALIZE ONLY THE FOLLOWING PARAMETERS.
78 C NEQN -- NUMBER OF EQUATIONS TO BE INTEGRATED
79 C Y(*) -- VECTOR OF INITIAL VALUES OF DEPENDENT VARIABLES
80 C X -- INITIAL VALUE OF THE INDEPENDENT VARIABLE
81 C H -- NOMINAL STEP SIZE INDICATING DIRECTION OF INTEGRATION
82 C AND MAXIMUM SIZE OF STEP. MUST BE VARIABLE
83 C EPS -- LOCAL ERROR TOLERANCE PER STEP. MUST BE VARIABLE
84 C WT(*) -- VECTOR OF NON-ZERO WEIGHTS FOR ERROR CRITERION
86 C KSTEPS -- SET KSTEPS TO ZERO
87 C DEFINE U TO BE THE MACHINE UNIT ROUNDOFF QUANTITY BY CALLING
88 C THE FUNCTION ROUTINE D1MACH, U = D1MACH(3), OR BY
89 C COMPUTING U SO THAT U IS THE SMALLEST POSITIVE NUMBER SUCH
90 C THAT 1.0+U .GT. 1.0.
92 C STEPS REQUIRES THAT THE L2 NORM OF THE VECTOR WITH COMPONENTS
93 C LOCAL ERROR(L)/WT(L) BE LESS THAN EPS FOR A SUCCESSFUL STEP. THE
94 C ARRAY WT ALLOWS THE USER TO SPECIFY AN ERROR TEST APPROPRIATE
95 C FOR HIS PROBLEM. FOR EXAMPLE,
96 C WT(L) = 1.0 SPECIFIES ABSOLUTE ERROR,
97 C = ABS(Y(L)) ERROR RELATIVE TO THE MOST RECENT VALUE OF THE
98 C L-TH COMPONENT OF THE SOLUTION,
99 C = ABS(YP(L)) ERROR RELATIVE TO THE MOST RECENT VALUE OF
100 C THE L-TH COMPONENT OF THE DERIVATIVE,
101 C = MAX(WT(L),ABS(Y(L))) ERROR RELATIVE TO THE LARGEST
102 C MAGNITUDE OF L-TH COMPONENT OBTAINED SO FAR,
103 C = ABS(Y(L))*RELERR/EPS + ABSERR/EPS SPECIFIES A MIXED
104 C RELATIVE-ABSOLUTE TEST WHERE RELERR IS RELATIVE
105 C ERROR, ABSERR IS ABSOLUTE ERROR AND EPS =
106 C MAX(RELERR,ABSERR) .
108 C SUBSEQUENT CALLS --
110 C SUBROUTINE STEPS IS DESIGNED SO THAT ALL INFORMATION NEEDED TO
111 C CONTINUE THE INTEGRATION, INCLUDING THE STEP SIZE H AND THE ORDER
112 C K , IS RETURNED WITH EACH STEP. WITH THE EXCEPTION OF THE STEP
113 C SIZE, THE ERROR TOLERANCE, AND THE WEIGHTS, NONE OF THE PARAMETERS
114 C SHOULD BE ALTERED. THE ARRAY WT MUST BE UPDATED AFTER EACH STEP
115 C TO MAINTAIN RELATIVE ERROR TESTS LIKE THOSE ABOVE. NORMALLY THE
116 C INTEGRATION IS CONTINUED JUST BEYOND THE DESIRED ENDPOINT AND THE
117 C SOLUTION INTERPOLATED THERE WITH SUBROUTINE SINTRP . IF IT IS
118 C IMPOSSIBLE TO INTEGRATE BEYOND THE ENDPOINT, THE STEP SIZE MAY BE
119 C REDUCED TO HIT THE ENDPOINT SINCE THE CODE WILL NOT TAKE A STEP
120 C LARGER THAN THE H INPUT. CHANGING THE DIRECTION OF INTEGRATION,
121 C I.E., THE SIGN OF H , REQUIRES THE USER SET START = .TRUE. BEFORE
122 C CALLING STEPS AGAIN. THIS IS THE ONLY SITUATION IN WHICH START
129 C THE SUBROUTINE RETURNS AFTER EACH SUCCESSFUL STEP WITH START AND
130 C CRASH SET .FALSE. . X REPRESENTS THE INDEPENDENT VARIABLE
131 C ADVANCED ONE STEP OF LENGTH HOLD FROM ITS VALUE ON INPUT AND Y
132 C THE SOLUTION VECTOR AT THE NEW VALUE OF X . ALL OTHER PARAMETERS
133 C REPRESENT INFORMATION CORRESPONDING TO THE NEW X NEEDED TO
134 C CONTINUE THE INTEGRATION.
136 C UNSUCCESSFUL STEP --
138 C WHEN THE ERROR TOLERANCE IS TOO SMALL FOR THE MACHINE PRECISION,
139 C THE SUBROUTINE RETURNS WITHOUT TAKING A STEP AND CRASH = .TRUE. .
140 C AN APPROPRIATE STEP SIZE AND ERROR TOLERANCE FOR CONTINUING ARE
141 C ESTIMATED AND ALL OTHER INFORMATION IS RESTORED AS UPON INPUT
142 C BEFORE RETURNING. TO CONTINUE WITH THE LARGER TOLERANCE, THE USER
143 C JUST CALLS THE CODE AGAIN. A RESTART IS NEITHER REQUIRED NOR
145 C***REFERENCES SHAMPINE L.F., GORDON M.K., *SOLVING ORDINARY
146 C DIFFERENTIAL EQUATIONS WITH ODE, STEP, AND INTRP*,
147 C SLA-73-1060, SANDIA LABORATORIES, 1973.
149 DOUBLE PRECISION ABSH
,ALPHA
,BETA
,D1MACH
,EPS
,ERK
,ERKM1
,ERKM2
,
150 1 ERKP1
,ERR
,FOURU
,FPWA1
,FPWA2
,FPWA3
,FPWA4
,FPWA5
,G
,GI
,GSTR
,H
,
151 2 HNEW
,HOLD
,P
,PAR
,P5EPS
,PHI
,PSI
,R
,REALI
,REALNS
,RHO
,ROUND
,SIG
,
152 3 SUM
,TAU
,TEMP1
,TEMP2
,TEMP3
,TEMP4
,TEMP5
,TEMP6
,TWO
,TWOU
,V
,
154 INTEGER I
,IFAIL
,IFPC1
,IFPC2
,IFPWA1
,IM1
,IPAR
,IP1
,IQ
,IV
,IVC
,
155 1 J
,JV
,K
,KGI
,KM1
,KM2
,KNEW
,KOLD
,KP1
,KP2
,KPREV
,KSTEPS
,
156 2 L
,LIMIT1
,LIMIT2
,NEQN
,NS
,NSM2
,NSP1
,NSP2
157 LOGICAL START
,CRASH
,PHASE1
,NORND
159 DIMENSION Y
(NEQN
),WT
(NEQN
),PHI
(NEQN
,16),P
(NEQN
),YP
(NEQN
),PSI
(12),
160 1 ALPHA
(12),BETA
(12),SIG
(13),V
(12),W
(12),G
(13),GI
(11),IV
(10),
161 2 FPWA1
(NEQN
),FPWA2
(NEQN
-1),FPWA3
(NEQN
-1,NEQN
),FPWA4
(NEQN
-1),
162 3 FPWA5
(NEQN
),IFPWA1
(NEQN
),PAR
(1),IPAR
(1)
163 DIMENSION TWO
(13),GSTR
(13)
165 C ALL LOCAL VARIABLES ARE SAVED, RATHER THAN PASSED, IN THIS
166 C SPECIALIZED VERSION OF STEPS.
172 DATA TWO
/2d0
,4d0
,8d0
,16d0
,32d0
,64d0
,128d0
,256d0
,512d0
,1024d0
,
173 1 2048d0
,4096d0
,8192d0
/
174 DATA GSTR
/0.500d0
,0.0833d0
,0.0417d0
,0.0264d0
,0.0188d0
,0.0143d0
,
175 1 0.0114d0
,0.00936d0
, 0.00789d0
,0.00679d0
,0.00592d0
,0.00524d0
,
179 C *** BEGIN BLOCK 0 ***
180 C CHECK IF STEP SIZE OR ERROR TOLERANCE IS TOO SMALL FOR MACHINE
181 C PRECISION. IF FIRST STEP, INITIALIZE PHI ARRAY AND ESTIMATE A
182 C STARTING STEP SIZE.
185 C IF STEP SIZE IS TOO SMALL, DETERMINE AN ACCEPTABLE ONE
187 C***FIRST EXECUTABLE STATEMENT
188 TWOU
= 2.0 * D1MACH
(4)
191 IF(ABS
(H
) .GE
. FOURU*ABS
(X
)) GO TO 5
192 H
= SIGN
(FOURU*ABS
(X
),H
)
196 C IF ERROR TOLERANCE IS TOO SMALL, INCREASE IT TO AN ACCEPTABLE VALUE
200 10 ROUND
= ROUND
+ (Y
(L
)/WT
(L
))**2
201 ROUND
= TWOU*SQRT
(ROUND
)
202 IF(P5EPS
.GE
. ROUND
) GO TO 15
203 EPS
= 2.0*ROUND*
(1.0 + FOURU
)
209 IF(.NOT
.START
) GO TO 99
211 C INITIALIZE. COMPUTE APPROPRIATE STEP SIZE FOR FIRST STEP
213 CALL F
(X
,Y
,YP
,FPWA1
,FPWA2
,FPWA3
,FPWA4
,FPWA5
,IFPWA1
,
214 $ IFPC1
,NEQN
-1,IFPC2
,PAR
,IPAR
)
215 IF (IFPC2
.GT
. 0) RETURN
220 20 SUM
= SUM
+ (YP
(L
)/WT
(L
))**2
223 IF(EPS
.LT
. 16.0*SUM*H*H
) ABSH
= 0.25*SQRT
(EPS
/SUM
)
224 H
= SIGN
(MAX
(ABSH
,FOURU*ABS
(X
)),H
)
227 C* BIG = SQRT(D1MACH(2))
228 C* CALL HSTART (F,NEQN,X,X+H,Y,YP,WT,1,U,BIG,
229 C* 1 PHI(1,3),PHI(1,4),PHI(1,5),PHI(1,6),RPAR,IPAR,H)
238 IF(P5EPS
.GT
. 100.0*ROUND
) GO TO 99
243 C *** END BLOCK 0 ***
245 C *** BEGIN BLOCK 1 ***
246 C COMPUTE COEFFICIENTS OF FORMULAS FOR THIS STEP. AVOID COMPUTING
247 C THOSE QUANTITIES NOT CHANGED WHEN STEP SIZE IS NOT CHANGED.
255 C NS IS THE NUMBER OF STEPS TAKEN WITH SIZE H, INCLUDING THE CURRENT
256 C ONE. WHEN K.LT.NS, NO COEFFICIENTS CHANGE
258 IF(H
.NE
. HOLD
) NS
= 0
259 IF (NS
.LE
.KOLD
) NS
= NS
+1
261 IF (K
.LT
. NS
) GO TO 199
263 C COMPUTE THOSE COMPONENTS OF ALPHA(*),BETA(*),PSI(*),SIG(*) WHICH
268 ALPHA
(NS
) = 1.0/REALNS
271 IF(K
.LT
. NSP1
) GO TO 110
276 BETA
(I
) = BETA
(IM1
)*PSI
(IM1
)/TEMP2
280 105 SIG
(I
+1) = REALI*ALPHA
(I
)*SIG
(I
)
283 C COMPUTE COEFFICIENTS G(*)
285 C INITIALIZE V(*) AND SET W(*).
287 IF(NS
.GT
. 1) GO TO 120
294 IF (K
.EQ
. 1) GO TO 140
299 C IF ORDER WAS RAISED, UPDATE DIAGONAL PART OF V(*)
301 120 IF(K
.LE
. KPREV
) GO TO 130
302 IF (IVC
.EQ
. 0) GO TO 122
310 IF (K
.NE
. 2) GO TO 123
314 IF(NSM2
.LT
. JV
) GO TO 130
317 V
(I
) = V
(I
) - ALPHA
(J
+1)*V
(I
+1)
319 IF (I
.NE
. 2) GO TO 130
323 C UPDATE V(*) AND SET W(*)
325 130 LIMIT1
= KP1
- NS
328 V
(IQ
) = V
(IQ
) - TEMP5*V
(IQ
+1)
331 IF (LIMIT1
.EQ
. 1) GO TO 137
334 137 W
(LIMIT1
+1) = V
(LIMIT1
+1)
335 IF (K
.GE
. KOLD
) GO TO 140
339 C COMPUTE THE G(*) IN THE WORK VECTOR W(*)
343 IF(KP1
.LT
. NSP2
) GO TO 199
348 145 W
(IQ
) = W
(IQ
) - TEMP6*W
(IQ
+1)
351 C *** END BLOCK 1 ***
353 C *** BEGIN BLOCK 2 ***
354 C PREDICT A SOLUTION P(*), EVALUATE DERIVATIVES USING PREDICTED
355 C SOLUTION, ESTIMATE LOCAL ERROR AT ORDER K AND ERRORS AT ORDERS K,
356 C K-1, K-2 AS IF CONSTANT STEP SIZE WERE USED.
359 C INCREMENT COUNTER ON ATTEMPTED STEPS
363 C CHANGE PHI TO PHI STAR
365 IF(K
.LT
. NSP1
) GO TO 215
369 205 PHI
(L
,I
) = TEMP1*PHI
(L
,I
)
372 C PREDICT SOLUTION AND DIFFERENCES
374 215 DO 220 L
= 1,NEQN
375 PHI
(L
,KP2
) = PHI
(L
,KP1
)
383 P
(L
) = P
(L
) + TEMP2*PHI
(L
,I
)
384 225 PHI
(L
,I
) = PHI
(L
,I
) + PHI
(L
,IP1
)
388 TAU
= H*P
(L
) - PHI
(L
,15)
390 235 PHI
(L
,16) = (P
(L
) - Y
(L
)) - TAU
392 240 DO 245 L
= 1,NEQN
393 245 P
(L
) = Y
(L
) + H*P
(L
)
397 CALL F
(X
,P
,YP
,FPWA1
,FPWA2
,FPWA3
,FPWA4
,FPWA5
,IFPWA1
,
398 $ IFPC1
,NEQN
-1,IFPC2
,PAR
,IPAR
)
399 IF (IFPC2
.GT
. 0) RETURN
401 C ESTIMATE ERRORS AT ORDERS K,K-1,K-2
408 TEMP4
= YP
(L
) - PHI
(L
,1)
410 255 ERKM2
= ERKM2
+ ((PHI
(L
,KM1
)+TEMP4
)*TEMP3
)**2
411 260 ERKM1
= ERKM1
+ ((PHI
(L
,K
)+TEMP4
)*TEMP3
)**2
412 265 ERK
= ERK
+ (TEMP4*TEMP3
)**2
414 270 ERKM2
= ABSH*SIG
(KM1
)*GSTR
(KM2
)*SQRT
(ERKM2
)
415 275 ERKM1
= ABSH*SIG
(K
)*GSTR
(KM1
)*SQRT
(ERKM1
)
416 280 TEMP5
= ABSH*SQRT
(ERK
)
417 ERR
= TEMP5*
(G
(K
)-G
(KP1
))
418 ERK
= TEMP5*SIG
(KP1
)*GSTR
(K
)
421 C TEST IF ORDER SHOULD BE LOWERED
424 285 IF(MAX
(ERKM1
,ERKM2
) .LE
. ERK
) KNEW
= KM1
426 290 IF(ERKM1
.LE
. 0.5*ERK
) KNEW
= KM1
428 C TEST IF STEP SUCCESSFUL
430 299 IF(ERR
.LE
. EPS
) GO TO 400
431 C *** END BLOCK 2 ***
433 C *** BEGIN BLOCK 3 ***
434 C THE STEP IS UNSUCCESSFUL. RESTORE X, PHI(*,*), PSI(*) .
435 C IF THIRD CONSECUTIVE FAILURE, SET ORDER TO ONE. IF STEP FAILS MORE
436 C THAN THREE TIMES, CONSIDER AN OPTIMAL STEP SIZE. DOUBLE ERROR
437 C TOLERANCE AND RETURN IF ESTIMATED STEP SIZE IS TOO SMALL FOR MACHINE
441 C RESTORE X, PHI(*,*) AND PSI(*)
449 305 PHI
(L
,I
) = TEMP1*
(PHI
(L
,I
) - PHI
(L
,IP1
))
451 IF(K
.LT
. 2) GO TO 320
453 315 PSI
(I
-1) = PSI
(I
) - H
455 C ON THIRD FAILURE, SET ORDER TO ONE. THEREAFTER, USE OPTIMAL STEP
458 320 IFAIL
= IFAIL
+ 1
460 IF(IFAIL
- 3) 335,330,325
461 325 IF(P5EPS
.LT
. 0.25*ERK
) TEMP2
= SQRT
(P5EPS
/ERK
)
466 IF(ABS
(H
) .GE
. FOURU*ABS
(X
)) GO TO 340
468 H
= SIGN
(FOURU*ABS
(X
),H
)
472 C *** END BLOCK 3 ***
474 C *** BEGIN BLOCK 4 ***
475 C THE STEP IS SUCCESSFUL. CORRECT THE PREDICTED SOLUTION, EVALUATE
476 C THE DERIVATIVES USING THE CORRECTED SOLUTION AND UPDATE THE
477 C DIFFERENCES. DETERMINE BEST ORDER AND STEP SIZE FOR NEXT STEP.
482 C CORRECT AND EVALUATE
488 RHO
= TEMP1*
(YP
(L
) - PHI
(L
,1)) - PHI
(L
,16)
490 PHI
(L
,15) = (Y
(L
) - P
(L
)) - RHO
493 410 DO 415 L
= 1,NEQN
495 Y
(L
) = P
(L
) + TEMP1*
(YP
(L
) - PHI
(L
,1))
497 420 CALL F
(X
,Y
,YP
,FPWA1
,FPWA2
,FPWA3
,FPWA4
,FPWA5
,IFPWA1
,
498 $ IFPC1
,NEQN
-1,IFPC2
,PAR
,IPAR
)
499 IF (IFPC2
.GT
. 0) RETURN
501 C UPDATE DIFFERENCES FOR NEXT STEP
504 PHI
(L
,KP1
) = YP
(L
) - PHI
(L
,1)
505 425 PHI
(L
,KP2
) = PHI
(L
,KP1
) - PHI
(L
,KP2
)
508 430 PHI
(L
,I
) = PHI
(L
,I
) + PHI
(L
,KP1
)
511 C ESTIMATE ERROR AT ORDER K+1 UNLESS:
512 C IN FIRST PHASE WHEN ALWAYS RAISE ORDER,
513 C ALREADY DECIDED TO LOWER ORDER,
514 C STEP SIZE NOT CONSTANT SO ESTIMATE UNRELIABLE
517 IF(KNEW
.EQ
. KM1
.OR
. K
.EQ
. 12) PHASE1
= .FALSE
.
519 IF(KNEW
.EQ
. KM1
) GO TO 455
520 IF(KP1
.GT
. NS
) GO TO 460
522 440 ERKP1
= ERKP1
+ (PHI
(L
,KP2
)/WT
(L
))**2
523 ERKP1
= ABSH*GSTR
(KP1
)*SQRT
(ERKP1
)
525 C USING ESTIMATED ERROR AT ORDER K+1, DETERMINE APPROPRIATE ORDER
528 IF(K
.GT
. 1) GO TO 445
529 IF(ERKP1
.GE
. 0.5*ERK
) GO TO 460
531 445 IF(ERKM1
.LE
. MIN
(ERK
,ERKP1
)) GO TO 455
532 IF(ERKP1
.GE
. ERK
.OR
. K
.EQ
. 12) GO TO 460
534 C HERE ERKP1 .LT. ERK .LT. MAX(ERKM1,ERKM2) ELSE ORDER WOULD HAVE
535 C BEEN LOWERED IN BLOCK 2. THUS ORDER IS TO BE RAISED
548 C WITH NEW ORDER DETERMINE APPROPRIATE STEP SIZE FOR NEXT STEP
552 IF(P5EPS
.GE
. ERK*TWO
(K
+1)) GO TO 465
554 IF(P5EPS
.GE
. ERK
) GO TO 465
556 R
= (P5EPS
/ERK
)**(1.0/TEMP2
)
557 HNEW
= ABSH*MAX
(0.5D0
,MIN
(0.9D0
,R
))
558 HNEW
= SIGN
(MAX
(HNEW
,FOURU*ABS
(X
)),H
)
561 C *** END BLOCK 4 ***