diff --git a/Dipolar Gas Simulator/+Plotter/makeMovie.m b/Dipolar Gas Simulator/+Plotter/makeMovie.m index 8842cbd..aad1333 100644 --- a/Dipolar Gas Simulator/+Plotter/makeMovie.m +++ b/Dipolar Gas Simulator/+Plotter/makeMovie.m @@ -1,77 +1,85 @@ -set(0,'defaulttextInterpreter','latex') -set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); - -RunIdx = 1; - -FileDir = dir(sprintf('./Data/Run_%03i/TimeEvolution/*.mat',RunIdx)); -NumFiles = numel(FileDir); -QuenchSettings = load(sprintf('./Data/Run_%03i/QuenchSettings',RunIdx),'Quench','Params','Transf','VDk','V'); -Transf = QuenchSettings.Transf; Params = QuenchSettings.Params; -x = Transf.x; y = Transf.y; z = Transf.z; -dx = x(2)-x(1); dy = y(2)-y(1); dz = z(2)-z(1); - -mkdir(sprintf('./Data/Run_%03i/Figures',RunIdx)) -outputVideo = VideoWriter(fullfile('./Data/Movie.avi')); -outputVideo.FrameRate = 10; -open(outputVideo) - -figure(1); -x0 = 800; -y0 = 200; -width = 800; -height = 600; -set(gcf,'position',[x0,y0,width,height]) - -EVecTemp = []; - -for ii = 2:(NumFiles-1) - load(sprintf('./Data/Run_%03i/TimeEvolution/psi_%i.mat',RunIdx,ii),'psi','muchem','T','Observ','t_idx'); - - %Plotting - subplot(2,3,1) - n = abs(psi).^2; - nxz = squeeze(trapz(n*dy,2)); - nyz = squeeze(trapz(n*dx,1)); - nxy = squeeze(trapz(n*dz,3)); +function makeMovie(run_index) + set(0,'defaulttextInterpreter','latex') + set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); - plotxz = pcolor(x,z,nxz'); shading interp - set(plotxz, 'EdgeColor', 'none'); - xlabel('$x$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); - - subplot(2,3,2) - plotyz = pcolor(y,z,nyz'); shading interp - set(plotyz, 'EdgeColor', 'none'); - xlabel('$y$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); + folder_path = './Data'; - subplot(2,3,3) - plotxy = pcolor(x,y,nxy'); shading interp - set(plotxy, 'EdgeColor', 'none'); - xlabel('$x$ [$\mu$m]'); ylabel('$y$ [$\mu$m]'); + FileDir = dir(sprintf(horzcat(folder_path, '/Run_%03i/*.mat'),run_index)); + NumFiles = numel(FileDir); + + Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_%i.mat'),run_index,1),'Params','Transf'); + + Params = Data.Params; + Transf = Data.Transf; + + x = Transf.x; y = Transf.y; z = Transf.z; + dx = x(2)-x(1); dy = y(2)-y(1); dz = z(2)-z(1); + + mkdir(sprintf(horzcat(folder_path, '/Run_%03i/Figures'),run_index)) + outputVideo = VideoWriter(fullfile(horzcat(folder_path, '/Movie.avi'))); + outputVideo.FrameRate = 10; + open(outputVideo) + + figure(1); + x0 = 800; + y0 = 200; + width = 800; + height = 600; + set(gcf,'position',[x0,y0,width,height]) + + for ii = 1:(NumFiles-1) + Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_%i.mat'),run_index,ii),'psi','muchem','T','Observ'); + + psi = Data.psi; + muchem = Data.muchem; + T = Data.T; + Observ = Data.Observ; - subplot(2,3,4) - plot(Observ.tVecPlot*1000/Params.w0,Observ.NormVec,'-b') - ylabel('Normalization'); xlabel('$t$ [$m$s]'); - - subplot(2,3,5) - plot(Observ.tVecPlot*1000/Params.w0,1-2*Observ.PCVec/pi,'-b') - ylabel('Coherence'); xlabel('$t$ [$m$s]'); - ylim([0,1]) - - subplot(2,3,6) - plot(Observ.tVecPlot*1000/Params.w0,Observ.EVec,'-b') - ylabel('E'); xlabel('$t$ [$m$s]'); - - tVal = Observ.tVecPlot(end)*1000/Params.w0; - sgtitle(sprintf('$\\mu =%.3f \\hbar\\omega_0$, $T=%.1f$nK, $t=%.1f$ms',muchem,T,tVal)) - - drawnow - saveas(gcf,sprintf('./Data/Run_%03i/Figures/Image_%i.jpg',RunIdx,ii)) - img = imread(sprintf('./Data/Run_%03i/Figures/Image_%i.jpg',RunIdx,ii)); - writeVideo(outputVideo,img) -% hold off; - clf -end - -close(outputVideo) -close(figure(1)) -delete(sprintf('./Data/Run_%03i/Figures/*.jpg',RunIdx)) % deleting images after movie is made \ No newline at end of file + %Plotting + subplot(2,3,1) + n = abs(psi).^2; + nxz = squeeze(trapz(n*dy,2)); + nyz = squeeze(trapz(n*dx,1)); + nxy = squeeze(trapz(n*dz,3)); + + plotxz = pcolor(x,z,nxz'); shading interp + set(plotxz, 'EdgeColor', 'none'); + xlabel('$x$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); + + subplot(2,3,2) + plotyz = pcolor(y,z,nyz'); shading interp + set(plotyz, 'EdgeColor', 'none'); + xlabel('$y$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); + + subplot(2,3,3) + plotxy = pcolor(x,y,nxy'); shading interp + set(plotxy, 'EdgeColor', 'none'); + xlabel('$x$ [$\mu$m]'); ylabel('$y$ [$\mu$m]'); + + subplot(2,3,4) + plot(Observ.tVecPlot*1000/Params.w0,Observ.NormVec,'-b') + ylabel('Normalization'); xlabel('$t$ [$m$s]'); + + subplot(2,3,5) + plot(Observ.tVecPlot*1000/Params.w0,1-2*Observ.PCVec/pi,'-b') + ylabel('Coherence'); xlabel('$t$ [$m$s]'); + ylim([0,1]) + + subplot(2,3,6) + plot(Observ.tVecPlot*1000/Params.w0,Observ.EVec,'-b') + ylabel('E'); xlabel('$t$ [$m$s]'); + + tVal = Observ.tVecPlot(end)*1000/Params.w0; + sgtitle(sprintf('$\\mu =%.3f \\hbar\\omega_0$, $T=%.1f$nK, $t=%.1f$ms',muchem,T,tVal)) + + drawnow + saveas(gcf,sprintf(horzcat(folder_path, '/Run_%03i/Figures/Image_%i.jpg'),run_index,ii)) + img = imread(sprintf(horzcat(folder_path, '/Run_%03i/Figures/Image_%i.jpg'),run_index,ii)); + writeVideo(outputVideo,img) + clf + end + + close(outputVideo) + close(figure(1)) + delete(sprintf(horzcat(folder_path, '/Run_%03i/Figures/*.jpg'),run_index)) % deleting images after movie is made +end \ No newline at end of file diff --git a/Dipolar Gas Simulator/+Plotter/plotLive.m b/Dipolar Gas Simulator/+Plotter/plotLive.m index 1e3abb3..f48288b 100644 --- a/Dipolar Gas Simulator/+Plotter/plotLive.m +++ b/Dipolar Gas Simulator/+Plotter/plotLive.m @@ -1,4 +1,4 @@ -function LPlot = LivePlot(psi,Params,Transf,Observ) +function plotLive(psi,Params,Transf,Observ) set(0,'defaulttextInterpreter','latex') set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); @@ -6,8 +6,6 @@ function LPlot = LivePlot(psi,Params,Transf,Observ) x = Transf.x*Params.l0*1e6; y = Transf.y*Params.l0*1e6; z = Transf.z*Params.l0*1e6; - %percentcomplete = linspace(0,1,Params.cut_off/200); - dx = x(2)-x(1); dy = y(2)-y(1); dz = z(2)-z(1); %Plotting @@ -43,5 +41,4 @@ function LPlot = LivePlot(psi,Params,Transf,Observ) subplot(2,3,6) plot(Observ.mucVec,'-b') ylabel('$\mu$'); xlabel('steps'); -% xlim([0,1]); ylim([0,8]); -% xlim([0,1]); ylim([0,8]); +end \ No newline at end of file diff --git a/Dipolar Gas Simulator/+Plotter/visualizeGSWavefunction.m b/Dipolar Gas Simulator/+Plotter/visualizeGSWavefunction.m new file mode 100644 index 0000000..bd09afc --- /dev/null +++ b/Dipolar Gas Simulator/+Plotter/visualizeGSWavefunction.m @@ -0,0 +1,53 @@ +function visualizeGSWavefunction(run_index) + set(0,'defaulttextInterpreter','latex') + set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); + + folder_path = './Data'; + + Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_gs.mat'),run_index),'psi','Params','Transf','Observ'); + + psi = Data.psi; + Params = Data.Params; + Transf = Data.Transf; + Observ = Data.Observ; + + format long + x = Transf.x*Params.l0*1e6; + y = Transf.y*Params.l0*1e6; + z = Transf.z*Params.l0*1e6; + dx = x(2)-x(1); dy = y(2)-y(1); dz = z(2)-z(1); + + %Plotting + + subplot(2,3,1) + n = abs(psi).^2; + nxz = squeeze(trapz(n*dy,2)); + nyz = squeeze(trapz(n*dx,1)); + nxy = squeeze(trapz(n*dz,3)); + + plotxz = pcolor(x,z,nxz'); + set(plotxz, 'EdgeColor', 'none'); + xlabel('$x$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); + + subplot(2,3,2) + plotyz = pcolor(y,z,nyz'); + set(plotyz, 'EdgeColor', 'none'); + xlabel('$y$ [$\mu$m]'); ylabel('$z$ [$\mu$m]'); + + subplot(2,3,3) + plotxy = pcolor(x,y,nxy'); + set(plotxy, 'EdgeColor', 'none'); + xlabel('$x$ [$\mu$m]'); ylabel('$y$ [$\mu$m]'); + + subplot(2,3,4) + plot(-log10(Observ.residual),'-b') + ylabel('$-\mathrm{log}_{10}(r)$'); xlabel('steps'); + + subplot(2,3,5) + plot(Observ.EVec,'-b') + ylabel('$E$'); xlabel('steps'); + + subplot(2,3,6) + plot(Observ.mucVec,'-b') + ylabel('$\mu$'); xlabel('steps'); +end \ No newline at end of file diff --git a/Dipolar Gas Simulator/+Scripts/run_locally.m b/Dipolar Gas Simulator/+Scripts/run_locally.m index 67dcdf1..3937cde 100644 --- a/Dipolar Gas Simulator/+Scripts/run_locally.m +++ b/Dipolar Gas Simulator/+Scripts/run_locally.m @@ -11,20 +11,20 @@ OptionsStruct.DipolarPolarAngle = pi/2; OptionsStruct.DipolarAzimuthAngle = 0; OptionsStruct.ScatteringLength = 86; -OptionsStruct.TrapFrequencies = [125, 125, 250]; +OptionsStruct.TrapFrequencies = [50, 10, 150]; OptionsStruct.TrapDepth = 5; OptionsStruct.BoxSize = 15; OptionsStruct.TrapPotentialType = 'Harmonic'; -OptionsStruct.NumberOfGridPoints = [64, 64, 48]; -OptionsStruct.Dimensions = [40, 40, 20]; +OptionsStruct.NumberOfGridPoints = [64, 32, 64]; +OptionsStruct.Dimensions = [20, 40, 80]; OptionsStruct.CutoffType = 'Cylindrical'; OptionsStruct.SimulationMode = 'ImaginaryTimeEvolution'; % 'ImaginaryTimeEvolution' | 'RealTimeEvolution' OptionsStruct.TimeStepSize = 50E-6; % in s OptionsStruct.NumberOfTimeSteps = 100; % in s OptionsStruct.EnergyTolerance = 5E-10; -OptionsStruct.JobNumber = 6; +OptionsStruct.JobNumber = 1; OptionsStruct.SaveData = true; OptionsStruct.SaveDirectory = './Data'; options = Helper.convertstruct2cell(OptionsStruct); diff --git a/Dipolar Gas Simulator/+Scripts/run_on_cluster.m b/Dipolar Gas Simulator/+Scripts/run_on_cluster.m index 0d29fbe..12e6dc2 100644 --- a/Dipolar Gas Simulator/+Scripts/run_on_cluster.m +++ b/Dipolar Gas Simulator/+Scripts/run_on_cluster.m @@ -16,7 +16,7 @@ OptionsStruct.TrapDepth = 5; OptionsStruct.BoxSize = 15; OptionsStruct.TrapPotentialType = 'Harmonic'; -OptionsStruct.NumberOfGridPoints = [256, 512, 256]; +OptionsStruct.NumberOfGridPoints = [128, 256, 128]; OptionsStruct.Dimensions = [50, 120, 150]; OptionsStruct.CutoffType = 'Cylindrical'; OptionsStruct.SimulationMode = 'ImaginaryTimeEvolution'; % 'ImaginaryTimeEvolution' | 'RealTimeEvolution'