fortran 配列宣言
以下のプログラムの中でeth(n), eph(n)は、配列なのですが、配列宣言はどのようにしたらよいのでしょうか?doループでnが決まるのでどのように配列宣言したらよいかわかりません。いろいろと試してはみたのですがコンパイルの際エラーがでてしまいます。わかる方がいらっしゃったら教えて下さい。よろしくお願いします。
subroutine far_output
use consts
use fdtd
implicit none
integer :: n, i, td
real(8) :: s
real(8) :: theta, phi
real(8) :: sx, sy, sz, px, py
real(8) :: wth, wph, uth, uph
real(8) :: eth(1000), eph(1000)
open(10,file="far_field.dat")
! s = pi/180.0d0
phi = 0.0d0
! do i = 0, 180
! td = i
! theta = s*td
theta = pi/3.0d0
sx = cos(theta)*cos(phi)
sy = cos(theta)*sin(phi)
sz = -sin(theta)
px = -sin(phi)
py = cos(phi)
do n = 1, ntime
wth = wx(l,n)*dx+wy(l,n)*sy+wz(l,n)*sz
wph = wx(l,n)*px+wy(l,n)*py
uth = ux(l,n)*sx+uy(l,n)*sy+uz(l,n)*sz
uph = ux(l,n)*px+uy(l,n)*py
eth(n) = -z0*wth-uph
eph(n) = -z0*wph+uth
write(10,*) eth, eph
enddo
! enddo
close(10)
return
end subroutine