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

What is the cause of these error- symbol 'x1' has no implicit type?

  1. Dec 12, 2011 #1
    Hi all,

    i am beginner in fortran and linux. I have wrote codes for 1d scalar wave as below:

    SUBROUTINE fd1d (x_num,x1,x2,t_num,t1,t2,c,u_x1,u_x2,u_t1,ut_t1,u)
    implicit none
    integer (kind=2) t_num,x_num,t,x
    real (kind=4) alpha,c,t_delta,t1,t2,u(t_num+1,x_num+1),ut(x_num+1),x_delta,x1,x2
    t_delta = (t2-t1)/real(t_num,kind=4)
    x_delta = (x2-x1)/real(x_num,kind=4)
    alpha = c*t_delta/x_delta
    write ( *,'(a)')''
    write ( *,'a,g14.6)') 'Stability condition ALPHA = C * DT/DX = ',alpha
    Open (103, FILE='parameters.DAT',status='old')
    Open(90, File = "abc.dat", ACCESS = 'APPEND')

    !the boundary conditions
    call u_x1 ( t_num,x_num,u )
    call u_x2 ( t_num,x_num,u )

    !the initial data
    call u_t1 ( t_num,x_num,u )
    call ut_t1( x_num,ut )

    t=1
    do x=2, x_num
    u(t+1,x) = alpha**2 * u(t,x+1) / 2.0D+00 + ( 1.0D+00-alpha**2 ) * u(t,x) &
    + alpha**2 * u(t,x-1) / 2.0D+00 + t_delta * ut(x)
    end do

    !All subsequent steps in time rely on two previous rows of solution data

    do t=2, t_num
    do x=2, x_num
    u(t+1,x) = alpha**2 * u(t, x+1) + 2.0D+00 * (1.0D+00-alpha**2) * u(t, x) &
    + alpha**2 * u(t, x-1) - u(t-1,x)
    end do
    end do
    return
    end SUBROUTINE fd1d


    when i am trying to compile, there are errors referring to all parameters which is "symbol 'x1' (and t1, c, x2...) has no implicit type. What is that mean?
     
  2. jcsd
  3. Dec 13, 2011 #2

    Mark44

    Staff: Mentor

    The variables that you list (x1, t1, c, and x2) are declared in the subroutine you showed, so my guess is that the error arises in some other part of your program, a part you didn't show us. Are these variables being used elsewhere in your program? If so, they probably aren't being declared in those places.

    What we aren't seeing is the main program and the four subroutines that are called in the code above, plus whatever else makes up the entire program.

    The compiler or linker probably gave more information than you showed, such as the line number at which the error occurred. That information can help you narrow down the source of the problem.
     
  4. Dec 13, 2011 #3
    thank you for ur time mark44. the list of subroutines that i didn't list here are quite long, might be bothering. I have found out the problem and finally have succeed to compile it without any error.

    thanks again
     
  5. Dec 14, 2011 #4
    Hi guys,

    The variables were re declared in the subroutine after being passed from the main program.

    s_hy, see what happens when you change types between the main and the subroutine for future reference.

    The windows wobble bug was similar and caused approx 60,000 programs to have errors when run in win 2000 (NT). The win com/com+ model created an extra thread on early dual processor systems that ran out after 8 ocurrences of a subroutine type change error.
     
    Last edited: Dec 14, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: What is the cause of these error- symbol 'x1' has no implicit type?
Loading...