主题:求助!调试问题
调试这个程序,总是出现问题,说已触发一个断点,大家给指点指点下。是在VS2008+intel fortran下。。。
附上代码
!--------------------FEM1.F90----------------
DIMENSION LOC(3,3),CX(5),CY(5),IFIX(3),F(10),&
& GK(10,10),STRES(3,3),BAK(3,3,6)
COMMON NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
!---------------------------------------------
OPEN(5,FILE='E1.DAT',STATUS='OLD')
OPEN(6,FILE='OUT1.')
READ(5,*) NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
WRITE(6,105) NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
105 FORMAT(2X,'NN NE ND NFIX E ANU T GM NTYPE'&
&4I4,E10.4,2F7.3,E10.4,I3)
READ(5,*)(LOC(I,1),LOC(I,2),LOC(I,3),I=1,NE)
READ(5,*)(CX(J),CY(J),J=1,NN)
READ(5,*)(IFIX(K),K=1,NFIX)
!---------------------------------------------
DO 10 I=1,ND
10 F(I)=0.0
F(2)=-1.0
!---------------------------------------------
CALL CST(LOC,CX,CY,IFIX,F,GK,STRES,BAK)
STOP
END
!----------------------------------------------------
SUBROUTINE CST(LOC,CX,CY,IFIX,F,GK,STRES,BAK)
DIMENSION LOC(NE,3),CX(NN),CY(NN),IFIX(NFIX),F(ND),&
& GK(ND,ND),STRES(NE,3),D(3,3),BB(3,6),EK(6,6),XX(6),&
& BE(3),CE(3),BA(3,6),BAK(NE,3,6)
COMMON NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
!----------------------------------------------------
DO 10 I=1,ND
DO 10 J=1,ND
10 GK(I,J)=0.0
!----------------------------------------------------
DO 20 II=1,3
DO 20 JJ=1,3
20 D(II,JJ)=0.0
IF(NTYPE.EQ.1)GO TO 30
E=E/(1.0-ANU**2)
ANU=ANU/(1.0-ANU)
30 S=E/(1.0-ANU**2)
D(1,1)=S
D(1,2)=S*ANU
D(2,2)=2
D(2,1)=D(1,2)
D(3,3)=0.5*S*(1.0-ANU)
!--------------------------------------------
DO 100 I=1,NE
DO 40 II=1,3
DO 40 JJ=1,6
40 BB(I,J)=0.0
I1=LOC(I,1)
I2=LOC(I,2)
I3=LOC(I,3)
BE(1)=CY(I2)-CY(I3)
BE(2)=CY(I3)-CY(I1)
BE(3)=CY(I1)-CY(I2)
CE(1)=CX(I3)-CX(I2)
CE(2)=CX(I1)-CX(I3)
CE(3)=CX(I2)-CX(I1)
S2=CX(I1)*BE(1)+CX(I2)*BE(2)+CX(I3)*BE(3)
DO 50 II=1,3
L=2*II
MM=L-1
BB(1,MM)=BE(II)/S2
BB(2,L)=CE(II)/S2
BB(3,MM)=BB(2,L)
50 BB(3,L)=BB(1,MM)
!---------------------------------------------------
DO 60 K=1,3
DO 60 L=1,6
BA(K,L)=0.0
DO 60 MM=1,3
BA(K,L)=BA(K,L)+D(K,MM)*BB(MM,L)
60 BAK(I,K,L)=BA(K,L)
!-----------------------------------------------------
IF(GM.EQ.0.0) GO TO 65
DO 70 INODE =1,3
NODEI=LOC(I,INODE)
J2=NODEI*2
70 F(J2)=F(J2)-T*GM*(0.5*S2)/3
65 CONTINUE
!------------------------------------------------------
DO 75 K=1,6
DO 75 L=1,6
B1=0.0
DO 80 MM=1,3
80 B1=B1+BB(MM,K)*BA(MM,L)
EK(K,L)=0.5*S2*B1*T
WRITE(6,140)I,K,L,EK(K,L)
140 FORMAT(1X,'I K L,EK ',3I4,E12.5)
75 CONTINUE
DO 85 INODE=1,3
NODEI = LOC(I,INODE)
DO 85 IDOFN=1,2
NROWS = (NODEI-1)*2+IDOFN
NROWE = (INODE-1)*2+IDOFN
DO 85 JNODE=1,3
NODEJ=LOC(I,JNODE)
DO 85 JDOFN=1,2
NCOLS=(NODEJ-1)*2+JDOFN
NCOLE=(JNODE-1)*2+JDOFN
85 GK(NROWS,NCOLS)=GK(NROWS,NCOLS)+EK(NROWE,NCOLE)
100 CONTINUE
WRITE(6,160)
160 FORMAT(/4X,'NODE',5X,'X-LOAD',8X,'Y-LOAD')
WRITE(6,165)(I,F(2*I-1),F(2*I),I=1,NN)
165 FORMAT(2X,I5,2E15.6)
WRITE(6,170)((I,J,GK(I,J),J=1,ND),I=1,ND)
170 FORMAT(1X,'IJ,GK',2I4,E12.5,2X,2I4,E12.5)
!------------------------------------------------------
DO 90 I=1,NFIX
IX=IFIX(I)
90 GK(IX,IX)=GK(IX,IX)*1.0E15
CALL GAUSS(GK,F,ND)
!-------------------------------------------
DO 95 I=1,NE
DO 95 J=1,3
XX(1)=F(2*LOC(I,1)-1)
XX(2)=F(2*LOC(I,1))
XX(3)=F(2*LOC(I,2)-1)
XX(4)=F(2*LOC(I,2))
XX(5)=F(2*LOC(I,3)-1)
XX(6)=F(2*LOC(I,3))
DO 95 K=1,6
95 STRES(I,J)=STRES(I,J)+BAK(I,J,K)*XX(K)
RETURN
WRITE(6,110)
110 FORMAT(/4X,'NODE',5X,'X-DISP',8X,'Y-DISP')
WRITE(6,115)(I,F(2*I-1),F(2*I),I=1,NN)
115 FORMAT(2X,I5,2E15.6)
WRITE(6,120)
120 FORMAT(/4X,'ELEMENT',4X,'X-STR',8X,'Y-STR',8X,'XY-STR')
WRITE(6,125)(I,(STRES(I,J),J=1,3),I=1,NE)
125 FORMAT(2X,I4,3E15.6)
END
!------TONG-JI P52------GAUSS'S METHOD------
SUBROUTINE GAUSS(A,B,N)
DIMENSION A(N,N),B(N)
DO 1 I=1,N
I1=I+1
DO 10 J=I1,N
10 A(I,J)=A(I,J)/A(I,I)
B(I)=B(I)/A(I,I)
A(I,I)=1.0
DO 20 J=I1,N
DO 30 M=I1,N
30 A(J,M)=A(J,M)-A(J,I)*A(I,M)
20 B(J)=B(J)-A(J,I)*B(I)
1 CONTINUE
DO 40 I=N-1,I,-1
DO 50 J=I+1,N
50 B(I)=B(I)-A(I,J)*B(J)
40 CONTINUE
RETURN
END
附上代码
!--------------------FEM1.F90----------------
DIMENSION LOC(3,3),CX(5),CY(5),IFIX(3),F(10),&
& GK(10,10),STRES(3,3),BAK(3,3,6)
COMMON NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
!---------------------------------------------
OPEN(5,FILE='E1.DAT',STATUS='OLD')
OPEN(6,FILE='OUT1.')
READ(5,*) NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
WRITE(6,105) NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
105 FORMAT(2X,'NN NE ND NFIX E ANU T GM NTYPE'&
&4I4,E10.4,2F7.3,E10.4,I3)
READ(5,*)(LOC(I,1),LOC(I,2),LOC(I,3),I=1,NE)
READ(5,*)(CX(J),CY(J),J=1,NN)
READ(5,*)(IFIX(K),K=1,NFIX)
!---------------------------------------------
DO 10 I=1,ND
10 F(I)=0.0
F(2)=-1.0
!---------------------------------------------
CALL CST(LOC,CX,CY,IFIX,F,GK,STRES,BAK)
STOP
END
!----------------------------------------------------
SUBROUTINE CST(LOC,CX,CY,IFIX,F,GK,STRES,BAK)
DIMENSION LOC(NE,3),CX(NN),CY(NN),IFIX(NFIX),F(ND),&
& GK(ND,ND),STRES(NE,3),D(3,3),BB(3,6),EK(6,6),XX(6),&
& BE(3),CE(3),BA(3,6),BAK(NE,3,6)
COMMON NN,NE,ND,NFIX,E,ANU,T,GM,NTYPE
!----------------------------------------------------
DO 10 I=1,ND
DO 10 J=1,ND
10 GK(I,J)=0.0
!----------------------------------------------------
DO 20 II=1,3
DO 20 JJ=1,3
20 D(II,JJ)=0.0
IF(NTYPE.EQ.1)GO TO 30
E=E/(1.0-ANU**2)
ANU=ANU/(1.0-ANU)
30 S=E/(1.0-ANU**2)
D(1,1)=S
D(1,2)=S*ANU
D(2,2)=2
D(2,1)=D(1,2)
D(3,3)=0.5*S*(1.0-ANU)
!--------------------------------------------
DO 100 I=1,NE
DO 40 II=1,3
DO 40 JJ=1,6
40 BB(I,J)=0.0
I1=LOC(I,1)
I2=LOC(I,2)
I3=LOC(I,3)
BE(1)=CY(I2)-CY(I3)
BE(2)=CY(I3)-CY(I1)
BE(3)=CY(I1)-CY(I2)
CE(1)=CX(I3)-CX(I2)
CE(2)=CX(I1)-CX(I3)
CE(3)=CX(I2)-CX(I1)
S2=CX(I1)*BE(1)+CX(I2)*BE(2)+CX(I3)*BE(3)
DO 50 II=1,3
L=2*II
MM=L-1
BB(1,MM)=BE(II)/S2
BB(2,L)=CE(II)/S2
BB(3,MM)=BB(2,L)
50 BB(3,L)=BB(1,MM)
!---------------------------------------------------
DO 60 K=1,3
DO 60 L=1,6
BA(K,L)=0.0
DO 60 MM=1,3
BA(K,L)=BA(K,L)+D(K,MM)*BB(MM,L)
60 BAK(I,K,L)=BA(K,L)
!-----------------------------------------------------
IF(GM.EQ.0.0) GO TO 65
DO 70 INODE =1,3
NODEI=LOC(I,INODE)
J2=NODEI*2
70 F(J2)=F(J2)-T*GM*(0.5*S2)/3
65 CONTINUE
!------------------------------------------------------
DO 75 K=1,6
DO 75 L=1,6
B1=0.0
DO 80 MM=1,3
80 B1=B1+BB(MM,K)*BA(MM,L)
EK(K,L)=0.5*S2*B1*T
WRITE(6,140)I,K,L,EK(K,L)
140 FORMAT(1X,'I K L,EK ',3I4,E12.5)
75 CONTINUE
DO 85 INODE=1,3
NODEI = LOC(I,INODE)
DO 85 IDOFN=1,2
NROWS = (NODEI-1)*2+IDOFN
NROWE = (INODE-1)*2+IDOFN
DO 85 JNODE=1,3
NODEJ=LOC(I,JNODE)
DO 85 JDOFN=1,2
NCOLS=(NODEJ-1)*2+JDOFN
NCOLE=(JNODE-1)*2+JDOFN
85 GK(NROWS,NCOLS)=GK(NROWS,NCOLS)+EK(NROWE,NCOLE)
100 CONTINUE
WRITE(6,160)
160 FORMAT(/4X,'NODE',5X,'X-LOAD',8X,'Y-LOAD')
WRITE(6,165)(I,F(2*I-1),F(2*I),I=1,NN)
165 FORMAT(2X,I5,2E15.6)
WRITE(6,170)((I,J,GK(I,J),J=1,ND),I=1,ND)
170 FORMAT(1X,'IJ,GK',2I4,E12.5,2X,2I4,E12.5)
!------------------------------------------------------
DO 90 I=1,NFIX
IX=IFIX(I)
90 GK(IX,IX)=GK(IX,IX)*1.0E15
CALL GAUSS(GK,F,ND)
!-------------------------------------------
DO 95 I=1,NE
DO 95 J=1,3
XX(1)=F(2*LOC(I,1)-1)
XX(2)=F(2*LOC(I,1))
XX(3)=F(2*LOC(I,2)-1)
XX(4)=F(2*LOC(I,2))
XX(5)=F(2*LOC(I,3)-1)
XX(6)=F(2*LOC(I,3))
DO 95 K=1,6
95 STRES(I,J)=STRES(I,J)+BAK(I,J,K)*XX(K)
RETURN
WRITE(6,110)
110 FORMAT(/4X,'NODE',5X,'X-DISP',8X,'Y-DISP')
WRITE(6,115)(I,F(2*I-1),F(2*I),I=1,NN)
115 FORMAT(2X,I5,2E15.6)
WRITE(6,120)
120 FORMAT(/4X,'ELEMENT',4X,'X-STR',8X,'Y-STR',8X,'XY-STR')
WRITE(6,125)(I,(STRES(I,J),J=1,3),I=1,NE)
125 FORMAT(2X,I4,3E15.6)
END
!------TONG-JI P52------GAUSS'S METHOD------
SUBROUTINE GAUSS(A,B,N)
DIMENSION A(N,N),B(N)
DO 1 I=1,N
I1=I+1
DO 10 J=I1,N
10 A(I,J)=A(I,J)/A(I,I)
B(I)=B(I)/A(I,I)
A(I,I)=1.0
DO 20 J=I1,N
DO 30 M=I1,N
30 A(J,M)=A(J,M)-A(J,I)*A(I,M)
20 B(J)=B(J)-A(J,I)*B(I)
1 CONTINUE
DO 40 I=N-1,I,-1
DO 50 J=I+1,N
50 B(I)=B(I)-A(I,J)*B(J)
40 CONTINUE
RETURN
END