- we need to give a certain AR reflectivity for the AR coating, for example a transmission of 1 – 0.001, to give a reflectivity of 0.1%
- specify the number of round trip in the substrate to simulate a very loss finesse cavity.

One example of such code is give in the OSCAR repository: *Example_Mirror_as_input.m*

But how to choose the right number of round trip in the substrate ? If it is too low, it will not account for all the reflections and so the energy will not be preserved. So the higher the reflectivity of the AR side, the higher the number of round trip necessary. Here a code to test that:

- define a flat – flat substrate without any loss
- try different numbers of round trip inside the substrate
- and the check of round trip when the loss is below 0.001 ppm (1E-9)

```
E_input = E_Field(G1,'w0', 0.001);
HR = Interface(G1,'RoC',inf,'CA',CA,'T',1E-3,'L',0);
AR = Interface(G1,'RoC',inf,'CA',CA,'T',1-1E-2,'L',0);
for ii=1:15 % try different number of round trips
MI = Mirror(HR,AR,6.35e-3);
MI.RT_inside = ii;
[E_ref, E_trans] = Transmit_Reflect_Mirror(E_input,MI,'AR');
Loss(ii) = abs(1 - (Calculate_Power(E_ref) + Calculate_Power(E_trans)));
end
ind_x_loss_inf = find(Loss < 1E-9);
semilogy(Loss)
ind_x_loss_inf(1)
```

Which give the following results (for a HR reflectivity of 99.9%):

AR reflectivity | Nb of round trip in substrate required |

2% (very bad AR) | 11 |

1% | 10 |

0.5% | 8 |

0.1% | 7 |

500 ppm | 6 |

100 ppm | 5 |

50 ppm | 5 |

10 ppm | 4 |

The solution described here was given to me by Jean-Yves Vinet (a big thank from all the OSCAR users). A 3D ellipsoid in a general manner could be defined as the surface following this equation:

\frac{x^2}{a^2} + \frac{y}{b^2} + \frac{z^2}{R^2} = 1

Isolating the z coordinate, the above equation could be written as:

z = \pm R \sqrt{1 – \frac{x^2}{a^2} – \frac{y^2}{b^2} }

For a surface tangential to the plan z = 0, we take:

z = R – R \sqrt{1 – \frac{x^2}{a^2} – \frac{y^2}{b^2} }

In case of astigmatic mirror with R_x and R_y, we can set:

R = \frac{1}{2}(R_x + R_y), a^2 = R R_x, b^2 = R R_y

]]>The generated code is not bad, some explanations are even added. Here for some simple examples, with the prompt on top:

```
% Display all the prime numbers between 100 and 200
lower_limit = 100;
upper_limit = 200;
prime_numbers = [];
for num = lower_limit:upper_limit
if isprime(num)
prime_numbers = [prime_numbers, num];
end
end
prime_numbers
% The code is correct but quite lazy (which is positive)
```

```
% Draw a circle of diameter 2 with the center at x = -1 and y = 0.5
diameter = 2;
center_x = -1;
center_y = 0.5;
radius = diameter / 2;
figure;
rectangle('Position', [center_x - radius, center_y - radius, diameter, diameter], 'Curvature', [1 1]);
axis equal;
```

]]>Example:

```
G1 = Grid(256,0.4);
IM1 = Interface(G1,'RoC',1420,'CA',0.33,'T',0.014);
Offset_X = 0.01;
Offset_Y = 0.03;
IM1.mask = circshift(IM1.mask,[round(-Offset_Y/G1.Step), round(Offset_X/G1.Step)]);
imagesc(G1.Axis,G1.Axis,(IM1.surface-5E-6).*IM1.mask); axis square; colormap gray
```

]]>First example, calculation of the steady state high finesse cavity.

Grid size | Calculation time on the CPU | Calculation time on the GPU |
---|---|---|

1024 x 1024 | 1 | 0.34 |

512 x 512 | 0.18 | 0.04 |

256 x 256 | 0.08 | 0.02 |

Second example, calculation time for a cavity FSR scan. To be noted, this procedure has been particularly optimised for the GPU, see this article.

Calculation time on the CPU | Calculation time on the GPU |
---|---|

1 | 0.06 |

The second idea would be to decrease the accuracy, a number which determines when we estimate that we have converged to the steady state field. It could be changed as an option to the function using the accelerated converge:

