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.

Charge : job error : Initialization failed to converge charge update

    • sara.bassil
      Subscriber

      I am using python to simulate an electrooptic modulator in lithium niobate in the CHARGE solver in lumerical. 
      I used this example as an inspiration :  https://optics.ansys.com/hc/en-us/articles/19435937674387-Thin-Film-Lithium-Niobate-Electro-Optic-Phase-Modulator

      I get this problem : 

      The program terminated due to an error: Initialization failed to converge charge update due to numerical failure. For instructions on how to troubleshoot this issue, please refer to this: online reference

      I tried all the advices that I could find in the online reference but nothing seems to work 
      I defined my charge region as follow : 

      from DEVICE.user_inputs.user_simu_param import *  
      from DEVICE.user_inputs.user_materiaux import *  
      from DEVICE.waveguide_render import waveguide_draw

      def add_charge_region(device):

          # Add the mesh and the FDE regions
          device.addchargesolver()
          device.addchargemesh()
         
          # Adds the anode and cathode
          device.addelectricalcontact(name = "metal_left")
          device.addelectricalcontact(name = "metal_center")
          device.addelectricalcontact(name = "metal_right")
         
          v_metal_center = v_signal
          v_metal_right = 0



          # Monitors
          device.addefieldmonitor(name = "electric_monitor")

         
          configuration = (
             
          ("CHARGE",
                    (("min edge length", min_edge_length),
                    ("max edge length", max_edge_length))),
         
         
          ("CHARGE::mesh",
                   (("x", 0),
                    ("y", 0),
                    ("z min", 0),
                    ("x span", wg_width),
                    ("z max", wg_height))),

         
          ("simulation region",
                   (("dimension", "2D Z-Normal"),
                    ("x", -(electrode_signal_width+electrodes_gap)/2),
                    ("z", 0),
                    ("y", 0),
                    ("x span", calcwindow_width),
                    ("y span", calcwindow_height),
                    ("background material", "my_SiO2"))),  
             
          ("CHARGE::boundary conditions::metal_left",
                   (("bc mode", "steady state"),
                    ('sweep type', 'single'),
                    ('voltage', 0),
                    ("surface type", "solid"),
                    ("solid", "metal_left"))),
         
          ("CHARGE::boundary conditions::metal_center",
                   (("bc mode", "steady state"),
                    ('sweep type', 'single'),
                    ('voltage', v_metal_center),
                    ("surface type", "solid"),
                    ("solid", "metal_center"))),
         
          ("CHARGE::electric_monitor",
                   (("monitor type", 6),
                    ("x", 0.),
                    ("y", 0.),
                    ("z", 0.),
                    ("x span", calcwindow_width),
                    ("z span", calcwindow_height))),


          ("CHARGE::boundary conditions::metal_right",
                   (("bc mode", "steady state"),
                    ('sweep type', 'single'),
                    ('voltage', v_metal_right),
                    ("surface type", "solid"),
                    ("solid", "metal_right"))),
           
         
          )
         
         

          # Populate the waveguide simulation region

          for obj, parameters in configuration:
                 for k, v in parameters:
                     device.setnamed(obj, k, v)
                     
                     
      if(__name__=="__main__"):
          with lumapi.DEVICE(hide=True) as device:
         
            # Draw the waveguide structure using a custom function
            device.redrawoff()
            waveguide_draw(device)
           
            # Draw the Simulation Region
            add_charge_region(device)


            device.save(EO_MODULATOR_DIRECTORY_WRITE_FILE + "\\eo_waveguide_render.ldev")

      My parameters are :

      # 1. Simulation Region Parameters
      calcwindow_width=25e-6
      calcwindow_length=8e-6
      calcwindow_height=8e-6

      # 2. Box
      box_length=8e-6
      background_material = 1.44

      # 3. Slab
      slab_length = box_length
      slab_height = 0.2e-6
      slab_width = 50e-6

      # 4. Waveguide
      spacer = 0.1e-6
      wg_height = 0.8e-6
      wg_width = 0.9e-6

      # 5. Electrodes
      electrodes_height = 1.8e-6
      electrode_signal_width = 9.5e-6
      electrode_ground_width = 9.5e-6
      electrodes_gap = 5e-6

      v_signal = 1

      # 6. Mesh parameters
      min_edge_length = 0.05e-6        # Minimum edge length for mesh
      max_edge_length = 1e-6    # Maximum edge length for mesh
      mesh_enable = True            # Enable mesh
      max_edge_length_mesh_override = 500e-9   # Maximum edge length for mesh override

      # 7. Feem parameters
      wavelength = 1.55e-6          # Wavelength
      num_modes = 6                 # Number of modes

      # 8. Figures
      my_dpi = 96                   # DPI for figures


      r_13, r_33 = 9.6e-12, 30.9e-12
      eps_e, eps_o = 2.14 ** 2, 2.21 ** 2

      The second problem I have is in the definition of my lithium niobate :

          #EM material property
          device.addmodelmaterial()
          device.set("name", "my_LNOI")
          device.set("color",Vert)
          device.addemmaterialproperty("Dielectric")
          device.set("name","my_LNOI_em")
          device.select("materials::my_LNOI::my_LNOI_em")
          device.set("refractive index", 2.21)
         
          #CT material property
          device.select("materials::my_LNOI")
          device.addctmaterialproperty("Semiconductor")
          device.set("name","my_LNOI_ct")
          device.select("materials::my_LNOI::my_LNOI_ct")
          # device.setnamed("anisotropy","Diagonal") =============> This leads to en error but it works when I use it in lumerical directly, do you know why ?
          # device.setnmed("dc permittivity xx",27.9)
          # device.setnamed("dc permittivity yy",44.3)
          # device.setnamed("dc permittivity zz",44.3)
          device.set("dc permittivity",27.9)
          device.set("work function",4)
          device.set("electronic.x.enabled",1)
          device.set("electronic.x.Eg.constant",7)
       
    • sara.bassil
      Subscriber

      Hi, I found the error :

      It's in the definition of my lithium niobate material, up you can see how i defined it as a non anisotropic material but this seem to provoke the error of convergence!

      Do you have an idea what may cause the lask of convergence in this definition ? 

      It would be so helpful! Thank you 

      Best,

      Sara 

    • sara.bassil
      Subscriber

      Hi again, 

      I found the error : the box of trap-assisted (rsrh) was checked 

      So the last help I need is to define the anisotropy via python, is it possible ? 

      Thank you!!

      Sara

    • Amrita Pati
      Ansys Employee

      Hi Sara,

      I apologize for the late reply. We are understaffed at the moment. I used python code to set the anisotropic permittivity and I wasn't able to recreate the issue. Here is the code I used:

      device.switchtolayout();
      device.select("materials::LiNbO3 semiconductor - X/Y cut (Lithium Niobate)::LiNbO3 semiconductor - X/Y cut (Lithium Niobate)");
      device.set("anisotropy","Diagonal")
      device.set("dc permittivity xx",10)
      device.set("dc permittivity yy",20)
      device.set("dc permittivity zz",20)

       

      Can you tell me which version of Lumerical are you using? Also, please use device.switchtolayout(); just before setting the material properties to make sure that the simulation is not in analysis mode. I noticed that if "Lock Mesh" is enabled then the file automatically goes to "Analysis Mode" even if you saved it in Layout Mode.

       

      As a workaround, you may use the eval() function in Python to execute Lumerical code in the Script Prompt. Please let me know if this doesn't work too:

       

      device.switchtolayout();
      device.select("materials::LiNbO3 semiconductor - X/Y cut (Lithium Niobate)::LiNbO3 semiconductor - X/Y cut (Lithium Niobate)");
      device.eval('set("anisotropy","Diagonal");')
      device.eval('set("dc permittivity xx",30);')
      device.eval('set("dc permittivity yy",40);')
      device.eval('set("dc permittivity zz",50);')

       

      Regards,
      Amrita

    • sara.bassil
      Subscriber

      Hi Amrita, no worries thank you for respoding,

      I tried your suggestion but I get the "Failed to evaluate code" error 

      I am using the 2024 R1.3 version of Lumerical

      Very weird.. 

      Best,

      Sara 

    • sara.bassil
      Subscriber

      The error I get when I use these lines of code :

          # LNOI=np.array([2.21,2.14,2.21])
          #EM material property
          device.addmodelmaterial()
          device.set("name", "my_LNOI")
          device.set("color",Vert)
          device.addemmaterialproperty("Dielectric")
          device.set("name","my_LNOI_em")
          device.select("materials::my_LNOI::my_LNOI_em")
          device.set("refractive index", 2.21)
         
          #CT material property
          device.select("materials::my_LNOI")
          device.addctmaterialproperty("Semiconductor")
          device.set("name","my_LNOI_ct")
          device.select("materials::my_LNOI::my_LNOI_ct")
        device.set("anisotropy","Diagonal")

          # device.set("dc permittivity",27.9)
          device.set("dc permittivity xx",27.9)
          device.set("dc permittivity yy",44.3)
          device.set("dc permittivity zz",44.3)

      Concerns the "anisotropy" line :

          device.set("anisotropy","Diagonal")
          raise LumApiError(message)
      lumapi.LumApiError: 'in set, the requested property was not found' 

      When I try : device.set("anisotropy","None") I get the same error !

      Can I control the anisotropy of the material in this version of Lumerical with python ? 

      Best,

      Sara 

       

       

    • Amrita Pati
      Ansys Employee

      Hi Sara,

      Sorry, I couldn't get back to you earlier. I was traveling for work last week. The anistropy feature in CHARGE was introduced in 2023 R1.2. So, in principle it should work. But it is possible that it wasn't accessible through script. I serached internally and couldn't find anything specfic to when the script version was implemented. I will check with the R&D team. Are you able to set it from Lumerical directly (using .lsf)? It looks like the property wasn't accessible through the script at all, so I would not expect it to work.

      Regards,
      Amrita

    • sara.bassil
      Subscriber

      Hi Amrita, 

      No worries, thank you for your assistance, it's a big help!

      Yes, I am able to set it in Lumerical directly using lsf, that's why I thought that it will not be a problem setting it with python

      Best,

      Sara 

Viewing 7 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]