[Fortran] 纯文本查看 复制代码
PROGRAM MAIN
IMPLICIT DOUBLE PRECISION(A-Z)
INTEGER::NGZ,NBGZ,DELTA,DELTB
CHARACTER(LEN=512)::JDH
REAL(KIND=8)::NSUM
EXTERNAL::ELEM_KA
OPEN(UNIT=1,FILE='J:\123\INPUT.DAT', STATUS='OLD')
OPEN(UNIT=3,FILE='J:\123\OUTPUT.DAT', STATUS='UNKNOWN')
NSUM=39
DO I=1,NSUM,1
READ(1,*) JDH,Z1,Z2,S,IXX,MTOT,ZCOG,JXX,JYY,JZZ !//从输入数据文件INPUT.DAT中读入已知参数 JDH,Z1,Z2,S,IXX,MTOT,ZCOG,JXX,JYY,JZZ
PI=3.1415926
L=ABS(Z1-Z2)
CALL ELEM_KA(Z1,Z2,S,IXX,MTOT,ZCOG,JXX,JYY,JZZ,M1,M2,JXM1,JYM1,JZM1,JXM2,JYM2,JZM2) !//调用子程序ELEM_KA,通过计算获得参数M1,M2,JXM1,JYM1,JZM1,JXM2,JYM2,JZM2
ENDDO
END PROGRAM MAIN
SUBROUTINE ELEM_KA(Z1,Z2,S,IXX,MTOT,ZCOG,JXX,JYY,JZZ,M1,M2,JXM1,JYM1,JZM1,JXM2,JYM2,JZM2) !//子程序ELEM_KA计算过程
REAL(KIND=8)::Z1,Z2,S,IXX,MTOT,ZCOG,JXX,JYY,JZZ,M1,M2,JXM1,JYM1,JZM1,JXM2,JYM2,JZM2
MELE=0
DEN=0
M2=MTOT*(ZCOG-Z1)/(Z2-Z1)
M1=MTOT-M2
JX=JXX-M1*(Z1-ZCOG)**2-M2*(Z2-ZCOG)**2
JY=JYY-M1*(Z1-ZCOG)**2-M2*(Z2-ZCOG)**2
JZ=JZZ
JXM1=JX*M1/(M1+M2)
JYM1=JY*M1/(M1+M2)
JZM1=JZ*M1/(M1+M2)
JXM2=JX*M2/(M1+M2)
JYM2=JY*M2/(M1+M2)
JZM2=JZ*M2/(M1+M2)
IYY=IXX
IXY=0
WRITE(3,6) JDH,S,IXX,IXY,IYY,DEN,M1,JXM1,JYM1,JZM1,M2,JXM2,JYM2,JZM2
6 FORMAT(A12,13E15.4)
END SUBROUTINE ELEM_KA