登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
Taflove的FDTD书附带程序的问题请教
发帖
回复
2000
阅读
4
回复
[
求助
]
Taflove的FDTD书附带程序的问题请教
离线
awell
UID :8837
注册:
2008-03-03
登录:
2010-05-28
发帖:
66
等级:
仿真一级
0楼
发表于: 2009-02-26 20:18:55
刚开始学习FDTD,看了Taflove的FDTD书附带程序里的一维FDTD算法,有些不明白的地方,想请教各位,请大家不吝赐教!
hb! ln7
1。scfact=dt/muz/dx;中的scfact有什么作用?为什么要设这个参数呢,有何实际意义?
vfXJYw+6_
2.cb=scfact*(dt/epsz/eps/dx)/(1.0+(dt*sig)/(2.0*epsz*eps));中的计算方法为什么是这样的而不是cb=(dt/(epsz*eps))/(1.0+(dt*sig)/(2.0*epsz*eps));后一个是我在课本上找到的公式。为什么会用前一个!
{{E jMBg{
6To:T[ z#
本人很菜,希望高手能耐心赐教,不胜感激!谢谢
QSmJ`Bm
?48AY6
附上源程序:
wA r~<
%***********************************************************************
F;a3
% 1-D FDTD code with simple radiation boundary conditions
JmjxGcG
%***********************************************************************
BVAr&cu
%
Vr\Q`H.
% Program author: Susan C. Hagness
-,/3"}<^78
% Department of Electrical and Computer Engineering
,F}r@
% University of Wisconsin-Madison
!2tw, QM
% 1415 Engineering Drive
b8cVnP
% Madison, WI 53706-1691
0dh#/
% 608-265-5739
eKJ:?Lxv;
%
hagness@engr.wisc.edu
Tc,$TCF
%
Bhx<g&|j
% Date of this version: February 2000
o4'Wr
%
/=trj5h
% This MATLAB M-file implements the finite-difference time-domain
Oc^m_U8>^
% solution of Maxwell's curl equations over a one-dimensional space
;[caiMA-
% lattice comprised of uniform grid cells.
&GU@8
%
\kk!Dz*H
% To illustrate the algorithm, a sinusoidal wave (1GHz) propagating
bx7\QU+
% in a nonpermeable lossy medium (epsr=1.0, sigma=5.0e-3 S/m) is
F8 ?uQP8
% modeled. The simplified finite difference system for nonpermeable
hpjUkGm5
% media (discussed in Section 3.6.6 of the text) is implemented.
~B*~'I9b*
%
<p)Z/
% The grid resolution (dx = 1.5 cm) is chosen to provide 20
ixzTJ]y u
% samples per wavelength. The Courant factor S=c*dt/dx is set to
<c\]Ct
% the stability limit: S=1. In 1-D, this is the "magic time step."
-s89)lUkS
%
=Pj@g/25u
% The computational domain is truncated using the simplest radiation
>3+FZ@.iT
% boundary condition for wave propagation in free space:
@9<S*
%
YJc%h@ _=]
% Ez(imax,n+1) = Ez(imax-1,n)
a6qwL4
%
lDlj+fK
% To execute this M-file, type "fdtd1D" at the MATLAB prompt.
= uk`pj[l
% This M-file displays the FDTD-computed Ez and Hy fields at every
L^jaBl
% time step, and records those frames in a movie matrix, M, which is
yP%o0n/"x
% played at the end of the simulation using the "movie" command.
u/#&0_ P
%
u6p5:oJj,
%***********************************************************************
Lxz
clear
K{N%kk%F
%***********************************************************************
(tpof 5a
% Fundamental constants
e^Aa!
%***********************************************************************
5=m3J!?
cc=2.99792458e8; %speed of light in free space
XW^8A77H
muz=4.0*pi*1.0e-7; %permeability of free space
v}f&q!
epsz=1.0/(cc*cc*muz); %permittivity of free space
:Dt\:`(r'
freq=1.0e+9; %frequency of source excitation
bk0Y
lambda=cc/freq; %wavelength of source excitation
gjQ=8&i
omega=2.0*pi*freq;
lc"qqt
%***********************************************************************
Y!;gQeC
% Grid parameters
p6 <}3m$
%***********************************************************************
9,w}Xe=C
ie=200; %number of grid cells in x-direction
Ny B&uf
ib=ie+1;
LjC6?a_?l
dx=lambda/20.0; %space increment of 1-D lattice
0w'|d@*wV
dt=dx/cc; %time step
`LE^:a:8,
omegadt=omega*dt;
) (+)Q'*
nmax=round(12.0e-9/dt); %total number of time steps
)X~#n
%***********************************************************************
?-d Ain1w
% Material parameters
QQT G9s
%***********************************************************************
PlF!cr7:4
eps=1.0;
:;q>31:h
sig=5.0e-3;
A<2I!
%***********************************************************************
s><IykIi
% Updating coefficients for space region with nonpermeable media
.E#<fz
%***********************************************************************
XL&hs+Y
scfact=dt/muz/dx;
@Mzz2&(dU
ca=(1.0-(dt*sig)/(2.0*epsz*eps))/(1.0+(dt*sig)/(2.0*epsz*eps));
2q/nAQ+
cb=scfact*(dt/epsz/eps/dx)/(1.0+(dt*sig)/(2.0*epsz*eps));
N:OD0m%`)
%***********************************************************************
3y/1!A3
% Field arrays
&7fY_~ )B
%***********************************************************************
_ r~+p
ez(1:ib)=0.0;
m:b^,2"g
hy(1:ie)=0.0;
tnN'V
%***********************************************************************
(lieiye^
% Movie initialization
mZ~mf->%
%***********************************************************************
2|$lk8 /,
x=linspace(dx,ie*dx,ie);
,zG <7~m
subplot(2,1,1),plot(x,ez(1:ie)/scfact,'r'),axis([0 3 -1 1]);
8znj~7}#
ylabel('EZ');
\m%J`{Mt
subplot(2,1,2),plot(x,hy,'b'),axis([0 3 -3.0e-3 3.0e-3]);
`(!W s\:
xlabel('x (meters)');ylabel('HY');
O1|B3M[P
rect=get(gcf,'Position');
ot]>}[
rect(1:2)=[0 0];
x3gwG)Sf
M=moviein(nmax/2,gcf,rect);
.r7D)xNa@
%***********************************************************************
XynU/Go,
% BEGIN TIME-STEPPING LOOP
Zo'/^S
%***********************************************************************
;x,+*%
for n=1:nmax
)-)ss"\+Ju
%***********************************************************************
bd} r#^'K
% Update electric fields
T.J`S(oI
%***********************************************************************
pn|p(6
ez(1)=scfact*sin(omegadt*n);
y#&$f
rbc=ez(ie);
\y[Bu^tk
ez(2:ie)=ca*ez(2:ie)+cb*(hy(2:ie)-hy(1:ie-1));
^v ]UcnB0
ez(ib)=rbc;
@X K>
%***********************************************************************
N?\bBt@
% Update magnetic fields
1!X1wCT
%***********************************************************************
4}+xeGA$
hy(1:ie)=hy(1:ie)+ez(2:ib)-ez(1:ie);
fE'-.nA+
%************************************ ..
^GE^Q\&D&
qo)Q}0
未注册仅能浏览
部分内容
,查看
全部内容及附件
请先
登录
或
注册
共
条评分
离线
herosword
UID :3621
注册:
2007-07-01
登录:
2019-11-03
发帖:
30
等级:
仿真二级
1楼
发表于: 2009-03-02 10:12:48
你看谁的程序应结合谁的书看,因为各个人编程时离散方程后设置的迭代系数形式上可能不一样。
Y0 @'za^y
这个程序你最好看Allen的第三版的书(第二版)也可以
)?F$-~7
1.是用来归一化电场的一个表示式。第三版P71页(3.37)式。
o G(0i
2.P72(3.38)和P67(3.31)
共
1
条评分
gwzhao
技术分
+1
积极参与讨论+技术分 论坛感谢您的参与
2009-03-02
离线
wq_463
UID :20925
注册:
2008-11-06
登录:
2021-04-22
发帖:
227
等级:
仿真三级
2楼
发表于: 2009-03-05 15:43:37
呵呵,我以前也被这个问题困惑原来如此,谢谢
共
条评分
离线
wq_463
UID :20925
注册:
2008-11-06
登录:
2021-04-22
发帖:
227
等级:
仿真三级
3楼
发表于: 2009-03-05 15:43:57
楼主留个qq咱们可以多交流
共
条评分
离线
awell
UID :8837
注册:
2008-03-03
登录:
2010-05-28
发帖:
66
等级:
仿真一级
4楼
发表于: 2009-03-23 10:54:10
非常感谢herosword!~
9#Aipu\
wq_463 ,我的QQ是15469459!一起学习交流!
共
条评分
发帖
回复