Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Photonics

Photonics

Topics related to Lumerical and more.

Setting refractive index for an anisotropic material does not work

TAGGED: 

    • m.hoormann
      Subscriber

      When I want to set an anistropic (n,k) material the new material does not take the refractive index values, but has only the values of 1, 1, 1. Also, I get the error "The material property, Refractive Index was not set. The property value must be a string or a matrix."

      I use the following python script to set the material:

      n_GaN = [2.4869, 2.3, 2.4869]
      material = "GaN"
      mode.setmaterial(mode.addmaterial("(n,k) Material"), "name", material)
      mode.setmaterial(material, "Anisotropy", 1)
      mode.setmaterial(material, {"Refractive Index": n_GaN, "Imaginary Refractive Index": [0, 0, 0]})
       
      Here, "mode" is defined as: 
      mode = lumapi.MODE()
       
      Do I have to define the values in anbother way?
    • Taylor Robertson
      Ansys Employee

      Hello Matthias,

      You have defined the indices of GaN as a list, but the materials need to be defined as a arrays, or using a string for the predefined materials in material library. In python [,,] creates a list data type which you need to convert to np array.

      Passing-Data-Python-API

      This type conversion between python and lsf can get a little complicated. I would suggest keeping it as simple as possible.

      mode.setmaterial(material, "Refractive Index", np.array(n_GaN))
      mode.setmaterial(material, "Imaginary Refractive Index", np.array([0, 0, 0]))
    • m.hoormann
      Subscriber

      Hello Mr. Robertson,

      thank you for the fast reply. Now it works. 

      Best,

      Matthias

Viewing 2 reply threads
  • The topic ‘Setting refractive index for an anisotropic material does not work’ is closed to new replies.
[bingo_chatbox]