fdtd二维解说(二)边界条件

完美匹配层(PML) 

 

 

figure();
hold on;
d=20;
N=7;
N_PML=2;
for i=0:N
    plot([i*d,i*d],[0,N*d],'-k'); hold on;
    plot([0,N*d],[i*d,i*d],'-k'); hold on;
    plot(ones(N)*i*d,((1:N)-1/2)*d,'kx'); hold on;
    plot(((1:N)-1/2)*d,ones(N)*i*d,'kx'); hold on;
end
shift=5;
plot([0,N*d,N*d,0,0],[0,0,N*d,N*d,0],'--r','Linewidth',2);
plot([N_PML*d-shift,(N-N_PML)*d+shift,(N-N_PML)*d+shift,N_PML*d-shift,N_PML*d-shift], ...
    [N_PML*d-shift,N_PML*d-shift,(N-N_PML)*d+shift,(N-N_PML)*d+shift,N_PML*d-shift],'--r','Linewidth',2);
for i=1:N
    plot(((1:N)-1/2)*d,ones(N)*(i-1/2)*d,'ko'); hold on;
end
axis([-20,160,-20,160]);

  

figure();
hold on;
d=20;
N=7;
N_PML=2;
shift=5;
for i=0:N
    plot([i*d,i*d]-shift,[0,N*d]+shift,'-k'); hold on;
    plot([0,N*d]-shift,[i*d,i*d]+shift,'-k'); hold on;
    plot(ones(N)*i*d,((1:N)-1/2)*d,'kV','MarkerFaceColor',[.49 1 .63]); hold on;
    plot(((1:N)-1/2)*d,ones(N)*i*d,'k>','MarkerFaceColor',[ 1 .63 .49]); hold on;
end
for i=1:N
    plot(((1:N)-1/2)*d,ones(N)*(i-1/2)*d,'ko'); hold on;
end


plot([0,N*d,N*d,0,0]-shift,[0,0,N*d,N*d,0]+shift,'--r','Linewidth',3);
plot([N_PML*d-shift, (N-N_PML)*d-shift, (N-N_PML)*d-shift, N_PML*d-shift, N_PML*d-shift], ...
    [N_PML*d+shift,N_PML*d+shift,(N-N_PML)*d+shift,(N-N_PML)*d+shift,N_PML*d+shift],'--r','Linewidth',3);

axis([-20,160,-20,160]);

  

 

posted @ 2017-06-01 21:46  I know you  阅读(1877)  评论(0编辑  收藏  举报