关于自由格式读写数组的问题,求指导
subroutine Stiffb
common/fem1/npoin,nelem,nboun,nprop,nnode,nevab,nsvab,ndofn,ndime,nstre
common/fem2/props(5,2),coord(50,2),lnods(75,2),ifpre(100),fixed(100),rload(50,2),eload(75,4),&
matno(75),stres(75,1),xdisp(100),tdisp(50,2),treac(50,2),astif(100,100),aslod(100),react(100)
dimension estif(4,4)
!
!evaluation of member stiffness matrices
!for pin-jointed plane frameworks
!
open(unit=10,file='input.txt')
open(unit=12,file='output.txt')
open(unit=11,file='between.txt')
rewind 11
do 20 ielem=1,nelem
lprop=matno(ielem)
young=props(lprop,1)
xarea=props(lprop,2)
node1=lnods(ielem,1)
node2=lnods(ielem,2)
xproj=coord(node2,1)-coord(node1,1)
yproj=coord(node2,2)-coord(node1,2)
eleng=sqrt(xproj**2+yproj**2)
sinth=yproj/eleng
costh=xproj/eleng
fmult=young*xarea/eleng
estif(1,1)=fmult*costh**2
estif(1,2)=fmult*sinth*costh
estif(2,1)=fmult*sinth*costh
estif(2,2)=fmult*sinth**2
do 10 inode=1,nnode
do 10 jnode=1,nnode
kount=(-1)**inode*(-1)**jnode
do 10 knode=1,nnode
do 10 lnode=1,nnode
index=(inode-1)*nnode+knode
jndex=(jnode-1)*nnode+lnode
10 estif(index,jndex)=kount*estif(knode,lnode)
write(11) estif !问题在此行
20 continue
return
end
您好,固定格式与自由格式并没有语法上的区别,只是书写格式的区别。就好像,推荐信和求职信,使用的都是同一个英语。
所以,并不存在 自由格式的数组用法 和 固定格式的数组用法 ,他们是一样的。
您的代码我这边编译没有问题。如果您遇到了链接错误,运行时错误,请给出完整的代码,或错误提示信息。 对,编译没有问题。完整程序在链接里,output文件本来是空的,运行后中止,output文件内容只是读写了input文件,没有进行计算就中止了。问题提示框在附件了。谢谢你了! 代码地址http://p.fcode.cn/_q3JOE 错误提示里已经提示您,145行有错。
把 145 行 write(11) estif
改为 write(11,*) estif
只会会提示其他几处相似的地方,也一并修改。 解决了,谢谢哈
页:
[1]