主题:流体力学 fortran运行报错,请大侠过来帮忙哈
run-time error M6101: MATH
- floating-point error: invalid
现把程序粘贴如下,希望大侠帮帮忙,小女子感激不尽!
REAL U(41),A(41),B(41),C(41),D(41),Y(41)
N=20
NN=N+1
Y(1)=0.0
DEL=1.0/FLOAT(N)
RE=5.0E+3
EE=1.0
TIME=0.0
DELTIM=EE*RE*DEL**2
U(1)=0.0
U(NN)=1.0
AA=-0.5*EE
BB=1.0+EE
KKEND=2
KKMOD=1
DO 1 J=1,N
U(J)=0.0
1 CONTINUE
A(1)=1.0
B(1)=1.0
C(1)=1.0
D(1)=1.0
DO 5 KK=1,KKEND
DO 2 J=2,N
Y(J)=Y(J-1)+DEL
A(J)=AA
IF (J.EQ.N) THEN
A(J)=0.0
D(J)=BB
B(J)=AA
END IF
IF(J.EQ.2) THEN
B(J)=0.0
C(J)=(1.0-EE)*U(J)+0.5*EE*(U(J+1)+U(J-1))
END IF
IF(J.EQ.N) THEN
C(J)=C(J)-AA*U(NN)
END IF
2 CONTINUE
DO 3 J=3,N
D(J)=D(J)-B(J)*A(J-1)/D(J-1)
C(J)=C(J)-C(J-1)*B(J)/D(J-1)
3 CONTINUE
DO 4 K=2,N
M=N-(K-2)
U(M)=(C(M)-A(M) *U(M+1))/D(M)
4 CONTINUE
Y(1)=0.0
Y(NN)=Y(N)+DEL
TIME=TIME+DELTIM
TEST=MOD(KK,KKMOD)
IF(TEST.GT.0.01) THEN
GOTO 5
WRITE (6,100) KK,TIME,DELTIM
WRITE (*,100) KK,TIME,DELTIM
WRITE (6,101)
WRITE (*,101)
END IF
5 CONTINUE
100 FORMAT(5X//5X,'SOLUTION
AT',5X,'KK',I3,5X,'TIME=',E10.3,5X,'DELTIM=',E10.3//)
101 FORMAT(3X,'J',6X,'Y',9X,'U',9X,'B',9X,'D',9X,'A',9X,'C')
102 FORMAT(2X,I3,6E10.3)
END