Fortran Coder

查看: 16239|回复: 3
打印 上一主题 下一主题

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

[复制链接]

11

帖子

4

主题

0

精华

入门

F 币
79 元
贡献
41 点
跳转到指定楼层
楼主
发表于 2018-8-22 16:24:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[Fortran] 纯文本查看 复制代码
subroutine read_obstacles(obst)
implicit none
include "head.inc"
      EXTERNAL SUM
      !EXTERNAL RANDOM_NUMBER
!integer k,l,m,n,P,Q,obst
      integer  k,l
      integer  m,n
      integer  P,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

错误 1  error #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   [K] C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 158
错误 2  error #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   [L] C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 158
错误 3  error #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   [P] C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 160
错误 4  error #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   [Q] C:\Users\Administrator\Desktop\coding\chap2\chap2\main.for 160

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

分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

1963

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1357 元
贡献
574 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

沙发
发表于 2018-8-22 19:03:28 | 只看该作者
k , l , p , q 等作为数组的大小,complex h(k,l),z(obst),h1(k,l),z1(obst)
不能是普通变量,只能是 常量、 COMMON 、虚参 或 module 里的变量

11

帖子

4

主题

0

精华

入门

F 币
79 元
贡献
41 点
板凳
 楼主| 发表于 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.   存储的虚拟参数超过了实际参数该如何修改呢??

1963

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1357 元
贡献
574 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

地板
发表于 2018-8-23 08:03:56 | 只看该作者
你翻译一下就知道了。虚参比实参大。
比如虚参是 real :: x( 5 )
但实参是 real :: x( 4 )
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-3 02:16

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表