Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Type/rank mismatch in argument

  1. Mar 12, 2012 #1
    Hi,

    I'm allocating the dimension of some arrays once I have calculated steps, then I send the allocated arrays to a function but I have the error Type/rank mismatch in argument 'a'.

    What am I doing wrong?

    Cheers


    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
     
  2. jcsd
  3. Mar 12, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    I'm not that familiar with modern fortran, but would the subroutine calc also need to delcare a , e, and time as real allocatable (versus double)?
     
  4. Mar 13, 2012 #3
    Unfortunately by doing so I have ever more error messages:
    In file tidalevolution.f90:84

    real, dimension(:), allocatable :: a, e, time
    1
    Error: ALLOCATABLE attribute conflicts with DUMMY attribute at (1)
    In file tidalevolution.f90:86

    allocate(time(steps), a(steps), e(steps))
    1
    Error: Syntax error in ALLOCATE statement at (1)
     
  5. Mar 13, 2012 #4

    rcgldr

    User Avatar
    Homework Helper

    OK, then could it just be a problem with the parameters from the main program being decleared as real while the subroutine parameters are declared as double?
     
  6. Mar 13, 2012 #5
    Yes, solved
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Type/rank mismatch in argument
Loading...