[Script][2d_poly_examples][2D Polygon - Simulation Object][fdtd]
来源:官网案例,侵删。
2D Polygon - Simulation Object – Ansys Optics
https://optics.ansys.com/hc/en-us/articles/360034901613-Structures-2D-Polygon
2d_poly_examples.lsf
################### # Example 1: circle ################### R = 1e-6; # radius res = 1000; # number of points used for circle x = R*cos(linspace(0,2*pi,res)); y = R*sin(linspace(0,2*pi,res)); V = [x,y]; add2dpoly; set("name","2d circle"); set("vertices",V); ################# # Example2: ring ################# Rin = 0.5e-6; # inner radius Rout = 1e-6; # inner radius res = 100; # number of points used for circle xin = Rin*cos(linspace(0,2*pi,res)); yin = Rin*sin(linspace(0,2*pi,res)); xout = Rout*cos(linspace(0,2*pi,res)); yout = Rout*sin(linspace(2*pi,0,res)); V = [xin,yin; xout,yout]; add2dpoly; set("name","2d ring"); set("vertices",V); ########################### # Example 3: circular hole ########################### x_span = 4e-6; # x span of structure y_span = 4e-6; # y span of structure R = 0.5e-6; # radius of hole x = R*cos(linspace(0,2*pi,res)); y = R*sin(linspace(0,2*pi,res)); V = [x,y; x_span/2,0; x_span/2,-y_span/2; -x_span/2,-y_span/2; -x_span/2, y_span/2; x_span/2, y_span/2; x_span/2,0]; add2dpoly; set("name","2d circular hole"); set("vertices",V); ######################## # Example 4: cross hole ######################## x_span = 2e-6; # x span of structure y_span = 2e-6; # y span of structure W = 1e-6; # width of arm L = 0.4e-6; # length of arm x = [W/2;L/2;L/2;-L/2;-L/2;-W/2;-W/2;-L/2;-L/2;L/2;L/2;W/2]; y = [L/2;L/2;W/2;W/2;L/2;L/2;-L/2;-L/2;-W/2;-W/2;-L/2;-L/2]; V = [x,y; W/2,0; x_span/2,0; x_span/2,-y_span/2; -x_span/2,-y_span/2; -x_span/2, y_span/2; x_span/2, y_span/2; x_span/2,0; W/2,0]; add2dpoly; set("name","2d cross hole"); set("vertices",V);
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 提示词工程——AI应用必不可少的技术
· 地球OL攻略 —— 某应届生求职总结
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界