编程学习_lumerical_FDTD_构建方孔阵列

deleteall;

# Hexagonal lattice PC array

# A periodic array of photonic crystals in a hexagonal lattice.

# Input properties

# nx, ny: 列数和行数

# z span: 高度

# a: 小单位的长度尺寸

# radius: 单位结构之间的半径

# index:折射率

# material

#简化变量

# simplify variable names by removing spaces

z_span = %z span%;

x_span = %x span%;

y_span = %y span%;

n_rows = ny-1;

n_cols = nx-1;

even_flag = 0;

for(i=-n_rows/2:n_rows/2) {

for(j=-n_cols/2:n_cols/2) {

#添加圆柱

addcircle;

set("radius",radius);

if( even_flag==0 ) {

set("x",(j)*a + a/2);

} else {

set("x",(j)*a);

}

set("y",(i)*a*sqrt(3)/2);

set("z",0);

set("z span",z_span);

#设置材料

set("material",material);

if(get("material")=="<Object defined dielectric>")

{ set("index",index); }

#添加矩形

addrect;

set("name","wood");

if( even_flag==0 ) {

set("x",(j)*a + a/2);

} else {

set("x",(j)*a);

}

#set("x",(j)*a);#可以直接设置为数字,公式

set("y",(i)*a*sqrt(3)/2);

set("z",0);

set("z span",z_span);

set("x span",x_span);

set("y span",y_span);

set("material",material);

if(get("material")=="<Object defined dielectric>") {set("index",index); }

}

if(even_flag==0) {

even_flag=1;

} else {

even_flag=0;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值