Photonics

Photonics

Is it possible to sweep wavelength/frequency center with other parameters?

    • dylanve
      Subscriber
      I would like to run 60 simulations in which I am changing the size of a particular feature and attempting to determine the resonant mode of the resulting structure. I have already ran a sweep which changes the feature size and records the eigenfrequency of the resonant mode. Now I would like to expand that sweep to include a frequency domain profile monitor to record the spatial profile of the E-field of the resonant mode. I already know the feature size and corresponding frequencies from the original sweep, and I have those readily available as a table/list. What is the easiest way to change the frequency center of the monitor (see picture) without manually editing it each run? Is what I am describing possible? I have searched the documentation and I have not found a script command or object property corresponding to frequency center. I considered just using multiple frequency points, but the frequencies I obtained from the original sweep are not linearly spaced, so this will not work. Thanks!


    • Guilin Sun
      Ansys Employee
      So you want to assign a specific frequency/wavelength to a monitor to record after you get the sweep result of the resonance? if so you can try
      setnamed("monitor","override global monitor settings",1);
      setnamed("monitor","frequency points",1);
      setnamed("monitor","wavelength center",c/fr);
      setnamed("monitor","wavelength span",0);

      here fr is the resonant frequency you found from the sweep.
      You can find all the parameters you can assign for a monitor by
      ?setnamed("monitor") where the monitor name is "monitor".
      Please try.
      The monitor can record two different points at the exact frequencies or wavelengths if you set the frequency points to 2.
      A more direct way is to use "custom" frequencies:
      setnamed("monitor","sample spacing","custom");
      setnamed("monitor","custom frequency samples",[200;300;500]*1e12); #set 3 frequency points .

      So as long as you know the frequency or frequencies to record, you can use script to do it easily. Please try based on your need.
    • dylanve
      Subscriber
      Thank you for the reply, this helped quite a bit. I am now able to change the center frequency of the monitor directly using the script commands. Is it possible to assign multiple values to a sweep parameter without setting the individual points manually? The example syntax given is:

      addsweep;
      setsweep("sweep", "name", "sweepName");
      setsweep("sweepName", "type", "Values");
      param.Value_1 = val1;
      param.Value_2 = val2;
      param.Value_3 = val3;
      ...
      param.Value_63 = val63;
      param.Value_64 = val64;
      addsweepparameter("sweepName", param);

      Is it possible to add the values from an array in a loop, instead of manually assigning each point? for example, adding 60 points like this:

      addsweep;
      setsweep("sweep", "name", "sweepName");
      setsweep("sweepName", "type", "Values");
      nValues = 60;
      for (i = 1; i <= nValues; i = i + 1) {
      param.Value_i = values(i);
      }

      where valuesis some array of length nValues containing all of the sweep points.
    • Guilin Sun
      Ansys Employee
      This is a different question. Please write a new post later since the forum is targeting one-question one-solution.
      A quick answer might be no, since param.Value_i cannot be changed by the loop "i". eg, the variables have to be defined before assigning values, except you find a way to change the variable name first.

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