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
|
|
|
|
OptionsStruct.SpontaneousEmission = false;
|
|
|
|
OptionsStruct.Sideband = false;
|
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;
|
|
|
|
OptionsStruct.SaveData = false;
|
|
|
|
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
|
|
|
|
Plotting.plotMeanFreePathAndVapourPressure(TemperatureinCelsius)
|
|
|
|
|
|
|
|
%% - 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
|
|
|
|
%Use a for loop to change the parameter during set initial conditions
|
|
|
|
%Run simulation
|
|
|
|
|
|
|
|
% TWO-PARAMETER SCAN
|
|
|
|
|
2021-07-03 10:19:27 +02:00
|
|
|
NumberOfPointsForFirstParam = 2; %iterations of the simulation
|
|
|
|
NumberOfPointsForSecondParam = 2;
|
2021-06-29 15:44:28 +02:00
|
|
|
LoadingRateArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam);
|
|
|
|
|
|
|
|
% Scan Sideband Detuning and Power Ratio
|
|
|
|
DetuningArray = linspace(-0.5,-10, NumberOfPointsForFirstParam);
|
|
|
|
PowerArray = linspace(0.1,0.9, NumberOfPointsForSecondParam);
|
|
|
|
|
2021-07-03 10:19:27 +02:00
|
|
|
OptionsStruct.NumberOfAtoms = 5000;
|
|
|
|
|
2021-06-29 15:44:28 +02:00
|
|
|
tStart = tic;
|
|
|
|
for i=1:NumberOfPointsForFirstParam
|
|
|
|
OptionsStruct.SidebandDetuning = DetuningArray(i) * Helper.PhysicsConstants.BlueLinewidth;
|
|
|
|
for j=1:NumberOfPointsForSecondParam
|
|
|
|
OptionsStruct.BluePower = PowerArray(j) * Simulator.TotalPower;
|
|
|
|
OptionsStruct.SidebandPower = Simulator.TotalPower - OptionsStruct.BluePower;
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
Simulator.setInitialConditions(options{:});
|
|
|
|
tic
|
|
|
|
[LoadingRate, ~] = Simulator.runSimulation();
|
|
|
|
LoadingRateArray(i,j) = LoadingRate;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tEnd = toc(tStart);
|
|
|
|
fprintf('Total Computational Time: %0.1f seconds. \n', tEnd);
|
|
|
|
|
2021-07-03 10:19:27 +02:00
|
|
|
%% TWO-PARAMETER SCAN FUNCTION
|
|
|
|
|
|
|
|
NumberOfPointsForFirstParam = 2; %iterations of the simulation
|
|
|
|
NumberOfPointsForSecondParam = 2;
|
|
|
|
Simulator.NumberOfAtoms = 5000;
|
|
|
|
|
|
|
|
% Scan Sideband Detuning and Power Ratio
|
|
|
|
DetuningArray = linspace(-0.5,-10, NumberOfPointsForFirstParam) * Helper.PhysicsConstants.BlueLinewidth;
|
|
|
|
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;
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
tStart = tic;
|
|
|
|
LoadingRateArray = Simulator.doTwoParameterScan('SidebandDetuning', DetuningArray, 'SidebandPower', SidebandPowerArray, options{:});
|
|
|
|
tEnd = toc(tStart);
|
|
|
|
fprintf('Total Computational Time: %0.1f seconds. \n', tEnd);
|
|
|
|
|
|
|
|
clear OptionsStruct
|
2021-06-29 15:44:28 +02:00
|
|
|
%% - Plot results
|
|
|
|
|
|
|
|
FirstParameterArray = DetuningArray * Helper.PhysicsConstants.BlueLinewidth;
|
|
|
|
SecondParameterArray = (Simulator.TotalPower - (PowerArray * Simulator.TotalPower));
|
|
|
|
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-06-29 15:44:28 +02:00
|
|
|
OptionsStruct.ZLabelString = 'Loading rate (atoms/s)';
|
|
|
|
OptionsStruct.TitleString = sprintf('Magnetic Gradient = %.0f (G/cm)', Simulator.MagneticGradient * 100);
|
|
|
|
|
|
|
|
options = Helper.convertstruct2cell(OptionsStruct);
|
|
|
|
|
|
|
|
Plotting.plotResultForTwoParameterScan(FirstParameterArray, SecondParameterArray, QuantityOfInterestArray, options{:})
|
|
|
|
|
|
|
|
clear OptionsStruct
|