问题
I'm working in a finite difference method on an irregular grid, this is the important part of the code:
IMPLICIT DOUBLE PRECISION (A-Z)
REAL*16 IPSI,ICORR,POT(20000),VA(20000),delta1(20000),
$delta2(20000),R(20000),a,b,d
COMPLEX Y(20000),TY2(50000),Z(20000),PSI0(20000),RES,DPSI,C,
$CORR,OPK
DO I=3,NR-1
delta1=R(I)-R(I-1)
delta2=R(I+1)-R(I)
a=(2/(delta1*(delta1+delta2)))
b=(-2/(delta1*delta2))
d=(2/(delta2*(delta1+delta2)))
TY2(I)=((d*Z(I+1))+(b*Z(I))+(a*Z(I-1)))
ENDDO
When I try to compile I got Error: Incompatible ranks 0 and 1 in assignment at (1) for a,b,d and TY2. Any solution will be appreciated. Thanks!
回答1:
a=(2/(delta1*(delta1+delta2)))
b=(-2/(delta1*delta2))
and the following lines are illegal. On the right you have arrays, on the left a scalar.
Maybe you forgot some index like delta1(I)
or delta1
should be a scalar. We can't say without knowing more about your code.
来源:https://stackoverflow.com/questions/37267656/error-incompatible-ranks-0-and-1-in-assignment-at-1