登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
菜鸟求助,PML边界问题
发帖
回复
1007
阅读
2
回复
[
求助
]
菜鸟求助,PML边界问题
离线
jillar
UID :55262
注册:
2010-03-21
登录:
2011-11-27
发帖:
6
等级:
旁观者
0楼
发表于: 2010-03-21 19:26:52
我在做一个光学电磁波仿真,并没有学过电磁场,找到一个matlab写的计算TE波的程序,现在想算TM,但是对着书研究了几天也没明白PML这块怎么回事,555
Bz4;R9_%I
我只想用一下,并不想了解细节,请问这个程序有TM波的版本吗?或者哪位仁兄知道怎么修改吗???万分感谢了!!!
l?:S)[:
s>ohXISB[
=H/ 5
%***********************************************************************
Y?xc#'
% 2-D FDTD TE code with PML absorbing boundary conditions
&*9' 0
%***********************************************************************
R7 ^f|/l
%
~w"e 2a
% Program author: Susan C. Hagness
dr^MW?{a\
% Department of Electrical and Computer Engineering
Bnh*;J0
% University of Wisconsin-Madison
J>Bc-%.Q
% 1415 Engineering Drive
P`OZoI$bV
% Madison, WI 53706-1691
]7J* (,sp
% 608-265-5739
`{ ` W-C
%
hagness@engr.wisc.edu
|^C35 6M>
%
`[F[0fY-
% Date of this version: February 2000
*Z2#U?_
%
Wh^wKF~%
% This MATLAB M-file implements the finite-difference time-domain
!<= ^&\A
% solution of Maxwell's curl equations over a two-dimensional
Dgm"1+
% Cartesian space lattice comprised of uniform square grid cells.
3h**y %^
%
LjPpnjU
% To illustrate the algorithm, a 6-cm-diameter metal cylindrical
[1g
% scatterer in free space is modeled. The source excitation is
!m6=Us
% a Gaussian pulse with a carrier frequency of 5 GHz.
O~D]C
%
8om)A0S
% The grid resolution (dx = 3 mm) was chosen to provide 20 samples
k@^T<Ci
% per wavelength at the center frequency of the pulse (which in turn
sPRo=LB
% provides approximately 10 samples per wavelength at the high end
Q&8epO |J
% of the excitation spectrum, around 10 GHz).
Nc:0opPM
%
gIY]hC.
% The computational domain is truncated using the perfectly matched
OEhDRU%k
% layer (PML) absorbing boundary conditions. The formulation used
g [c^7
% in this code is based on the original split-field Berenger PML. The
J8?V1Ad{
% PML regions are labeled as shown in the following diagram:
5~{s-Ms
% y
a}V<CBi
% ----------------------------------------------
U[M~O*9
% | | BACK PML | |
DMiB \o
% ----------------------------------------------
B~47mw&b
% |L | /| R|
QS%t:,0lp
% |E | (ib,jb) | I|
tG*HUN?*
% |F | | G|
bj7r"_
% |T | | H|
=&#t("
% | | MAIN GRID | T|
5q _n69b
% |P | | |
wkKSL
% |M | | P|
<Y+>a#T
% |L | (1,1) | M|
$Qcr8~+a
% | |/ | L|
T~)R,OA7m
% ----------------------------------------------
W3w$nV
% | | FRONT PML | |
g<^-[w4/
% ---------------------------------------------- x
v%;Nyab6$
%
s7s@!~
% To execute this M-file, type "fdtd2D" at the MATLAB prompt.
YSux#*#H
% This M-file displays the FDTD-computed Ex, Ey, and Hz fields at
jh"YHe/X
% every 4th time step, and records those frames in a movie matrix,
%6E:SI4
% M, which is played at the end of the simulation using the "movie"
,"?xy-6
% command.
Tzr'3m_
%
|6 E !wW
%***********************************************************************
.05x=28n%
clear
%nhE588xf
%***********************************************************************
E{]PfUfFY
% Fundamental constants
Ah_0o_Di
%***********************************************************************
^ wb 9 n
cc=2.99792458e8; %speed of light in free space
dyVfDF
muz=4.0*pi*1.0e-7; %permeability of free space
X{8g2](z.
epsz=1.0/(cc*cc*muz); %permittivity of free space
pReSvF}}C
freq=5.0e+9; %center frequency of source excitation
@o>3 Bv.
lambda=cc/freq; %center wavelength of source excitation
S3gd'Bahq
omega=2.0*pi*freq;
`ZGKM>q`
%***********************************************************************
s_cur-
% Grid parameters
jPEOp#C
%***********************************************************************
_[,7DA.qc
ie=100; %number of grid cells in x-direction
^b6yN\,S
je=50; %number of grid cells in y-direction
bFsJqA.A
ib=ie+1;
5#Et.P'
jb=je+1;
:Hj #1-U
is=15; %location of z-directed hard source
[WO>}rGw4
js=je/2; %location of z-directed hard source
nTCwLnX(O
dx=3.0e-3; %space increment of square lattice
_:+ k|I
dt=dx/(2.0*cc); %time step
U(5 Yg
nmax=300; %total number of time steps
7uq^TO>9f
iebc=8; %thickness of left and right PML region
*Ke\Yb
jebc=8; %thickness of front and back PML region
jf=\\*64r4
rmax=0.00001;
V11XI<V
orderbc=2; %二阶边界条件???
>f*Zf(F
ibbc=iebc+1;
=`.OKUAn
jbbc=jebc+1;
.4XX )f5
iefbc=ie+2*iebc;
8K2=WYN
jefbc=je+2*jebc;
VvTi>2(.
ibfbc=iefbc+1;
2<tU
jbfbc=jefbc+1;
Yz? 8n
%***********************************************************************
Vr hd\
% Material parameters
MS;^@>|wj
%***********************************************************************
XPT@ LM
media=2;
$fG~;`T
eps=[1.0 1.0];
0N):8`dY
sig=[0.0 1.0e+7];
YcN &\(
mur=[1.0 1.0];
f}cCnJK
sim=[0.0 0.0];
[ps5
%***********************************************************************
|Q$9I#rv
% Wave excitation
'Xu3]'m*
%***********************************************************************
3c[]P2Bh
rtau=160.0e-12;
N `[ ?db-%
tau=rtau/dt;
]K|td)1X
delay=3*tau;
pMzlpmW;P
source=zeros(1,nmax);
G<Y}QhFU
for n=1:7.0*tau
UnOcw
source(n)=sin(omega*(n-delay)*dt)*exp(-((n-delay)^2/tau^2));
,tak{["
end
gmN$}Gy}
%***********************************************************************
h@fF`
% Field arrays
sF~!qag4q'
%***********************************************************************
qkBCI,X_Y
ex=zeros(ie,jb); %fields in main grid
USzO):o
ey=zeros(ib,je);
<\oD4EE_
hz=zeros(ie,je);
b{}ao
exbcf=zeros(iefbc,jebc); %fields in front PML region
Dr5AJ`y9A
eybcf=zeros(ibfbc,jebc);
<v3pI!)x
hzxbcf=zeros(iefbc,jebc);
4P^CqD&i
hzybcf=zeros(iefbc,jebc);
[Nu py,v
exbcb=zeros(iefbc,jbbc); %fields in back PML region
3ICM H
eybcb=zeros(ibfbc,jebc);
3u[5T|D'
hzxbcb=zeros(iefbc,jebc);
Z ty9O8g
hzybcb=zeros(iefbc,jebc);
F[*/D/y(
exbcl=zeros(iebc,jb); %fields in left PML region
c{[ lT2yxU
eybcl=zeros(iebc,je);
M=Y['wx
hzxbcl=zeros(iebc,je);
a LJ d1Q
hzybcl=zeros(iebc,je);
&{g y{npQ
exbcr=zeros(iebc,jb); %fields in right PML region
g9gi7.'0
eybcr=zeros(ibbc,je);
[" sm7yQ
hzxbcr=zeros(iebc,je);
G$VE o8Blb
hzybcr=zeros(iebc,je);
=)nJ'}x
%***********************************************************************
@|<qTci
% Updating coefficients
_FkIg>s
%***********************************************************************
P.- `[
for i=1:media
.zsYVtK
eaf =dt*sig(i)/(2.0*epsz*eps(i));
\e~5Dx1
ca(i)=(1.0-eaf)/(1.0+eaf);
F~?|d0
cb(i)=dt/epsz/eps(i)/dx/(1.0+eaf);
2*a5pFkb
haf =dt*sim(i)/(2.0*muz*mur(i));
dz1kQzOU*
da(i)=(1.0-haf)/(1.0+haf);
|>KOlwh5n
db(i)=dt/muz/mur(i)/dx/(1.0+haf);
tv%B=E!r
end
U&0 RQ:B
%***********************************************************************
aole`PD,l
% Geometry specification (main grid)
6UM1>xq9A
%***********************************************************************
~ nb1c:F
% Initialize entire main grid to free space
pyp0SGCM:
caex(1:ie,1:jb)=ca(1);
i JS7g
cbex(1:ie,1:jb)=cb(1);
v(=E R%
caey(1:ib,1:je)=ca(1);
f0 kz:sZ9
cbey(1:ib,1:je)=cb(1);
@4=Az1W*
dahz(1:ie,1:je)=da(1);
_ O;R
dbhz(1:ie,1:je)=db(1);
2b&Fu\2Dmv
% Add metal cylinder
R)6"P?h._4
diam=20; % diameter of cylinder: 6 cm
;e$YM;;d
rad=diam/2.0; % radius of cylinder: 3 cm
=b#:j:r
icenter=4*ie/5; % i-coordinate of cylinder's center
8/R9YiY5*
jcenter=je/2; % j-coordinate of cylinder's center
r0q?e`nsA
for i=1:ie
Dq+S'x~>
for j=1:je
| z?c>.
dist2=(i+0.5-icenter)^2 + (j-jcenter)^2;
v\D.j4%ij
if dist2 <= rad^2
! =*k+gpF
caex(i,j)=ca(2);
~L:H]_8F l
cbex(i,j)=cb(2);
QypUBf
end
/6:qmh2
dist2=(i-icenter)^2 + (j+0.5-jcenter)^2;
C4)m4r%
if dist2 <= rad^2
\i3)/sZ?l
caey(i,j)=ca(2);
P DwBSj
cbey(i,j)=cb(2);
BT"n;L?[
end
'<xV]k|v
end
p\DSFB
end
'cA(-ghY/E
%***********************************************************************
2YK2t<EO
% Fill the PML regions
GK1oS
%***********************************************************************
S=G2%u!;
delbc=iebc*dx;
DA>TT~L
sigmam=-log(rmax/100.0)*epsz*cc*(orderbc+1)/(2*delbc);
Qcn;:6_&W
bcfactor=eps(1)*sigmam/(dx*(delbc^orderbc)*(orderbc+1));
}WHq?
% FRONT region
6N[X:F 3`,
caexbcf(1:iefbc,1)=1.0;
i?f;C_w
cbexbcf(1:iefbc,1)=0.0;
~>XqR/v
for j=2:jebc
L| ;WE=
y1=(jebc-j+1.5)*dx;
bWJ&SR>
y2=(jebc-j+0.5)*dx;
!o\e/HGc!
sigmay=bcfactor*(y1^(orderbc+1)-y2^(orderbc+1));
@a,}k<@E
ca1=exp(-sigmay*dt/(epsz*eps(1)));
lYS*{i1^ '
cb1=(1.0-ca1)/(sigmay*dx);
u>/Jb+
caexbcf(1:iefbc,j)=ca1;
.mplML0oW
cbexbcf(1:iefbc,j)=cb1;
pO)5NbU
end
$E}N`B7
sigmay = bcfactor*(0.5*dx)^(orderbc+1);
7m8(8$-6
ca1=exp(-sigmay*dt/(epsz*eps(1)));
myF/_o&Ty
cb1=(1-ca1)/(sigmay*dx);
p3V?n[/}
caex(1:ie,1)=ca1;
,n$NF0^l
cbex(1:ie,1)=cb1;
k|^`0~E
caexbcl(1:iebc,1)=ca1;
& l0LW,Bx
cbexbcl(1:iebc,1)=cb1;
5,?^SK|'x
caexbcr(1:iebc,1)=ca1;
B7PdavO#
cbexbcr(1:iebc,1)=cb1;
hGRHuJ
for j=1:jebc
_gw paAJ
y1=(jebc-j+1)*dx;
slaH 2}$xR
y2=(jebc-j)*dx;
1p8hn!V
sigmay=bcfactor*(y1^(orderbc+1)-y2^(orderbc+1));
a3L-q>h
sigmays=sigmay*(muz/(epsz*eps(1)));
}6gum
da1=exp(-sigmays*dt/muz);
WZ=$c]gG
db1=(1-da1)/(sigmays*dx);
`%*`rtZ+H.
dahzybcf(1:iefbc,j)=da1;
*W2o$_Hs
dbhzybcf(1:iefbc,j)=db1;
n?"("Fiw
caeybcf(1:ibfbc,j)=ca(1);
z fu)X!t^
cbeybcf(1:ibfbc,j)=cb(1);
ZE9.r`
dahzxbcf(1:iefbc,j)=da(1);
>4J(\'}m|
dbhzxbcf(1:iefbc,j)=db(1);
QW_BT^d"
end
g]E3+: 5dk
%**************************************************************************
biENRJQ.
%
q@1xYz:J
% BACK region
L~C:1VG5
caexbcb(1:iefbc,jbbc)=1.0;
V3ExS1fNf
cbexbcb(1:iefbc,jbbc)=0.0;
6zI}?KZf
for j=2:jebc
Q 3/J@MC
y1=(j-0.5)*dx;
Y|buQQ|
y2=(j-1.5)*dx;
nPk&/H%5hn
sigmay=bcfactor*(y1^(orderbc+1)-y2^(orderbc+1));
odn3*{c{x
ca1=exp(-sigmay*dt/(epsz*eps(1)));
y-{?0mLq
cb1=(1-ca1)/(sigmay*dx);
F?t;bV
caexbcb(1:iefbc,j)=ca1;
}s[`T
cbexbcb(1:iefbc,j)=cb1;
Kl<NAv%j
end
1u"#rC>7.4
sigmay = bcfactor*(0.5*dx)^(orderbc+1);
*,28@_EwY
ca1=exp(-sigmay*dt/(epsz*eps(1)));
^U##9KkP
cb1=(1-ca1)/(sigmay*dx);
\2CEEs'
caex(1:ie,jb)=ca1;
] !n3j=*
cbex(1:ie,jb)=cb1;
!|8"}ZF
caexbcl(1:iebc,jb)=ca1;
$laUkD#vz
cbexbcl(1:iebc,jb)=cb1;
dSe d6
caexbcr(1:iebc,jb)=ca1;
=MT'e,T
cbexbcr(1:iebc,jb)=cb1;
qG +PqK;
for j=1:jebc
BZ(I]:oDL
y1=j*dx;
^I)+u>fJ
y2=(j-1)*dx;
-d^'-s
sigmay=bcfactor*(y1^(orderbc+1)-y2^(orderbc+1));
,&L}^ Up
sigmays=sigmay*(muz/(epsz*eps(1)));
dWdD^>8Ef
da1=exp(-sigmays*dt/muz);
=_CH$F!U
db1=(1-da1)/(sigmays*dx);
D@kf^1G
dahzybcb(1:iefbc,j)=da1;
fk!9` p'
dbhzybcb(1:iefbc,j)=db1;
/ }*}r
caeybcb(1:ibfbc,j)=ca(1);
-A zOujSS
cbeybcb(1:ibfbc,j)=cb(1);
d.HcO^
dahzxbcb(1:iefbc,j)=da(1);
';v1AX}5q
dbhzxbcb(1:iefbc,j)=db(1);
_fSBb<
end
6"; ITU^v
% LEFT region
Ss_}@p ^
caeybcl(1,1:je)=1.0;
/EuH2cy$l
cbeybcl(1,1:je)=0.0;
O{0it6
for i=2:iebc
qae|?z
x1=(iebc-i+1.5)*dx;
txE+A/>i9
x2=(iebc-i+0.5)*dx;
d{"@<0i?
sigmax=bcfactor*(x1^(orderbc+1)-x2^(orderbc+1));
s+(@UUl
ca1=exp(-sigmax*dt/(epsz*eps(1)));
@8$z2
cb1=(1-ca1)/(sigmax*dx);
VfozqUf
caeybcl(i,1:je)=ca1;
"BZ@m:I6hy
cbeybcl(i,1:je)=cb1;
g>l+oH[Tv|
caeybcf(i,1:jebc)=ca1;
v]Aop<KLX
cbeybcf(i,1:jebc)=cb1;
zrf tF2U
caeybcb(i,1:jebc)=ca1;
v0?SN>fZ
cbeybcb(i,1:jebc)=cb1;
"Q{l])N
end
}F"98s W
sigmax=bcfactor*(0.5*dx)^(orderbc+1);
EWr7eH
ca1=exp(-sigmax*dt/(epsz*eps(1)));
JKy~'>Q
cb1=(1-ca1)/(sigmax*dx);
)?pnV":2Y
caey(1,1:je)=ca1;
)j\_*SoH
cbey(1,1:je)=cb1;
Pm,.[5uc
caeybcf(iebc+1,1:jebc)=ca1;
nxNHf3
cbeybcf(iebc+1,1:jebc)=cb1;
%>5>wP
caeybcb(iebc+1,1:jebc)=ca1;
=-,'LOE
cbeybcb(iebc+1,1:jebc)=cb1;
#jd.i
for i=1:iebc
*f_A:`:
x1=(iebc-i+1)*dx;
z:Z-2WV2o
x2=(iebc-i)*dx;
IR#BSfBZ
sigmax=bcfactor*(x1^(orderbc+1)-x2^(orderbc+1));
x=+>J$~Pb
sigmaxs=sigmax*(muz/(epsz*eps(1)));
jAU&h@
da1=exp(-sigmaxs*dt/muz);
Y6Ux*vhK
db1=(1-da1)/(sigmaxs*dx);
X yiaRW
dahzxbcl(i,1:je)=da1;
,HI%ym
dbhzxbcl(i,1:je)=db1;
yDWBrN._
dahzxbcf(i,1:jebc)=da1;
\BN$WV
dbhzxbcf(i,1:jebc)=db1;
Cy*.pzCi
dahzxbcb(i,1:jebc)=da1;
vn!3Z! dm(
dbhzxbcb(i,1:jebc)=db1;
E(vO^)#
caexbcl(i,2:je)=ca(1);
0a bQY
cbexbcl(i,2:je)=cb(1);
k1ja ([Q
dahzybcl(i,1:je)=da(1);
K/j u=>
dbhzybcl(i,1:je)=db(1);
^bP`Iv
end
uB#U( jl
% RIGHT region
57=d;Yg e
caeybcr(ibbc,1:je)=1.0;
n oM=8C&U
cbeybcr(ibbc,1:je)=0.0;
"eqzn KT%u
for i=2:iebc
lQBEq"7$
x1=(i-0.5)*dx;
LNyrIk/1
x2=(i-1.5)*dx;
:Zx|=
sigmax=bcfactor*(x1^(orderbc+1)-x2^(orderbc+1));
b`@C #qB
ca1=exp(-sigmax*dt/(epsz*eps(1)));
- Ry+WS=
cb1=(1-ca1)/(sigmax*dx);
MTKNIv|
caeybcr(i,1:je)=ca1;
;FW <%
cbeybcr(i,1:je)=cb1;
lRNm &3:-
caeybcf(i+iebc+ie,1:jebc)=ca1;
*")*w> R
cbeybcf(i+iebc+ie,1:jebc)=cb1;
E AZX
caeybcb(i+iebc+ie,1:jebc)=ca1;
2dcvB]T!
cbeybcb(i+iebc+ie,1:jebc)=cb1;
!Q*w]
end
lfre-pS+
sigmax=bcfactor*(0.5*dx)^(orderbc+1);
DR,7rT{$
ca1=exp(-sigmax*dt/(epsz*eps(1)));
vB}c6A4'U
cb1=(1-ca1)/(sigmax*dx);
,aa 4Kh
caey(ib,1:je)=ca1;
g7a446QR\K
cbey(ib,1:je)=cb1;
cpALs1j:
caeybcf(iebc+ib,1:jebc)=ca1;
O6vxp?:^
cbeybcf(iebc+ib,1:jebc)=cb1;
>^GV #z
caeybcb(iebc+ib,1:jebc)=ca1;
3W]gn8
cbeybcb(iebc+ib,1:jebc)=cb1;
U| VL+9#hd
for i=1:iebc
`*B V@
x1=i*dx;
L`X5\D'X
x2=(i-1)*dx;
w%8y5v5
sigmax=bcfactor*(x1^(orderbc+1)-x2^(orderbc+1));
CWocb=E
sigmaxs=sigmax*(muz/(epsz*eps(1)));
{dm>]@"S
da1=exp(-sigmaxs*dt/muz);
XH@(V4J(.
db1=(1-da1)/(sigmaxs*dx);
?$T ^L"~
dahzxbcr(i,1:je) = da1;
([}08OW@
dbhzxbcr(i,1:je) = db1;
x)GheM^
dahzxbcf(i+ie+iebc,1:jebc)=da1;
Pq8oK'z-
dbhzxbcf(i+ie+iebc,1:jebc)=db1;
GM?s8yZ<
dahzxbcb(i+ie+iebc,1:jebc)=da1;
,B_c
dbhzxbcb(i+ie+iebc,1:jebc)=db1;
H7z)OaM
caexbcr(i,2:je)=ca(1);
<oV[[wl
cbexbcr(i,2:je)=cb(1);
jT}={[9b
dahzybcr(i,1:je)=da(1);
8A.7q
dbhzybcr(i,1:je)=db(1);
I "O^.VC
end
Z) 2d4:uv
%***********************************************************************
ZWo~!Z [Y
% Movie initialization
miu?X !
%***********************************************************************
MkL2I+*
subplot(3,1,1),pcolor(ex');
8?Ju\W
shading flat;
N5,LHO
caxis([-80.0 80.0]);
7 4MxU
axis([1 ie 1 jb]);
cjJfxD&q
colorbar;
!|UX4
axis image;
d9BFeq8
axis off;
K3M.ZRh\;`
title(['Ex at time step = 0']);
~J&-~<%P}
subplot(3,1,2),pcolor(ey');
%ut8/T
shading flat;
q7f`:P9~
caxis([-80.0 80.0]);
&(A#F[ =0
axis([1 ib 1 je]);
h`dQOH#
colorbar;
,[zSz8R
axis image;
V7r_Ubg@K
axis off;
0 !{X8>x
title(['Ey at time step = 0']);
Sk/@w[
subplot(3,1,3),pcolor(hz');
ENIg_s4
shading flat;
[P =P8-5
caxis([-0.2 0.2]);
)#cZ& O
axis([1 ie 1 je]);
jC4>%!{m
colorbar;
()bQmNqmO=
axis image;
2xf lRks
axis off;
#v<`|_
title(['Hz at time step = 0']);
M\a{2f7'n
rect=get(gcf,'Position');
;?tH8jf>
rect(1:2)=[0 0];
Pd\4hy
M=moviein(nmax/4,gcf,rect);
6]~/`6Dub
%***********************************************************************
4=/jh:h
% BEGIN TIME-STEPPING LOOP
PfRA\
%***********************************************************************
P.C?/7$7Z+
for n=1:nmax
*DC/O( 0
%***********************************************************************
FHw%ynC
% Update electric fields (EX and EY) in main grid
A|S)cr8z
%***********************************************************************
f? @Qt<+k
ex(:,2:je)=caex(:,2:je).*ex(:,2:je)+...
_uLpU4# ?
cbex(:,2:je).*(hz(:,2:je)-hz(:,1:je-1));
>Zs!
ey(2:ie,:)=caey(2:ie,:).*ey(2:ie,:)+...
-grmmE]/
cbey(2:ie,:).*(hz(1:ie-1,:)-hz(2:ie,:));
#dL,d6a
%***********************************************************************
`bfUP s
% Update EX in PML regions
G<D8a2q
%***********************************************************************
kN Ll|in@
% FRONT
GDSXBa*7
exbcf(:,2:jebc)=caexbcf(:,2:jebc).*exbcf(:,2:jebc)-...
wT\BA'VQ
cbexbcf(:,2:jebc).*(hzxbcf(:,1:jebc-1)+hzybcf(:,1:jebc-1)-...
j1%8r*Jj
hzxbcf(:,2:jebc)-hzybcf(:,2:jebc));
&K[sb%
ex(1:ie,1)=caex(1:ie,1).*ex(1:ie,1)-...
'z AvQm
cbex(1:ie,1).*(hzxbcf(ibbc:iebc+ie,jebc)+...
n qO*z<
hzybcf(ibbc:iebc+ie,jebc)-hz(1:ie,1));
|1(x2x%}D^
% BACK
Ux*xz|^
exbcb(:,2:jebc-1)=caexbcb(:,2:jebc-1).*exbcb(:,2:jebc-1)-...
kSzap+ nB?
cbexbcb(:,2:jebc-1).*(hzxbcb(:,1:jebc-2)+hzybcb(:,1:jebc-2)-...
2[ofz}k]r)
hzxbcb(:,2:jebc-1)-hzybcb(:,2:jebc-1));
xc 1d[dCdp
ex(1:ie,jb)=caex(1:ie,jb).*ex(1:ie,jb)-...
t;6<k7h
cbex(1:ie,jb).*(hz(1:ie,jb-1)-hzxbcb(ibbc:iebc+ie,1)-...
"Zh,;)hS
hzybcb(ibbc:iebc+ie,1));
grzmW4Cw
% LEFT
{$hWz (
exbcl(:,2:je)=caexbcl(:,2:je).*exbcl(:,2:je)-...
6qFzo1LO
cbexbcl(:,2:je).*(hzxbcl(:,1:je-1)+hzybcl(:,1:je-1)-...
~`FRU/@r
hzxbcl(:,2:je)-hzybcl(:,2:je));
^tGAJ_b79
exbcl(:,1)=caexbcl(:,1).*exbcl(:,1)-...
@jm +TW
cbexbcl(:,1).*(hzxbcf(1:iebc,jebc)+hzybcf(1:iebc,jebc)-...
R/Bjc}J'
hzxbcl(:,1)-hzybcl(:,1));
; F'IS/ttX
exbcl(:,jb)=caexbcl(:,jb).*exbcl(:,jb)-...
v:QUwW
cbexbcl(:,jb).*(hzxbcl(:,je)+hzybcl(:,je)-...
T`":Q1n
hzxbcb(1:iebc,1)-hzybcb(1:iebc,1));
q,L>PN+W
% RIGHT
))f@9m
exbcr(:,2:je)=caexbcr(:,2:je).*exbcr(:,2:je)-...
el*|@#k}
cbexbcr(:,2:je).*(hzxbcr(:,1:je-1)+hzybcr(:,1:je-1)-...
&)tiO>B^6
hzxbcr(:,2:je)-hzybcr(:,2:je));
os"R'GYmf
exbcr(:,1)=caexbcr(:,1).*exbcr(:,1)-...
5z,q~CU
cbexbcr(:,1).*(hzxbcf(1+iebc+ie:iefbc,jebc)+...
R}gdN-941
hzybcf(1+iebc+ie:iefbc,jebc)-...
*3`R W<Z
hzxbcr(:,1)-hzybcr(:,1));
5=I({=/>
exbcr(:,jb)=caexbcr(:,jb).*exbcr(:,jb)-...
L?+N:G
cbexbcr(:,jb).*(hzxbcr(:,je)+hzybcr(:,je)-...
W+1nf:AI.
hzxbcb(1+iebc+ie:iefbc,1)-...
r=0PW_r:
hzybcb(1+iebc+ie:iefbc,1));
iYgVSVNg
%***********************************************************************
[|oG}'Xz
% Update EY in PML regions
.1RQ}Ro,<
%***********************************************************************
3 0[Xkz
% FRONT
gfj_]
eybcf(2:iefbc,:)=caeybcf(2:iefbc,:).*eybcf(2:iefbc,:)-...
Ja:4EU$Lu
cbeybcf(2:iefbc,:).*(hzxbcf(2:iefbc,:)+hzybcf(2:iefbc,:)-...
`e<IO_cg
hzxbcf(1:iefbc-1,:)-hzybcf(1:iefbc-1,:));
m(U.BXo
% BACK
!DFTg4xb
eybcb(2:iefbc,:)=caeybcb(2:iefbc,:).*eybcb(2:iefbc,:)-...
EQ,`6UT>
cbeybcb(2:iefbc,:).*(hzxbcb(2:iefbc,:)+hzybcb(2:iefbc,:)-...
@9| jY1
hzxbcb(1:iefbc-1,:)-hzybcb(1:iefbc-1,:));
<q$Tk,
% LEFT
:38h)9>RK
eybcl(2:iebc,:)=caeybcl(2:iebc,:).*eybcl(2:iebc,:)-...
R9R~$@~G
cbeybcl(2:iebc,:).*(hzxbcl(2:iebc,:)+hzybcl(2:iebc,:)-...
@i!+Z
hzxbcl(1:iebc-1,:)-hzybcl(1:iebc-1,:));
UTh2?Rh/
ey(1,:)=caey(1,:).*ey(1,:)-...
XXum2eA
cbey(1,:).*(hz(1,:)-hzxbcl(iebc,:)-hzybcl(iebc,:));
v4s4D1}
% RIGHT
X^N6s"2
eybcr(2:iebc,:)=caeybcr(2:iebc,:).*eybcr(2:iebc,:)-...
)VkVZf | S
cbeybcr(2:iebc,:).*(hzxbcr(2:iebc,:)+hzybcr(2:iebc,:)-...
2=fM\G
hzxbcr(1:iebc-1,:)-hzybcr(1:iebc-1,:));
s 0Uid&qE
ey(ib,:)=caey(ib,:).*ey(ib,:)-...
"h_f-vP
cbey(ib,:).*(hzxbcr(1,:)+hzybcr(1,:)- hz(ie,:));
>IrQhSF
X-(( [A
%***********************************************************************
jn|NrvrX
% Update magnetic fields (HZ) in main grid
GqL&hbpi
%***********************************************************************
O=7S=Rm4&
hz(1:ie,1:je)=dahz(1:ie,1:je).*hz(1:ie,1:je)+...
'Xwv,
dbhz(1:ie,1:je).*(ex(1:ie,2:jb)-ex(1:ie,1:je)+...
F\xIVY
ey(1:ie,1:je)-ey(2:ib,1:je));
y,`n9[$K\
hz(is,js)=source(n);
e8("G[P>
,.p 36ZLP
%***********************************************************************
y/Y}C.IWp)
% Update HZX in PML regions
pJ}U'*Z2
%***********************************************************************
j!i*&
% FRONT
,]wQ]fpt
hzxbcf(1:iefbc,:)=dahzxbcf(1:iefbc,:).*hzxbcf(1:iefbc,:)-...
}.)R#hG?
dbhzxbcf(1:iefbc,:).*(eybcf(2:ibfbc,:)-eybcf(1:iefbc,:));
W7WHDL^
% BACK
V'=;M[&