2012-03-13 23 views
0

計算されたステップがあると、配列の次元を割り当てています。割り当てられた配列を関数に送りますが、引数 'a'に型/位取りの不一致があります。Fortran90引数のタイプ/ランクの不一致

私は間違っていますか?

乾杯

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で実際の割り当て可能として、E、および時間を宣言しようとしましたが、私はこれらのエラーを取得

: ファイルtidalevolution.f90で:84

本当、寸法(:)、割り当て可能::、E、時間エラー:ファイルtidalevolution.f90で(1) でDUMMY属性を持つALLOCATABLE属性の競合:86

((手順)、時間(ステップ)、E(手順))を割り当てるエラー:構文エラーでは、あなたがa(およびeを定義したメインプログラムでは(1)

+0

時間 'へ(0 ) '、' a(0) '、' e(0) 'となります。 fortranでは、配列のインデックスはデフォルトで1から始まります。 – eriktous

答えて

2

でALLOCATE文、および単精度実数変数としてtime):

real, dimension(:), allocatable :: a, e, time 

しかし、あなたは倍精度配列を期待するルーチンにそれを渡している:あなたが代入しているメインプログラムで

subroutine calc (steps, a, e, time) 

    integer i, steps 
    double precision time(steps), a(steps), e(steps) 
関連する問題