- #1
s_hy
- 61
- 0
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?
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?