

October 25, 2024 at 2:35 pm

October 25, 2024 at 5:49 pmKirillSubscriber
Hello Rahul,
1. There are several options for creating complexshaped 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 90degree bend waveguide such that it creates a waveguide of an arbitrary angle instead of 90 deg?Â
#####################################################################
# 90 degree waveguide bend
# This object makes a 90degree 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 semicircile 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 amKirillSubscriber
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.Â

 You must be logged in to reply to this topic.

791

407

265

201

162
Â© 2024 Copyright ANSYS, Inc. All rights reserved.