登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
Taflove的FDTD书附带程序的问题请教
发帖
回复
2001
阅读
4
回复
[
求助
]
Taflove的FDTD书附带程序的问题请教
离线
awell
UID :8837
注册:
2008-03-03
登录:
2010-05-28
发帖:
66
等级:
仿真一级
0楼
发表于: 2009-02-26 20:18:55
刚开始学习FDTD,看了Taflove的FDTD书附带程序里的一维FDTD算法,有些不明白的地方,想请教各位,请大家不吝赐教!
E7D DMU
1。scfact=dt/muz/dx;中的scfact有什么作用?为什么要设这个参数呢,有何实际意义?
FW4 hqgE@
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));后一个是我在课本上找到的公式。为什么会用前一个!
frt?*|:
=zKp(_[D
本人很菜,希望高手能耐心赐教,不胜感激!谢谢
yLP0w^Q
qCMcN<:>
附上源程序:
6~s,j({^
%***********************************************************************
[*(MI 9WM
% 1-D FDTD code with simple radiation boundary conditions
Jz6PqU|=
%***********************************************************************
7blZAA?-
%
tj0vB]c
% Program author: Susan C. Hagness
/zWWUl`:
% Department of Electrical and Computer Engineering
=[,adB
% University of Wisconsin-Madison
v3p..A~XZ.
% 1415 Engineering Drive
$W2AiE[Wm
% Madison, WI 53706-1691
Q.Acmht#
% 608-265-5739
8"@<s?0\"
%
hagness@engr.wisc.edu
q%"nk
%
SO%5ts
% Date of this version: February 2000
h$!qb'|
%
/D q]=P
% This MATLAB M-file implements the finite-difference time-domain
*=8)]_=f
% solution of Maxwell's curl equations over a one-dimensional space
C{D2mSS
% lattice comprised of uniform grid cells.
;"3Mm$
%
,#A,+!4
% To illustrate the algorithm, a sinusoidal wave (1GHz) propagating
tv0xfAV
% in a nonpermeable lossy medium (epsr=1.0, sigma=5.0e-3 S/m) is
1#V0g Q
% modeled. The simplified finite difference system for nonpermeable
\?o%<c5{
% media (discussed in Section 3.6.6 of the text) is implemented.
wcOAyo5(n
%
R8E<;^?j
% The grid resolution (dx = 1.5 cm) is chosen to provide 20
nF-FoO98
% samples per wavelength. The Courant factor S=c*dt/dx is set to
\yqiv"'
% the stability limit: S=1. In 1-D, this is the "magic time step."
u0,~pJvX
%
C9z{8 ;
% The computational domain is truncated using the simplest radiation
Vl EkT9^:
% boundary condition for wave propagation in free space:
s-*XAnot
%
OjHBzrK
% Ez(imax,n+1) = Ez(imax-1,n)
Pzqgg43Xf
%
ru&RL HFV
% To execute this M-file, type "fdtd1D" at the MATLAB prompt.
\@xnC$dd/
% This M-file displays the FDTD-computed Ez and Hy fields at every
(#:Si~3
% time step, and records those frames in a movie matrix, M, which is
Q*wx6Pu8
% played at the end of the simulation using the "movie" command.
#O~Y[''C5X
%
}8svd#S+
%***********************************************************************
%/s1ma6q
clear
(mEZ4yM
%***********************************************************************
KQqlM
% Fundamental constants
u32<=Q[
%***********************************************************************
]:njP3r
cc=2.99792458e8; %speed of light in free space
XEuv aM
muz=4.0*pi*1.0e-7; %permeability of free space
jC oZm(bi
epsz=1.0/(cc*cc*muz); %permittivity of free space
U+ 8[Ia(t
freq=1.0e+9; %frequency of source excitation
bhI8b/
lambda=cc/freq; %wavelength of source excitation
&.}zZ/
omega=2.0*pi*freq;
|LQmdgVr$
%***********************************************************************
97g\nq<
% Grid parameters
Mf *qr9*
%***********************************************************************
<[q)2 5RL
ie=200; %number of grid cells in x-direction
4@5<B
ib=ie+1;
~7m+cWC-+
dx=lambda/20.0; %space increment of 1-D lattice
8177x7UG2[
dt=dx/cc; %time step
,kP{3.#Q
omegadt=omega*dt;
f9$98SI
nmax=round(12.0e-9/dt); %total number of time steps
7+c@pEU]
%***********************************************************************
bIH2cJ
% Material parameters
G$Dg*<
%***********************************************************************
~UnfS};U
eps=1.0;
@f$P*_G
sig=5.0e-3;
q<1@ut
%***********************************************************************
>[p+L='
% Updating coefficients for space region with nonpermeable media
,"/_G
%***********************************************************************
<D=%55
scfact=dt/muz/dx;
vL><Y.kOEs
ca=(1.0-(dt*sig)/(2.0*epsz*eps))/(1.0+(dt*sig)/(2.0*epsz*eps));
TQ BL!w
cb=scfact*(dt/epsz/eps/dx)/(1.0+(dt*sig)/(2.0*epsz*eps));
A=,m
%***********************************************************************
AkF1Hj
% Field arrays
5t PmrWZ
%***********************************************************************
D H/1 :H
ez(1:ib)=0.0;
Y,a.9AWw)
hy(1:ie)=0.0;
1/gh\9h
%***********************************************************************
UeRenp
% Movie initialization
xj}N;FWo
%***********************************************************************
eI[z%j[Y*
x=linspace(dx,ie*dx,ie);
Q.N^1?(>k
subplot(2,1,1),plot(x,ez(1:ie)/scfact,'r'),axis([0 3 -1 1]);
+vQyHo
ylabel('EZ');
YONg1.^!(
subplot(2,1,2),plot(x,hy,'b'),axis([0 3 -3.0e-3 3.0e-3]);
O-7 \qz
xlabel('x (meters)');ylabel('HY');
(/)JnBy0
rect=get(gcf,'Position');
h m"B kOA
rect(1:2)=[0 0];
]*@7o^4i
M=moviein(nmax/2,gcf,rect);
5pDxFs=v
%***********************************************************************
-,rl[1ZYZ
% BEGIN TIME-STEPPING LOOP
!=-l760
%***********************************************************************
.`iq+i~
for n=1:nmax
c(~M<nL0
%***********************************************************************
~(^[TuJC
% Update electric fields
a5)+5
%***********************************************************************
M,9WF)p)V
ez(1)=scfact*sin(omegadt*n);
zJ\I%7h*
rbc=ez(ie);
uIR_p\)
ez(2:ie)=ca*ez(2:ie)+cb*(hy(2:ie)-hy(1:ie-1));
.-r 1.'.A
ez(ib)=rbc;
mF_/Rhu
%***********************************************************************
BG|Kw)z*KM
% Update magnetic fields
.OjJK?
%***********************************************************************
0 cQf_o
hy(1:ie)=hy(1:ie)+ez(2:ib)-ez(1:ie);
aw,8'N)
%************************************ ..
0}ZuF.
&K7g8x"x.
未注册仅能浏览
部分内容
,查看
全部内容及附件
请先
登录
或
注册
共
条评分
离线
herosword
UID :3621
注册:
2007-07-01
登录:
2019-11-03
发帖:
30
等级:
仿真二级
1楼
发表于: 2009-03-02 10:12:48
你看谁的程序应结合谁的书看,因为各个人编程时离散方程后设置的迭代系数形式上可能不一样。
yeW|Ux:
这个程序你最好看Allen的第三版的书(第二版)也可以
tkd2AMkh!
1.是用来归一化电场的一个表示式。第三版P71页(3.37)式。
Y!SD^Ie7!
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!~
K+PzTGWq^
wq_463 ,我的QQ是15469459!一起学习交流!
共
条评分
发帖
回复