From e3f9c7b3526a589f5939531565aa32147091405e Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Sun, 17 Nov 2024 13:25:06 +0100 Subject: [PATCH] Modified progress bar settings to work for the variational solver. --- Dipolar-Gas-Simulator/+Scripts/run_locally.m | 6 +++--- .../@DipolarGas/propagateWavefunction.m | 14 +++++++++++--- .../+VariationalSolver2D/@DipolarGas/run.m | 11 +++++------ .../bwhpc_matlab_gpe_sim_gpu.slurm | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Dipolar-Gas-Simulator/+Scripts/run_locally.m b/Dipolar-Gas-Simulator/+Scripts/run_locally.m index 0929700..16498e4 100644 --- a/Dipolar-Gas-Simulator/+Scripts/run_locally.m +++ b/Dipolar-Gas-Simulator/+Scripts/run_locally.m @@ -62,10 +62,10 @@ OptionsStruct.TrapPotentialType = 'None'; OptionsStruct.NumberOfGridPoints = [128, 128]; OptionsStruct.Dimensions = [7.5, 7.5]; % Critical point: 6.996; Triangular phase: 7.5; Stripe phase: 6.972; Honeycomb phase: 6.239 for both for Atom Number fixed to 1E5 -OptionsStruct.TimeStepSize = 500E-6; % in s -OptionsStruct.TimeCutOff = 2E6; % in s +OptionsStruct.TimeStepSize = 200E-6; % in s +OptionsStruct.TimeCutOff = 100; % in s OptionsStruct.EnergyTolerance = 5E-10; -OptionsStruct.ResidualTolerance = 1E-04; +OptionsStruct.ResidualTolerance = 1E-05; OptionsStruct.JobNumber = 1; OptionsStruct.RunOnGPU = false; diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m index 2c3bd9a..fbb6d4d 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/propagateWavefunction.m @@ -8,7 +8,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, Observ.res = 1; AdaptIdx = 0; - + % Change in Energy E = this.Calculator.calculateTotalEnergy(psi,Params,VParams,Transf,VDk,V); E = E/Params.N; @@ -21,13 +21,17 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, % Normalized residuals res = this.Calculator.calculateNormalizedResiduals(psi,Params,VParams,Transf,VDk,V,muchem); Observ.residual = [Observ.residual res]; - + g_eff = Params.gs * (1/(sqrt(2*pi)*VParams.ell)); gamma_eff = Params.gammaQF * (sqrt(2/5)/(pi^(3/4)*VParams.ell^(3/2))); Ez = (0.25*VParams.ell^2) + (0.25*Params.gz*VParams.ell^2); - while t_idx < Params.sim_time_cut_off + pb = Helper.ProgressBar(); + fprintf('\n') + pb.run('Propagating wavefunction in imaginary time: '); + while t_idx < Params.sim_time_cut_off + % kin psi = fftn(psi); psi = psi.*exp(-0.5*1i*dt*KEop); @@ -89,6 +93,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, break end t_idx=t_idx+1; + pb.run(100*t_idx/Params.sim_time_cut_off); end % Change in Energy @@ -103,4 +108,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, % Chemical potential Observ.mucVec = [Observ.mucVec muchem]; + + pb.run(' - Job Completed!'); + clear pb.run end \ No newline at end of file diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m index 44e8464..b283ca0 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m @@ -30,11 +30,10 @@ function [Params, Transf, psi, V, VDk] = run(this) E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, VDk, V)/Params.N; E_vs_iter(1) = E_Var(ells(1)); - t_idx = 1; % Start at t = 0; - for nn = 1:Params.SelfConIter - Observ.EVec = []; Observ.NormVec = []; Observ.PCVec = []; Observ.tVecPlot = []; Observ.mucVec = []; Observ.residual = []; - Observ.res_idx = 1; + Observ.EVec = []; Observ.NormVec = []; Observ.PCVec = []; Observ.tVecPlot = []; Observ.mucVec = []; Observ.residual = []; Observ.res_idx = 1; + + t_idx = 1; % Start at t = 0; [~,V,VDk] = this.initialize(Params,VParams,Transf); % Do not overwrite psi, susbequent iterations should use psi generated at the end of the loop to converge faster % This is still needed however to recalculate VDk with new value @@ -63,12 +62,12 @@ function [Params, Transf, psi, V, VDk] = run(this) E_vs_iter = [E_vs_iter E_Var(VParams.ell)]; save(sprintf('./Data/Run_%03i/psi_gs_%i.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams'); - + if relelldiff < Params.ellcutoff break end end - + fprintf('\n') disp('Saving data...'); save(sprintf('./Data/Run_%03i/psi_gs.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams'); disp('Save complete!'); diff --git a/Dipolar-Gas-Simulator/bwhpc_matlab_gpe_sim_gpu.slurm b/Dipolar-Gas-Simulator/bwhpc_matlab_gpe_sim_gpu.slurm index 9ba4467..dc1d64e 100644 --- a/Dipolar-Gas-Simulator/bwhpc_matlab_gpe_sim_gpu.slurm +++ b/Dipolar-Gas-Simulator/bwhpc_matlab_gpe_sim_gpu.slurm @@ -5,8 +5,8 @@ # Request number of nodes and GPU for job #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 -#SBATCH --gres=gpu:1 -#SBATCH --mem=4G +#SBATCH --gres=gpu:4 +#SBATCH --mem=8G # Estimated wallclock time for job #SBATCH --time=04:00:00 #SBATCH --job-name=simulation