⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄

📁 二维光子晶体时域有限差分方法研究起传输特性
💻
📖 第 1 页 / 共 4 页
字号:
   end do

  
  !write(*,11)  zi_jie_shu/1.0e6

11  format(1x,'已经占用的字节数为:',ES13.6E2, 'M')
!求解点磁场
 nsx1=nx-5
 nsx2=nx-5
 !nsy1=102
 !nsy2=107
 !躬行波导加源
 !nsy1=302
 !nsy2=307
 
 nsy1=5
 nsy2=ny-5
 !j0=(nsy1+nsy2)/2.
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!j0
 j0=155
 jw=8
 !w=0.8764*(2*pi*light_speed/v_a)
 !w=0.415*(2*pi*light_speed/v_a)
 w=fff*(2*pi*light_speed/v_a)
 wave='sinee'
 wave='pulse'
 !n0=2048
 !m0=11
 !n=2047
 n0=8192*2
 m0=14
 n=8191
 allocate(u(5:305,1:n0))
 allocate(v(5:305,1:n0))
 allocate(xt(1:n0))
 allocate(yt(1:n0))
 allocate(xt1(1:n0))
 allocate(yt1(1:n0))
 allocate(xt2(1:n0))
 allocate(yt2(1:n0))
 allocate(xt3(1:n0))
 allocate(yt3(1:n0))
 allocate(xt4(1:n0))
 allocate(yt4(1:n0))
 allocate(xt5(1:n0))
 allocate(yt5(1:n0))
 allocate(xt6(1:n0))
 allocate(yt6(1:n0))
 allocate(xt7(1:n0))
 allocate(yt7(1:n0))
 allocate(xt8(1:n0))
 allocate(yt8(1:n0))
 allocate(xt9(1:n0))
 allocate(yt9(1:n0))
 allocate(a(1:n0))
 allocate(b(1:n0))
 !!!!!!!!!!!!!!!!!!!	allocate st
 


 do  i=1,n0,1
     xt(i)=0.0
	 yt(i)=0.0
	 xt1(i)=0.0
	 yt1(i)=0.0
	 xt2(i)=0.0
	 yt2(i)=0.0
     xt3(i)=0.0
	 yt3(i)=0.0
	 xt4(i)=0.0
	 yt4(i)=0.0
	 xt5(i)=0.0
	 yt5(i)=0.0
	 xt6(i)=0.0
	 yt6(i)=0.0
     xt7(i)=0.0
	 yt7(i)=0.0
	 xt8(i)=0.0
	 yt8(i)=0.0
     xt9(i)=0.0
	 yt9(i)=0.0
	 !!!!!!!!!!!!!!!!!!!!!!!  st(i)
	 do j=5,ny-5
	  u(j,i)=0.0
	  v(j,i)=0.0
	 end do
end  do

!write(*,222) w
!write(*,223) n
!222   format(1x,'所用时谐源的角频率为:  ',Es13.6E2)
!223   format(1x,'  所用总的时间步数为:  ',I5)
sru=0.0
schu=0.0
sru0=0.0
schu0=0.0
sru01=0.0
schu01=0.0
!light_speed=light_speed/sqrt(jiedian1)
 !write(*,*) 'zhu zhihong'
do   nt=0,6003,1
    t=nt*dt
!	write(*,*) 'nt=',nt
    call  ezfield
    call  boundary
	t=nt*dt+dt/2.
    call  hxfield
    call  hyfield
!取样
    !xt(nt+1)=ez(nx-2,117)
	do j=5,ny-5,1
	 u(j,nt+1)=ez(nsx1,j)
	 v(j,nt+1)=ez(5,j)
!每个点的能量随时间变化	
    !xt(nt+1)=xt(nt+1)+ez(nsx1,j)
	!xt2(nt+1)=xt2(nt+1)+ez(5,j)
	end do

	!xt1(nt+1)=0.5*(jiedian0*jiedian11(nx-3,ny/2)*(ez(nx-3,ny/2)**2)+cidao0*(hx(nx-3,ny/2)**2+hy(nx-3,ny/2)**2))
	xt1(nt+1)=ez(5,5)
	xt2(nt+1)=ez(505,5)
	xt3(nt+1)=ez(5,305)
	xt4(nt+1)=ez(505,305)
	xt5(nt+1)=ez(5,155)
	xt6(nt+1)=ez(505,155)
	xt7(nt+1)=ez(5,140)
	xt8(nt+1)=ez(505,140)
	xt9(nt+1)=ez(3,155)
	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	

   ! if(0.le.nt.and.nt.le.50)  write(*,*)  nt, xt(nt+1)
!记录下某一时刻某一网格点的场值




!判断能量是否守恒
 call  eee
!判断能量守恒完成

