Photonics

Photonics

Lumerical MODE crashes after n iterations

    • Lorenzo Lazzari
      Subscriber

      Hello! I use MODE to retrieve guided modes of an integrated structure. I use a .lsf script with 3 nested cycles: at each iteration, relevant data are saved in arrays, while the structure is deleted and recreated with slightly different parametrs, for optimization purposes. Once the most internal cycle is over, the data arrays are saved to a file (matlabsave command); anything that is not strictly necessary for next steps is deleted (clear command). The problem is that, after 3 iterations of the second cycle (so after the internal cycle is concluded 3 times) successfully completed, the program crashes without even sending any error code. I tried to keep track of the RAM consumption, but it seems to never exceed critical values. In the meanwhile, the computer works as usual, without any particular problem. Any clue on how to solve this (or at least understand what is going on)?

      Thanks in advance, Lorenzo 

    • Guilin Sun
      Ansys Employee

      It might be because you manipulated variables using "clear". "clear" will delete all vriables, including the loop counters.

      I would suggest that you use a 3D matrix (3 layers of loops) to keep all the data. At the end of the simulation you save the data, if the data file is not very large. Later you can load/read the data for further processing.

       

      Or you can reuse the matrix instead of clear it since you have already saved the data.

      DO not use "clear" in the middle of the script. Only use it before any variables.

    • Lorenzo Lazzari
      Subscriber

      Thanks for your answer!

      I was using clear("var1", "var2", ...), erasing specific variables and not the loop counters; I got rid of this command now anyways. The simulation is actually working as expected - from the point of view of the results -, but crashes as described in the post.

      Inspired by your advice, I noticed I was re-initializing the data arrays any time the internal cycle was concluded (so after the saving stage), and I changed it to initialize them only once before starting the first loops. However, the simulation crashed as before.

      I also tried to build 3D matrices containing all the data, to be saved at the very end of the loop. Unfortunately, nothing changed even in this configuration... and no data was saved before the crash.

      Any other idea that might help? Thanks again!

      Lorenzo

    • Guilin Sun
      Ansys Employee

      When some parameters have conflict, such as a geometry cannot be formed, the file can be crashed. I would suggest to output the loop counters, and then reopen the file, use the loop counter data (and nearby data) and see if it works.

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