登 录 註 冊
  • 725阅读
  • 1回复

[RFEDA原创]FDTD迷你代码-1D UPML [复制链接]

上一主题 下一主题
离线zuzero
 
只看楼主 倒序阅读 0楼 发表于: 2014-06-11
wovmy{K  
clear; wovmy{K  
clc; wovmy{K  
c=3e8; wovmy{K  
m0=1e-7*4*pi; wovmy{K  
e0=1e-9/(36*pi); wovmy{K  
eta0=120*pi; (wife#)~  
nz=100; (wife#)~  
na=10;%absorbing boundary (wife#)~  
ex=zeros(1,nz+1); (wife#)~  
hy=zeros(1,nz); (wife#)~  
lambda=1;%wavelength (wife#)~  
f=c/lambda; (wife#)~  
omega=2*pi*f; (wife#)~  
nd=20; (wife#)~  
d=lambda/nd; (wife#)~  
s=1; (wife#)~  
dt=s*d/c; (wife#)~  
cb=dt/(d*e0); (wife#)~  
cq=dt/(d*m0); (wife#)~  
fh=@(t)(heaviside(t).*sin(t).*((heaviside(t)-heaviside(t-6*pi)).*(1-cos(pi*t/(6*pi)))/2+heaviside(t-6*pi))); (wife#)~  
fh=@(t)(fh(omega.*t)); (wife#)~  
m=1; (wife#)~  
sigmamax=(m+1)/(150*pi*d); (wife#)~  
sigma=sigmamax*((na-1:-1:0)/(na-1)).^m; o/1JO_41  
sigmam=sigma*m0/e0; o/1JO_41  
kappa=1; o/1JO_41  
ca0=(e0*kappa/dt-(sigma(1:end-1)+sigma(2:end))/2)./(e0*kappa/dt+(sigma(1:end-1)+sigma(2:end))/2); o/1JO_41  
cb0=1/d./(e0*kappa/dt+(sigma(1:end-1)+sigma(2:end))/2); o/1JO_41  
cp0=(m0*kappa/dt-sigmam/2)./(m0*kappa/dt+sigmam/2); o/1JO_41  
cq0=1/d./(m0*kappa/dt+sigmam/2); o/1JO_41  
ca1=fliplr(ca0); o/1JO_41  
cb1=fliplr(cb0); o/1JO_41  
cp1=fliplr(cp0); o/1JO_41  
cq1=fliplr(cq0); o/1JO_41  
h=plot(ex); o/1JO_41  
set(gca,'ylim',[-2,2]); o/1JO_41  
for n=0:500 o/1JO_41  
    ex(1)=fh(n*dt); o/1JO_41  
    ex(2:end-na)=ex(2:end-na)-cb*diff(hy(1:end-na+1)); o/1JO_41  
    ex(end-na+1:end-1)=ca1.*ex(end-na+1:end-1)-cb1.*diff(hy(end-na+1:end)); o/1JO_41  
    hy(1:end-na)=hy(1:end-na)-cq*diff(ex(1:end-na)); o/1JO_41  
    hy(end-na+1:end)=cp1 .. o/1JO_41  
o/1JO_41  
亲爱的朋友您仅能浏览部分内容,查看全部内容及附件请先 登录注册

关注公众号
离线birdcc
只看该作者 1楼 发表于: 05-13
[s:10 .. L,W:,i/C  
L,W:,i/C  
亲爱的朋友您仅能浏览部分内容,查看全部内容及附件请先 登录注册

快速回复
限1000 字节
 
上一个 下一个