作者kermomo (小柯)
看板Fortran
标题[问题] 想不出错在哪..
时间Thu Jul 21 21:10:48 2011
想了好久还是不晓得错在哪,烦请各位替我解惑一下~~
以下是我的程式码
module spectrum
use input
use constant
implicit none
contains
function J(w)
implicit none
real(kind=8) :: w
real(kind=8) :: J
J = 2*pi*eta*w*((w/wc)**(s-1))*exp(-(w/wc))
return
end function
function expo(w,i) !! exp(-iwt)
implicit none
real(kind=8) :: w
integer(kind=8) :: i
complex(kind=8) :: expo
complex(kind=8), parameter :: k = (0.0,1.0)
expo = exp(-1*i*k*w*dt)
end function
function g(i)
implicit none
real(kind=8) :: w
integer(kind=8) i, counter
complex(kind=8) g
complex(kind=8) :: X0, X1, X2
X0 = J(0.0)*expo(0.0, i)+J(15.0)*expo(15.0, i)
X1 = 0.0
X2 = 0.0
w = 0.0
do counter=1, nn
w = counter*dw
if(mod(counter,2)<0.001) then
X2 = X2+J(w)*expo(w,i)
else
X1 = X1+J(w)*expo(w,i)
end if
end do
g = dw*(X0+2*X2+4*X1)
end function
end module spectrum
其中use用到的部份是
module input
implicit none
integer,parameter :: n = 100, ni = 2*n, nn = 1000 !! the cutting number, the number of interval
real(kind=8), parameter :: ti = 0.0 !! initial time
real(kind=8), parameter :: tf = 10.0 !! final time
real(kind=8) :: dt = (tf-ti)/n !! time interval
real(kind=8) :: t
real(kind=8) :: u_0 = 1.0 !! initial condition
real(kind=8) :: w0 = 1.0 !! frequency of the cavity
real(kind=8) :: eta = 0.02 !! coupling strength 0.02, 0.1, 0.3, 0.4, 0.6, 1.0
real(kind=8) :: s = 0.5 !! type of sprctral, 1.0 = ohmic, 0.5 = subohmic, 3.0 = superohmic
real(kind=8) :: wc = 1.0 !! the cut-off frequency
real(kind=8), parameter :: w_i = 0.0
real(kind=8), parameter :: w_f = 15.0
real(kind=8) :: dw = (w_f-w_i)/n !!frequency interval
end module input
跟
module constant
implicit none
real, parameter :: pi = 3.1415926
real, parameter :: boltzmann = 1.38*1E-23
end module constant
--------------------Configuration: IDERK4 - Win32 Debug--------------------
Compiling Fortran...
E:\0Physichair\FORTRAN\IDERK4\spectrum.f90
E:\0Physichair\FORTRAN\IDERK4\spectrum.f90(37) :
Error: The type of the actual argument
differs from the type of the dummy argument. [0.0]
X0 = J(0.0)*expo(0.0, i)+J(15.0)*expo(15.0, i)
----------^
E:\0Physichair\FORTRAN\IDERK4\spectrum.f90(37) :
Error: The type of the actual argument
differs from the type of the dummy argument. [0.0]
X0 = J(0.0)*expo(0.0, i)+J(15.0)*expo(15.0, i)
--------------------^
E:\0Physichair\FORTRAN\IDERK4\spectrum.f90(37) :
Error: The type of the actual argument
differs from the type of the dummy argument. [15.0]
X0 = J(0.0)*expo(0.0, i)+J(15.0)*expo(15.0, i)
------------------------------^
E:\0Physichair\FORTRAN\IDERK4\spectrum.f90(37) :
Error: The type of the actual argument
differs from the type of the dummy argument. [15.0]
X0 = J(0.0)*expo(0.0, i)+J(15.0)*expo(15.0, i)
-----------------------------------------^
Error executing df.exe.
spectrum.obj - 4 error(s), 0 warning(s)
我的问题是,明明已经宣告了要传进J跟EXPO的参数是浮点
为什麽还是会出现这样的错误讯息?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.116.91.242
1F:推 terryys:real(8)的话要用0.d0,15.d0等,或者用dble来转 07/21 21:18
2F:→ kermomo:哦哦~~~我改了以後真的可以跑了~! 07/21 21:43