Photonics – Chinese

Photonics – Chinese

Topics related to Lumerical and more, in Chinese language

FDTD计算光子晶体能带结构问题

    • Qingyun Li
      Bbp_participant

      老师您好,在案例“Bandstructure of planar photonic crystal with a hexagonal lattice”中,我使用了如下脚本来计算能带结构,但系统报错。

      #############################################################################

      # This script combines the results from the Gamma-M-K-Gamma sweep

      # and plots the frequency spectrum fs from the bandstructure object

      # results over k, and the bandstructure.

      # The bandstructure information is extracted using tolerance and num_band

      # specified by the user at the beginning of the script.

      #

      # Properties:

      # a: period used to normalize the frequency (f_norm=f*a/c)

      # f_band: Frequencies of bands in units of Hz

      # f_band_norm: Frequencies of bands in units of Hz * a / c

      #############################################################################

      # User Defined properties:

      tolerance = 1e-3; #tolerance for finding peaks and accepting bands

      # setting this too low will result in noisy data where sidelobes of

      # peaks are interpreted as new bands

      # setting it too high will mean that some bands are not found

      num_band = 10; #number of bands to search for in the bandstructure

      #

      #############################################################################

       

      runsweep; # run all sweeps

       

      # get a from model

      a = getnamed("::model","a");

       

      # get fs data from the sweeps

      sweepname="Gamma-M";

      spectrum=getsweepresult(sweepname,"spectrum");

      f=c/spectrum.lambda;

      fs_all=matrix(length(f),30); # initialize matrix to store fs data in

      fs_all(1:length(f),1:10)=spectrum.fs;

       

      sweepname="M-K";

      spectrum=getsweepresult(sweepname,"spectrum");

      fs_all(1:length(f),11:20)=spectrum.fs;

       

      sweepname="K-Gamma";

      spectrum=getsweepresult(sweepname,"spectrum");

      fs_all(1:length(f),21:30)=spectrum.fs;

       

      # simple imaging of fs vs k

      image(1:30,f,transpose(fs_all),"k (Gamma-M-K-Gamma)","f (Hz)","bandstructure, logscale","logplot");

      image(1:30,f,transpose(fs_all),"k (Gamma-M-K-Gamma)","f (Hz)","bandstructure, linearscale");

       

      setplot("colorbar min",0);

      setplot("colorbar max",max(fs_all)*1e-4);

       

      # plot bandstructure

      bandstructure=matrix(num_band,30); # initialize matrix in which to store band frequency information

       

      # loop over sweep results

      for (i=1:30){

      #use findpeaks to find num_band number of peaks

      temp = findpeaks(fs_all(1:length(f),i),num_band);

       

      #collect data for any peaks that are more than 'tolerance' of the maximum peak (to avoid minor peaks like sidelobes)

      minvalue = fs_all(temp(1),i)*tolerance;

      f_band=matrix(num_band);

      for(bandcount = 1:num_band) {

      if( fs_all(temp(bandcount),i) > minvalue) {

      f_band(bandcount) = f(temp(bandcount));

      }

      }

       

      f_band_norm = f_band*a/c; # normalize the frequency vector

      bandstructure(1:num_band,i)=f_band_norm;

      }

       

      bandstructure=transpose(bandstructure);

      plot(1:30,bandstructure,"k (Gamma-M-K-Gamma)","f (Hz*a/c)","bandstructure","plot points");

      请问老师是我设置有什么问题吗?

    • Guilin Sun
      Ansys Employee

      你可能用的是旧文件吧,我下载测试没有问题:

      我修改了仿真时间所以与网上结果有差别。

      另外,如果是旧版,看看扫描输出结果是fs 还是其它参数,你可能需要修改脚本,应该不是大问题。

    • Qingyun Li
      Bbp_participant

      感谢老师的回答。

      案例中的脚本不能得到如下图所示的能带结构图

      所以,我想修改案例中的脚本,以期望得到上面的能带图。修改的脚本如下图所示。

      但脚本第20行有点问题

      请问老师,该如何修改案例或者脚本?谢谢。

    • Guilin Sun
      Ansys Employee

      那你要看看Resonance这个DATASET里面有没有波长这个参数。

      参见 

      Ansys Insight: script中的数据类型和数据格式 Dataset

      你可能需要学习如何找到脚本的错误,最简单的就是用问号查某个出错变量是标量数据还是矩阵,矩阵的维数以及它是否有数值,参见 

      Ansys Insight: 几个简单实用的脚本Script命令:用于设置

      Ansys Insight: 几个简单实用的脚本Script命令:用于结果分析

    • Qingyun Li
      Bbp_participant

      感谢老师的解答,脚本问题我已经解决。

      但是我还有一些问题需要向您请教。

      1.在计算的能带结构图中,有如下图所示的一些杂点,不知什么方法可以优化一下,可以去除这些杂点。

      2.我尝试调整模拟精度来优化能带图,即增加网格数量。增加了网格数量,那么也应该提高模拟时间,我把模拟时间从1000fs提高到了100000fs。出现了如下图情况。即Auto shutoff到了0.00069又升了起来,直到升到80733。但是到了80733时,模拟进度才73%就已经模拟结束。不知这个怎么解释?

      期待老师的解答,谢谢。

    • Guilin Sun
      Ansys Employee

      这是仿真要发散了。一般情况仿真能带结构不需要很长的时间 (个别情况需要)。

      那些杂点也许是空气中的Light Line。你可以调整监视器不要位于空气或者均匀介质中。

      有可能是PML反射造成的。你增加一下PML层数。

    • alicemagnet12
      Bbp_participant

       

      有了这些信息,我可以帮助你分析代码中的问题,找到合适的解决方案。如果你能提供这些细节,Mapquest Directions 我们可以更有效地解决问题!

       

Viewing 6 reply threads
  • You must be logged in to reply to this topic.