defehl.f 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. *DECK DEFEHL
  2. SUBROUTINE DEFEHL (F, NEQ, T, Y, H, YP, F1, F2, F3, F4, F5, YS,
  3. + RPAR, IPAR)
  4. C***BEGIN PROLOGUE DEFEHL
  5. C***SUBSIDIARY
  6. C***PURPOSE Subsidiary to DERKF
  7. C***LIBRARY SLATEC
  8. C***TYPE SINGLE PRECISION (DEFEHL-S, DFEHL-D)
  9. C***AUTHOR Watts, H. A., (SNLA)
  10. C***DESCRIPTION
  11. C
  12. C Fehlberg Fourth-Fifth order Runge-Kutta Method
  13. C **********************************************************************
  14. C
  15. C DEFEHL integrates a system of NEQ first order
  16. C ordinary differential equations of the form
  17. C dU/DX = F(X,U)
  18. C over one step when the vector Y(*) of initial values for U(*) and
  19. C the vector YP(*) of initial derivatives, satisfying YP = F(T,Y),
  20. C are given at the starting point X=T.
  21. C
  22. C DEFEHL advances the solution over the fixed step H and returns
  23. C the fifth order (sixth order accurate locally) solution
  24. C approximation at T+H in the array YS(*).
  25. C F1,---,F5 are arrays of dimension NEQ which are needed
  26. C for internal storage.
  27. C The formulas have been grouped to control loss of significance.
  28. C DEFEHL should be called with an H not smaller than 13 units of
  29. C roundoff in T so that the various independent arguments can be
  30. C distinguished.
  31. C
  32. C This subroutine has been written with all variables and statement
  33. C numbers entirely compatible with DERKFS. For greater efficiency,
  34. C the call to DEFEHL can be replaced by the module beginning with
  35. C line 222 and extending to the last line just before the return
  36. C statement.
  37. C
  38. C **********************************************************************
  39. C
  40. C***SEE ALSO DERKF
  41. C***ROUTINES CALLED (NONE)
  42. C***REVISION HISTORY (YYMMDD)
  43. C 800501 DATE WRITTEN
  44. C 890831 Modified array declarations. (WRB)
  45. C 891009 Removed unreferenced statement label. (WRB)
  46. C 891214 Prologue converted to Version 4.0 format. (BAB)
  47. C 900328 Added TYPE section. (WRB)
  48. C 910722 Updated AUTHOR section. (ALS)
  49. C***END PROLOGUE DEFEHL
  50. C
  51. C
  52. DIMENSION Y(*),YP(*),F1(*),F2(*),F3(*),F4(*),F5(*),
  53. 1 YS(*),RPAR(*),IPAR(*)
  54. C
  55. C***FIRST EXECUTABLE STATEMENT DEFEHL
  56. CH=H/4.
  57. DO 230 K=1,NEQ
  58. 230 YS(K)=Y(K)+CH*YP(K)
  59. CALL F(T+CH,YS,F1,RPAR,IPAR)
  60. C
  61. CH=3.*H/32.
  62. DO 240 K=1,NEQ
  63. 240 YS(K)=Y(K)+CH*(YP(K)+3.*F1(K))
  64. CALL F(T+3.*H/8.,YS,F2,RPAR,IPAR)
  65. C
  66. CH=H/2197.
  67. DO 250 K=1,NEQ
  68. 250 YS(K)=Y(K)+CH*(1932.*YP(K)+(7296.*F2(K)-7200.*F1(K)))
  69. CALL F(T+12.*H/13.,YS,F3,RPAR,IPAR)
  70. C
  71. CH=H/4104.
  72. DO 260 K=1,NEQ
  73. 260 YS(K)=Y(K)+CH*((8341.*YP(K)-845.*F3(K))+
  74. 1 (29440.*F2(K)-32832.*F1(K)))
  75. CALL F(T+H,YS,F4,RPAR,IPAR)
  76. C
  77. CH=H/20520.
  78. DO 270 K=1,NEQ
  79. 270 YS(K)=Y(K)+CH*((-6080.*YP(K)+(9295.*F3(K)-5643.*F4(K)))+
  80. 1 (41040.*F1(K)-28352.*F2(K)))
  81. CALL F(T+H/2.,YS,F5,RPAR,IPAR)
  82. C
  83. C COMPUTE APPROXIMATE SOLUTION AT T+H
  84. C
  85. CH=H/7618050.
  86. DO 290 K=1,NEQ
  87. 290 YS(K)=Y(K)+CH*((902880.*YP(K)+(3855735.*F3(K)-1371249.*F4(K)))+
  88. 1 (3953664.*F2(K)+277020.*F5(K)))
  89. C
  90. RETURN
  91. END