登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
有用MATLAB做FDTD的进
发帖
回复
2118
阅读
1
回复
[
讨论
]
有用MATLAB做FDTD的进
离线
wuzjian@126
UID :20979
注册:
2008-11-07
登录:
2009-05-18
发帖:
44
等级:
仿真新人
0楼
发表于: 2009-03-06 15:24:56
这个程序不是很清楚,望各位大虾或同道中人一起研究。我的QQ:67715710.请注明FDTD.
=X'EDw
%***********************************************************************
1Mq"f7X8
% 3-D FDTD code with UPML absorbing boundary conditions
n\Is}Czl
%***********************************************************************
KUX6n(u
%
L' _%zO
% Program author: Keely J. Willis, Graduate Student
q#Otp\f
% UW Computational Electromagnetics Laboratory
r|Uz?
% Director: Susan C. Hagness
uu4!e{K
% Department of Electrical and Computer Engineering
Y]R=z*i%
% University of Wisconsin-Madison
~*h)`uM
% 1415 Engineering Drive
5Qg*j/z?
% Madison, WI 53706-1691
n)cc\JPQ
% [url=mailto:kjwillis@wisc.edu]kjwillis@wisc.edu[/url]
J8FzQ2
%
br0\O
% Copyright 2005
5D3&E_S
%
t`&mszd~T
% This MATLAB M-file implements the finite-difference time-domain
~ xam ;]2
% solution of Maxwell's curl equations over a three-dimensional
DDIRJd<J
% Cartesian space lattice comprised of uniform cubic grid cells.
K&._fG
%
~+ae68{p
% The dimensions of the computational domain are 8.2 cm
Q>yj<DR
% (x-direction), 3.4 cm (y-direction), and 3.2 cm (z-direction).
0F!Uai1
% The grid is terminated with UPML absorbing boundary conditions.
iU0jv7}n
%
z1RHdu0;z
% An electric current source comprised of two collinear Jz components
L9hL@
% (realizing a Hertzian dipole) excites a radially propagating wave.
Wsd_RT }ww
% The current source is located in the center of the grid. The
56."&0
% source waveform is a differentiated Gaussian pulse given by
3|e~YmZx
% J(t)=J0*(t-t0)*exp(-(t-t0)^2/tau^2),
fm^tU0DY
% where tau=50 ps. The FWHM spectral bandwidth of this zero-dc-
3mE8tTA$R
% content pulse is approximately 7 GHz. The grid resolution
*>iJ=H
% (dx = 2 mm) was chosen to provide at least 10 samples per
r_ 9"^Er
% wavelength up through 15 GHz.
Mf"(P.GIS
%
d?U,}tv
% To execute this M-file, type "fdtd3D_UPML" at the MATLAB prompt.
#/(L.5d[
%
!pa7]cZ
% This code has been tested in the following Matlab environments:
z4.|N
% Matlab version 6.1.0.450 Release 12.1 (May 18, 2001)
L) _ VdB
% Matlab version 6.5.1.199709 Release 13 Service Pack 1 (August 4, 2003)
S% ptG$Z
% Matlab version 7.0.0.19920 R14 (May 6, 2004)
] %7m+-h@
% Matlab version 7.0.1.24704 R14 Service Pack 1 (September 13, 2004)
T8LvdzS
% Matlab version 7.0.4.365 R14 Service Pack 2 (January 29, 2005)
oMn'{+(w
%
/;TD n>lq
% Note: if you are using Matlab version 6.x, you may wish to make
31g1zdT!
% one or more of the following modifications to this code:
#I ,c'Vj
% --uncomment line numbers 485 and 486
JKYtBXOl
% --comment out line numbers 552 and 561
6EWCJ%_
%
:'H}b*VWx
%***********************************************************************
Zjc/GO
clear
pdQaVe7tRo
%***********************************************************************
(s1iYK
% Fundamental constants
>SZuN"r8`
%***********************************************************************
oPAc6ObOV~
cc=2.99792458e8;
R $/q=*k
muz=4.0*pi*1.0e-7;
>&Ye(3w&
epsz=1.0/(cc*cc*muz);
;rh=63g
etaz=sqrt(muz/epsz);
' z^v}~
%***********************************************************************
>hnhV6ss
% Material parameters
MmfshnTN
%***********************************************************************
5*"WS $
mur=1.0;
|c]L]PU
epsr=1.0;
B aCzN;)
eta=etaz*sqrt(mur/epsr);
l 9rN!Q|
%***********************************************************************
3wgZDF38
% Grid parameters
C`oB [
%
1{xkAy0
% Each grid size variable name describes the number of sampled points
IOrYm
% for a particular field component in the direction of that component.
A[88IMZs
% Additionally, the variable names indicate the region of the grid
u7wZPIC{_
% for which the dimension is relevant. For example, ie_tot is the
Y% [H:
% number of sample points of Ex along the x-axis in the total
wGz_IL.D
% computational grid, and jh_bc is the number of sample points of Hy
U$ZbBVa`~
% along the y-axis in the y-normal UPML regions.
iQh:y:Jo1&
%
up3mum
%***********************************************************************
9zehwl]~
ie=41; % Size of main grid
'~6l 6wi
je=17;
78mJ3/?rC
ke=16;
d D^?%,a
ih=ie+1;
k"`^vV[{F
jh=je+1;
YBk* CW9
kh=ke+1;
8/9YR(H3H
upml=10; % Thickness of PML boundaries
-fz( ]d
ih_bc=upml+1;
WdrMp
jh_bc=upml+1;
G|$n,X1O(
kh_bc=upml+1;
l~`JFWur]
ie_tot=ie+2*upml; % Size of total computational domain
na/,1iI<
je_tot=je+2*upml;
oA ]F`N=
ke_tot=ke+2*upml;
tUFXx\p
ih_tot=ie_tot+1;
41XXL$
jh_tot=je_tot+1;
f2$<4Hhmm
kh_tot=ke_tot+1;
x A ZRl
is=round(ih_tot/2); % Location of z-directed current source
-uK@2}NZ
js=round(jh_tot/2);
`MMZR=LA
ks=round(ke_tot/2);
6}mSA@4&
%***********************************************************************
hcD.-(-;)
% Fundamental grid parameters
'^t(=02J
%***********************************************************************
wMiRN2\^
delta=0.002;
"k7C
dt=delta*sqrt(epsr*mur)/(2.0*cc);
#fe zUU
nmax=100;
k*T&>$k}^
%***********************************************************************
]O M?e
% Differentiated Gaussian pulse excitation
s[/)v:
%***********************************************************************
i ;YRE&X
rtau=50.0e-12;
Bk4|ik}
tau=rtau/dt;
,6\oT;G
ndelay=3*tau;
4vPKDd
J0=-1.0*epsz;
m3b?f B
%***********************************************************************
ViG-tb
% Initialize field arrays
SL% Ec%9Y
%***********************************************************************
t4,(W`
ex=zeros(ie_tot,jh_tot,kh_tot);
rOq>jvy
ey=zeros(ih_tot,je_tot,kh_tot);
=hKu85
ez=zeros(ih_tot,jh_tot,ke_tot);
EG!):P
dx=zeros(ie_tot,jh_tot,kh_tot);
M#]URS2h<O
dy=zeros(ih_tot,je_tot,kh_tot);
k{C|{m
dz=zeros(ih_tot,jh_tot,ke_tot);
'~Gk{'Nx"
hx=zeros(ih_tot,je_tot,ke_tot);
`>$l2,
hy=zeros(ie_tot,jh_tot,ke_tot);
.$-%rU:*}
hz=zeros(ie_tot,je_tot,kh_tot);
P?U}@U~9
bx=zeros(ih_tot,je_tot,ke_tot);
Hh;o<N>U
by=zeros(ie_tot,jh_tot,ke_tot);
6~(iLtd#
bz=zeros(ie_tot,je_tot,kh_tot);
jowR!rqf
%***********************************************************************
af2yng
% Initialize update coefficient arrays
/\uW[mt
%***********************************************************************
v%2Jm!i+
C1ex=zeros(size(ex));
;ZLfb n3\
C2ex=zeros(size(ex));
8J#TP7;
C3ex=zeros(size(ex));
WG*S:_?
C4ex=zeros(size(ex));
^cYt4NHXn
C5ex=zeros(size(ex));
cX-)]D
C6ex=zeros(size(ex));
NIOWjhi[Jn
C1ey=zeros(size(ey));
wo!;Bxo N
C2ey=zeros(size(ey));
,HO@bCK
C3ey=zeros(size(ey));
[]eZO_o6j
C4ey=zeros(size(ey));
GI*2*m!u
C5ey=zeros(size(ey));
9RN! <`H
C6ey=zeros(size(ey));
a{8g9a4
C1ez=zeros(size(ez));
7tz#R:
C2ez=zeros(size(ez));
5},kXXN{+
C3ez=zeros(size(ez));
qeZ*!H6-
C4ez=zeros(size(ez));
V\><6v
C5ez=zeros(size(ez));
?t];GNU`l
C6ez=zeros(size(ez));
5-X(K 'Q
D1hx=zeros(size(hx));
s av
D2hx=zeros(size(hx));
DC%H(2
D3hx=zeros(size(hx));
+aIy':P
D4hx=zeros(size(hx));
* d[sja+
D5hx=zeros(size(hx));
wrt^0n'r)c
D6hx=zeros(size(hx));
<</ Le%
D1hy=zeros(size(hy));
XB-l[4?
D2hy=zeros(size(hy));
be{t yV
D3hy=zeros(size(hy));
< {dV=
D4hy=zeros(size(hy));
Jx1JtnyP@
D5hy=zeros(size(hy));
-7l)mk
D6hy=zeros(size(hy));
z}m)u
D1hz=zeros(size(hz));
W_N!f=HW
D2hz=zeros(size(hz));
) bGzsb1\
D3hz=zeros(size(hz));
^c]lEo
D4hz=zeros(size(hz));
ZnYoh/
D5hz=zeros(size(hz));
p=U5qM.O
D6hz=zeros(size(hz));
ZYX(Cf
%***********************************************************************
E#cZM>
% Update coefficients, as described in Section 7.8.2.
-nrfu) G
%
vErlh:~e
% In order to simplify the update equations used in the time-stepping
at `\7YfQp
% loop, we implement UPML update equations throughout the entire
(|<.7K N
% grid. In the main grid, the electric-field update coefficients of
!;^TW$ G
% Equations 7.91a-f and the correponding magnetic field update
T8rf+B/.L
% coefficients extracted from Equations 7.89 and 7.90 are simplified
HGRH9W
% for the main grid (free space) and calculated below.
qy|si4IU8,
%
9gokTFoN
%***********************************************************************
b:}+l;e52
C1=1.0;
{n>W8sN<
C2=dt;
pI|H9
C3=1.0;
${%*O}$
C4=1.0/2.0/epsr/epsr/epsz/epsz;
j8ebVq
C5=2.0*epsr*epsz;
()v{HBi
C6=2.0*epsr*epsz;
Xz, sL
D1=1.0;
C|A:^6d3=
D2=dt;
oUwu:&<Orm
D3=1.0;
"xV9$m>
D4=1.0/2.0/epsr/epsz/mur/muz;
x p#+{}
D5=2.0*epsr*epsz;
( nH3
D6=2.0*epsr*epsz;
wN ![SM/+
%***********************************************************************
-Fj:^q:@u
% Initialize main grid update coefficients
yXx}'=&!0
%***********************************************************************
-]h3s >t
C1ex(:,jh_bc:jh_tot-upml,:)=C1;
ES#K'Lf
C2ex(:,jh_bc:jh_tot-upml,:)=C2;
a~F`{(Q2
C3ex(:,:,kh_bc:kh_tot-upml)=C3;
<2a7>\74E0
C4ex(:,:,kh_bc:kh_tot-upml)=C4;
<v)Ai;l,
C5ex(ih_bc:ie_tot-upml,:,:)=C5;
_%HyXd
C6ex(ih_bc:ie_tot-upml,:,:)=C6;
c|'hs
C1ey(:,:,kh_bc:kh_tot-upml)=C1;
"sf]I[a
C2ey(:,:,kh_bc:kh_tot-upml)=C2;
tCdgtZm
C3ey(ih_bc:ih_tot-upml,:,:)=C3;
~\z\f}w
C4ey(ih_bc:ih_tot-upml,:,:)=C4;
Lc<C1I 5=
C5ey(:,jh_bc:je_tot-upml,:)=C5;
$fE$j {
C6ey(:,jh_bc:je_tot-upml,:)=C6;
jpCQ2 XD:
C1ez(ih_bc:ih_tot-upml,:,:)=C1;
E}$K&<J'-
C2ez(ih_bc:ih_tot-upml,:,:)=C2;
zV }-_u.
C3ez(:,jh_bc:jh_tot-upml,:)=C3;
Wh)QCp0|n
C4ez(:,jh_bc:jh_tot-upml,:)=C4;
H+>l][
C5ez(:,:,kh_bc:ke_tot-upml)=C5;
R3$K[Lv,
C6ez(:,:,kh_bc:ke_tot-upml)=C6;
P:")Qb2
D1hx(:,jh_bc:je_tot-upml,:)=D1;
y^oSVj
D2hx(:,jh_bc:je_tot-upml,:)=D2;
Y`u.P(7#
D3hx(:,:,kh_bc:ke_tot-upml)=D3;
b)A$lP%`
D4hx(:,:,kh_bc:ke_tot-upml)=D4;
J8"Cw<=O
D5hx(ih_bc:ih_tot-upml,:,:)=D5;
g[P8
D6hx(ih_bc:ih_tot-upml,:,:)=D6;
(Js'(tBhiU
D1hy(:,:,kh_bc:ke_tot-upml)=D1;
>_y>["u6J#
D2hy(:,:,kh_bc:ke_tot-upml)=D2;
%HJ_0qg
D3hy(ih_bc:ie_tot-upml,:,:)=D3;
U9KnW]O%"
D4hy(ih_bc:ie_tot-upml,:,:)=D4;
,&sBa{0
D5hy(:,jh_bc:jh_tot-upml,:)=D5;
P==rY5+s`
D6hy(:,jh_bc:jh_tot-upml,:)=D6;
gn? ~y`
D1hz(ih_bc:ie_tot-upml,:,:)=D1;
UUx0#D/U0C
D2hz(ih_bc:ie_tot-upml,:,:)=D2;
@])qw_
D3hz(:,jh_bc:je_tot-upml,:)=D3;
*}\!&Zk"
D4hz(:,jh_bc:je_tot-upml,:)=D4;
/EOtK|E
D5hz(:,:,kh_bc:kh_tot-upml)=D5;
IdlW[h3`[
D6hz(:,:,kh_bc:kh_tot-upml)=D6;
,!f*OWnZ
%***********************************************************************
:LL>C)(f
% Fill in PML regions
* SG0-_S
%
c4R6E~S
% PML theory describes a continuous grading of the material properties
.s_wP
% over the PML region. In the FDTD grid it is necessary to discretize
PT|W{RlNl
% the grading by averaging the material properties over a grid cell
m(Cn'@i`"0
% width centered on each field component. As an example of the
or u.a
% implementation of this averaging, we take the integral of the
{}ZQK
% continuous sigma(x) in the PML region
!5}Ibb
%
CW Y'q
% sigma_i = integral(sigma(x))/delta
V$wf;v0d(
%
~mtL\!vaM
% where the integral is over a single grid cell width in x, and is
bQ=R,
% bounded by x1 and x2. Applying this to the polynomial grading of
j`\} xDg
% Equation 7.60a produces
*fq=["O
%
cvbv\G'aT
% sigma_i = (x2^(m+1)-x1^(m+1))*sigmam/(delta*(m+1)*d^m)
1e;^MzB"
%
u8*Uia*vwH
% where sigmam is the maximum value of sigma as described by Equation
".qh]RVjV
% 7.62.
DiAPs_@
%
~<pGiW'w5
% The definitions of x1 and x2 depend on the position of the field
j0k"iv
% component within the grid cell. We have either
6|05-x|
%
IiACr@[?e
% x1 = (i-0.5)*delta, x2 = (i+0.5)*delta
J*8fGR%
%
Rp)82- .
% or
&Q^M[X
%
33\{S$p
% x1 = (i)*delta, x2 = (i+1)*delta
DB yRP-TH
%
`?Wak=]g
% where i varies over the PML region.
E#_TX3B
%
Frt_X %
%***********************************************************************
'Z-jj2t}
rmax=exp(-16); %desired reflection error, designated as R(0) in Equation 7.62
YXH9Q@Gn
orderbc=4; %order of the polynomial grading, designated as m in Equation 7.60a,b
'hL\xf{
% x-varying material properties
Od'!v &
delbc=upml*delta;
i` Es7 }
sigmam=-log(rmax)*(orderbc+1.0)/(2.0*eta*delbc);
N`/6 By
sigfactor=sigmam/(delta*(delbc^orderbc)*(orderbc+1.0));
C CX\"-C
kmax=1;
nVoPTr
kfactor=(kmax-1.0)/delta/(orderbc+1.0)/delbc^orderbc;
]7ROCJ;
for i=1:upml
<Ja>
)L`0VTw'M
% Coefficients for field components in the center of the grid cell
Xb42R1
x1=(upml-i+1)*delta;
a Kb2:1EQ
x2=(upml-i)*delta;
@7%nMTZ@&v
sigma=sigfactor*(x1^(orderbc+1)-x2^(orderbc+1));
=%|S$J
ki=1+kfactor*(x1^(orderbc+1)-x2^(orderbc+1));
'u$$scGt
facm=(2*epsr*epsz*ki-sigma*dt);
JPgV7+{b[
facp=(2*epsr*epsz*ki+sigma*dt);
8(D>ws$
C5ex(i,:,:)=facp;
F`U%xn,
C5ex(ie_tot-i+1,:,:)=facp;
yjpV71!M
C6ex(i,:,:)=facm;
4_`+&
C6ex(ie_tot-i+1,:,:)=facm;
H__9%p#
D1hz(i,:,:)=facm/facp;
T<DQi
D1hz(ie_tot-i+1,:,:)=facm/facp;
f>5{SoM
D2hz(i,:,:)=2.0*epsr*epsz*dt/facp;
!tFs(![
D2hz(ie_tot-i+1,:,:)=2.0*epsr*epsz*dt/facp;
\A _g
D3hy(i,:,:)=facm/facp;
|qJQWmJO&U
D3hy(ie_tot-i+1,:,:)=facm/facp;
cxrUk$f
D4hy(i,:,:)=1.0/facp/mur/muz;
U=p,drF,A
D4hy(ie_tot-i+1,:,:)=1.0/facp/mur/muz;
5FnWlFc
% Coefficients for field components on the grid cell boundary
NZ'S~Lr
x1=(upml-i+1.5)*delta;
;&P%A<[`
x2=(upml-i+0.5)*delta;
JMw1qPJQ
sigma=sigfactor*(x1^(orderbc+1)-x2^(orderbc+1));
r<Ll>R
ki=1.0+kfactor*(x1^(orderbc+1)-x2^(orderbc+1));
#Z}\;a{vZ
facm=(2.0*epsr*epsz*ki-sigma*dt);
29pIO]8;
facp=(2.0*epsr*epsz*ki+sigma*dt);
s*:J=+D]G
C1ez(i,:,:)=facm/facp;
YQiTx)_
C1ez(ih_tot-i+1,:,:)=facm/facp;
3IZ^!J
C2ez(i,:,:)=2.0*epsr*epsz*dt/facp;
CfoSow-
C2ez(ih_tot-i+1,:,:)=2.0*epsr*epsz*dt/facp;
Ip( IGR"
C3ey(i,:,:)=facm/facp;
"Sc_E}q|e
C3ey(ih_tot-i+1,:,:)=facm/facp;
N|T%cdh:/
C4ey(i,:,:)=1.0/facp/epsr/epsz;
uE-~7Q(@
C4ey(ih_tot-i+1,:,:)=1.0/facp/epsr/epsz;
zhU)bb[A
D5hx(i,:,:)=facp;
c{6!}0Q4
D5hx(ih_tot-i+1,:,:)=facp;
bJ]g2C7`36
D6hx(i,:,:)=facm;
q/?#+d
D6hx(ih_tot-i+1,:,:)=facm;
^:\|6`{n
I2qC,Nkk
end
ykxjT@[
% PEC walls
6YQ&+4
C1ez(1,:,:)=-1.0;
%s%v|HDs
C1ez(ih_tot,:,:)=-1.0;
AIF?+i%H}
C2ez(1,:,:)=0.0;
'd^U!l
C2ez(ih_tot,:,:)=0.0;
4_8%ZaQ\.?
C3ey(1,:,:)=-1.0;
'u{m37ZJ
C3ey(ih_tot,:,:)=-1.0;
y1(smZU
C4ey(1,:,:)=0.0;
uv}[MXOP
C4ey(ih_tot,:,:)=0.0;
)Rn}4)9!iT
% y-varying material properties
UBrYN'QRNt
delbc=upml*delta;
pcv (P
sigmam=-log(rmax)*epsr*epsz*cc*(orderbc+1.0)/(2.0*delbc);
,;'9PsIS^
sigfactor=sigmam/(delta*(delbc^orderbc)*(orderbc+1.0));
Z'>Xn^
kmax=1.0;
L=Fm:O'#2
kfactor=(kmax-1.0)/delta/(orderbc+1.0)/delbc^orderbc;
( N~[sf?&
for j=1:upml
T#Qn\8
SY["dcx+
% Coefficients for field components in the center of the grid cell
M&~3fRb4
y1=(upml-j+1)*delta;
k ;R*mg*K
y2=(upml-j)*delta;
B8'" ^a^&-
sigma=sigfactor*(y1^(orderbc+1)-y2^(orderbc+1));
xpKD 'O=T
ki=1+kfactor*(y1^(orderbc+1)-y2^(orderbc+1));
cV_nYcLkz
facm=(2*epsr*epsz*ki-sigma*dt);
`)&-;CMY
facp=(2*epsr*epsz*ki+sigma*dt);
H ZIJKk(
*{P"u(K
C5ey(:,j,:)=facp;
5v=%pQbY
C5ey(:,je_tot-j+1,:)=facp;
zJOjc/\
C6ey(:,j,:)=facm;
m\__Fl
C6ey(:,je_tot-j+1,:)=facm;
mrX3/e
D1hx(:,j,:)=facm/facp;
T/V8&'^i
D1hx(:,je_tot-j+1,:)=facm/facp;
4T`u?T]
D2hx(:,j,:)=2*epsr*epsz*dt/facp;
Rgw\qOb
D2hx(:,je_tot-j+1,:)=2*epsr*epsz*dt/facp;
X5cl'J(j9
D3hz(:,j,:)=facm/facp;
iJk`{P _
D3hz(:,je_tot-j+1,:)=facm/facp;
t;TMD\BU
D4hz(:,j,:)=1/facp/mur/muz;
QDRSQ[ \
D4hz(:,je_tot-j+1,:)=1/facp/mur/muz;
YBN@{P$
AKC';J
% Coefficients for field components on the grid cell boundary
``)ys^V
y1=(upml-j+1.5)*delta;
**d3uc4y
y2=(upml-j+0.5)*delta;
W^ict,t
sigma=sigfactor*(y1^(orderbc+1)-y2^(orderbc+1));
EkgS*q_
ki=1+kfactor*(y1^(orderbc+1)-y2^(orderbc+1));
p[VBeO^%
facm=(2*epsr*epsz*ki-sigma*dt);
ns9iTU)
facp=(2*epsr*epsz*ki+sigma*dt);
"D'A7DA
H`G[QC
C1ex(:,j,:)=facm/facp;
mEmznA
C1ex(:,jh_tot-j+1,:)=facm/facp;
7JD jJQy
C2ex(:,j,:)=2*epsr*epsz*dt/facp;
:[m;#b
C2ex(:,jh_tot-j+1,:)=2*epsr*epsz*dt/facp;
-LJbx<'
C3ez(:,j,:)=facm/facp;
iv2did4
C3ez(:,jh_tot-j+1,:)=facm/facp;
]vMr@JM-G
C4ez(:,j,:)=1/facp/epsr/epsz;
V]tucs
C4ez(:,jh_tot-j+1,:)=1/facp/epsr/epsz;
_{)e\n
D5hy(:,j,:)=facp;
$(H%|Oyn
D5hy(:,jh_tot-j+1,:)=facp;
:D8V*F6P
D6hy(:,j,:)=facm;
ZMy0iQ@
D6hy(:,jh_tot-j+1,:)=facm;
\C5 YVl#
end
bX:Y5o49
% PEC walls
<LIL{g0eX
C1ex(:,1,:)=-1;
jwgXq(
C1ex(:,jh_tot,:)=-1;
rP>iPDf
C2ex(:,1,:)=0;
?1K|.lr
C2ex(:,jh_tot,:)=0;
6e(|t2^
C3ez(:,1,:)=-1;
DnS# cs~
C3ez(:,jh_tot,:)=-1;
fHCLsI
C4ez(:,1,:)=0;
>t&Frw/Bl
C4ez(:,jh_tot,:)=0;
8Gzc3
% z-varying material properties
^&MMtWR
delbc=upml*delta;
QU_O9 BN
sigmam=-log(rmax)*epsr*epsz*cc*(orderbc+1)/(2*delbc);
r j#K5/df
sigfactor=sigmam/(delta*(delbc^orderbc)*(orderbc+1));
1@6dHFA`o
kmax=1;
Mf Dna>,Y
kfactor=(kmax-1)/delta/(orderbc+1)/delbc^orderbc;
;t{Ew+s
for k=1:upml
.$y}}/{j?[
% Coefficients for field components in the center of the grid cell
cH?j@-pY
z1=(upml-k+1)*delta;
8bLA6qmM\
z2=(upml-k)*delta;
im_WTZz2P
sigma=sigfactor*(z1^(orderbc+1)-z2^(orderbc+1));
@tWyc%t
ki=1+kfactor*(z1^(orderbc+1)-z2^(orderbc+1));
r5h}o)J
facm=(2*epsr*epsz*ki-sigma*dt);
t8DySFT
facp=(2*epsr*epsz*ki+sigma*dt);
1T a48
iY1%"x
C5ez(:,:,k)=facp;
uV!Ax*'
C5ez(:,:,ke_tot-k+1)=facp;
m!3b.2/h
C6ez(:,:,k)=facm;
vyP3]+n
C6ez(:,:,ke_tot-k+1)=facm;
1P:r=Rt/
D1hy(:,:,k)=facm/facp;
ml <X92Y
D1hy(:,:,ke_tot-k+1)=facm/facp;
o7)<