[Fortran] 纯文本查看 复制代码
program exercise1_2
implicit none
!读入风向风度数据
real a(5,6),u1(5,6),v1(5,6),u(5,6),v(5,6),w(5,12),L0
real i,j
real,parameter::pi=3.1416,r=6378.140,k=0.7156,b=(pi/3)
L0=r/k*sin(b)
open(unit=10,file='F:\111\dddff.txt',recl=4)
do i=1,5
read(10,*) (w(i,j),j=1,12)
enddo
!计算风场分量
do i=1,5
do j=1,6
u1(i,j)=w(i,j+1)*sin(w(i,j)*pi/180-pi)
v1(i,j)=w(i,j+1)*cos(w(i,j)*pi/180-pi)
enddo
enddo
!计算订正风场
do i=1,5
do j=1,6
a(i,j)=atan2(((j-1)*100),(L0-(i-1)*100))
u(i,j)=u1*cos(a(i,j)*pi/180)+v1*sin(a(i,j)*pi/180)
v(i,j)=v1*cos(a(i,j)*pi/180)-u1*sin(a(i,j)*pi/180)
enddo
enddo
end
[Fortran] 纯文本查看 复制代码
do i=1,5
do j=1,6
a(i,j)=atan2(((j-1)*100),(L0-(i-1)*100))
u(i,j)=u1*cos(a(i,j)*pi/180)+v1*sin(a(i,j)*pi/180) !注意这一行和下一行中,u1,v1也是二维数组,你需要制定他们的位置,比如u1(i,j)
v(i,j)=v1*cos(a(i,j)*pi/180)-u1*sin(a(i,j)*pi/180)
enddo
enddo