We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Photonics – Chinese

Photonics – Chinese

Topics related to Lumerical and more, in Chinese language.

getsweepresult和farfield3d指令的結合

TAGGED: ,

    • Jian Nan Gao
      Subscriber

      我有一個模擬檔案是要進行不同參數的sweep,而同時需要得到各個參數模擬後該monitor的遠場角度。

      首先對模擬後的各個.fsp檔案執行指令

      m="Far-Field"

      res = 201;

      E2 = farfield3d(m,1,res,res);

      ux = farfieldux(m,1,res,res);

      uy = farfielduy(m,1,res,res);

      theta = linspace(-90,90,180);

      phi = 0;

      ?pos = findpeaks(farfieldspherical(E2,ux,uy,theta,phi),1);

      ?far_angle = theta(pos);
      就可以得到遠場角度

      但今天對於參數sweep後有許多模擬檔案,要打開每個檔案都執行一次有點費時

      於是想直接在當初建立sweep檔案進行data收集和分析

      sweep設定如下圖

      然後使用指令

      sweepname="sweep_gap";

      far_field=getsweepresult(sweepname,"Far-Field");

      far_field_E2=far_field.E2;

      res = 201;

      E2 = farfield3d(far_field_E2,1,res,res);

      到了這一步就報錯:the first argument of farfield3d must be a string or a rectilinear dataset

      查了後不確定是不是因為要計算遠場角度需要包含E和H的全部資料,這樣的話sweep要如何設置?或是指令要如何更改?

    • Guilin Sun
      Ansys Employee

      “到了這一步就報錯:the first argument of farfield3d must be a string or a rectilinear dataset” 这是因为远场计算需要包含电场和磁场的dataset,而你用far_field_E2=far_field.E2;后就成立一般矩阵了。

      正确的解决办法是:

      在分析组或者Model里面用脚本先计算角度,即你一部分脚本适当修改即可,同时将角度在分析组或者Model里面设置为输出;

      然后在Sweep里面选分析组或者Model里面的Result的角度参数;

      最后用getsweepresult提取这个角度的扫描仿真结果。

      可以参考这里例子,了解脚本如何在分析组或者Model里面工作和输出: https://optics.ansys.com/hc/en-us/articles/360042097393-Metamaterial-parameter-extraction-Smith 

Viewing 1 reply thread
  • The topic ‘getsweepresult和farfield3d指令的結合’ is closed to new replies.