diff --git a/Dipolar Gas Simulator/+Helper/PhysicsConstants.m b/Dipolar Gas Simulator/+Helper/PhysicsConstants.m index f62dd0a..9a37257 100644 --- a/Dipolar Gas Simulator/+Helper/PhysicsConstants.m +++ b/Dipolar Gas Simulator/+Helper/PhysicsConstants.m @@ -7,15 +7,15 @@ classdef PhysicsConstants < handle ElectronMass=9.10938291E-31; GravitationalConstant=6.67384E-11; ProtonMass=1.672621777E-27; - AtomicMassUnit=1.66053878283E-27; - BohrRadius=0.52917721092E-10; - BohrMagneton=927.400968E-26; - BoltzmannConstant=1.380649E-23; + AtomicMassUnit=1.660539066E-27; + BohrRadius=5.2917721067E-11; + BohrMagneton=9.274009994E-24; + BoltzmannConstant=1.38064852E-23; StandardGravityAcceleration=9.80665; SpeedOfLight=299792458; StefanBoltzmannConstant=5.670373E-8; ElectronCharge=1.602176634E-19; - VacuumPermeability=1.25663706212E-6; + VacuumPermeability=1.25663706212E-6; DielectricConstant=8.8541878128E-12; ElectronGyromagneticFactor=-2.00231930436153; AvogadroConstant=6.02214076E23; @@ -23,19 +23,8 @@ classdef PhysicsConstants < handle GravitationalAcceleration = 9.80553; % Dy specific constants - Dy164Mass = 163.929174751*1.66053878283E-27; + Dy164Mass = 163.929174751*1.660539066E-27; Dy164IsotopicAbundance = 0.2826; - BlueWavelength = 421.291e-9; - BlueLandegFactor = 1.22; - BlueLifetime = 4.94e-9; - BlueLinewidth = 1/4.94e-9; - RedWavelength = 626.086e-9; - RedLandegFactor = 1.29; - RedLifetime = 1.2e-6; - RedLinewidth = 1/1.2e-6; - PushBeamWaveLength = 626.086e-9; - PushBeamLifetime = 1.2e-6; - PushBeamLinewidth = 1/1.2e-6; end methods diff --git a/Dipolar Gas Simulator/+Scripts/test.m b/Dipolar Gas Simulator/+Scripts/test.m index 0ff3407..45fce31 100644 --- a/Dipolar Gas Simulator/+Scripts/test.m +++ b/Dipolar Gas Simulator/+Scripts/test.m @@ -6,11 +6,10 @@ OptionsStruct = struct; OptionsStruct.SimulationMode = 'ImaginaryTimeEvolution'; % 'ImaginaryTimeEvolution' | 'RealTimeEvolution' -OptionsStruct.ErrorEstimationMethod = 'bootstrap'; % 'jackknife' | 'bootstrap' -OptionsStruct.NumberOfAtoms = 5000; +OptionsStruct.CutoffType = 'Cylindrical'; +OptionsStruct.PotentialType = 'Harmonic'; OptionsStruct.TimeStep = 50e-06; % in s OptionsStruct.SimulationTime = 4e-03; % in s -OptionsStruct.CutoffType = true; OptionsStruct.SaveData = true; OptionsStruct.SaveDirectory = './Data'; options = Helper.convertstruct2cell(OptionsStruct); @@ -18,6 +17,7 @@ clear OptionsStruct sim = Simulator.DipolarGas(options{:}); calc = Simulator.Calculator(options{:}); +pot = Simulator.Potentials(options{:}); %-% Run Simulation %-% [Params, Transf, psi, V, VDk] = sim.runSimulation(calc); diff --git a/Dipolar Gas Simulator/+Simulator/@DipolarGas/DipolarGas.m b/Dipolar Gas Simulator/+Simulator/@DipolarGas/DipolarGas.m index ea3ca51..d9cef99 100644 --- a/Dipolar Gas Simulator/+Simulator/@DipolarGas/DipolarGas.m +++ b/Dipolar Gas Simulator/+Simulator/@DipolarGas/DipolarGas.m @@ -5,8 +5,13 @@ classdef DipolarGas < handle & matlab.mixin.Copyable TimeStep; SimulationTime; NumberOfAtoms; - ErrorEstimationMethod; + % Etol = 5e-10; % Tolerances + % rtol = 1e-5; + % cut_off = 2e6; % sometimes the imaginary time gets a little stuck + % even though the solution is good, this just stops it going on forever + % mindt = 1e-6; %Minimum size for a time step using adaptive dt + %Flags @@ -25,11 +30,9 @@ classdef DipolarGas < handle & matlab.mixin.Copyable p.KeepUnmatched = true; addParameter(p, 'SimulationMode', 'ImaginaryTimeEvolution',... @(x) any(strcmpi(x,{'ImaginaryTimeEvolution','RealTimeEvolution'}))); - addParameter(p, 'ErrorEstimationMethod', 'bootstrap',... - @(x) any(strcmpi(x,{'jackknife','bootstrap'}))); addParameter(p, 'NumberOfAtoms', 5000,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); - addParameter(p, 'TimeStep', 10e-06,... + addParameter(p, 'TimeStep', 0.0005,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); addParameter(p, 'SimulationTime', 3e-03,... @(x) assert(isnumeric(x) && isscalar(x) && (x > 0))); diff --git a/Dipolar Gas Simulator/+Simulator/@DipolarGas/setupParameters.m b/Dipolar Gas Simulator/+Simulator/@DipolarGas/setupParameters.m index 678372d..fdd000a 100644 --- a/Dipolar Gas Simulator/+Simulator/@DipolarGas/setupParameters.m +++ b/Dipolar Gas Simulator/+Simulator/@DipolarGas/setupParameters.m @@ -1,27 +1,16 @@ function [Params] = setupParameters(this) -%%--%% Parameters %%--%% - -%========= Simulation =========% -pert = 0; % 0 = no perturbation during real-time, 1=perturbation -%method=1; % 0 = normal dipolar potential, 1=spherical cut-off, 2=cylindrical cut-off - -% Tolerances -Params.Etol = 5e-10; -Params.rtol = 1e-5; -Params.cut_off = 2e6; % sometimes the imaginary time gets a little stuck - % even though the solution is good, this just stops it going on forever - %========= Constants =========% -hbar = 1.0545718e-34; % Planck constant [J.s] -kbol = 1.38064852e-23; % Boltzmann Constant [J/K] -mu0 = 1.25663706212e-6; % Vacuum Permeability [N/A^2] -- -muB = 9.274009994e-24; % Bohr Magneton [J/T] -a0 = 5.2917721067e-11; % Bohr radius [m] -m0 = 1.660539066e-27; % Atomic mass [kg] -w0 = 2*pi*100; % Angular frequency unit [s^-1] -mu0factor = 0.3049584233607396; % =(m0/me)*pi*alpha^2 -- me=mass of electron, alpha=fine struct. const. - % mu0=mu0factor *hbar^2*a0/(m0*muB^2) +CONSTANTS = Helper.PhysicsConstants; +hbar = CONSTANTS.PlanckConstantReduced; % [J.s] +kbol = CONSTANTS.BoltzmannConstant; % [J/K] +mu0 = CONSTANTS.VacuumPermeability; % [N/A^2] +muB = CONSTANTS.BohrMagneton; % [J/T] +a0 = CONSTANTS.BohrRadius; % [m] +m0 = CONSTANTS.AtomicMassUnit; % [kg] +w0 = 2*pi*100; % Angular frequency unit [s^-1] +mu0factor = 0.3049584233607396; % =(m0/me)*pi*alpha^2 -- me=mass of electron, alpha=fine struct. const. + % mu0=mu0factor *hbar^2*a0/(m0*muB^2) %=============================% % Number of points in each direction @@ -35,7 +24,7 @@ Params.Ly = 40; Params.Lz = 20; % Masses -Params.m = 164*m0; +Params.m = CONSTANTS.Dy164Mass; l0 = sqrt(hbar/(Params.m*w0)); % Defining a harmonic oscillator length % Atom numbers @@ -57,10 +46,6 @@ Params.wx = 2*pi*125; Params.wy = 2*pi*125; Params.wz = 2*pi*250; -% Time step -Params.dt = 0.0005; -Params.mindt = 1e-6; %Minimum size for a time step using adaptive dt - % Stochastic GPE Params.gamma_S = 7.5*10^(-3); % gamma for the stochastic GPE Params.muchem = 12.64*Params.wz/w0; % fixing the chemical potential for the stochastic GPE @@ -81,7 +66,7 @@ Params.gx=(Params.wx/w0)^2; Params.gy=(Params.wy/w0)^2; Params.gz=(Params.wz/w0)^2; -% == Calculating quantum fluctuations == % +% == Calculate LHY correction == % eps_dd = Params.add/Params.as; if eps_dd == 0 Q5 = 1; diff --git a/Dipolar Gas Simulator/+Simulator/@DipolarGas/solver.m b/Dipolar Gas Simulator/+Simulator/@DipolarGas/solver.m index fa150b1..bc02386 100644 --- a/Dipolar Gas Simulator/+Simulator/@DipolarGas/solver.m +++ b/Dipolar Gas Simulator/+Simulator/@DipolarGas/solver.m @@ -3,7 +3,7 @@ function [psi] = solver(this,psi,Params,Transf,VDk,V,njob,t_idx,Observ) set(0,'defaulttextInterpreter','latex') set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); -dt=-1j*abs(Params.dt); +dt=-1j*abs(this.TimeStep); KEop= 0.5*(Transf.KX.^2+Transf.KY.^2+Transf.KZ.^2); Observ.residual = 1; Observ.res = 1;