!透过率计算
!call touguolv1
!call touguolv2
!透过率计算结束

end  do
!结束电场求解
!write(*,676)  iii,abs(sru0/schu0)
!write(1,676)  iii,abs(schu01/sru0) ,abs(schu0/sru0),abs(sru01/sru0)
676  format(i2,1x,es12.3e2,1x,es12.3e2,1x,es12.3e2)
!write(*,*)  iii,abs(schu01/sru0) ,abs(schu0/sru0),abs(sru01/sru0)
!close(1)
!        deallocate(jiedian11)
!        deallocate(hx)
!	    deallocate(hy)
!	    deallocate(ez)
!	    deallocate(ez1)
!	    deallocate(ez2)
!		deallocate(u)
!	    deallocate(v)
!        deallocate(xt)
!	    deallocate(yt)
!	    deallocate(xt1)
!	    deallocate(yt1)
!		deallocate(xt2)
!	    deallocate(yt2)
!	    deallocate(xt3)
!	    deallocate(yt3)
!	    deallocate(xt4)
!	    deallocate(yt4)
!	    deallocate(xt5)
!	    deallocate(yt5)
!		deallocate(xt6)
!	    deallocate(yt6)
!	    deallocate(xt7)
!	    deallocate(yt7)
!	    deallocate(xt8)
!	    deallocate(yt8)
!	    deallocate(xt9)
!	    deallocate(yt9)
!goto  11111

!输出总时域信号
   !open(1,file='e:\work\matlabm\shilianguv.m',action='write',form='formatted',access='sequential')
  ! open(2,file='e:\work\matlabm\donghuat.dat',form='binary')
  ! write(1,*) '% shilianguv'
   !write(1,12) 'dx=',dx,';','dy=',dy,';','a=',v_a,';','dt=',dt,';'
!12  format(1x,a, es13.6e2,a,a, es13.6e2,a,a,es13.6e2,a)

   !write(1,13)  ((u(i,j,103),i=1,nx-1),j=1,ny-1)
!	write(2)  ((i,i=1,nx-1),j=1,ny-1)
 !write(2)  ((i,i=1,nx-1),j=1,ny-1)
!13  format(1x,'u=[',109(f16.8,','))
  ! write(1,*) '];'

  ! write(1,113)  ((u(i,j,103),i=1,nx-1),j=1,ny-1)
   113  format(1x,'v=[',109(f16.8,','))
   !write(1,*) '];'
   !close(1)
