Ansys Learning Forum › Forums › Discuss Simulation › Photonics › Trapezoidal ring › Reply To: Trapezoidal ring
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