`C1 = Calculate_Fields_AC(C1,'accuracy',1E-10);`

With C1 an object of class Cavity 1. By default the accuracy is set to 1E-12. Below an empirical table to show the impact of this parameter and the speed gain for a cavity of finesse 30 000 with mirror maps and substantial clipping loss (RTL).

Accuracy | Cavity gain | RTL [ppm] | Gain speed |
---|---|---|---|

1E-12 | 5496.9 | 179.44 | 1 |

1E-10 | 5493.4 | 179.44 | 1.6 |

1E-8 | 5480.1 | 179.44 | 2.8 |

1E-6 | 5336.9 | 179.43 | 6.1 |

1E-4 | 5011.7 | 179.44 | 33 |

As we can see from the table, the RTL is pretty robust to the accuracy, whereas the cavity gain is more sensitive dropping by 3% when the accuracy is reduced from 1E-12 to 1E-6.

A third option, more obvious is to reduce the grid size. It has the direct drawback to cut part of the highest spatial frequencies of the surface maps. Here an example of possible gain with the same cavity:

Grid dimension | Cavity gain | RTL [ppm] | Gain speed |
---|---|---|---|

1064 x 1064 | 5478.5 | 180.0 | 1 |

512 x 512 | 5493.4 | 179.4 | 5.7 |

256 x 256 | 5484.0 | 179.8 | 13.6 |

128 x 128 | 5551.5 | 177.4 | 76 |

In a next post, we will explore the benefits of running the code on the GPU.

]]>Then go to the OSCAR Gitlab page and at the bottom of the readme file, you will find a button named Open in MATLAB Online:

It should open directly a Matlab window in your browser with git repository installed:

Then one can navigate in the folder examples and run them with the green arrow on top:

Et voilĂ !

(to be transparent you only have a monthly free number of calculation hours with Matlab online but it is still an amazing product)

The advantage of the ABCD matrix is to propose very quick calculations to validate a design (or confirm we have entered the right parameters). For example, with an object of class Cavity1, the ABCD matrix of the cavity round trip will automatically be calculated. So we can derive the beam parameters on the input mirror as well as the beam size evolution or the accumulated Gouy phase during the propagation over one cavity length:

Those results will be available with function Check_Stability()

]]>`C1 = Cavity_Scan(C1);`

Display_Scan(C1);

However one may want to also record the reflected power. One way to do that would be to scan the cavity manually setting a different round trip phase for each iteration. Concretely, once the cavity C1 is defined it looks like:

```
C1 = Cavity1(IM,EM,1000,E_input); % the cavity is misaligned and not well matched to the input beam
C1 = Cavity_Resonance_Phase(C1); % will be overwritten later
Nb_point = 400; % Number of points for the scan
Phase_scan = zeros(Nb_point,1);
Power_transmitted = zeros(Nb_point,1);
Power_reflected = zeros(Nb_point,1);
for ii=1:Nb_point
Phase_scan(ii) = ii*(2*pi)/Nb_point; % Scan the round trip phase shift from 0 to 2 pi
C1.Resonance_phase = exp(1i*Phase_scan(ii)); % Set the round trip phase shift for the cavity
C1 = Calculate_Fields_AC(C1,'accuracy',1E-5);
Power_transmitted(ii) = Calculate_Power(C1.Field_trans); % store the transmitted power
Power_reflected(ii) = Calculate_Power(C1.Field_ref); % and also the reflected one
end
```

And we can then plot the transmitted power (top plot) and the reflected power (bottom one):

The technique presented here could also be used to only display a certain sideband during a scan (or an arbitrary sum of sidebands).

]]>For large Radii of Curvature (RoC >> size of the grid), it is possible to input directly an astigmatic surface. For example in the following code we define a RoC of 998m in X and 1002 in Y for the *Interfac*e EM_HR:

```
EM_HR = Interface(G1,'RoC',inf,'T',5E-6);
Astigma_RoC = 2;
RoC_X = -1000 - Astigma_RoC;
RoC_Y = -1000 + Astigma_RoC;
EM_HR.surface = (1/(2*RoC_X)*G1.D2_X.^2 + 1/(2*RoC_Y)*G1.D2_Y.^2); % G1 is the simulation grid, could be found also from EM_HR.Grid
```

If someone has the universal formula for parabolic mirrors, with no approximation I am interested.

]]>