-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLaser.m
134 lines (120 loc) · 3.53 KB
/
Laser.m
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
classdef Laser < matlab.mixin.Copyable
% Sebastian C. Robarts 2023 - sebrobarts@gmail.com
properties
Name = "Laser";
Waist % Minimum 1/e Intensity radius (m)
RepetitionRate
AveragePower
PulseDuration
Wavelength
LineWidth
BandWidth
PeakPowerCoefficientTL % Pulse PPC if the pulse was transform limited
SourceString
PhaseString
end
properties (Transient)
Pulse OpticalPulse
end
properties (Dependent)
Frequency
WaistArea
PulseEnergy
PulseIntensity % Max (Temporal) Pulse Irradiance [W/m^2]
IntensityCheck % Beam Irradiance [W/m^2]
end
methods(Access = protected)
% Override copyElement method:
function cpObj = copyElement(obj)
% Make a shallow copy of all properties
cpObj = copyElement@matlab.mixin.Copyable(obj);
% Make a deep copy of the Deep object
cpObj.Pulse = copy(obj.Pulse);
if ~isempty(cpObj.Pulse)
cpObj.Pulse.Source = cpObj;
end
end
end
methods
% Constructor
function obj = Laser(lambda_central,waistR,f_rep,power,src_str,dtau,dlam,phase_str)
arguments
lambda_central % Central wavelength (m)
waistR
f_rep
power
src_str
dtau = 100e-15;
dlam = (4 * c * 0.315 * dtau * (lambda_central^2)) / ((2*c*dtau)^2 - (lambda_central*0.315)^2);
phase_str = NaN;
end
obj.Wavelength = lambda_central;
obj.Waist = waistR;
obj.RepetitionRate = f_rep;
obj.AveragePower = power;
obj.PulseDuration = dtau;
obj.SourceString = src_str;
obj.PhaseString = phase_str;
obj.LineWidth = dlam;
end
function simulate(obj,simWin)
obj.Pulse = OpticalPulse(obj,simWin);
obj.PeakPowerCoefficientTL = 1./((sum(abs(obj.Pulse.TemporalField).^2).*...
obj.Pulse.SimWin.DeltaTime./obj.Pulse.DurationTL));
nr = obj.Pulse.Medium.Bulk.RefractiveIndex(obj.Pulse.SimWin.ReferenceIndex);
% Free space field magnitude scaling [W/m^2] -> [V/m]
I2E = sqrt(obj.PulseIntensity .* 2./nr./eps0./c);
obj.Pulse.TemporalField = I2E .* obj.Pulse.TemporalField;
obj.Wavelength = obj.Pulse.PeakWavelength;
obj.LineWidth = obj.Pulse.WavelengthFWHM;
obj.BandWidth = obj.Pulse.FrequencyFWHM;
end
function f = get.Frequency(obj)
f = c ./ obj.Wavelength;
end
function a = get.WaistArea(obj)
a = pi .* (obj.Waist .^ 2);
end
function Qe = get.PulseEnergy(obj)
Qe = obj.AveragePower / obj.RepetitionRate;
end
function I0TL = get.PulseIntensity(obj)
peakPTL = obj.PulseEnergy ./ obj.Pulse.DurationTL;
peakPTL = peakPTL .* obj.PeakPowerCoefficientTL;
I0TL = peakPTL./obj.Pulse.Area;
end
function I0 = get.IntensityCheck(obj)
peakP = obj.PulseEnergy / obj.PulseDuration;
peakP = peakP * obj.Pulse.PeakPowerCoefficient;
I0 = peakP/obj.Pulse.Area;
end
function specTable = writePulse(obj)
pulse = obj.Pulse;
pulse.applyGD(-pulse.SimWin.TimeOffset);
% pulse.spectralShift(0);
pulse.gather;
wavelength = pulse.SimWin.Wavelengths';
intensity = pulse.EnergySpectralDensity';
phase = pulse.SpectralPhase';
% phase = phase - phase(pulse.SimWin.ReferenceIndex);
specTable = table(wavelength,intensity,phase);
% specTable = specTable(and(wavelength>0,wavelength<7e-6),:);
fname = pulse.Source.Name + 'PulseSpectrum.txt';
writetable(specTable,fname);
pulse.timeShift;
end
function store(laser,name,devFlag)
arguments
laser
name
devFlag = 0;
end
laser.Name = name;
currentfolder = pwd;
cd(OptiFaxRoot(devFlag));
cd("objects" + filesep + "lasers");
save(name + ".mat","laser","-mat");
cd(currentfolder);
end
end
end