!close(2)
!输出某一点的时域信号
  !open(1,file='e:\work\matlabm\fftzzht.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht'
     
  !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !14 format(1x,a, es13.6e2,a,a,es13.6e2,a)
    !write(1,16)  (xt(i),i=1,8192,1)
 !16   format(1x,'y=[',20(f14.6,','),'...')
  !write(1,*) '];'
  !close(1)

   !open(1,file='e:\work\matlabm\fftzzht1.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht1'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
   !write(1,16)  (xt1(i),i=1,8192,1)
 !write(1,*) '];'
 !close(1)

  !open(1,file='e:\work\matlabm\fftzzht2.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht2'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt2(i),i=11,8192,1)
 !write(1,*) '];'
!close(1)

 !open(1,file='e:\work\matlabm\fftzzht3.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht3'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt3(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

 !open(1,file='e:\work\matlabm\fftzzht4.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht4'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt4(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

  !open(1,file='e:\work\matlabm\fftzzht5.m',action='write',form='formatted',access='sequential')
  !write(1,*) '% fftzzht5'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt5(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

  !open(1,file='e:\work\matlabm\fftzzht6.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht6'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt6(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

 !open(1,file='e:\work\matlabm\fftzzht7.m',action='write',form='formatted',access='sequential')
 ! write(1,*) '% fftzzht7'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt7(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

  !open(1,file='e:\work\matlabm\fftzzht8.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht8'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt8(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

   !open(1,file='e:\work\matlabm\fftzzht9.m',action='write',form='formatted',access='sequential')
   !write(1,*) '% fftzzht9'
     !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  !write(1,16)  (xt9(i),i=1,8192,1)
 !write(1,*) '];'
!close(1)

! 时域信号over

!频谱分析
!call fft(xt,yt,n0,m0)

 !open(1,file='e:\work\matlabm\fftzzh.m',action='write',form='formatted',access='sequential')
 !open(1,file='c:\work\fftzzh.m',action='write',form='formatted',access='sequential')

  
  !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
  14 format(1x,a, es13.6e2,a,a,es13.6e2,a)
  !do  i=1,20,1
   !   j=i-1
      !write(*,15) j,j/(n0*dt),xt(i),yt(i), sqrt(xt(i)**2+yt(i)**2)
 !end do
  !write(1,16)  (sqrt(xt(i)**2+yt(i)**2),i=1,320,5)
  !maxx=sqrt(xt(1)**2+yt(1)**2)
  !do i=1,450,1
	!if(sqrt(xt(i)**2+yt(i)**2).gt.maxx)  maxx=sqrt(xt(i)**2+yt(i)**2)
   !end do
   !maxx=1.0
   !write(1,16)  (sqrt(xt(i)**2+yt(i)**2)/maxx,i=1,8192,1)
   !write(1,16)  (sqrt(xt(i)**2+yt(i)**2)/(1.025*maxx),i=1,8192,1)
 !15   format(1x,'f=',i3,1x,es13.6e2,1x,3(f16.8,1x))
 16   format(1x,'y=[',20(f14.6,','),'...')
 !write(1,*) '];'
 !close(1)

 call fft(xt1,yt1,n0,m0)

 !open(1,file='e:\work\matlabm\fftzzh1.m',action='write',form='formatted',access='sequential')
 
  !write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
   !maxx=sqrt(xt1(1)**2+yt1(1)**2)
   !do i=1,8192,1
	!if(sqrt(xt1(i)**2+yt1(i)**2).gt.maxx)  maxx=sqrt(xt1(i)**2+yt1(i)**2)
   !end do
   !maxx=1.
   !write(1,16)  (sqrt(xt1(i)**2+yt1(i)**2)/maxx,i=1,8192,1)
  !write(1,*) '];'
 !close(1)

  call fft(xt1,yt1,n0,m0)
  call fft(xt2,yt2,n0,m0)
 open(1,file='e:\work\matlabm\x12.m',action='write',form='formatted',access='sequential')
 
  write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
   !maxx=sqrt(xt2(1)**2+yt2(1)**2)
   !do i=1,450,1
	!if(sqrt(xt2(i)**2+yt2(i)**2).gt.maxx)  maxx=sqrt(xt2(i)**2+yt2(i)**2)
   !end do
  !maxx=1.
   write(1,16)  (xt1(i)/xt2(i),i=1,8192,1)
  !write(1,16)  (sqrt(xt2(i)**2+yt2(i)**2)/sqrt(xt(i)**2+yt(i)**2),i=1,8192,1)
  write(1,*) '];'
 close(1)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!touguolv
   do j=5,ny-5
    do i=1,n0
	 a(i)=u(j,i)
	 b(i)=v(j,i)
	end do
    yt2=0.0
    yt=0.0
    call fft(a,yt,n0,m0)
    call fft(b,yt2,n0,m0)
    do i=1,n0
     u(j,i)=a(i)
	 v(j,i)=b(i)
    end do
   end do
  a=0.
  b=0. 
  do i=1,n0
   do j=150,160
    a(i)=a(i)+u(j,i)
	b(i)=b(i)+v(j,i)
   end do
  end do
 open(1,file='e:\work\matlabm\touguolv.m',action='write',form='formatted',access='sequential')
 
  write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
   !maxx=sqrt(xt2(1)**2+yt2(1)**2)
  ! do i=1,450,1
!	if(sqrt(xt2(i)**2+yt2(i)**2).gt.maxx)  maxx=sqrt(xt2(i)**2+yt2(i)**2)
  ! end do
 ! maxx=1.
   !write(1,16)  (xt2(i)/st2(i),i=1,8192,1)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  write(1,16)  (b(i)/a(i),i=1,8192,1)
  write(1,*) '];'
 close(1)

 open(1,file='e:\work\matlabm\v.m',action='write',form='formatted',access='sequential')
  write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';' 
  write(1,16)  (b(i),i=1,8192,1)
  write(1,*) '];'
 close(1)

 open(1,file='e:\work\matlabm\u.m',action='write',form='formatted',access='sequential')
  write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';' 
  write(1,16)  (a(i),i=1,8192,1)
  write(1,*) '];'
 close(1)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 call fft(xt3,yt3,n0,m0)
 call fft(xt4,yt4,n0,m0)

 open(1,file='e:\work\matlabm\x34.m',action='write',form='formatted',access='sequential')
 
  write(1,14) 'df=',1.0/(n0*dt),';','a=',v_a,';','dt=',dt,';'
   !maxx=sqrt(xt3(1)**2+yt3(1)**2)
   !do i=1,8192,1
	!if(sqrt(xt3(i)**2+yt3(i)**2).gt.maxx)  maxx=sqrt(xt3(i)**2+yt3(i)**2)
   !end do
   !maxx=1.
   !write(1,16)  (sqrt(xt3(i)**2+yt3(i)**2)/maxx,i=1,8192,1)
  write(1,16)  (xt3(i)/xt4(i),i=1,8192,1)
  write(1,*) '];'
 close(1)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -