diff --git a/latex/ising_model.tex b/latex/ising_model.tex index f03d617..de5c0c5 100644 --- a/latex/ising_model.tex +++ b/latex/ising_model.tex @@ -90,15 +90,16 @@ % Method % Problem 1: OK % Problem 2: OK -% Problem 3: OK - missing theory of phase transition -% Problem 4: validate numerical results using the analytical results -% Problem 7: division of workload mpi and openmp -% Problem 9: rewrite theoretical background of phase transition and critical temperature +% Problem 3: OK +% Problem 4: OK +% Problem 9: OK % Results % Problem 5: burn-in time -% Problem 6: estimate probability distribution based on histogram +% Problem 6: OK +% Problem 7: OK % Problem 8: investigate phase transitions, and estimate critical temperature based on plot % Problem 9: use critical temperature to estimate the ctritical temperature of infinite lattice -% -% \ No newline at end of file + +% Appendices +% Problem 0: move in front of references, and change back to double column diff --git a/latex/sections/appendices.tex b/latex/sections/appendices.tex index d04aecb..151e96b 100644 --- a/latex/sections/appendices.tex +++ b/latex/sections/appendices.tex @@ -180,34 +180,34 @@ $\Delta E = E_{\text{after}} - E_{\text{before}}$. We find the $3^{2}$ values as where the five distinct values are $\Delta E = \{-16J, -8J, 0, 8J, 16J\}$. -\section{Extra}\label{sec:extra_results} -We increased number of MC cycles to 10 million +\section{Additional results}\label{sec:additional_results} +Results of 1 million MC cycles. \begin{figure} \centering \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/energy.pdf} - \caption{$\langle \epsilon \rangle$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.} - \label{fig:phase_energy_10M} + \caption{$\langle \epsilon \rangle$ for $T \in [2.1, 2.4]$, $10^{6}$ MC cycles.} + \label{fig:phase_energy_1M} \end{figure} \begin{figure} \centering \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/magnetization.pdf} - \caption{$\langle |m| \rangle$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.} - \label{fig:phase_magnetization_10M} + \caption{$\langle |m| \rangle$ for $T \in [2.1, 2.4]$, $10^{6}$ MC cycles.} + \label{fig:phase_magnetization_1M} \end{figure} \begin{figure} \centering \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/heat_capacity.pdf} - \caption{$C_{V}$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.} - \label{fig:phase_heat_10M} + \caption{$C_{V}$ for $T \in [2.1, 2.4]$, $10^{6}$ MC cycles.} + \label{fig:phase_heat_1M} \end{figure} \begin{figure} \centering \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/susceptibility.pdf} - \caption{$\chi$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.} - \label{fig:phase_susceptibility_10M} + \caption{$\chi$ for $T \in [2.1, 2.4]$, $10^{6}$ MC cycles.} + \label{fig:phase_susceptibility_1M} \end{figure} \end{document} \ No newline at end of file diff --git a/latex/sections/methods.tex b/latex/sections/methods.tex index 9352144..db5deb3 100644 --- a/latex/sections/methods.tex +++ b/latex/sections/methods.tex @@ -212,11 +212,13 @@ correlation length is proportional with the lattice size, resulting in the criti temperature scaling relation \begin{equation} T_{c}(L) - T_{c}(L = \infty) = aL^{-1} \ , + \label{eq:critical_infinite} \end{equation} where $a$ is a constant. For the Ising model in two dimensions, with an lattice of -infinite size, the critical temperature is +infinite size, the analytical solution of the critical temperature is \begin{equation} T_{c}(L = \infty) = \frac{2}{\ln (1 + \sqrt{2})} J/k_{B} \approx 2.269 J/k_{B} + \label{eq:critical_solution} \end{equation} This result was found analytically by Lars Onsager in 1944. We can estimate the critical temperature of an infinite lattice, using finite lattices critical temperature @@ -288,7 +290,7 @@ distribution of the system. \subsection{Implementation and testing}\label{subsec:implementation_test} We implemented a test suite, and compared the numerical estimates to the analytical -results from \ref{subsec:statistical_mechanics}. In addition, we set a tolerance to +results from Section \ref{subsec:statistical_mechanics}. In addition, we set a tolerance to verify convergence, and a maximum number of Monte Carlo cycles to avoid longer runtimes during implementation. diff --git a/latex/sections/results.tex b/latex/sections/results.tex index 531019b..83ebee2 100644 --- a/latex/sections/results.tex +++ b/latex/sections/results.tex @@ -2,22 +2,8 @@ \begin{document} \section{Results}\label{sec:results} - -% 2.1-2-4 divided into 40 steps, which gives us a step size of 0.0075. - -% 10 MPI processes -% - 10 threads per process -% = 100 threads total -% Not a lot of downtime for the threads - -However, when the temperature is close to the critical point, we observe an increase -in expected energy and a decrease in magnetization. Suggesting a higher energy and -a loss of magnetization close to the critical temperature. - -% We did not set the seed for the random number generator, which resulted in -% different numerical estimates each time we ran the model. However, all expectation -% values are calculated using the same data. The burn-in time varied each time. -% We see a burn-in time t = 5000-10000 MC cycles. However, this changed between runs. +\subsection{Burn-in time}\label{subsec:burnin_time} +$\boldsymbol{Draft}$ We decided with a burn-in time parallelization trade-off. That is, we set the burn-in time lower in favor of sampling. To take advantage of the parallelization and not to waste computational resources. The argument to discard samples generated @@ -26,25 +12,6 @@ parallelize using MPI. We generated samples for the temperature range $T \in [2.1, 2.4]$. Using Fox we generated both 1 million samples and 10 million samples. -It is worth mentioning that the time (number of MC cycles) necessary to get a -good numerical estimate, compared to the analytical result, foreshadowing the -burn-in time. - -Markov chain starting point can differ, resulting in different simulation. By -discarding the first samples, the ones generated before system equilibrium we can -get an estimate closer to the real solution. Since we want to estimate expectation -values at a given temperature, the samples should represent the system at that -temperature. - -Depending on number of samples used in numerical estimates, using the samples -generated during burn-in can in high bias and high variance if the ratio is skewed. -However, if most samples are generated after burn-in the effect is not as visible. -Can't remove randomness by starting around equilibrium, since samples are generated -using several ising models we need to sample using the same conditions that is -system state equilibrium. - -\subsection{Burn-in time}\label{subsec:burnin_time} -$\boldsymbol{Draft}$ We start with a lattice where $L = 20$, to study the burn-in time, that is the number of Monte Carlo cycles necessary for the system to reach an equilibrium. We consider two different temperatures $T_{1} = 1.0 J/k_{B}$ and $T_{2} = 2.4 J/k_{B}$, @@ -52,7 +19,7 @@ where $T_{2}$ is close to the critical temperature. We can use the correlation time $\tau \approx L^{d + z}$ to determine time, where $d$ is the dimensionality of the system and $z = 2.1665 \pm 0.0012$ \footnote{This value was determined by Nightingale and Blöte for the Metropolis algorithm.} -% Need to include a section of Onsager's analytical result. +% We show the numerical estimates for temperature $T_{1}$ of $\langle \epsilon \rangle$ in Figure \ref{fig:burn_in_energy_1_0} and $\langle |m| \rangle$ in Figure \ref{fig:burn_in_magnetization_1_0}. For temperature $T_{2}$, the numercal estimate @@ -97,85 +64,125 @@ pdf using $T = 1.0$ result in \subsection{Probability distribution}\label{subsec:probability_distribution} -$\boldsymbol{Draft}$ % Histogram figures -We use the estimated burn-in time to set starting time for sampling, then generate -samples to plot in a histogram for $T_{1}$ in Figure \ref{fig:histogram_1_0} and -$T_{2}$ in Figure \ref{fig:histogram_2_4}. For $T_{1}$ we can see that most samples -have the expected value $-2$, we have a distribution with low variance. +We used the estimated burn-in time as starting time for sampling, and generated +samples. To visualize the distribution of energy per spin $\epsilon$, we used histograms +with a bin size (...). In Figure \ref{fig:histogram_1_0} we show the distribution +for $T_{1}$, where the majority of the energy per spin is $-2$. The resulting expectation +value of energy per spin is $\langle \epsilon \rangle = -1.9969$, with a low variance +of Var$(\epsilon) = 0.0001$. % \begin{figure}[H] \centering \includegraphics[width=\linewidth]{../images/pd_estimate_1_0.pdf} \caption{Histogram $T = 1.0 J / k_{B}$} \label{fig:histogram_1_0} -\end{figure} +\end{figure} % +In Figure \ref{fig:histogram_2_4}, for $T_{2}$, the samples of energy per spin is +centered around the expectation value $\langle \epsilon \rangle = -1.2370$. % \begin{figure}[H] \centering \includegraphics[width=\linewidth]{../images/pd_estimate_2_4.pdf} \caption{Histogram $T = 2.4 J / k_{B}$} \label{fig:histogram_2_4} -\end{figure} +\end{figure} % +However, we observe a higher variance of Var$(\epsilon) = 0.0203$. When the temperature +increase, the system moves from an ordered to an onordered state. The change in +system state, or phase transition, indicates the temperature is close to a critical +point. \subsection{Phase transition}\label{subsec:phase_transition} $\boldsymbol{Draft}$ % Phase transition figures +We continue investigating the behavior of the system around the critical temperature. +First, we generated $10$ million samples of spin configurations for lattices of +size $L \in \{20, 40, 60, 80, 100\}$, and temperatures $T \in [2.1, 2.4]$. We divided the +temperature range into $40$ steps, with an equal step size of $0.0075$. The samples +were generated in parallel, where we allocated $4$ sequential temperatures to $10$ +MPI processes. Each process was set to spawn $10$ thread, resulting in a total of +$100$ threads working in parallel. We include results for $1$ million MC cycles +in Appendix \ref{sec:additional_results} + +$\boldsymbol{Rewrite}$ We ran a profiler to make sure the program was fully optimized which found that the +workload was balanced, the threads was not left idle to long/not a lot of downtime. + +In Figure \ref{fig:phase_energy_10M}, for the larger lattices we observe a sharper +increase in $\langle \epsilon \rangle$ in the temperature range $T \in [2.25, 2.35]$. %] \begin{figure} \centering - \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/1M/energy.pdf} - \caption{$\langle \epsilon \rangle$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.} - \label{fig:phase_energy} -\end{figure} - + \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/energy.pdf} + \caption{$\langle \epsilon \rangle$ for $T \in [2.1, 2.4]$, $10^7$ MC cycles.} + \label{fig:phase_energy_10M} +\end{figure} % +We observe a deacrese in $\langle |m| \rangle$ for the same temperature range in +Figure \ref{fig:phase_magnetization_10M}, suggesting the system moves from an ordered +magnetized state to a state of no net magnetization. The system energy increase, +however, there is a loss of magnetization close to the critical temperature. \begin{figure}[H] \centering - \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/1M/magnetization.pdf} - \caption{$\langle |m| \rangle$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.} - \label{fig:phase_magnetization} -\end{figure} - + \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/magnetization.pdf} + \caption{$\langle |m| \rangle$ for $T \in [2.1, 2.4]$, $10^7$ MC cycles.} + \label{fig:phase_magnetization_10M} +\end{figure} % +In Figure \ref{fig:phase_heat_10M}, we observe an increase in heat capacity in the +temperature range $T \in [2.25, 2.35]$. In addition, we observed a sharper peak +value of heat capacity the lattice size increase. \begin{figure}[H] \centering - \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/1M/heat_capacity.pdf} - \caption{$C_{V}$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.} - \label{fig:phase_heat} -\end{figure} - + \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/heat_capacity.pdf} + \caption{$C_{V}$ for $T \in [2.1, 2.4]$, $10^7$ MC cycles.} + \label{fig:phase_heat_10M} +\end{figure} % +The magnetic susceptibility in Figure \ref{fig:phase_susceptibility_10M}, showed +the sharp peak in the same temperature range as that of the heat capacity. Since +shape of the curve for both heat capacity and the magnetic susceptibility become +sharper when we increase lattice size, we are moving closer to the critical temperature. \begin{figure}[H] \centering - \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/1M/susceptibility.pdf} - \caption{$\chi$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.} - \label{fig:phase_susceptibility} -\end{figure} -We include results for 10 million MC cycles in Appendix \ref{sec:extra_results} + \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/susceptibility.pdf} + \caption{$\chi$ for $T \in [2.1, 2.4]$, $10^7$ MC cycles.} + \label{fig:phase_susceptibility_10M} +\end{figure} % +% Add something about the correlation length? \subsection{Critical temperature}\label{subsec:critical_temperature} -$\boldsymbol{Draft}$ -We use the critical temperatures found in previous section, in addition to the -scaling relation in Equation \eqref{eq:critical_intinite} -\begin{equation} - T_{c} - T_{c}(L = \infty) = \alpha L^{-1} - \label{eq:critical_intinite} -\end{equation} -to estimate the critical temperature for a lattize of infinte size. We also -compared the estimate with the analytical solution -\begin{equation} - T_{c}(L = \infty) = \frac{2}{\ln (1 + \sqrt{2})} J/k_{B} \approx 2.269 J/k_{B} -\end{equation} -using linear regression. In Figure \ref{fig:linreg} we find the critical -temperatures as function of the inverse lattice size. When the lattice size increase -toward infinity, $1/L$ goes toward zero, we find the intercept which gives us an -estimated value of the critical temperature for a lattice of infinite size. - -% Critical temp regression figure +Based on the heat capacity (Figure \ref{fig:phase_heat_10M}) and susceptibility +(Figure \ref{fig:phase_susceptibility_10M}), we estimated the critical temperatures +of lattices of size $L \in \{20, 40, 60, 80, 100\}$ found in Table \ref{tab:critical_temperatures}. +\begin{table}[H] + \centering + \begin{tabular}{cc} % @{\extracolsep{\fill}} + \hline + $L$ & $T_{c}(L)$ \\ + \hline + $20$ & $J$ \\ + $40$ & $1$ \\ + $60$ & $J / k_{B}$ \\ + $80$ & $k_{B}$ \\ + $100$ & $1 / J$ \\ + \hline + \end{tabular} + \caption{Estimated critical temperatures for lattices $L \times L$.} + \label{tab:critical_temperatures} +\end{table} +We used the critical temperatures of finite lattices and the scaling relation in +Equation \eqref{eq:critical_infinite}, Section \ref{subsec:phase_critical}, to estimate +the critical temperature of a lattice of infinite size. In Figure \ref{fig:linreg_10M}, +we plot the critical temperatures $T_{c}(L)$ of the inverse lattice size $1/L$. When +the lattice size increase toward infinity, $1/L$ approaches zero. % \begin{figure}[H] \centering - \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/1M/linreg.pdf} - \caption{Linear regression, where $\beta_{0}$ is the intercept $T_{c}(L = \infty)$ and $\beta_{1}$ is the slope.} - \label{fig:linreg} + \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/linreg.pdf} + \caption{Linear regression, where $\beta_{0}$ is the intercept approximating $T_{c}(L = \infty)$, and $\beta_{1}$ is the slope.} + \label{fig:linreg_10M} \end{figure} - - +Using linear regression, we find the intercept which gives us an estimated value +of the critical temperature for a lattice of infinite size. We find the critical +temperature to be $T_{c \text{num}} \approx 2.2695 J/k_{B}$. We also compared the +estimate with the analytical solution, the relative error of our estimate is +\begin{equation*} + \text{Relative error} = \frac{T_{c \text{ numerical}} - T_{c \text{ analytical}}}{T_{c \text{ analytical}}} \approx 0.001 J/k_{B} +\end{equation*} \end{document}