selene 发表于 2018-8-22 16:24:32

求助!有个错误不知道该怎么修改

subroutine read_obstacles(obst)
implicit none
include "head.inc"
      EXTERNAL SUM
      !EXTERNAL RANDOM_NUMBER
!integer k,l,m,n,P,Q,obst
      integerk,l
      integerm,n
      integerP,Q
      integer obst
      complex h(k,l),z(obst),h1(k,l),z1(obst)
      
      
      real*8 sum_1,sum_2,sum_3,random_number,F(P,Q),F1(P,Q)
do 11 k= 1, 300
do 10 l = 1, 300
            F(P,Q)=0.675*0.675*(exp(-2.3*((k/50)*(k/50)+(l/10)*
   &         (l/10))**0.5))*((-1)**(2*k*P/300+2*l*Q/300))
            if (k==(1,300).and.l==(1,300))then
                  F1(P,Q)=sum_1(F(P,Q))
      end if
   10 continue
   11 continue
      
      do 20 P=1,300
          do 21 Q=1, 300
            h(k,l)=1/90000*F1(P,Q)*(-1)**((k*P+l*Q)/150)
               if (P==(1,300).and.Q==(1,300))then
               h1(k,l)=sum_2(h(k,l))
      end if
   21 continue
   20 continue
      
      do 22 k= 1, 300
do 23 l = 1, 300
            !call RANDOM_NUMBER
            z(obst)=h1(k,l)*random_number
            if (m==(1,300).and.n==(1,300))then
            z1(obst)=sum_3(z(obst))
      end if
   23 continue
   22 continue
      
end
错误 1error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association    C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 158
错误 2error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association    C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 158
错误 3error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association    C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 160
错误 4error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association    C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 160

这里好像是k,l,P,Q四个变量在声明时出错了,但是我没明白什么意思怎么改。
求助!

fcode 发表于 2018-8-22 19:03:28

k , l , p , q 等作为数组的大小,complex h(k,l),z(obst),h1(k,l),z1(obst)
不能是普通变量,只能是 常量、 COMMON 、虚参 或 module 里的变量

selene 发表于 2018-8-22 20:42:37

本帖最后由 selene 于 2018-8-22 21:46 编辑

fcode 发表于 2018-8-22 19:03
k , l , p , q 等作为数组的大小,complex h(k,l),z(obst),h1(k,l),z1(obst)
不能是普通变量,只能是 常量 ...
The storage extent of the dummy argument exceeds that of the actual argument.   存储的虚拟参数超过了实际参数该如何修改呢??

fcode 发表于 2018-8-23 08:03:56

你翻译一下就知道了。虚参比实参大。
比如虚参是 real :: x( 5 )
但实参是 real :: x( 4 )
页: [1]
查看完整版本: 求助!有个错误不知道该怎么修改