登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
帮忙看看我的编程思路有没有问题(附程序)
发帖
回复
1304
阅读
1
回复
[
求助
]
帮忙看看我的编程思路有没有问题(附程序)
离线
yuyeliuxu
UID :21110
注册:
2008-11-10
登录:
2009-10-09
发帖:
31
等级:
仿真一级
0楼
发表于: 2009-07-10 10:02:08
得到的结果pml不吸收
)TH@#1
tic;
v oj^pzZ
clear; clc;
\)?HJ
N_iteration=1;
"!%l/_p?
%***********************************************************************
X*Prl l(
% Fundamental constants
:zF,A,)
%***********************************************************************
'u b@]ru|
w=J3=T@TD
cc=2.99792458e8; %speed of light in free space
OH(waKq2I
muz=4.0*pi*1.0e-7; %permeability of free space
;VO:ph4Aj
epsz=1.0/(cc*cc*muz); %permittivity of free space
%Q dn
kq,ucU%>p
freq=5e+9; %frequency of source excitation
d4c8~L H-
Tc=0.2e-9 %Time shift, i.e. time for the center position of the pulse
KNIn:K^/
Tau=1/freq; %impulse width parameter, e.g.: 0.2ns pulse width here
)f<z%:I+Z
% corresponds frequency of 1/Tau Hz, i.e.
uGEfIy 2
% 0.2ns---5GHz, 0.5ns---2GHz
8q}q{8
lambda=cc/freq; %center wavelength of source excitation
~1vDV>dpE
omega=2.0*pi*freq;
5S--'=fu+
X*@dj_,
M_factor=1;%1 % refine the mesh to get higher quality M_factor times meshed on 1e-3
^RtIh-Z.9
eM?I$eP TN
SJ>vwmA4
lv+TD!b
nmax=500*M_factor; %total number of calculating time steps nmax=2200*M_factor;
psMvq@>
nstep=10; % =250 every nstep give a display
?'{SX9
'u |c
FE|JHh$
K}MK<2vU
P! #[mio
%***********************************************************************
h|{]B,.Lh
% Grid parameters
D\NKC@(M
%***********************************************************************
JHTSUq
ie=100*M_factor; %100 %number of grid cells in x-direction
&AbNWtCV+G
je=100*M_factor; %100 %number of grid cells in y-direction
Vt&2z)Zz
8&`LYdzt
ib=ie+1;
o!ebs0
jb=je+1;
wyO4Y
imp_x=50*M_factor; %imp_x=5*M_factor; %imp_x=10*M_factor;
#KexvP&*
imp_y=50*M_factor; %(imp_x ,imp_y) is the location of the point source impulse
aH/ k Ua
k5.Lna
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X!dYdWw*m
;P%1j| 7
%%%%% fine meshed %%%%
_C[q4?
dx=1e-3/M_factor ;% dx=0.25e-3; %dx=1e-3 %dx=0.25e-3; %dx=1e-3/M_factor; %space increment of square lattice
F%D.zvKN
dt=dx/(2.0*cc); %time step dt=dx/(2.0*cc);
.MoU1n{Yc
U6fgo3RH
iebc=8*M_factor; %thickness of left and right PML region
XG{zlOD+
jebc=8*M_factor; %thickness of front and back PML region
0*D$R`$
rmax=0.000001; %reflection factor ?x?? concerning PML issue
]R f[y
orderbc=2;
'^~{@~ ;%L
ibbc=iebc+1;
'=8d?aeF
jbbc=jebc+1;
M {T-iW"
iefbc=ie+2*iebc;
z !rL s76
jefbc=je+2*jebc;
V7fq4O^:
ibfbc=iefbc+1;
LR.<&m%~.
jbfbc=jefbc+1;
7/@TF/V
fN^8{w/O
%***********************************************************************
)g#T9tx2D
% Material parameters
WX|`1b
%***********************************************************************
G.a b ql
epss=10;
c?[I?ytl
eps=7;
=QiI :|eRA
tau0=7e-12;
Jgd'1'FOs
sigdisp=(epss-eps)*epsz/tau0;
=Qj{T
sig=0.15+sigdisp;
8_B4?` k
mur=1.0;
Y;^l%ePuW
sim=0;
3>`mI8$t
%***********************************************************************
Hp!-248 S
% Wave excitation
9u}Hmb
%***********************************************************************
3E $f)
source=zeros(1,nmax);
HjD8u`qQ
% for n=1:nmax
9BBmw(M}
% t(n)=dt*n;
ryUQU^v
% source(n)=-sqrt(exp(1))*(2*pi/Tau)*(t(n)-Tc)*exp(-(1/2)*(2*pi*(t(n)-Tc)/Tau)^2); % normalized
o5uph=Q{
% end
:Cs4NF
for n=1:nmax % n=n1:n2
BdblLUGK#
t(n)=dt*n;
EPM-df!=
source(n)=-sin(omega*(t(n)-Tc)); % %Eq.(6) of Monocycle shapes paper
$OkBg0
end
k(7&N0V%zz
%***********************************************************************
" h~Zu
% Field arrays
-23w2Qt
%***********************************************************************
tKx~1-
xvl#w
ex=zeros(ie,jb); %fields in main grid
F]]]y5t
px=zeros(ie,jb);
q" sed]
ey=zeros(ib,je);
]e>w}L(gV
py=zeros(ib,je);
>kDQkhZ
hz=zeros(ie,je);
KD7dye
4,gK[ dc
exbcf=zeros(iefbc,jebc); %fields in front PML region
}DfshZ0QM
pxbcf=zeros(iefbc,jebc);
][h%UrV
eybcf=zeros(ibfbc,jebc);
_w+:Dv~*a
pybcf=zeros(ibfbc,jebc);
Yz"#^j}Kg
hzxbcf=zeros(iefbc,jebc);
V0.vQ/
hzybcf=zeros(iefbc,jebc);
/saIs%(fU
rt~d6|6
exbcb=zeros(iefbc,jbbc); %fields in back PML region
a PfO$b:
pxbcb=zeros(iefbc,jbbc);
J1RJ*mo7,
eybcb=zeros(ibfbc,jebc);
.A{tQ1&_
pybcb=zeros(ibfbc,jebc);
QIvVcfM^
hzxbcb=zeros(iefbc,jebc);
Z=Y& B>:[
hzybcb=zeros(iefbc,jebc);
j0S#>t
YPK(be_|I
exbcl=zeros(iebc,jb); %fields in left PML region
ju8q?Nyhs
pxbcl=zeros(iebc,jb);
6x[}g
eybcl=zeros(iebc,je);
ujq=F
pybcl=zeros(iebc,je);
9gEwh<
hzxbcl=zeros(iebc,je);
;jvBF4Lb>
hzybcl=zeros(iebc,je);
%wvdn
a /l)qB#
exbcr=zeros(iebc,jb); %fields in right PML region
"ZoRZ'i
pxbcr=zeros(iebc,jb);
z] PSpUd
eybcr=zeros(ibbc,je);
_w(7u(Z
pybcr=zeros(ibbc,je);
E}Z/*lX
hzxbcr=zeros(iebc,je);
xU>WEm2
hzybcr=zeros(iebc,je);
OXSmt DvJ
vkd.)x`J,
%***********************************************************************
q#ClnG*
% Updating coefficients
5Y'qaIFR
%***********************************************************************
u#;7<.D
?o4C;
FR4QUk
Qu"\wE^.`
haf=dt*sim/(2.0*muz*mur);
E=CsIK
da=(1.0-haf)/(1.0+haf);
ag#S6E^%S
db=dt/muz/mur/dx/(1.0+haf);
`maKN \;
dapm=(2*tau0-dt)/(2*tau0+dt);
AFDq}*2Qb
dbpm=2*tau0*dt/(2*tau0+dt)*sigdisp;
i6tf2oqO7
m=A(NKZ
2U\u4NO{
%***********************************************************************
K'Tm_"[u
% Geometry specification (main grid)
.4M.y:F
%***********************************************************************
;F!5%}OcL%
haf=dt*sim/(2.0*muz*mur);
i,E{f
dahz(1:ie,1:je)=(1.0-haf)/(1.0+haf);
>WQMqQ^t@
dbhz(1:ie,1:je)=dt/muz/mur/dx/(1.0+haf);
ZQoU3AD;
for i=1:ie
;I 9&]
for j=1:jb
K>r,(zgVc
EZy)A$|
eaf=dt*sig/(2.0*epsz*eps);
Ng>5?F^v
caex(i,j)=(1.0-eaf)/(1.0+eaf); % parameters refer to page 6 from
!&ayYu##{
cpex(i,j)=dt/epsz/eps/tau0/(1.0+eaf);
nE&