三维电磁场FDTD程序PEC边界.docx
《三维电磁场FDTD程序PEC边界.docx》由会员分享,可在线阅读,更多相关《三维电磁场FDTD程序PEC边界.docx(15页珍藏版)》请在三一办公上搜索。
1、三维电磁场FDTD程序PEC边界三维电磁场FDTD程序PEC边界 % FDTD Main Function Jobs to Workers % %* % 3-D FDTD code with PEC boundaries %* % % This MATLAB M-file implements the finite-difference time-domain % solution of Maxwells curl equations over a three-dimensional % Cartesian space lattice comprised of uniform cubic gr
2、id cells. % % To illustrate the algorithm, an air-filled rectangular cavity % resonator is modeled. The length, width, and height of the % cavity are X cm (x-direction), Y cm (y-direction), and % Z cm (z-direction), respectively. % % The computational domain is truncated using PEC boundary % conditi
3、ons: % ex(i,j,k)=0 on the j=1, j=jb, k=1, and k=kb planes % ey(i,j,k)=0 on the i=1, i=ib, k=1, and k=kb planes % ez(i,j,k)=0 on the i=1, i=ib, j=1, and j=jb planes % These PEC boundaries form the outer lossless walls of the cavity. % % The cavity is excited by an additive current source oriented % a
4、long the z-direction. The source waveform is a differentiated % Gaussian pulse given by % J(t)=-J0*(t-t0)*exp(-(t-t0)2/tau2), % where tau=50 ps. The FWHM spectral bandwidth of this zero-dc- % content pulse is approximately 7 GHz. The grid resolution % (dx = 2 mm) was chosen to provide at least 10 sa
5、mples per % wavelength up through 15 GHz. % % To execute this M-file, type fdtd3D at the MATLAB prompt. % This M-file displays the FDTD-computed Ez fields at every other % time step, and records those frames in a movie matrix, M, which % is played at the end of the simulation using the movie command
6、. % %* function Ex,Ey,Ez=FDTD3D_Main(handles) global SimRunStop % if isdir(C:MATLAB7workcavityfigures) % mkdir C:MATLAB7workcavityfigures % end %* % Grid Partition %* p.ip = get(handles.XdirPar,Value); p.jp = get(handles.YdirPar,Value); p.PN = get(handles.PartNo,Value); %* % Grid Dimensons %* ie = g
7、et(handles.xslider,Value); %number of grid cells in x-direction je = get(handles.yslider,Value); %number of grid cells in y-direction ke = get(handles.zslider,Value); %number of grid cells in z-direction ib=ie+1; jb=je+1; kb=ke+1; %* % All Domains Fields Ini. %* Ex=zeros(ie,jb,kb); Ey=zeros(ib,je,kb
8、); Ez=zeros(ib,jb,ke); Hx=zeros(ib,je,ke); Hy=zeros(ie,jb,ke); Hz=zeros(ie,je,kb); %* % Fundamental constants %* param.cc=2.99792458e8; %speed of light in free space param.muz=4.0*pi*1.0e-7; %permeability of free space param.epsz = 1.0/(param.cc*param.cc*param.muz); %permittivity of free space %* %
9、Grid parameters %* param.is = get(handles.xsource,Value); %location of z-directed current source param.js = get(handles.ysource,Value); %location of z-directed current source param.kobs = floor(ke/2); %Surface of observation param.dx = get(handles.CellSize,Value); %space increment of cubic lattice p
10、aram.dt = param.dx/(2.0*param.cc); %time step param.nmax = get(handles.TimeStep,Value); %total number of time steps %* % Differentiated Gaussian pulse excitation %* param.rtau=get(handles.tau,Value)*100e-12; param.tau=param.rtau/param.dt; param.ndelay=3*param.tau; param.Amp = get(handles.sourceamp,V
11、alue)*10e11; param.srcconst=-param.dt*param.Amp; %* % Material parameters %* param.eps= get(handles.epsilon,Value); param.sig= get(handles.sigma,Value); %* % Updating coefficients %* param.ca=(1.0-(param.dt*param.sig)/(2.0*param.epsz*param.eps)/(1.0+(param.dt*param.sig)/(2.0*param.epsz*param.eps); p
12、aram.cb=(param.dt/param.epsz/param.eps/param.dx)/(1.0+(param.dt*param.sig)/(2.0*param.epsz*param.eps); param.da=1.0; param.db=param.dt/param.muz/param.dx; %* % Calling FDTD Algorithm %* ex=zeros(ib,jb,kb); ey=zeros(ib,jb,kb); ez=zeros(ib,jb,kb); hx=zeros(ib,jb,kb); hy=zeros(ib,jb,kb); hz=zeros(ib,jb
13、,kb); X,Y,Z = meshgrid(1:ib,1:jb,1:kb); % Grid coordinates Psim = zeros(param.nmax,1); Panl = zeros(param.nmax,1); if (p.ip = 1)&(p.jp = 0) x = ceil(ie/p.PN) param.a = 1:x-1:ie-x; param.b = x+1:x-1:ie; param.c = 1,1; param.d = je,je; m2 = 1; for n=1:1:param.nmax for m1=1:1:p.PN ex,ey,ez=Efields(para
14、m,handles,ex,ey,ez,hx,hy,hz,ie,je,ke,ib,jb,kb,n,m1,m2,p); hx,hy,hz = Hfields(param,hx,hy,hz,ex,ey,ez,ie,je,ke,ib,jb,kb,n,m1,m2,p); end Psim(n),Panl(n) = Cavity_Power(param,handles,ex,ey,ez,n); field_viz(param,handles,ex,ey,ez,X,Y,Z,n,Psim,Panl,p); Dyn_FFT pause(0.01); end elseif (p.ip = 0)&(p.jp = 1
15、) y = ceil(je/p.PN); param.c = 1:y-1:je-y; param.d = y+1:y-1:je; param.a = 1,1; param.b = ie,ie; m1 = 1; for n=1:1:param.nmax for m2=1:1:p.PN ex,ey,ez=Efields(param,handles,ex,ey,ez,hx,hy,hz,ie,je,ke,ib,jb,kb,n,m1,m2,p); hx,hy,hz = Hfields(param,hx,hy,hz,ex,ey,ez,ie,je,ke,ib,jb,kb,n,m1,m2,p); end Ps
16、im(n),Panl(n) = Cavity_Power(param,handles,ex,ey,ez,n); field_viz(param,handles,ex,ey,ez,X,Y,Z,n,Psim,Panl,p); pause(0.01); end elseif (p.ip = 1)&(p.jp = 1) x = ceil(ie/p.PN); param.a = 1:x-1:ie-x; param.b = x+1:x-1:ie; y = ceil(je/p.PN); param.c = 1:y-1:je-y; param.d = y+1:y-1:je; for n=1:1:param.n
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 三维 电磁场 FDTD 程序 PEC 边界
链接地址:https://www.31ppt.com/p-3204877.html