作者what357159 (silentkenny)
看板Fortran
标题[问题] 简单的sum数值积分问题
时间Fri May 26 16:58:35 2017
各位fortran高手大家好 小弟最近遇到了一点问题想请大家帮忙
我使用有限差分法解出我所要的压力分布格点
但现在积分回去力时去遇到几个error
附上积分简单程式码(省略有限差分之code)
real::fx,fy
do theta = 1,440,1
do z = 1,zmax,1
fx=0.d0
fy=0.d0
fx=fx+p(theta,z)*cosd(theta)*r*dtheta*dz
fy=fy+p(theta,z)*sind(theta)*r*dtheta*dz
end do
end do
p(theta,z)是我已经先解出来的资料点
但现在会跳出三个error
error6362 the data types of the arguments are invalid [cosd]
error6404 this name does not have a type and must have a explicit type[sind]
warning#7319 this arguments data type is imcompatibale with this intrinsic
procedure;procedure assume external[sind]
不太理解为何会有这些错误
先谢谢大家的帮忙了
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.116.71.246
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Fortran/M.1495789117.A.92A.html
1F:→ rex0707: cosd/sind 里的 theta 要转成实数吧 05/26 18:56
2F:→ rex0707: 而且fx=fy=0.0要放在DO外面吧 才会累加 不然每次都设成0 05/26 18:57
3F:推 PTT0207445: cosd(:)和sind(:)如果是阵列的话要宣告好。 11/29 07:23
4F:→ PTT0207445: sind(x)如果是自订函数的话function sind(x)也要写。 11/29 07:24
5F:→ PTT0207445: 双精度的内建的正弦和余弦函数是dsin(x)和dcos(x)。 11/29 07:26