登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Fortran菜鸡一枚想问下这个执行出错是怎么回事?
显示循环:
program ex13
implicit none
integer,parameter::nx=144,ny=73,nz=2,nt=12
real u(nx,ny,nz,nt),v(nx,ny,nz,nt),hgt(nx,ny,nt)
integer i,j,k,m
open(1,file='d\u200.dat')
open(2,file='d\v200.dat')
open(3,file='d\u850.dat')
open(4,file='d\v850.dat')
open(5,file='d\hgt500.dat')
do m=1,nt
do k=1,nz
read(1,*)((u(i,j,k,m),i=1,nx),j=1,ny)
end do
do k=1,nz
read(2,*)((v(i,j,k,m),i=1,nx),j=1,ny)
end do
read(3,*)((hgt(i,j,m),i=1,nx),j=1,ny)
end do
open(12,file='d:\uv.grd',form='binary')
do m=1,nt
do k=1,nz
write(12)((u(i,j,k,m),i=1,nx),j=1,ny)
end do
do k=1,nz
write(12)((v(i,j,k,m),i=1,nx),j=1,ny)
end do
write(12)((hgt(i,j,m),i=1,nx),j=1,ny)
end do
end
隐式循环:
program ex13
implicit none
integer,parameter::nx=144,ny=73,nz=2,nt=12
real u(nx,ny,nz,nt),v(nx,ny,nz,nt),hgt(nx,ny,nt)
integer i,j,k,m
open(1,file='d\u200.dat')
open(2,file='d\v200.dat')
open(3,file='d\u850.dat')
open(4,file='d\v850.dat')
open(5,file='d\hgt500.dat')
do m=1,nt
read(1,*)(((u(i,j,k,m),i=1,nx),j=1,ny),k=1,nz)
read(2,*)(((v(i,j,k,m),i=1,nx),j=1,ny),k=1,nz)
read(3,*)((hgt(i,j,m),i=1,nx),j=1,ny)
end do
open(6,file='d:\liti\uv.grd',form='binary')
do m=1,nt
write(6)(((u(i,j,k,m),i=1,nx),j=1,ny),k=1,nz)
write(6)(((v(i,j,k,m),i=1,nx),j=1,ny),k=1,nz)
write(6)((hgt(i,j,m),i=1,nx),j=1,ny)
end do
end
想问一下应该怎么改,不太懂
|