FDTD_mie散射_仿真学习(2)
代码分析:
Model模式
# parameter definitions
#
# mesh size: the mesh size (dx = dy = dz) of the mesh override网格覆盖的网格大小(dx = dy = dz)
# simulation_span: the span of the simulation region仿真区间
# particle_x(_y,_z)_span:the span of the nanoparticle(s) in the x (y, z) direction
#粒子x、y、z区间范围
# particle_x(_y,_z)_center: the center of the nanoparticle(s) in the x, y, z directions
#粒子x、y、z中心坐标
# set the simulation spans选中FDTD,修改其坐标
select("FDTD");
set("x span",simulation_span);
set("y span",simulation_span);
set("z span",simulation_span);
# set the mesh override mesh的范围大小
select("mesh");
set("x span",particle_x_span+12*mesh_size);
set("y span",particle_y_span+12*mesh_size);
set("z span",particle_z_span+12*mesh_size);
set("dx",mesh_size);
set("dy",mesh_size);
set("dz",mesh_size);
# set the monitors监视器的大小
select("time_corner");#时间
set("x",simulation_span/2);
set("y",simulation_span/2);
set("z",simulation_span/2);
#x_normal_profile这名字需要与设定的监视器名字相同
setnamed("x_normal_profile","y span",particle_y_span+12*mesh_size);
setnamed("x_normal_profile","z span",particle_z_span+12*mesh_size);
setnamed("y_normal_profile","x span",particle_x_span+12*mesh_size);
setnamed("y_normal_profile","z span",particle_z_span+12*mesh_size);
setnamed("z_normal_profile","x span",particle_x_span+12*mesh_size);
setnamed("z_normal_profile","y span",particle_y_span+12*mesh_size);
setnamed("movie","x span",simulation_span);
setnamed("movie","y span",simulation_span);
# set the analysis groups and the TFSF source分析组和TFSF光源
select("abs");
set("x span",particle_x_span+4*mesh_size);
set("y span",particle_y_span+4*mesh_size);
set("z span",particle_z_span+4*mesh_size);
select("mie_source");
set("x span",particle_x_span+8*mesh_size);
set("y span",particle_y_span+8*mesh_size);
set("z span",particle_z_span+8*mesh_size);
selectpartial("scat");
set("x span",particle_x_span+12*mesh_size);
set("y span",particle_y_span+12*mesh_size);
set("z span",particle_z_span+12*mesh_size);
# align the center of FDTD, mesh override, source, monitors and analysis groups to the center of the particle(s)
#将FDTD、网格覆盖、源、监视器和分析组的中心对齐到粒子的中心
select("FDTD");
shiftselect("mesh");
shiftselect("mie_source");
shiftselectpartial("_profile");
shiftselect("time_corner");
shiftselect("movie");
shiftselect("abs");
shiftselectpartial("scat");
set("x",particle_x_center);
set("y",particle_x_center);
set("z",particle_x_center);
Abs分析组
结构
deleteall;
####################################################
# This script sets up the field monitors
# for calculating the cross sections
#
# Input properties
# x,y,z span: object span
#
# Tags: cross section scattering absorption extinction
#
# Copyright 2012 Lumerical Solutions Inc
#####################################################
# simplify variable names by removing spaces
x_span = %x span%;
y_span = %y span%;
z_span = %z span%;
# add X monitors
addpower;
set("name","x1");
set("monitor type","2D X-normal");
set("x",-x_span/2);
set("y",0);
set("y span",y_span);
set("z",0);
set("z span",z_span);
#复制了一个x监视器
copy(x_span,0,0);#x_span,0,0这三个平移坐标。向x的正方向平移
set("name","x2");
# add Y monitors
addpower;
set("name","y1");
set("monitor type","2D Y-normal");
set("x",0);
set("x span",x_span);
set("y",-y_span/2);
set("z",0);
set("z span",z_span);
copy(0,y_span,0);
set("name","y2");
# add Z monitors
addpower;
set("name","z1");
set("monitor type","2D Z-normal");
set("simulation type","3D"); # only include in 3D simulations
set("x",0);
set("x span",x_span);
set("y",0);
set("y span",y_span);
set("z",-z_span/2);
copy(0,0,z_span);
set("name","z2");
# only record net power transmission, not field components
selectall;
set("output power",1);
set("output Ex",0);
set("output Ey",0);
set("output Ez",0);
set("output Hx",0);
set("output Hy",0);
set("output Hz",0);
set("output Px",0);
set("output Py",0);
set("output Pz",0);
分析:输出sigma
Sigma是什么参数呢
####################################################
#
# This object can be used to calculate nano-particle
# cross sections.
#
# Output properties
# sigma: cross section as a function of frequency/wavelength
#横截面作为频率/波长的函数
# Tags: cross section scattering absorption extinction
#横截面散射吸收消光
# Copyright 2012 Lumerical Solutions Inc
################################################################
f=getdata("x2","f"); # get freqency data
dim = getdata("x2","dimension"); # dimension of simulation x监视器的维度,此时为2维
#T数据,也就是输出的power
Px2 = transmission("x2");
if(havedata("x1")){ Px1 = -transmission("x1"); } else { Px1=Px2; }
Py2 = transmission("y2");
if(havedata("y1")){ Py1 = -transmission("y1"); } else { Py1=Py2; }
# include z monitors if 3D simulation包括z监视器,如果3D模拟
if (dim==3) {
Pz2 = transmission("z2");
if(havedata("z1")){ Pz1 = -transmission("z1"); } else { Pz1=Pz2; }
} else {
Pz2 = 0; Pz1 = 0;
}
# Total power flowing outwards. Units = W总能量向外流动。单位= W
Pscat = (Px1 + Px2 + Py1 + Py2 + Pz1 + Pz2)*sourcepower(f);
# Calculate cross-section计算截面/sourceintensity(f)不同频率下光的能量
cross_section = Pscat/sourceintensity(f);
# Create dataset result
sigma = matrixdataset("sigma");
sigma.addparameter("lambda",c/f,"f",f);
sigma.addattribute("sigma",cross_section);