[問題] 以可調步幅法解ODE-IVP
各位版上的朋友大家好
小弟第一次在這裡發文,望各位多多包涵 ^ ^a
問題是關於使用IMSL庫存函式IVPAG解ODE-IVP(一階常微分方程組)
ODE寫於函式CODE,計算所需的起始值和欲計算的y(t)寫在主程式內
以下為部分程式碼:(使用Visual Fortran90撰寫)
--
PROGRAM MAIN
USE IMSL
IMPLICIT NONE
INTEGER, PARAMETER :: N = 2 ! No. of eqns
INTEGER, PARAMETER :: NPARAM = 50 ! no. of input entries
INTEGER MODE, I
INTEGER IDO, IEND, NOUT
REAL TI, TF, Y10, Y20, TFI
REAL PARAM(NPARAM)
REAL, PARAMETER :: TOLERR = 1.0E-4
INTEGER, PARAMETER :: NUMPT = 20
DATA TI, TF, Y10, Y20 /0.0, 1.0, 1.0, 0.0/
REAL Y(N), A(1,1), T ! A is not uesd since the ODEs is explicit
REAL, EXTERNAL :: CODE, CODEJ ! Required for IVPAG and IVPRK
c Initialization:
CALL SSET(NPARAM, 0.0, PARAM, 1)
IDO = 1
T = TI
TFI = 0.0002
Y(1) = Y10
Y(2) = Y20
... (從略)
SELECT CASE (MODE)
CASE (1)
PRINT*, 'Use Adams-Moulton-Gear method'
DO I = 1, NUMPT+1
CALL IVPAG(IDO, N, CODE, CODEJ, A, T, TFI, TOLERR, PARAM, Y)
TFI = TFI + (TF - TI)/REAL(NUMPT)
IF (TFI .EQ. TF) THEN
IDO = 3
ELSE
WRITE(*,100) T, Y
END IF
END DO
CASE (2)
... (從略)
END SELECT
100 FORMAT(3E16.4)
END
SUBROUTINE CODE(N, T, Y, DIFFY)
IMPLICIT NONE
INTEGER N
REAL T, Y(N), DIFFY(N)
DIFFY(1) = -5.005E2*Y(1) + 4.995E2*Y(2)
DIFFY(2) = 4.995E2*Y(1) - 5.005E2*Y(2)
RETURN
END SUBROUTINE
SUBROUTINE CODEJ(N, T, Y, DIFFY) ! Not used
IMPLICIT NONE
INTEGER N
REAL T, Y(N), DIFFY(N,*)
RETURN
END SUBROUTINE
--
在編譯程式的時候出現了以下訊息:
Warning: In the call to IVPAG,
actual argument #3 does not match the type and kind of the corresponding
dummy argument.
CALL IVPAG(IDO, N, CODE, CODEJ, A, T, TFI, TOLERR, PARAM, Y)
---------------------------------^
Warning: In the call to IVPAG,
actual argument #4 does not match the type and kind of the corresponding
dummy argument.
CALL IVPAG(IDO, N, CODE, CODEJ, A, T, TFI, TOLERR, PARAM, Y)
程式計算出來的結果似乎沒有問題
不過實在是對這警告訊息有點介意XD
想請問版上高手們
這警告訊息是不是來自於我宣告變數或函式有錯?
應該要怎樣修改才不會有這問題呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.112.36.25
→
05/07 19:58, , 1F
05/07 19:58, 1F
→
05/07 19:58, , 2F
05/07 19:58, 2F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章