2D laser waveguide simulation: import electric field norm from txt file

  • 1 November 2022
  • 5 replies



I created a 2D simulation of a waveguide in COMSOL as shown in the figure (semiconductor laser).

semiconductor laser simulation in COMSOL

it is an intensity plot showing the electric field at the edge of the waveguide. From here I can extract x,y and z (electric field) into a .txt file.


How can I import this data into OpticStudio?


Thank you


Best answer by Christophe.Weisse 14 November 2022, 10:14

View original

5 replies

Userlevel 2
Badge +1

Hi !

You could use Physical Optics Propagation (POP) to propagate this beam in OpticStudio, using the “file” option to define the input beam :

The .zbf file can be either binary or text, the latter one being easier to convert from your original file format, to the .zbf file format.
There is an Exel sheet that can help you with the conversion:
How to manually create a ZBF file | Zemax Community
Alternatively, you could also use the programming capabilities of OpticStudio to write your own converter.
I hope this helps,


Hello @Christophe.Weisse ,

Thank you for the hint, I was able to import the simulation as a .zbf text-format file.

However, I encountered another problem, namely the wx and wy calculated by Zemax (The Analyze Tab (sequential ui mode) > Laser and Fibers Group > About Physical Optics Propagation > Quantitative Beam Analysis > Beam Width and M-Squared ) isn’t equal to the wx and wy I export from my simulation. In both cases they are calulated using the second-moment.

How would you explain this difference?

PS. I don’t understand why there is a place for Rayleigh distance in the .zbf file if, as stated in the Help “The Rayleigh distance is ignored on input and is automatically recomputed by OpticStudio.”

Thank you

(running Zemax OpticStudio 21.3.1)

Userlevel 6
Badge +2

Hi @Imam.Usmani 

Thank you for sending your file. Your profile imports correctly when I looked at the Beam File Viewer:


The pilot waists along X and Y are read from the ZBF file.

But using POP, we can read the real values for the beam:

If I click on Save on the POP settings, I can check those values in the merit function. The top values are the waists in X and Y and the bottom the M^2 in X and Y.

What values do you expect?



I just realized that the waist values in my .zbf file were calculated using the Amplitude of the Electric field instead of the Intensity. Now my input values (.ZBF) for wx and wy are almost equal to the values calculated by OpticStudio.

@Sandrine Auriol I expect my input values for the waist (x and y) to be equal to the waist calculated by OpticStudio. You can see in the PNG that it’s much better now.

Thank you for calculating the M-square, I will definitely look at that as the next step.

Userlevel 6
Badge +2

Hi @Imam.Usmani ! Glad it works now.