Photonics

Photonics

How to script an ellipsoid?

TAGGED: ,

    • Mickael Aelbrecht
      Subscriber

      Hello everyone!

      I would like to write a script to automatically set up a coated sphere. Unfortunately, I couldn't find any information on how to write that. Before, I used "addsphere" for example. But now that I want ellipses, I don't know how to script it. Can you help me?

      Thanks a lot!

    • Amrita Pati
      Ansys Employee

      Hi Mickael,

      Once you create the the sphere, you can use the following code for creating an ellipsoid:

      setnamed("sphere","make ellipsoid",true);

      setnamed("sphere","radius",0.5e-6);

      setnamed("sphere","radius 2",1e-6);

      The semi-major and semi-minor axis are defined by radius and radius 2. Please let me know if you have any other questions.

       

      Regards,
      Amrita

    • Mickael Aelbrecht
      Subscriber

      Hi Amrita,

      I'm sorry but I'm not sure that you understood my problem correctly. I need to create a coated ellipse. The fact is that I know how to create a sphere, an ellipsoid or even a coated ellipse by hand but I need to place a coated ellipse automatically using a script. How can I manage to create it and to modify it only using script ?

      Thanks a lot for your previous answer though.

      Regards,

      Mickaël Aelbrecht

    • Amrita Pati
      Ansys Employee

      Hi Mickaël,

      Let's say you have a SiO2 coated Au ellipsoid. If the thickness of the coat is fixed, then it could be simply done by creating two ellipsoids and changing their mesh orders. If the central ellipsoid has a lower mesh order than the coating, then in the overlapping regions, the central ellipsoid will take priority. Assuming that the thickness of the coat is 250 nm and the ellipsoid is placed at the origin (0,0,0), then you can use the following code:

      addsphere;

      set("name","central");

      setnamed("central","make ellipsoid",true);

      setnamed("central","x",0e-6);

      setnamed("central","y",0e-6);

      setnamed("central","z",0e-6);

      setnamed("central","radius",0.5e-6);

      setnamed("central","radius 2",1e-6);

      setnamed("central","radius 3",1e-6);

      setnamed("central","material","Au (Gold) - Johnson and Christy");

      ######

      addsphere;

      set("name","coat");

      setnamed("coat","make ellipsoid",true);

      setnamed("coat","x",0e-6);

      setnamed("coat","y",0e-6);

      setnamed("coat","z",0e-6);

      setnamed("coat","radius",0.75e-6);

      setnamed("coat","radius 2",1.25e-6);

      setnamed("coat","radius 3",1.25e-6);

      setnamed("coat","material","SiO2 (Glass) - Palik");

      setnamed("coat","override mesh order from material database",true);

      setnamed("coat","mesh order",3);

      setnamed("coat","override color opacity from material database",true);

      setnamed("coat","alpha",0.5);



      Here, by default, the mesh order of "central" is 2 and I have changed the mesh order of "coat" to 3. So, you effectively have a gold ellipsoid that is coated by 250 nm of SiO2 (index preview from the index monitor shown below).



      Please let me know if I missed something.

      Regards,
      Amrita

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