[问题] 不同的编辑软件出来结果不同?

楼主: Kira76 (王牌投手)   2012-12-10 16:51:35
我想请问为什么我的程式码在旧版的Compaq Visual Fortran可以顺利执行(作业环境是在
Win7的XP_Mode里执行),但是我把同样的程式码放在微软的Microsoft Visual Studio 的
Fortran编辑器里却出现两个错(作业系统直接在Win7),请问有人可以帮我侦错吗?
以下是我的程式码
program homework01
implicit none
integer::num,i,j
real::U(20)
real::Matrix_Bij(20,20)
real::T(20)
real::Y(20)
real::b,a,G,E,pr,n,L,f,xi,xj,bij,bij1,bij2,bij3,bij4,uyi,PI,a1,a2,a3,a4,Tyy
real::ux,uy,d,zxx,zyy,zxy,r1,r2,th1,th2
real::sumux,sumuy,sumzxx,sumzxy,sumzyy
real::MATRIX_C(20)
real::MATRIX_x(20)
real::MATRIX_y(20)
real::MATRIX_xx(20)
real::MATRIX_yy(20)
real::MATRIX_xy(20)
! bij1: bij的第一部分
! bij2: bij的第二部分
! bij3: bij的第三部分
! bij4: bij的第四部分
PI=3.14159
num=20
E=10000
pr=0.3
G=0.5*(E/(1+pr))
uyi=-0.03
open(10,file='output.txt')
! L的修正
write(*,*)"L=b*f,请输入此次的f值"
read(*,*)f
write(*,*)"请输入此次的b值"
read(*,*)b
L=b*f
write(*,*)"请输入此次的num值,不超过20"
read(*,*)num
write(10,*)"元素数目:",num
write(10,*)"杨氏模数:",E,"MPa"
write(10,*)"柏松比:",pr
write(10,*)"剪力模数:",G
write(10,*)"一半的基础宽:",b,"m"
write(10,*)"元素长度 :",2*a,"m"
write(10,*)"L =",f,"*基础宽 :",L
write(10,*)"沉陷量 :",uyi,"m"
call slove_Bij
(num,i,j,xi,xj,a,bij,bij1,bij2,bij3,bij4,pr,G,Matrix_Bij,U,uyi,L,b,a1,a2,a3,a4)
call solve (U,Matrix_Bij,T,num,uyi)
!
call compare (num,g,uyi,b,pr,Y,Tyy,xi,a,i)
!
call sum (ux,uy,zxx,zxy,zyy,uyi,r1,r2,th1,th2,y,a,d,f,b,pr,num,&
PI,G,L,T,Matrix_x,Matrix_y,Matrix_xx,Matrix_xy,Matrix_yy,sumzxx,sumzxy,sumzyy)
!
stop
end program homework01
! 解Bij subroutine1 Matrix_Bij
subroutine slove_Bij
(num,i,j,xi,xj,a,bij,bij1,bij2,bij3,bij4,pr,G,Matrix_Bij,U,uyi,L,b,a1,a2,a3,a4)
implicit none
integer::num,i,j
real::U(20)
real::Matrix_Bij(20,20)
real::T(20)
real::a,b,G,xi,xj,pr,n,L,bij,bij1,bij2,bij3,bij4,uyi,PI,E,a1,a2,a3,a4
PI=3.14159
E=10000
pr=0.3
G=0.5*(E/(1+pr))
uyi=-0.03
! 定义元素
a=b/num
write(10,*)"L :"
write(10,*)L
write(10,*)"a:"
write(10,*)a
write(10,*)"Bij :"
do I=1,num
xi=-b+(2*i-1)*a
do j=1,num
xj=-b+(2*j-1)*a
a1=abs(xi-xj+a)
a2=abs(xi-xj-a)
a3=(L-xj-a)
a4=(L-xj+a)
write(10,*)"i"
write(10,*)i
write(10,*)"j:"
write(10,*)j
write(10,*)"xi:"
write(10,*)xi
write(10,*)"xj:"
write(10,*)xj
bij1=(xi-xj+a)*log(a1)
bij2=(xi-xj-a)*log(a2)
bij3=(L-xj-a)*log(a3)
bij4=(L-xj+a)*log(a4)
bij=-((1-pr)/(PI*G))*(bij1-bij2+bij3-bij4)
Matrix_Bij(i,j)=bij
write(10,*)"Bij :"
write(10,*)bij
write(*,*)"Bij :"
write(*,*)bij
Matrix_Bij(i,j)=bij
end do
end do
! uyi
do i=1,num
U(i)=uyi
write(10,*)"uyi :"
write(10,*)U(i)
end do
return
end subroutine
! 比较理论解与数值分析 subroutine3 compare
subroutine compare (num,G,uyi,b,pr,Y,Tyy,xi,a,i)
implicit none
integer::num,i
real::Y(20)
real::Tyy
real::G,uyi,b,pr,xi,a
write(10,*)"解析解为 :"
write(*,*)"解析解为 :"
do i=1,num
a=b/num
xi=(-1)*b+(2*i-1)*a
Tyy=(((-1)*G*uyi)/((1-pr)*0.69314718))*(1/((b**2-xi**2)**0.5))
write(10,*)Tyy
write(*,*)Tyy
end do
write(*,*)"
作者: gilocustom   2012-02-10 16:58:00
错误讯息是?
作者: mk650   2012-02-10 18:11:00
call副程式(参数),(参数)跳到下一行了,移回就可以执行如果你不是这个错误那就不解了,因为没细看程式码.如果是这个错误,那这个程式复制贴上缴出真轻松!执行为L=b*f,请输入此次的f值,输入三个值可得计算结果我觉得是IVF设定问题,不是程式问题.请贴上图片或说明,这样才比较好debug我在想这是作业吧,拿去问助教应该很快就解决了.你的程式是正确的,但IVF你可能不熟,有些小地方需要微调一下就可以执行

Links booklink

Contact Us: admin [ a t ] ucptt.com