主题:[讨论]!!紧急求助:IVF数组传递-类型不匹配
在IVF中,我调用一个子函数,主要功能是传递数组做运算。
结果我明明把数组的大小,还有类型都申明的一致,但是编译却出问题。实在不知道如何处理。请大家指点在下。
在此,贴出关键代码。
module data_module
implicit double precision (a-h,o-z) !默认双精度
real(8),parameter :: pi = 3.14159265358979323846d0
real(8),parameter :: epsilon = 1.0/4/pi/8.9880/1.0d9 !误差
real(8),parameter :: mu0 = 4.0*pi*1.0d-7
integer,parameter :: nns = 20
integer,parameter :: nf=40
end module data_module
subroutine Jacobian(rho,h,layer,fre,Arho,J1)
use data_module,only : nns,nf
implicit none
integer::layer,i,j,n
real(8)::Arho(nf),fre(nf)
real(8),dimension(nns)::rho,h,tran
real(8)::dif,fa,a,frho
real(8)::J1(nf,2*layer-1)
do n = 1,layer
do j = 1,layer
do i = 1,nf
tran = rho
dif = 0.1*rho(j)
tran(j) = tran(j) + dif
fa = fre(i)
call Forward(tran,h,layer,fa,frho)(the type of the actual argument differs from the type of dummy argument. (fa))
a = Arho(i)
J1(i,n) = 10*(frho/a - 1)
end do
end do
end do
do n = layer+1,2*layer-1
do j = 1,layer
do i = 1,nf
tran = h
dif = 0.1*h(j)
tran(j) = tran(j) + dif
fa = fre(i)
call Forward(rho,tran,layer,fa,frho)
a = Arho(i)
J1(i,n) = 10*(frho/a - 1)
end do
end do
end do
end subroutine Jacobian
subroutine forward(R1,ho,np,fj,rhok)
use data_module
implicit real(8)(a-h,o-z)
real(8)::R1(nns),ho(nns)
real(8)::rhok,fj
complex(8) ep1,ep2,ep3,er1,er2,er3,hr1,hr2,hp1
complex(8) rk,ex,er,ep,hr,hp,hy
complex(8) er_add,ep_add,hr_add,hp_add
complex(8) k2(nns),ter1,tep2,tep3
complex(8) c1,e1,e2,e3,ex90,ex0,h1,h2,hy90,hy0
complex(8),external:: fe1,fe2,fe3,fh1
complex(8),external:: fep1,fep2,fep3,fer2,fhr1,fhr2
character fname *30
common /kk/k2
common /pr/rho(nns)
common /ps/h(nns)
common /pp/ns
dX=1.0
rho = R1
h = ho
ns = np
ab = 1000.0
amp = 1.0
xo = -1*ab/2.0
yo = 0.0
xp = -300.0
yp = 7000.0
wj = 2*pi*fj
k2 = -dcmplx(0,1.0)*wj*mu0/rho
ex = dcmplx(0,0)
hy = dcmplx(0,0)
r = dsqrt((yp-yo)**2+(xp-xo)**2)
fai = cos((xp-xo)/r)
c1 = dcmplx(0,1.0)*wj*mu0*amp*dx/2.0/pi
。。。
rhok = cdabs(ex/hy)**2/wj/mu0
end subroutine forward
这是最主要的错误了,限于篇幅,主程序就不给了,太长了。关键是在CVF中运行是对的。昏~
另外,A non-optional actual argument must be present when invoking a procedure with an explicit interface.是什么意思啊?non-optional不太懂,请指教。祝大家周末愉快!
注:那是第一个错误。先说这个错误。另外,那一个子程序中,下面有类似的代码页有错误就不标明了。附件是完整代码!!