登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
发一个电磁波在梯度等离子体中传播的程序 ..
发帖
回复
1
2
4197
阅读
15
回复
[
RFEDA原创
]
发一个电磁波在梯度等离子体中传播的程序回馈一下论坛
离线
itnice
UID :19155
注册:
2008-10-14
登录:
2009-03-30
发帖:
29
等级:
仿真一级
0楼
发表于: 2008-10-22 11:10:53
— 本帖被 tensor 设置为精华(2008-10-22) —
前些天一直在赶计算电磁学的期中大作业,由于本人将来的研究方向可能是等离子,所以就选了电磁波在等离子体中传播这个题目。由于等离子物理这门课这学期才开始上,原理还不是太理解,随便找了些公式来拼凑,但发现自己做的仿真老出问题。后来参考了gwzhao前辈的一维程序,并经其指点发觉CFL条件在等离子中是不稳定的,顿时豁然开朗,马上把程序写好了。在此感谢一下gwzhao前辈,并把程序贴出来回馈一下论坛。
T )QZ9a
oSGx7dj+
clear all;
/ {|<3CEe
close all;
kVu8/*Q
l5?fF6#j
N_x=301;
2?=R_&0Q
N_y=101;
^;on
timesteps=1500;
3I|&}+Z6
er=ones(N_y,N_x);
y]1:IJL2;
un1=zeros(N_y,N_x);
}d<xbL!#
un0=zeros(N_y,N_x);
Jxyeh1zqB
un_1=zeros(N_y,N_x);
E:EXp7
p8yn? ~]^
c=3e8;%velocity of light in vacuum
aD5jy
f=8e10;%frequency of the incident wave
:wlX`YW+e
']'H8Y-M
dx=.5e-3;
iF.eBL%
dy=1.5e-3;
l# -4}95
dt=1/(1/dx^2+1/dy^2)^.5/c/2;%one have of the CFL coefficent
RL0#WBR
"rnZ<A}
x=-dx/2:dx:(N_x-1)*dx-dx/2;
3Zy $NsY3
y=0:dy:(N_y-1)*dy;
G=rgL'{
x_inc=0.03;%incident plane
g[Tl#X7F
Q@M>DA!d^V
%O9kq
e=1.6e-19;%charge of an electron
,mpvGvAI
me=9.1e-31;
V1aWVLltj
epsilon=1/(4*pi*9*10^9); % permittivity of vacuum
`jl 1Q,~2r
for(i=1:N_x-x_inc/dx-1)%set the gradient of plasma density
\tL9`RKpg
n0(i)=1e19*(1+.08*i);%particle density in the plasma
o;.6Y `-fJ
wpe(i)=(n0(i)*e^2/epsilon/me)^.5;%calculate the plasma frequency from the plasma density
z^tws*u],5
end
r3 OTU$t?
' KX'{Gy
W=0.03e-9;%temperal width of the gaussian pulse
< 0S+[7S"
T0=0.1e-9;%center time of the gaussian pulse
:g1C,M~
S1_X@[t
a1=c^2*(dt/dx)^2;
RPb/U8
a2=c^2*(dt/dy)^2;
q]1HCWde
gY)NPi}!`
w=2*pi*f;
ql Z()
k=2*pi*f/c;
#Y)Gos
YX||\
startnodeleft=round(x_inc/dx);%computate the incident nodes near the incident plane
/^#8z(@B
startnoderight=round(x_inc/dx)+1;
XaFu(Xu7
a(!_3i@
pstart=0.05;%calculate the shape of the plasma.
DA>_9o/l
%it is a circle center at (N_x,(N_y+1)/2),the radius is
iw`,\V&
% the length of the computational region minus 0.05cm
{Ac5(li_
for(i=1:N_y)
-!X,MDO
for (j=5/dx+N_x)
f7y a0%N
Npstart(i)=round(N_x-(((N_x-pstart/dx-1)*dx)^2-((i-51)*1.5e-3)^2)^.5/dx);
[&IJy
end
i5oV,fiZo
end
C~C}b
Oa[G #
for (n=1:timesteps)
#bFJ6;g=V
for(i=2:N_y-1)%calculate the incident wave using TF/SF method
tS$^k)ZXip
un1(i,startnoderight)=2*(1-(a1+a2))*un0(i,startnoderight)+(a1+a2)*...
j%|#8oV
(un0(i,startnoderight-1)+sin(w*(n-1)*dt-k*(x_inc-dx/2))*exp(-...
T#L/HD
(((n-1)*dt-T0)/W*2)^2)+un0(i,startnoderight+1))-un_1(i,startnoderight);
6\8 lx|w
un1(i,startnodeleft)=2*(1-(a1+a2))*un0(i,startnodeleft)+(a1+a2)*...
g>])O
(un0(i,startnodeleft-1)-sin(w*(n-1)*dt-k*(x_inc+dx/2))*exp(-...
/FzO9'kj
(((n-1)*dt-T0)/W*2)^2)+un0(i,startnodeleft+1))-un_1(i,startnodeleft);
#LP38wE
end
z(-j%?
for(i=2:N_y-1)
ROWb:tX}
for(j=2:startnodeleft-1)%calculate the node on the left of the plasma
nEtG(^N
un1(i,j)=1/er(i,j)*(a1*(un0(i,j-1)+un0(i,j+1))+a2*(un0(i-1,j)+...
{J`]6 ba
un0(i+1,j))-2*(a1+a2)*un0(i,j))+2*un0(i,j)-un_1(i,j);
wUnz D)
end
=(!&8U9
for(j=startnoderight+1:Npstart(i)-1)%calculate the nodes between the incident wave and the plasma
RR*eq.;
un1(i,j)=1/er(i,j)*(a1*(un0(i,j-1)+un0(i,j+1))+a2*(un0(i-1,j)+...
wHGiN9A+
un0(i+1,j))-2*(a1+a2)*un0(i,j))+2*un0(i,j)-un_1(i,j);
I-@A{vvPK
end
fgmu*\x<