Photonics

Photonics

Topics related to Lumerical and more.

Far-Field 2D FDTD

    • giovanni.piscopo
      Subscriber

      Hello everyone,

      I am working with a 2D periodic structure with waveguide incidence. I have a monitor named "field top" and I need to calculate the far field using the farfield2d script command.

      Following the instructions provided in the Ansys example, I ran the FDTD simulation and then executed the following lines of code:

      E = farfield2d("field top", 1);
      theta = farfieldangle("field top", 1);

      However, running these lines gives me the following error:
      "In farfield2d the frequency is out of range".

      According to the Ansys documentation, the number 1 in the input represents the index of the frequency value to calculate.
      In my simulation settings, I set f_points = 300, so I don't understand how 1 could be out of range. Even when I try varying the index, I get the same error.

      Could the issue be related to the fact that I set the range using wavelengths?
      For completeness, here are the relevant lines of code:
      addmode;
      [...]
      set("wavelength start", wl_start);
      set("wavelength stop", wl_stop);
      (The range is from 0.4 microns to 0.7 microns.)

      Could someone help me with this?
      Thanks in advance for your help!

      Giovanni

    • anna.wirth-singh
      Ansys Employee

      Hi Giovanni,

      Thanks for your question, and I am sorry to hear that you are having issues with Lumerical. 

      Is the monitor named "field top" a Frequency-domain field and power (DFTMonitor) or a ModeExpansionMonitor? Typically, the farfield commands are used with a DFTMonitor. If you want to record the E field and project it to the far-field, then a DFTMonitor would be best. A ModeExpansionMonitor could fail to find a supported mode and therefore not find any data. So I suspect the issue could be due to the type of monitor; if you think this is not the case, let me know and we will look for other explanations. 

      Alternatively, could you please try the command without specifying the frequency, as in ' E = farfield2d("field top"); ' and let me know if that also has issues?

       

      Best,

      Anna

    • giovanni.piscopo
      Subscriber

      Hello Anna,

      thank you very much for your detailed response! 

      As a confirmation, the monitor I'm using is a Frequency-domain field and power and, as you suggested, I tried to run the code without specifying the frequency and still I get some error stating that there are some parameter missing.

      Waiting for your kinde response, I wish you a good day.

       

      Best Regards

       

      Giovanni 

    • anna.wirth-singh
      Ansys Employee

      Hi Giovanni,

      Thank you for providing that additional information and confirming that the monitor is the correct type. 

      I have another follow-up question. Are you able to access the results from this monitor through the GUI? Just to identify whether this is an issue only with the script command, or with the monitor set-up, please go to the Result View and visualize the farfield results. If you are able to visualize the desired results from the GUI, then we can be sure that the issue is with the script and not something else. 

      I am a bit confused because the code snippet 

      addmode;
      [...]
      set("wavelength start", wl_start);
      set("wavelength stop", wl_stop);

      should add a mode expansion monitor, and then modify the start and stop wavelengths of that mode expansion monitor. Unless there are additional commands, I do not think these lines would change the setup for a DFTmonitor that you had set up previously.

      In any case, please try to plot the desired result from the GUI. Let me know if there is some error, and if there is no error, it will be helpful if you can share any other parts of your script that may be relevant. 

      Best,

      Anna

    • giovanni.piscopo
      Subscriber

      Dear Anna, 

      thank you very much for your response. First I would like to answer regarding the addmode line. In this case, the addmode command serves to add a mode source to excite the grating.

      On the other hand, about accessing the results from the GUI, I can see the field results but not the farfield results. However I think that this might be due to the fact that the simulation domain is 2D and not 3D.

      Waiting for your kind response, I wish you a good day and good holidays.

      Best Regards

      Giovanni

    • anna.wirth-singh
      Ansys Employee

      Hi Giovanni,

      Thanks for that additional information. If you can see the field results but there is no option to calculate the farfield results, I think you are right that the issue may be that the dimension of the monitor is not correct. If you are using a 2D FDTD simulation, then the monitor type should be linear in order to calculate the farfield. What monitor type (point, linear, 2D or 3D) are you using?

      However, I am surprised that the error message is about frequency being out of range; usually, if there is an issue about dimensions with farfield calculations, the error message reports that it is impossible to determine the surface normal. Can I also ask, what version of Lumerical are you using?

      Best,

      Anna

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