Photonics

Photonics

An inquiry regarding a drawing a truncated cone

    • amora
      Subscriber

      Hello,

      I am trying to draw a truncated cone and I am using the code in this webpage:

      https://optics.ansys.com/hc/en-us/articles/1500007997382-Drawing-truncated-cone-in-finite-element

      I have a question regarding the code. Does the code draw a hollow truncated cone or a solid one?

      Thanks 

    • Guilin Sun
      Ansys Employee

      It is a solid cone. You can add to FDTD and use index monitor to check it.

    • amora
      Subscriber

      Thank you for your reply.

      I was trying to run a parametric sweep using this code, but when I tried to enter a variable, the code didn't read this variable. For example, instead of writing 'radius_bottom=1' I wrote it 'radius_bottom=r' It happened also for zspan. The code accepts only numbers. I have attached a photo to clarify.

      How can I fix that please to run a parametric sweep?

      Thanks

    • Guilin Sun
      Ansys Employee

       

      ”instead of writing ‘radius_bottom=1’ I wrote it ‘radius_bottom=r’ “

      Unfortunately, the script does not work that way. The assignment must be either a numerical value or a character (need to be quoted). If you want to let the radius_bottom be a variable, you will need to define it in the variable panel:

      Please note that the scipt uses SI unit. So when you specify zspan=0.7, it means zspan is 0.7 meter. if it is micron, you will need to use zspan=0.7e-6.

      Please modify your script.

       

    • amora
      Subscriber

      Thank you for your reply.

      I tried to add it as a character and define it in the Variables, but it didn't work. I have attached photos to clarify

    • amora
      Subscriber

      I updated the code as well.

    • Guilin Sun
      Ansys Employee

      You are duplicating the variable zspan!

      When you specify zspan 0.7 in the variable panel, you can use directly, eg

      z=zspan*.5 which means z is at half the zspan, since now zspan is a variable and has the value.

      you can also define rrr before assigning it to radius_bottom, as you have done.

      Once a varaible has the value, you can do math operations with it.

      If you have defined a variable in the “variable” panel, it should not appear on the left side of the “=”. Instead, since it has alreay had a value, it should appear in the irhgt hand side.

       

       

    • amora
      Subscriber

      I defined the parameters in the variable panel and still not able to draw the truncated cone. For the bottom radius, I gave it a variable 'rrr' and defined it in the variable panel. I also changed the units in line number 109 and 110 in the attached photo. 

      Also, in line 102, you can see that it has tti and tau. These two variables are defined in the panel and the script did not apply them

    • amora
      Subscriber

      Also, this is the variable panel

    • Guilin Sun
      Ansys Employee

       

      Sorry, I did not see your variable table (panel) before.

      In the variable table, you have already used um (micron meter) unit. So in the script file you do not need to multiply 1e-6 again.

      Take the truncated cone from the FDTD object library as an example:

      Please directly use it and modify the values of the variables.

       

    • Guilin Sun
      Ansys Employee

       

      For the finite element cone, you only need to define

      radius_bottom

      radius_top

      zspan

      segment

      in the variable panel (table), and once you define them, you can directly use them.  Be careful for their unit.

       

      Please note that some scripts may not work in "model". You will need to test your script and see if there is any error message:

       

       

    • amora
      Subscriber

      Thank you so much, that's working.

      I just have the last question please, I changed the script, so that the truncated cone starts from the top of another cylinder with a radius 'r1' I chose the value of the bottom radius to be equal to r1 as well. However, I found that the bottom of the truncated cone is smaller than the cylinder. please have a look at the XZ view in the attached photo, thanks.

    • amora
      Subscriber

      Here is the variable panel

    • Guilin Sun
      Ansys Employee

      This is due to the way the cone is created as a polygon and dispay rendering. If it is smaller than a mesh, just ignore it. or you can use a slightly larger radius fior the cone.

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