Calculations/MOT Capture Process Simulation/@MOTSimulator/runSimulation.m

25 lines
1.1 KiB
Mathematica
Raw Normal View History

function [LoadingRate, StandardError, ConfidenceInterval] = runSimulation(this)
%% - Sampling for initial positions and velocities
% - sampling the position distribution
this.InitialPositions = this.initialPositionSampling();
% - sampling the velocity distribution
this.InitialVelocities = this.initialVelocitySampling();
%% Solve ODE
progressbar = Helper.parforNotifications();
progressbar.PB_start(this.NumberOfAtoms,'Message',['Simulating capture process for ' num2str(this.NumberOfAtoms,'%.0f') ' atoms:']);
% calculate the final position of the atoms
ParticleDynamicalQuantities = zeros(this.NumberOfAtoms,int64(this.SimulationTime/this.TimeStep),6);
Positions = this.InitialPositions;
Velocities = this.InitialVelocities;
parfor Index = 1:this.NumberOfAtoms
ParticleDynamicalQuantities(Index,:, :) = this.solver(Positions(Index,:), Velocities(Index,:));
progressbar.PB_iterate();
end
clear Index
%% Calculate the Loading Rate
[LoadingRate, StandardError, ConfidenceInterval] = this.calculateLoadingRate(ParticleDynamicalQuantities);
end