[英]Fortran90 Type/rank mismatch in argument
一旦我計算了步驟,我就分配一些數組的維度,然后我將分配的數組發送給一個函數,但我在參數'a'中有錯誤的類型/等級不匹配。
我究竟做錯了什么?
干杯
integer i, steps, noutput, savestep
double integrationtime, outputstep, timestep, deltat, ain, ein
real, dimension(:), allocatable :: a, e, time
steps=int(integrationtime/timestep)
allocate(time(steps), a(steps), e(steps))
time(0)=0.0d0
a(0)=ain*1.49597870691d11
e(0)=ein
call calc (steps, a, e, time)
stop
contains
subroutine calc (steps, a, e, time)
integer i, steps
double precision time(steps), a(steps), e(steps)
do i=1, steps
time(i)=..
a(i)=...
e(i)=...
end subroutine calc
我也嘗試在子例程calc中聲明a,e和time為真正的可分配,但是我得到了這些錯誤:在文件中tidalevolution.f90:84
real,dimension(:),allocatable :: a,e,time 1錯誤:ALLOCATABLE屬性與DUMMY屬性沖突(1)在文件中tidalevolution.f90:86
allocate(時間(步驟),a(步驟),e(步驟))1錯誤:(1)中ALLOCATE語句中的語法錯誤
在你的主程序你定義a
(和e
,和time
)為單精度實型變量:
real, dimension(:), allocatable :: a, e, time
但是你將它傳遞給一個需要雙精度數組的例程:
subroutine calc (steps, a, e, time)
integer i, steps
double precision time(steps), a(steps), e(steps)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.