请教高手,帮我查看下下面这段fortran程序问题出现什么地方。万分感谢!
programsurfaceimplicitnoneinteger::i,jreal::n=1.0integer,parameter::horizontal=100int...
program surface
implicit none
integer :: i,j
real :: n=1.0
integer,parameter :: horizontal=100
integer,parameter :: vertical=100
real :: u(0:horizontal+1,0:vertical+1)
real :: v(0:horizontal+1,0:vertical+1)
real :: k(0:horizontal+1,0:vertical+1)
real :: k0(0:horizontal+1,0:vertical+1)
real :: k1(0:horizontal+1,0:vertical+1)
real :: fi0(0:horizontal+1,0:vertical+1)
real :: fi1(0:horizontal+1,0:vertical+1)
real :: fi2(0:horizontal+1,0:vertical+1)
real :: x(0:horizontal+1)
real :: y(0:vertical+1)
real,parameter :: dx=0.002
real,parameter :: dy=0.002
real,parameter :: dt=0.1
real,parameter :: pi=3.1415926
real :: t
do i=0,horizontal+1
x(i)=dx*i
open(unit=32,file='xx.txt')
write(32,"('x('I2')=',f5.3)")i,x(i)
end do
do j=0,vertical+1
y(j)=dy*j
open(unit=33,file='yy.txt')
write(33,"('y('I2')=',f5.3)")j,y(j)
end do
do i=0,horizontal+1
do j=0,vertical+1
u(i,j)=-0.05
v(i,j)=-0.05
end do
end do
call initialize(fi0,x,y,horizontal,vertical)
call curvature(k1,k0,fi0,horizontal,vertical,x,y,dx,dy)
do i=0,horizontal+1
do j=0,vertical+1
open(unit=13,file='x0.xls')
write(13,"(f5.3)")x(i)
open(unit=14,file='y0.xls')
write(14,"(f5.3)")y(j)
open(unit=15,file='fi0.xls')
write(15,"(f10.5)")fi0(i,j)
open(unit=16,file='k0.xls')
write(16,"(f15.5)")k1(i,j)
end do
end do
do while(.true.)
t=n*dt
open(unit=16,file='x.xls')
write(16,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=17,file='y.xls')
write(17,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=18,file='fi1.xls')
write(18,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=19,file='k1.xls')
write(19,"('t=',f4.3,/,'n=',f5.1)") t,n
n=n+1
do i=2,horizontal-1
do j=0,vertical+1
fi1(i,j)=fi0(i,j)-dt*u(i,j)*(fi0(i+1,j)-fi0(i,j))/dx
end do
end do
call boundaryin(fi1,horizontal,vertical,x,y,1)
do j=2,vertical-1
do i=0,horizontal+1
fi2(i,j)=fi1(i,j)-dt*v(i,j)*(fi0(i,j+1)-fi0(i,j))/dy
end do
end do
call boundaryin(fi2,horizontal,vertical,x,y,2)
do i=0,horizontal+1
do j=0,vertical+1
call curvature(k1,k0,fi2,horizontal,vertical,x,y,dx,dy)
end do
end do
do i=0,horizontal+1
do j=0,vertical+1
fi1(i,j)=fi2(i,j)
open(unit=16,file='x.xls')
write(16,"(f5.3)")x(i)
open(unit=17,file='y.xls')
write(17,"(f5.3)")y(j)
open(unit=18,file='fi1.xls')
write(18,"(f10.5)")fi1(i,j)
open(unit=19,file='k1.xls')
write(19,"(f12.5)")k1(i,j)
end do
end do
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=fi1(i,j)
end do
end do
call reinitialize(fi1,fi0,x,y,dx,dy,dt,horizontal,vertical)
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=fi1(i,j)
end do
end do
if(t==1.0) exit
end do
stop
end
!!!!!!initialize
subroutine initialize(fi0,x,y,horizontal,vertical)
implicit none
integer i,j
integer :: horizontal
integer :: vertical
integer :: itime
real :: fi0(0:horizontal+1,0:vertical+1)
real :: x(0:horizontal+1)
real :: y(0:vertical+1)
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=sqrt((x(i)-0.1)*(x(i)-0.1)+(y(j)-0.1)*(y(j)-0.1))-0.01
end do
end do
return
end subroutine initialize
还有几段子程序 受字数限制 无法贴出 请高手留个邮箱。谢谢 展开
implicit none
integer :: i,j
real :: n=1.0
integer,parameter :: horizontal=100
integer,parameter :: vertical=100
real :: u(0:horizontal+1,0:vertical+1)
real :: v(0:horizontal+1,0:vertical+1)
real :: k(0:horizontal+1,0:vertical+1)
real :: k0(0:horizontal+1,0:vertical+1)
real :: k1(0:horizontal+1,0:vertical+1)
real :: fi0(0:horizontal+1,0:vertical+1)
real :: fi1(0:horizontal+1,0:vertical+1)
real :: fi2(0:horizontal+1,0:vertical+1)
real :: x(0:horizontal+1)
real :: y(0:vertical+1)
real,parameter :: dx=0.002
real,parameter :: dy=0.002
real,parameter :: dt=0.1
real,parameter :: pi=3.1415926
real :: t
do i=0,horizontal+1
x(i)=dx*i
open(unit=32,file='xx.txt')
write(32,"('x('I2')=',f5.3)")i,x(i)
end do
do j=0,vertical+1
y(j)=dy*j
open(unit=33,file='yy.txt')
write(33,"('y('I2')=',f5.3)")j,y(j)
end do
do i=0,horizontal+1
do j=0,vertical+1
u(i,j)=-0.05
v(i,j)=-0.05
end do
end do
call initialize(fi0,x,y,horizontal,vertical)
call curvature(k1,k0,fi0,horizontal,vertical,x,y,dx,dy)
do i=0,horizontal+1
do j=0,vertical+1
open(unit=13,file='x0.xls')
write(13,"(f5.3)")x(i)
open(unit=14,file='y0.xls')
write(14,"(f5.3)")y(j)
open(unit=15,file='fi0.xls')
write(15,"(f10.5)")fi0(i,j)
open(unit=16,file='k0.xls')
write(16,"(f15.5)")k1(i,j)
end do
end do
do while(.true.)
t=n*dt
open(unit=16,file='x.xls')
write(16,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=17,file='y.xls')
write(17,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=18,file='fi1.xls')
write(18,"('t=',f4.3,/,'n=',f5.1)") t,n
open(unit=19,file='k1.xls')
write(19,"('t=',f4.3,/,'n=',f5.1)") t,n
n=n+1
do i=2,horizontal-1
do j=0,vertical+1
fi1(i,j)=fi0(i,j)-dt*u(i,j)*(fi0(i+1,j)-fi0(i,j))/dx
end do
end do
call boundaryin(fi1,horizontal,vertical,x,y,1)
do j=2,vertical-1
do i=0,horizontal+1
fi2(i,j)=fi1(i,j)-dt*v(i,j)*(fi0(i,j+1)-fi0(i,j))/dy
end do
end do
call boundaryin(fi2,horizontal,vertical,x,y,2)
do i=0,horizontal+1
do j=0,vertical+1
call curvature(k1,k0,fi2,horizontal,vertical,x,y,dx,dy)
end do
end do
do i=0,horizontal+1
do j=0,vertical+1
fi1(i,j)=fi2(i,j)
open(unit=16,file='x.xls')
write(16,"(f5.3)")x(i)
open(unit=17,file='y.xls')
write(17,"(f5.3)")y(j)
open(unit=18,file='fi1.xls')
write(18,"(f10.5)")fi1(i,j)
open(unit=19,file='k1.xls')
write(19,"(f12.5)")k1(i,j)
end do
end do
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=fi1(i,j)
end do
end do
call reinitialize(fi1,fi0,x,y,dx,dy,dt,horizontal,vertical)
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=fi1(i,j)
end do
end do
if(t==1.0) exit
end do
stop
end
!!!!!!initialize
subroutine initialize(fi0,x,y,horizontal,vertical)
implicit none
integer i,j
integer :: horizontal
integer :: vertical
integer :: itime
real :: fi0(0:horizontal+1,0:vertical+1)
real :: x(0:horizontal+1)
real :: y(0:vertical+1)
do i=0,horizontal+1
do j=0,vertical+1
fi0(i,j)=sqrt((x(i)-0.1)*(x(i)-0.1)+(y(j)-0.1)*(y(j)-0.1))-0.01
end do
end do
return
end subroutine initialize
还有几段子程序 受字数限制 无法贴出 请高手留个邮箱。谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询