What Causes Type/Rank Mismatch in Argument 'a'?

  • Thread starter Thread starter Giammy85
  • Start date Start date
  • Tags Tags
    Argument
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
Giammy85
Messages
19
Reaction score
0
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
 
on Phys.org
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)?
 
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)
 
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?