有耗介质中波的传播
1 %1D FDTD simulation with a simple absorbing boundary condition 2 % and a TFSF boundary between hy[49] and ez[50]. 3 % dielectric material located ez[100] 4 SIZE = 300; 5 LOSS = 0.01; 6 ez = zeros(1,SIZE); 7 hy = zeros(1,SIZE-1); 8 ceze = zeros(1,SIZE); 9 cezh = zeros(1,SIZE); 10 imp0=377.0; 11 maxTime = 10000; 12 % initialize update coefficient 13 for mm = 1 : 1 : SIZE -1 14 if mm < 150 15 ceze(mm) = 1.0; 16 cezh(mm) = imp0; 17 else 18 ceze(mm) = (1-LOSS)/(1+LOSS); 19 cezh(mm) = imp0 /9/(1+LOSS); 20 end 21 end 22 23 for qTime = 0 : 1 : maxTime 24 % hy(SIZE)=hy(SIZE-1);% 25 26 % update magnetic field 27 for mm = 1 : 1 : SIZE -1 28 hy(mm) = hy(mm) + (ez(mm+1)- ez(mm))/imp0; 29 end 30 % correction for Hy adjacent to TFSF boundary */ 31 hy(50)=hy(50)-exp(-(qTime - 30)*(qTime - 30) / 100) / imp0; 32 33 figure(1); t_hy = plot(hy); 34 title('Magnetic Field'); 35 36 % ABC 37 ez(1)=ez(2);% 38 % ez(SIZE)=ez(SIZE-1);% 39 40 for mm = 2 : 1 : SIZE-1 41 ez(mm) = ez(mm)*ceze(mm) + (hy(mm)- hy(mm-1))*cezh(mm); 42 end 43 figure(2); t_ez = plot(ez); 44 title('Electric Field') 45 ez(51) = ez(51) + exp(-(qTime+0.5-(-0.5)-30.0)*(qTime+0.5-(-0.5)-30.0)/100.0); 46 47 % pause(0.01); 48 % % refreshdata(t_hy); 49 % refreshdata(t_ez); 50 % drawnow; 51 end
OPTIMISM, PASSION & HARDWORK