2021-06-29 15:44:28 +02:00
|
|
|
%% - Create solver object with specified options
|
|
|
|
clc
|
|
|
|
%%
|
|
|
|
|
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.SimulationMode = '2D';
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.TimeStep = 50e-06; % in s
|
|
|
|
OptionsStruct.SimulationTime = 4e-03; % in s
|
2021-07-04 20:24:38 +02:00
|
|
|
OptionsStruct.SpontaneousEmission = true;
|
|
|
|
OptionsStruct.Sideband = true;
|
2021-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.ZeemanSlowerBeam = false;
|
|
|
|
OptionsStruct.Gravity = true;
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.AtomicBeamCollision = true;
|
2021-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.DebugMode = false;
|
2021-07-04 20:24:38 +02:00
|
|
|
OptionsStruct.SaveData = true;
|
|
|
|
OptionsStruct.SaveDirectory = 'C:\DY LAB\MOT Simulation Project\Calculations\Code\MOT Capture Process Simulation';
|
2021-06-29 15:44:28 +02:00
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
Simulator = MOTSimulator(options{:});
|
|
|
|
|
|
|
|
clear OptionsStruct
|
|
|
|
%% - Set Initial Conditions: Run with default values
|
|
|
|
Simulator.setInitialConditions();
|
|
|
|
|
|
|
|
%% - Set Initial Conditions: Set manually
|
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.NumberOfAtoms = 5000;
|
|
|
|
OptionsStruct.BluePower = 0.2; % in W
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.BlueDetuning = -1.5 * Helper.PhysicsConstants.BlueLinewidth; % in Hz
|
|
|
|
OptionsStruct.BlueBeamWaist = 0.016; % in m
|
2021-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.SidebandPower = 0.2;
|
|
|
|
OptionsStruct.SidebandDetuning = -3 * Helper.PhysicsConstants.BlueLinewidth; % in Hz
|
|
|
|
OptionsStruct.SidebandBeamWaist = 0.010; % in m
|
|
|
|
OptionsStruct.PushBeamPower = 0.010; % in W
|
|
|
|
OptionsStruct.PushBeamDetuning = 0; % in Hz
|
|
|
|
OptionsStruct.PushBeamWaist = 0.005; % in m
|
|
|
|
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
Simulator.setInitialConditions(options{:});
|
|
|
|
clear OptionsStruct
|
|
|
|
%% - Run Simulation
|
|
|
|
[LoadingRate, ~] = Simulator.runSimulation();
|
|
|
|
|
|
|
|
%% - Plot initial distribution
|
|
|
|
NumberOfBins = 100;
|
|
|
|
Plotting.plotPositionAndVelocitySampling(Simulator, NumberOfBins);
|
|
|
|
|
|
|
|
%% - Plot Magnetic Field
|
|
|
|
XAxisRange = [-5 5];
|
|
|
|
YAxisRange = [-5 5];
|
|
|
|
ZAxisRange = [-5 5];
|
|
|
|
Plotting.visualizeMagneticField(Simulator, XAxisRange, YAxisRange, ZAxisRange)
|
|
|
|
|
2021-07-03 10:19:27 +02:00
|
|
|
%% - Plot MFP & VP for different temperatures
|
|
|
|
TemperatureinCelsius = linspace(750,1100,2000); % Temperature in Celsius
|
2021-07-04 20:24:38 +02:00
|
|
|
Plotting.plotMeanFreePathAndVapourPressureVsTemp(TemperatureinCelsius)
|
2021-07-03 10:19:27 +02:00
|
|
|
|
|
|
|
%% - Plot the Free Molecular Flux for different temperatures
|
|
|
|
Temperature = [900, 950, 1000, 1050, 1100]; % Temperature'
|
|
|
|
Plotting.plotFreeMolecularFluxVsTemp(Simulator,Temperature)
|
|
|
|
|
|
|
|
%% - Plot Angular Distribution for different Beta
|
|
|
|
Beta = [0.5, 0.1 , 0.05, 0.02, 0.01]; %Beta = 2 * radius / length of the tube
|
|
|
|
Plotting.plotAngularDistributionForDifferentBeta(Simulator, Beta)
|
|
|
|
|
|
|
|
%% - Plot Capture Velocity
|
|
|
|
|
|
|
|
Simulator.setInitialConditions();
|
|
|
|
Simulator.SimulationTime = 15*10^(-4);
|
|
|
|
Simulator.TimeStep = 1.5*10^(-6);
|
|
|
|
Simulator.MOTExitDivergence = 15/360*2*pi;
|
|
|
|
Simulator.MagneticGradient = 0.4;
|
|
|
|
|
|
|
|
Plotting.plotCaptureVelocityVsAngle(Simulator);
|
|
|
|
|
|
|
|
%% - Plot Phase Space with Acceleration Field
|
|
|
|
|
|
|
|
Simulator.NumberOfAtoms = 100;
|
|
|
|
MaximumVelocity = 150;
|
|
|
|
NumberOfBins = 200; %Along each axis
|
|
|
|
IncidentAtomDirection = 0*2*pi/360;
|
|
|
|
IncidentAtomPosition = 0;
|
|
|
|
Plotting.plotPhaseSpaceWithAccelerationField(Simulator, MaximumVelocity, NumberOfBins, IncidentAtomDirection, IncidentAtomPosition)
|
|
|
|
|
2021-06-29 15:44:28 +02:00
|
|
|
%% - Scan parameters
|
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
% ONE-PARAMETER SCAN
|
2021-06-29 15:44:28 +02:00
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
NumberOfPointsForParam = 20; %iterations of the simulation
|
|
|
|
% Scan Cooling Beam Power
|
|
|
|
PowerArray = linspace(0.1, 1.0, NumberOfPointsForParam) * Simulator.TotalPower;
|
|
|
|
% Scan Cooling Beam Detuning
|
|
|
|
% DetuningArray = linspace(-0.5,-10, NumberOfPointsForParam) * Helper.PhysicsConstants.BlueLinewidth;
|
2021-06-29 15:44:28 +02:00
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.ChangeInitialConditions = true;
|
|
|
|
OptionsStruct.ParameterNameArray = {'NumberOfAtoms'};
|
|
|
|
OptionsStruct.ParameterValueArray = {10000};
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
2021-07-03 10:19:27 +02:00
|
|
|
|
2021-06-29 15:44:28 +02:00
|
|
|
tStart = tic;
|
2021-07-04 20:24:38 +02:00
|
|
|
[LoadingRateArray, ~] = Simulator.doOneParameterScan('BluePower', PowerArray, options{:});
|
2021-06-29 15:44:28 +02:00
|
|
|
tEnd = toc(tStart);
|
|
|
|
fprintf('Total Computational Time: %0.1f seconds. \n', tEnd);
|
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
clear OptionsStruct
|
|
|
|
|
|
|
|
% - Plot results
|
|
|
|
|
|
|
|
ParameterArray = PowerArray .* Simulator.TotalPower;
|
|
|
|
QuantityOfInterestArray = LoadingRateArray;
|
|
|
|
|
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.RescalingFactorForParameter = 1000;
|
|
|
|
OptionsStruct.XLabelString = 'Cooling Beam Power (mW)';
|
|
|
|
OptionsStruct.RescalingFactorForYQuantity = 1e-16;
|
|
|
|
OptionsStruct.ErrorsForYQuantity = false;
|
|
|
|
OptionsStruct.YLabelString = 'Loading rate (x 10^{16} atoms/s)';
|
|
|
|
OptionsStruct.TitleString = sprintf('Magnetic Gradient = %.0f (G/cm)', Simulator.MagneticGradient * 100);
|
2021-07-03 10:19:27 +02:00
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
Plotting.plotResultForOneParameterScan(ParameterArray, QuantityOfInterestArray, options{:})
|
|
|
|
|
|
|
|
clear OptionsStruct
|
|
|
|
|
|
|
|
%% TWO-PARAMETER SCAN
|
|
|
|
|
|
|
|
NumberOfPointsForParam = 20; %iterations of the simulation
|
|
|
|
NumberOfPointsForSecondParam = 10;
|
2021-07-03 10:19:27 +02:00
|
|
|
|
|
|
|
% Scan Sideband Detuning and Power Ratio
|
2021-07-04 20:24:38 +02:00
|
|
|
DetuningArray = linspace(-0.5,-6, NumberOfPointsForParam) * Helper.PhysicsConstants.BlueLinewidth;
|
2021-07-03 10:19:27 +02:00
|
|
|
SidebandPowerArray = linspace(0.1,0.9, NumberOfPointsForSecondParam) * Simulator.TotalPower;
|
|
|
|
BluePowerArray = Simulator.TotalPower - SidebandPowerArray;
|
|
|
|
|
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.ChangeRelatedParameter = true;
|
|
|
|
OptionsStruct.Order = 2; %Change after first parameter = 1, Change after second parameter = 2
|
|
|
|
OptionsStruct.RelatedParameterName = 'BluePower';
|
|
|
|
OptionsStruct.RelatedParameterArray = BluePowerArray;
|
2021-07-04 20:24:38 +02:00
|
|
|
OptionsStruct.ChangeInitialConditions = true;
|
|
|
|
OptionsStruct.ParameterNameArray = {'NumberOfAtoms'};
|
|
|
|
OptionsStruct.ParameterValueArray = {10000};
|
2021-07-03 10:19:27 +02:00
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
tStart = tic;
|
2021-07-04 20:24:38 +02:00
|
|
|
[LoadingRateArray, StandardErrorArray] = Simulator.doTwoParameterScan('SidebandDetuning', DetuningArray, 'SidebandPower', SidebandPowerArray, options{:});
|
2021-07-03 10:19:27 +02:00
|
|
|
tEnd = toc(tStart);
|
|
|
|
fprintf('Total Computational Time: %0.1f seconds. \n', tEnd);
|
|
|
|
|
|
|
|
clear OptionsStruct
|
2021-06-29 15:44:28 +02:00
|
|
|
|
2021-07-04 20:24:38 +02:00
|
|
|
% - Plot results
|
|
|
|
|
|
|
|
FirstParameterArray = DetuningArray;
|
|
|
|
SecondParameterArray = SidebandPowerArray;
|
2021-06-29 15:44:28 +02:00
|
|
|
QuantityOfInterestArray = LoadingRateArray;
|
|
|
|
|
|
|
|
OptionsStruct = struct;
|
|
|
|
OptionsStruct.RescalingFactorForFirstParameter = (Helper.PhysicsConstants.BlueLinewidth)^-1;
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.XLabelString = 'Sideband Detuning (\Delta/\Gamma)';
|
2021-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.RescalingFactorForSecondParameter = 1000;
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.YLabelString = 'Sideband Power (mW)';
|
2021-07-04 20:24:38 +02:00
|
|
|
OptionsStruct.RescalingFactorForQuantityOfInterest = 1e-16;
|
|
|
|
OptionsStruct.ZLabelString = 'Loading rate (x 10^{16} atoms/s)';
|
2021-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.TitleString = sprintf('Magnetic Gradient = %.0f (G/cm)', Simulator.MagneticGradient * 100);
|
|
|
|
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
Plotting.plotResultForTwoParameterScan(FirstParameterArray, SecondParameterArray, QuantityOfInterestArray, options{:})
|
|
|
|
|
|
|
|
clear OptionsStruct
|