-
-
October 25, 2024 at 2:35 pm
-
October 25, 2024 at 5:49 pmKirillAnsys 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:
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 -
October 28, 2024 at 8:22 amrahul.sanghviSubscriber
Thank you Kirill. I will go through the links.Â
-
October 29, 2024 at 11:02 amrahul.sanghviSubscriber
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);
-
October 30, 2024 at 1:10 amKirillAnsys Employee
Hello Rahul,
You’ll need to adjust your
px
andpy
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:
- Approximation of a cubic Bézier curve by circular arcs and vice versa – This provides a solid mathematical discussion on the topic.
- Approximate a circle with cubic Bézier curves – This source presents a clear discussion on approximation accuracy.
- 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 -
November 4, 2024 at 8:26 amrahul.sanghviSubscriber
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. -
November 5, 2024 at 5:31 pmKirillAnsys 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 -
November 8, 2024 at 4:15 pmrahul.sanghviSubscriber
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 ?
Â
-
November 11, 2024 at 12:23 pmKirillAnsys 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
-
November 11, 2024 at 1:08 pm
-
November 11, 2024 at 5:45 pmKirillAnsys Employee
Hello Rahul,
It seems your geometry might have unwanted intersections. Generally, you can ignore these warnings.
Best regards,
Kirill
-
November 11, 2024 at 10:06 pmrahul.sanghviSubscriber
It does not create any structures but.
-
November 12, 2024 at 1:00 amKirillAnsys 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
-
November 12, 2024 at 9:35 amrahul.sanghviSubscriber
Thank you for the detailed response. Will try it.Â
-
November 13, 2024 at 3:50 pm
-
November 13, 2024 at 5:03 pm
-
- You must be logged in to reply to this topic.
-
1091
-
447
-
375
-
225
-
201
© 2024 Copyright ANSYS, Inc. All rights reserved.