FDTD自定义光源代码问题

fdtd

#1

您好:我想请教下官网自带的自定义光源的例子里求散射的代码有下面这样

power

su=.5/sourcepower(f);#used for calculating cross sections
##scattering
#x monitors
if(mx==1){
temp =real(pinch(ey_x1conj(hz_x1)-ez_x1conj(hy_x1)));
px1=suintegrate(temp,1:2,x2y,x2z);}
temp =real(pinch(ey_x2
conj(hz_x2)-ez_x2conj(hy_x2)));
px2=su
integrate(temp,1:2,x2y,x2z);
#y monitors
if(my==1){
temp =real(pinch(ez_y1conj(hx_y1)-ex_y1conj(hz_y1)));
py1=suintegrate(temp,1:2,y2x,y2z);}
temp =real(pinch(ez_y2
conj(hx_y2)-ex_y2conj(hz_y2)));
py2=su
integrate(temp,1:2,y2x,y2z);
#z monitors
if(mz==1){
temp =real(pinch(ex_z1conj(hy_z1)-ey_z1conj(hx_z1)));
pz1=suintegrate(temp,1:2,z2x,z2y);}
temp =real(pinch(ex_z2
conj(hy_z2)-ey_z2conj(hx_z2)));
pz2=su
integrate(temp,1:2,z2x,z2y);

#totaling the power, for the case the source is along z axis
if( (mx==1) and (my==1) ){
P_scat=-px1+px2-py1+py2-pz1+pz2;

}
if( (mx==0) and (my==1) ){
P_scat= px2+px2-py1+py2-pz1+pz2;

}
if( (mx==1) and (my==0) ){
P_scat=-px1+px2+py2+py2-pz1+pz2;

}
if( (mx==0) and (my==0) ){
P_scat= px2+px2+py2+py2-pz1+pz2;

}
scat_cross= 1e12P_scatsourcepower(f)/ave_intensity;

我想问的是pz2=su*integrate(temp,1:2,z2x,z2y);这个求的是z2面的透过率吗?这是怎么定义的?


#2

是的,定义参见这个帖子


#3

this script is used for a customerized TFSF using NA beam source

还是对应这个案例里的代码
mx=0;my=0;mz=0;#1 means using symmetry/antisymmetry BCs, automatic detect
这里描述说1的话代码有对称边界,它说的自动检测就是通过
#obtain E, H and the power
if (havedata(“total::x1”)) {
mx=1;e_ref_x1=getresult(“total::x1”,“E”);
h_ref_x1=getresult(“total::x1”,“H”);
}
e_ref_x2=getresult(“total::x2”,“E”);
h_ref_x2=getresult(“total::x2”,“H”);
来检测的,但我不明白的是为什么是x1探测器有数据的话代码x有对称?mx=1.不是应该x1面没数据才是设置了对称条件吗?
因为下面这代码mx,my=0,按它描述的就是x,y没对称边界,那这样应该是P_scat= -px1+px2-py1+py2-pz1+pz2;吧?应该是有设置对称条件才是P_scat= px2+px2+py2+py2-pz1+pz2;
所以我想是不是代码描述里mx=0才是对称,mx=1是没有对称边界?
if( (mx==0) and (my==0) ){
P_scat= px2+px2+py2+py2-pz1+pz2;


#4

你分析的对!此例子的脚本改过几次,前后没有统一,应该是0 means using symmetry/antisymmetry BCs, automatic detect。谢谢!
抽空我修改一下。