summaryrefslogtreecommitdiff
path: root/cavity_design_demo.m
blob: ccc96c1035f63d370183b826b9c51d2d4a3181d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
% Design of a laser cavity with focus on 2  bow-tie resonator
% Notation follows

% "Laser resonators with several mirrors  and lenses with the bow-tie laser
% resonator with compensation for astigmatism  and thermal lens effects as an
% example" by Haim Abitan and Torben Skettrup 2005 J. Opt. A: Pure Appl. Opt. 7 7
% doi:10.1088/1464-4258/7/1/002
% http://dx.doi.org/10.1088/1464-4258/7/1/002


% The cavity defined by two flat mirrors and distance between them dm
% two concave mirrors with curvatures R1 and R2, and the shortest distance between them d1
% d2 is the beam path length from concave mirror -> flat -> flat -> concave mirror.
% dm is part of d2

% let's set some parameters
f1=0.30;
d1=.105; % with respect to the flat front mirror
% we use single lens design
f2=Inf; % dummy lens
Lcav = 0.79; % geometrical pathlength of the cavity
n_refr = 1.5; % PBS index of reffraction
% we need to add to geometrical path extra optical path due to two PBS 0.5" each
Lcav = Lcav + 2 * 0.025/2 * (n_refr-1) ;
d2=Lcav-d1; %distance between lens1 and lens2

% time to build the optics set
mirror1.abcd = abcd_lens( f1 ) ;
mirror1.x = d1;
mirror2.abcd = abcd_lens( f2 ) ;
mirror2.x = d1+d2;
optics={mirror1, mirror2};


% operational wavelength
lambda = 795e-9;  

%% let's create cavity abcd matrix
% follow figure 4: elements goes as d1, f1, d3, f2
% where f1 and f2 lens mirror equivalent with f_i=R_i/2

abcd_cavity = optics2abcd( optics );

if ~isCavityStable(abcd_cavity)
    display('Cavity is unstable !');
    display('We should stop now. There is no stable mode in this cavity');
    error('Not possible to calculate a cavity mode in the unstable cavity');
end

display('Cavity is stable');

zstart = 0;
qstart = abcd2self_repeating_q( abcd_cavity );

zfinal = Lcav;
qfinal = q_after_abcd( qstart, abcd_cavity );


eps = 1e-8; % typical round of error
if ( abs( q2wr(qstart, lambda ) - q2wr(qfinal, lambda) ) > eps )
    % We should never be here if above functions do their job correctly
    display(qstart);
    display(qfinal);
    error('The calculation is incorrect: resonator mode sizes do not match at the beginning and the end. Go fix the code.');
end


%% Preparing for the graphical mode output
% display properties setup
lens_width = .03; %Lens width
show_lens_width = 1; %Set to 1 to enable display of lens width on solution propagation plot
show_lens_position = 1; %Set to 1 to enable display of position of center of lens on solution propagation plot
display_prop = [show_lens_width, show_lens_position];


% show beam in the resonator
[waist_at_the_end, radius_at_the_end, waist_at_mirrors] = solution_visualization(qstart,zstart, qfinal, zfinal, optics, lambda, lens_width, display_prop);

waist_at_mirrors

display('Presumed size and location of the cavity waist');
[wc, zc] = cavity_optics2its_waist_and_position( optics, lambda )

qc_via_propagation = gbeam_propagation ( zc, qstart, zstart, optics );
[wcprop, Rcprop] = q2wr(qc_via_propagation, lambda);

% we expect Rcprop to be infinite since it is focused point
% wcprop should match wc

if ( abs( wc - wcprop ) > eps )
    % We should never be here if above functions do their job correctly
    display(wcprop);
    error('Different methods to calculate focused point parameters do not match');
end