The Ansys Innovation Space website recently experienced a database corruption issue. While service has been restored there appears to have been some data loss from November 13. We are still investigating and apologize for any issues our users may have as a result.
Photonics

Photonics

Topics related to Lumerical and more.

Trapezoidal ring

    • rahul.sanghvi
      Subscriber

      How can I create a ring that on the cross section looks like a trapezoid. I want to extend the XY plane and make a semi circle. 

       

    • Kirill
      Ansys Employee

      Hello Rahul,

      1. There are several options for creating complex-shaped objects. I suggest checking the FDTD product reference manual under Simulation objects > Structures for details.

      2. Based on my understanding of your geometry, the Waveguide might be useful. Also, take a look at Tips for creating waveguide bends using the path object. You can easily create something like this:

      Trapezoidal half-ring made with Waveguide Simulation Object

      3. The Planar solid is another option, though it may be less convenient in this case.

      4. Additionally, you can be creative with polygon primitives. Check out Tips for creating spiral and helix geometries and Tips for creating a 3D contour path object for inspiration.

      Best regards,
      Kirill

    • rahul.sanghvi
      Subscriber

      Thank you Kirill. I will go through the links. 

    • rahul.sanghvi
      Subscriber

      Hi Kirill, 

      Do you know how to modify the code for 90-degree bend waveguide such that it creates a waveguide of an arbitrary angle instead of 90 deg? 

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

      # 90 degree waveguide bend

      # This object makes a 90-degree waveguide bend with angled sidewalls.

      #

      # Input properties

      # base angle: sidewall angle of the waveguide

      # base height: height of the waveguide

      # base width: width of the waveguide base

      # radius: radius of the bend

      # start angle: start angle of the waveguide

      #

      # Tags: integrated optics waveguide bend 90 degrees ridge

      #

      # Copyright 2015 Lumerical Solutions Inc

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

       

      # simplify variable names by removing spaces

      base_angle = %base angle%;

      base_width = %base width%;

      base_height = %base height%;

      start_angle = %start angle%;

       

      select("arc");

      set("material",material);

      set("base angle",base_angle);

      set("base height",base_height);

      set("base width",base_width);

      set("detail",0.5);

       

      # magic number

      # The cubic Bezier curve using this magic number in the pole points approximates the semi-circile with least error

      m=0.55191502449;

       

      px = radius*[0;m;1;1];

      py = radius*[1;1;m;0];

      p = [px,py];

       

      set("poles",p);

      set("first axis",'z');

      set("rotation 1",start_angle);

    • Kirill
      Ansys Employee

      Hello Rahul,

      You’ll need to adjust your px and py coordinates. Check this example:

      # Parameters
      start_angle = 0.0;       # Start angle in degrees
      end_angle = 45.0;        # End angle in degrees
      radius = 10.0;           # Radius of the arc
      m = 0.55191502449;       # "Magic number" for a 90° arc approximation
      
      # Convert angles to radians
      start_angle_rad = start_angle * pi / 180;
      end_angle_rad = end_angle * pi / 180;
      
      # Calculate arc angle
      arc_angle = end_angle_rad - start_angle_rad;
      
      # Adjust the "magic number" for the specified arc angle
      m_adj = m * arc_angle / (pi / 2);
      
      # Calculate control points for Bezier curve approximation
      # Starting point (p0)
      p0_x = cos(start_angle_rad) * radius;
      p0_y = sin(start_angle_rad) * radius;
      
      # First control point (p1)
      p1_x = p0_x - sin(start_angle_rad) * m_adj * radius;
      p1_y = p0_y + cos(start_angle_rad) * m_adj * radius;
      
      # Ending point (p3)
      p3_x = cos(end_angle_rad) * radius;
      p3_y = sin(end_angle_rad) * radius;
      
      # Second control point (p2)
      p2_x = p3_x + sin(end_angle_rad) * m_adj * radius;
      p2_y = p3_y - cos(end_angle_rad) * m_adj * radius;
      
      # Create array of control points
      px = [p0_x; p1_x; p2_x; p3_x];
      py = [p0_y; p1_y; p2_y; p3_y];
      p = [px, py];
      
      # Output
      ?("Control points:");
      ?num2str(p, "%.3f");
      

      So for:

      px = [10.000; 10.000; 9.022; 7.071];
      py = [ 0.000;  2.760; 5.120; 7.071];
      

      you should get an approximation of a 45° arc.

      I also suggest reviewing the following resources:

      1. Approximation of a cubic Bézier curve by circular arcs and vice versa – This provides a solid mathematical discussion on the topic.
      2. Approximate a circle with cubic Bézier curves – This source presents a clear discussion on approximation accuracy.
      3. Bézier curves - Desmos calculator – A nice interactive tool to speed up your understanding of Bézier curves.

      I hope you find this helpful.

      Best regards,
      Kirill

    • rahul.sanghvi
      Subscriber

      Hi Kirill,

      I am working on inverse 3D grating coupler design and I wish to have trapezoidal grates instead of rectangular as provided in the lumerical example. The example uses "addring" to create the rectangular grates in XZ view, but I got many errors when I tried to convert them into a trapezoid. Do you know if there is any easy or an efficient way to do it ?

      Many thanks!
      Rahul. 

    • Kirill
      Ansys Employee

      Hello Rahul,

      Try to use ‘addwaveguide’ to add the Waveguide object mentioned earlier. Then follow the suggestions above to configure it to your needs. Check addwaveguide.

      Best regards,
      Kirill

    • rahul.sanghvi
      Subscriber

      Hi Kirill,

      The methods you suggested worked and helped alot. I am trying to use the addwaveguide command in for loop but it is not producing results.

      Can you suggest me some method ?

       

    • Kirill
      Ansys Employee

      Hello Rahul,

      This script (LSF) creates 10 waveguides in a ‘for’ loop. Feel free to adapt it to your needs.

      # Loop to add waveguides with incremental positions
      for (x = 1:10) {
          addwaveguide;
          set("name", "wg_" + num2str(x)); # Set unique name for each waveguide
          set("y", x * 2.0e-6);            # Position waveguide based on index
      }
      

      Best regards,

      Kirill

    • rahul.sanghvi
      Subscriber

      I used the addwaveguide with a for loop but got this error. I am not sure what does this mean. 

    • Kirill
      Ansys Employee

      Hello Rahul,

      It seems your geometry might have unwanted intersections. Generally, you can ignore these warnings.

      Best regards,

      Kirill

    • rahul.sanghvi
      Subscriber

      It does not create any structures but.

    • Kirill
      Ansys Employee

      Hello Rahul,

      I can suggest following debugging tips.

      Isolate the issue. Try simplifying your script by commenting out parts that could be causing the problem. Focus on the most reliable sections and make sure each one works when tested individually.

      Check your waveguide parameters. If you’re having trouble with waveguide objects, double-check that the construction parameters are correct. It can help to print them out and manually create a few waveguides with those parameters to see if they behave as expected.

      I’m not sure if this would be helpful, but this script creates a set of concentric waveguides with tilted walls.

      for (x = 1:10) {
          addwaveguide;
          set("name", "wg_" + num2str(x));             # Set waveguide name
          set("x", 0.0); set("y", 0.0); set("z", 0.0); # Position of waveguide
      
          set("base width", 600.0e-9);
          set("base height", 220.0e-9);
          set("base angle", 60.0);
      
          # Angle and arc parameters
          start_angle = -30.0; end_angle = 30.0; radius = x*1e-6; m = 0.55191502449;
          start_angle_rad = start_angle * pi / 180; end_angle_rad = end_angle * pi / 180;
          arc_angle = end_angle_rad - start_angle_rad;
          m_adj = m * arc_angle / (pi / 2);
      
          # Calculating control points for Bezier curve approximation
          p0_x = cos(start_angle_rad) * radius;
          p0_y = sin(start_angle_rad) * radius;
          p1_x = p0_x - sin(start_angle_rad) * m_adj * radius;
          p1_y = p0_y + cos(start_angle_rad) * m_adj * radius;
          p3_x = cos(end_angle_rad) * radius;
          p3_y = sin(end_angle_rad) * radius;
          p2_x = p3_x + sin(end_angle_rad) * m_adj * radius;
          p2_y = p3_y - cos(end_angle_rad) * m_adj * radius;
      
          # Defining poles
          px = [p0_x; p1_x; p2_x; p3_x];
          py = [p0_y; p1_y; p2_y; p3_y];
          poles = [px, py];
      
          set("poles", poles);                     # Apply poles to the waveguide
          set("material", "Si (Silicon) - Palik"); # Set material for the waveguide
      }
      
      # Create a rectangle
      addrect;
      set("name", "rectangle");
      set("x", 6.0e-6); set("x span", 12.0e-6);
      set("y", 0.0e-6); set("y span", 12.0e-6);
      set("z", -220.0e-9); set("z span", 220.0e-9);
      set("material", "Si (Silicon) - Palik");
      

      Best regards,

      Kirill

    • rahul.sanghvi
      Subscriber

      Thank you for the detailed response. Will try it. 

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