[Fortran] 纯文本查看 复制代码
IMPLICIT NONE
REAL*8 N1,N2,MU1,MU2,EPS1,EPS2
REAL*8 ETA1,ETA2,C11,C12,C21,C22
REAL*8 LAM,D,PI,C,OME
REAL*8 K1,K2
REAL*8 R,T,A
COMPLEX*16 i,B11,B12,B21,B22,T11,T12,T21,T22
PARAMETER(PI=3.14159D0)
PARAMETER(C=3.99792D8)
N1=1.00D0
N2=1.50D0
MU1=1.00D0
MU2=1.00D0
i=(0,1)
EPS1=(N1)**2
EPS2=(N2)**2
ETA1=DSQRT(EPS1/MU1)*N1
ETA2=DSQRT(EPS2/MU2)*N2
C11=(ETA1+ETA2)/(2*ETA1)
C12=(ETA1-ETA2)/(2*ETA1)
C21=(ETA1-ETA2)/(2*ETA1)
C22=(ETA1+ETA2)/(2*ETA1)
LAM=3.00D-7
OPEN(12,FILE='out.txt')
DO LAM = 3.00D-7,12.00D-7,0.01D-7
D=2.00D-7
OME=2*PI*C/LAM
K1=(OME*N1)/C
K2=(OME*N2)/C
B11=CDEXP(i*K1*D)*DEXP(-K2*D)
B12=(0,0)
B21=(0,0)
B22=CDEXP(-i*K1*D)*DEXP(K2*D)
T11=C11*B11+C12*B21
T12=C11*B12+C12*B22
T21=C21*B11+C22*B21
T22=C21*B12+C22*B22
R=(CDABS(-T12/T22))**2
T=(CDABS(T11-(T12*T21)/T22))**2
A=1-R-T
WRITE(*,100)R,T,A
WRITE(12,100)R,T,A
100 FORMAT(1X,F8.3,2X,F8.3,2X,F8.3)
END DO
CLOSE(12)
WRITE(*,*)'FINISH'
END