作者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://www.ptt.cc/bbs/Fortran/M.1495789117.A.92A.html
→ rex0707: cosd/sind 裡的 theta 要轉成實數吧 05/26 18:56
→ rex0707: 而且fx=fy=0.0要放在DO外面吧 才會累加 不然每次都設成0 05/26 18:57
推 PTT0207445: cosd(:)和sind(:)如果是陣列的話要宣告好。 11/29 07:23
→ PTT0207445: sind(x)如果是自訂函數的話function sind(x)也要寫。 11/29 07:24
→ PTT0207445: 雙精度的內建的正弦和餘弦函數是dsin(x)和dcos(x)。 11/29 07:26