%% - Create solver object with specified options clc %% OptionsStruct = struct; OptionsStruct.SimulationMode = '2D'; OptionsStruct.TimeStep = 50e-06; OptionsStruct.SimulationTime = 04e-03; OptionsStruct.SpontaneousEmission = true; OptionsStruct.Sideband = true; OptionsStruct.ZeemanSlowerBeam = false; OptionsStruct.Gravity = true; 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 OptionsStruct.BlueDetuning = -2 * Helper.PhysicsConstants.BlueLinewidth; % in Hz OptionsStruct.BlueBeamWaist = 0.010; % in m 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) %% - Scan parameters %Use a for loop to change the parameter during set initial conditions %Run simulation % TWO-PARAMETER SCAN NumberOfPointsForFirstParam = 10; %iterations of the simulation NumberOfPointsForSecondParam = 10; LoadingRateArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam); % Scan Sideband Detuning and Power Ratio DetuningArray = linspace(-0.5,-10, NumberOfPointsForFirstParam); PowerArray = linspace(0.1,0.9, NumberOfPointsForSecondParam); 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); %% - Plot results FirstParameterArray = DetuningArray * Helper.PhysicsConstants.BlueLinewidth; SecondParameterArray = (Simulator.TotalPower - (PowerArray * Simulator.TotalPower)); QuantityOfInterestArray = LoadingRateArray; OptionsStruct = struct; OptionsStruct.RescalingFactorForFirstParameter = (Helper.PhysicsConstants.BlueLinewidth)^-1; OptionsStruct.XLabelString = 'Detuning (\Delta/\Gamma)'; OptionsStruct.RescalingFactorForSecondParameter = 1000; OptionsStruct.YLabelString = 'Sideband Beam Power (mW)'; 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