Add draft for most of the method and result sections.

This commit is contained in:
Janita Willumsen 2023-11-30 15:24:05 +01:00
parent ad18cabfdd
commit abb13ef2da
8 changed files with 254 additions and 96 deletions

View File

@ -474,18 +474,18 @@
% \end{figure} % \end{figure}
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. % 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. % % 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.
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 during the burn-in time is ... Increasing number of samples outweigh the ... % 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 during the burn-in time is ... Increasing number of samples outweigh the ...
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. % 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. % 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. % 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.
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 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.
% \begin{figure} % \begin{figure}
% \centering % \centering
@ -562,17 +562,17 @@ When the speed-up was satisfactory, we investigated the phase transition for lat
% \label{fig:phase_susceptibility} % \label{fig:phase_susceptibility}
% \end{figure} % \end{figure}
We include results using 10 million MC cycles in Appendix \ref{sec:extra} % We include results using 10 million MC cycles in Appendix \ref{sec:extra}
We use the critical temperatures found studying the phase transition, in addition to the scaling relation % We use the critical temperatures found studying the phase transition, in addition to the scaling relation
\begin{equation} % \begin{equation}
T_{c} - T_{c}(L = \infty) = \alpha L^{-1} % T_{c} - T_{c}(L = \infty) = \alpha L^{-1}
\end{equation} % \end{equation}
to estimate the critical temperatur for a lattize of infinte size. We also compare the estimate with the analytical solution % to estimate the critical temperatur for a lattize of infinte size. We also compare the estimate with the analytical solution
\begin{equation} % \begin{equation}
T_{c}(L = \infty) = \frac{2}{\ln (1 + \sqrt{2})} J/k_{B} \approx 2.269 J/k_{B} % T_{c}(L = \infty) = \frac{2}{\ln (1 + \sqrt{2})} J/k_{B} \approx 2.269 J/k_{B}
\end{equation} % \end{equation}
using linear regression. In Figure \ref{fig:linreg} we show the critical temperatures as function of the inverse lattice size. As size goes toward infinity we reach inv L = 0 and find the intercept which is equal to the estimated critical of L=infty. % using linear regression. In Figure \ref{fig:linreg} we show the critical temperatures as function of the inverse lattice size. As size goes toward infinity we reach inv L = 0 and find the intercept which is equal to the estimated critical of L=infty.
% \begin{figure} % \begin{figure}
% \centering % \centering
@ -582,7 +582,7 @@ using linear regression. In Figure \ref{fig:linreg} we show the critical tempera
% \end{figure} % \end{figure}
\subsection{Draft} %\subsection{Draft}
% Test that the numerical stuff gets close to the analytical % Test that the numerical stuff gets close to the analytical
% - validate implementation a given number of times, find average number of cycles % - validate implementation a given number of times, find average number of cycles
@ -658,33 +658,33 @@ using linear regression. In Figure \ref{fig:linreg} we show the critical tempera
% \caption{Rules for multiplying spin pairs.} % \caption{Rules for multiplying spin pairs.}
% \end{figure} % \end{figure}
\begin{figure}\label{fig:tikz_neighbor} % \begin{figure}\label{fig:tikz_neighbor}
\centering % \centering
\begin{subfigure}{0.4\linewidth} % \begin{subfigure}{0.4\linewidth}
\begin{tikzpicture} % \begin{tikzpicture}
\draw (0, 0) grid (2, 2); % \draw (0, 0) grid (2, 2);
\node (s1) at (0.5, 1.5) {$\uparrow$}; % \node (s1) at (0.5, 1.5) {$\uparrow$};
\node (s2) at (1.5, 1.5) {$\uparrow$}; % \node (s2) at (1.5, 1.5) {$\uparrow$};
\node (s3) at (0.5, 0.5) {$\downarrow$}; % \node (s3) at (0.5, 0.5) {$\downarrow$};
\node (s4) at (1.5, 0.5) {$\downarrow$}; % \node (s4) at (1.5, 0.5) {$\downarrow$};
\end{tikzpicture} % \end{tikzpicture}
\caption{} % \caption{}
\label{fig:sub_tikz_neighbor_a} % \label{fig:sub_tikz_neighbor_a}
\end{subfigure} % \end{subfigure}
\ % \
\begin{subfigure}{0.4\linewidth} % \begin{subfigure}{0.4\linewidth}
\begin{tikzpicture} % \begin{tikzpicture}
\draw (0, 0) grid (2, 2); % \draw (0, 0) grid (2, 2);
\node (s1) at (0.5, 1.5) {$\uparrow$}; % \node (s1) at (0.5, 1.5) {$\uparrow$};
\node (s2) at (1.5, 1.5) {$\downarrow$}; % \node (s2) at (1.5, 1.5) {$\downarrow$};
\node (s3) at (0.5, 0.5) {$\downarrow$}; % \node (s3) at (0.5, 0.5) {$\downarrow$};
\node (s4) at (1.5, 0.5) {$\uparrow$}; % \node (s4) at (1.5, 0.5) {$\uparrow$};
\end{tikzpicture} % \end{tikzpicture}
\caption{} % \caption{}
\label{fig:sub_tikz_neighbor_b} % \label{fig:sub_tikz_neighbor_b}
\end{subfigure} % \end{subfigure}
\caption{Possible spin configurations for two spins up.} % \caption{Possible spin configurations for two spins up.}
\end{figure} % \end{figure}
%---------- %----------
% APPENDIX % APPENDIX
@ -856,35 +856,35 @@ using linear regression. In Figure \ref{fig:linreg} we show the critical tempera
% \langle |m| \rangle = \frac{1}{N} \sum_{i=1}^{N} |M(s_{i})| p(s_{i} \ | \ T) % \langle |m| \rangle = \frac{1}{N} \sum_{i=1}^{N} |M(s_{i})| p(s_{i} \ | \ T)
% \end{align*} % \end{align*}
\section{Extra}\label{sec:extra} % \section{Extra}\label{sec:extra}
We increased number of MC cycles to 10 million % We increased number of MC cycles to 10 million
\begin{figure} % \begin{figure}
\centering % \centering
\includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/energy.pdf} % \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.} % \caption{$\langle \epsilon \rangle$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.}
\label{fig:phase_energy_10M} % \label{fig:phase_energy_10M}
\end{figure} % \end{figure}
\begin{figure} % \begin{figure}
\centering % \centering
\includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/magnetization.pdf} % \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.} % \caption{$\langle |m| \rangle$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.}
\label{fig:phase_magnetization_10M} % \label{fig:phase_magnetization_10M}
\end{figure} % \end{figure}
\begin{figure} % \begin{figure}
\centering % \centering
\includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/heat_capacity.pdf} % \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.} % \caption{$C_{V}$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.}
\label{fig:phase_heat_10M} % \label{fig:phase_heat_10M}
\end{figure} % \end{figure}
\begin{figure} % \begin{figure}
\centering % \centering
\includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/susceptibility.pdf} % \includegraphics[width=\linewidth]{../images/phase_transition/fox/wide/10M/susceptibility.pdf}
\caption{$\chi$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.} % \caption{$\chi$ for $T \in [2.1, 2.4]$, 10000000 MC cycles.}
\label{fig:phase_susceptibility_10M} % \label{fig:phase_susceptibility_10M}
\end{figure} % \end{figure}
\end{document} \end{document}

View File

@ -91,14 +91,14 @@
% Problem 1: OK % Problem 1: OK
% Problem 2: OK % Problem 2: OK
% Problem 3: OK - missing theory of phase transition % Problem 3: OK - missing theory of phase transition
% Problem 7: % Problem 4: validate numerical results using the analytical results
% Problem 9: % Problem 7: division of workload mpi and openmp
% Problem 9: rewrite theoretical background of phase transition and critical temperature
% Results % Results
% Problem 4: % Problem 5: burn-in time
% Problem 5: % Problem 6: estimate probability distribution based on histogram
% Problem 6: % Problem 8: investigate phase transitions, and estimate critical temperature based on plot
% Problem 8: % Problem 9: use critical temperature to estimate the ctritical temperature of infinite lattice
% Problem 9:
% %
% %

View File

@ -122,6 +122,21 @@
urldate = {2023-10-22} urldate = {2023-10-22}
} }
@inproceedings{gabriel:2004:open_mpi,
author = {Edgar Gabriel and Graham E. Fagg and George Bosilca
and Thara Angskun and Jack J. Dongarra and Jeffrey
M. Squyres and Vishal Sahay and Prabhanjan Kambadur
and Brian Barrett and Andrew Lumsdaine and Ralph
H. Castain and David J. Daniel and Richard L. Graham
and Timothy S. Woodall},
title = {Open {MPI}: Goals, Concept, and Design of a Next Generation {MPI} Implementation},
booktitle = {Proceedings, 11th European PVM/MPI Users' Group Meeting},
address = {Budapest, Hungary},
pages = {97--104},
year = {2004},
month = {September}
}
# Miscellaneous things # Miscellaneous things
@misc{tds:2021:mcmc, @misc{tds:2021:mcmc,
author = {Shivam Agari}, author = {Shivam Agari},
@ -138,3 +153,18 @@
year = {2023} year = {2023}
} }
@online{scalasca,
author = {M. Geimer and F. Wolf and B.J.N. Wylie and E. Abraham and D. Becker and B. Mohr},
title = {Scalasca},
url = {https://www.scalasca.org/scalasca/about/about.html},
urldate = {2023-10-24},
note = {Tool to support performance optimization of parallel programs, measuring and analyzing runtime behavior.}
}
@online{scorep,
title = {Score-P: the Scalable Performance Measurement Infrastructure for Parallel Codes},
url = {https://perftools.pages.jsc.fz-juelich.de/cicd/scorep/tags/latest/html/},
urldate = {2023-10-24},
note = {Tool suite for profiling and event tracing.}
}

View File

@ -2,6 +2,7 @@
\begin{document} \begin{document}
\begin{abstract} \begin{abstract}
$\boldsymbol{Draft}$
We have used the Ising model to study the behavior in ferromagnets, when undergoing We have used the Ising model to study the behavior in ferromagnets, when undergoing
a phase transition near a critical temperature. We generated samples using the a phase transition near a critical temperature. We generated samples using the
Markov chain Monte Carlo method, while utilizing methods of parallelization. Markov chain Monte Carlo method, while utilizing methods of parallelization.

View File

@ -6,7 +6,7 @@
When two spins have the orientation up, the total magnetization is zero. However, When two spins have the orientation up, the total magnetization is zero. However,
the total energy of the system have two possible values, due to the location of the total energy of the system have two possible values, due to the location of
the spin up as visualized in Figure \ref{fig:tikz_neighbor}. the spin up as visualized in Figure \ref{fig:tikz_neighbor}.
\begin{figure}\label{fig:tikz_neighbor} \begin{figure}
\centering \centering
\begin{subfigure}{0.4\linewidth} \begin{subfigure}{0.4\linewidth}
\begin{tikzpicture} \begin{tikzpicture}
@ -35,6 +35,7 @@ the spin up as visualized in Figure \ref{fig:tikz_neighbor}.
\label{fig:tikz_neighbor} \label{fig:tikz_neighbor}
\end{figure} \end{figure}
\section{Partition function}\label{sec:partition_function} \section{Partition function}\label{sec:partition_function}
Using the values estimated for the $2 \times 2$ case, found in \ref{tab:lattice_config}, Using the values estimated for the $2 \times 2$ case, found in \ref{tab:lattice_config},
we find the partition function we find the partition function
@ -49,6 +50,7 @@ and get
z &= 4 \cosh (8 \beta J) + 12 \ . z &= 4 \cosh (8 \beta J) + 12 \ .
\end{align*} \end{align*}
\section{Expectation values}\label{sec:expectation_values} \section{Expectation values}\label{sec:expectation_values}
For a linear function of a stochastic random variable $X$, with a known probability For a linear function of a stochastic random variable $X$, with a known probability
distribution, the expected value of $x$ is given by distribution, the expected value of $x$ is given by
@ -160,6 +162,7 @@ and susceptibility
\frac{\chi}{N} &= \frac{4}{N k_{B} T} \bigg( \frac{3e^{8 \beta J} + e^{-8 \beta J} + 3}{(\cosh(8 \beta J) + 3)^{2}} \bigg) \ . \frac{\chi}{N} &= \frac{4}{N k_{B} T} \bigg( \frac{3e^{8 \beta J} + e^{-8 \beta J} + 3}{(\cosh(8 \beta J) + 3)^{2}} \bigg) \ .
\end{align*} \end{align*}
\section{Change in total system energy}\label{sec:delta_energy} \section{Change in total system energy}\label{sec:delta_energy}
When we consider the change in energy after flipping a single spin, we evaluate When we consider the change in energy after flipping a single spin, we evaluate
$\Delta E = E_{\text{after}} - E_{\text{before}}$. We find the $3^{2}$ values as $\Delta E = E_{\text{after}} - E_{\text{before}}$. We find the $3^{2}$ values as
@ -176,4 +179,35 @@ $\Delta E = E_{\text{after}} - E_{\text{before}}$. We find the $3^{2}$ values as
\end{align*} \end{align*}
where the five distinct values are $\Delta E = \{-16J, -8J, 0, 8J, 16J\}$. 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
\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}
\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}
\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}
\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}
\end{figure}
\end{document} \end{document}

View File

@ -2,10 +2,15 @@
\begin{document} \begin{document}
\section{Conclusion}\label{sec:conclusion} \section{Conclusion}\label{sec:conclusion}
% Draft based on abstract $\boldsymbol{Draft}$
We have used the Ising model to study the behavior in ferromagnets, when undergoing We have studied ferromagnetism using the Ising model, and observed
a phase transition near a critical temperature. We generated samples using the a phase transition when the temperature of the system is close to the critical
Markov chain Monte Carlo method, while utilizing methods of parallelization. temperature. We used the Markov chain Monte Carlo method to generate samples of
spin configurations, while utilizing methods of parallelization.
We use the samples to compute energy per spin $\langle \epsilon \rangle$,
magnetization per spin $\langle |m| \rangle$, heat capacity $C_{V}$, and $\chi$.
Finding the burn-in time to be approx. 3000 Monte Carlo cycles. For temperature Finding the burn-in time to be approx. 3000 Monte Carlo cycles. For temperature
$T = 1.0 J / k_{B}$ we found a propability distrobution with an expected mean $T = 1.0 J / k_{B}$ we found a propability distrobution with an expected mean
value of $\mu \approx -1.9969$ and variation $\sigma^{2} = 0.0001$. Whereas the value of $\mu \approx -1.9969$ and variation $\sigma^{2} = 0.0001$. Whereas the

View File

@ -59,7 +59,8 @@ We also find the total magnetization of the system, which is given by % Eq. \eqr
\end{equation} \end{equation}
In addition, we have to consider the state degeneracy, the number of different In addition, we have to consider the state degeneracy, the number of different
microstates sharing the same value of total magnetization. In the case where we microstates sharing the same value of total magnetization. In the case where we
have two spins oriented up the total energy have two possible values, as shown in \ref{sec:energy_special}. have two spins oriented up the total energy have two possible values, as shown
in \ref{sec:energy_special}.
% The derivation of the analytical values can be found in Appendix \ref{} % The derivation of the analytical values can be found in Appendix \ref{}
\begin{table}[H] \begin{table}[H]
\centering \centering
@ -128,7 +129,7 @@ of a microstate at a fixed temperature is given by
\label{eq:pdf} \label{eq:pdf}
\end{equation} \end{equation}
% Add something about why we use the expectation values? % Add something about why we use the expectation values?
We derive the analytical expressions for expectation values in Appendix. We derive the analytical expressions for expectation values in Appendix
\ref{sec:expectation_values}. We find the expected total energy \ref{sec:expectation_values}. We find the expected total energy
\begin{equation}\label{eq:energy_total_result} \begin{equation}\label{eq:energy_total_result}
\langle E \rangle = -\frac{8J \sinh(8 \beta J)}{\cosh(8 \beta J) + 3} \ , \langle E \rangle = -\frac{8J \sinh(8 \beta J)}{\cosh(8 \beta J) + 3} \ ,
@ -187,14 +188,28 @@ Boltzmann constant we derive the remaining units, which can be found in Table
\label{tab:units} \label{tab:units}
\end{table} \end{table}
\subsection{Phase transition and critical temperature}\label{subsec:phase_critical} \subsection{Phase transition and critical temperature}\label{subsec:phase_critical}
$\boldsymbol{Draft}$
% P9 critical temperature % P9 critical temperature
% Add something about critical temperature in ferromagnets
At temperatures below the critical temperature $T_{c}$, the Ising model will
magnetize spontaneous. Based on a $2 \times 2$ lattice, we can show that the total
energy is equal to the energy where all spins have the orientation up \cite[p. 426]{hj:2015:comp_phys}.
When a ferromagnetic material is heated, it will change at a macroscopic level. When a ferromagnetic material is heated, it will change at a macroscopic level.
Based on a $2 \times 2$ lattice, we can show that the total energy is equal to the When increasing the temperature of the external field, the Ising model move from
energy where all spins have the orientation up \cite[p. 426]{hj:2015:comp_phys}. an ordered to an unordered phase. At the critical temperature the heat capacity
Increasing the temperature of the external field, the Ising model move from an $C_{V}$, and the magnetic susceptibility $\chi$ diverge \cite[p. 431]{hj:2015:comp_phys}.
ordered to an unordered phase. At the critical temperature the heat capacity $C_{V}$,
and the magnetic susceptibility $\chi$ diverge \cite[p. 431]{hj:2015:comp_phys}. We can describe the behavior of the physical system close to the critical temperature
using power laws and critical exponents. For an Ising model of infinite lattice size
in two dimensions we have
\begin{align}
\langle |m| \rangle &\propto |T - T_{c}(L = \infty)|^{\beta} \\
C_{V} &\propto |T - T_{c}(L = \infty)|^{-\alpha} \\
\chi &\propto |T - T_{c}(L = \infty)|^{-\gamma}
\end{align}
\subsection{The Markov chain Monte Carlo method}\label{subsec:mcmc_method} \subsection{The Markov chain Monte Carlo method}\label{subsec:mcmc_method}
Markov chains consist of a sequence of samples, where the probability of the next Markov chains consist of a sequence of samples, where the probability of the next
@ -210,7 +225,7 @@ until the model reaches an equilibrium state. However, generating new random sta
require ergodicity and detailed balance. A Markov chain is ergoditic when all system require ergodicity and detailed balance. A Markov chain is ergoditic when all system
states can be reached at every current state, whereas detaild balance implies no states can be reached at every current state, whereas detaild balance implies no
net flux of probability. To satisfy these criterias we use the Metropolis-Hastings net flux of probability. To satisfy these criterias we use the Metropolis-Hastings
algorithm, found in Fig. \ref{algo:metropolis}, to implement the MCMC method. algorithm, found in Figure \ref{algo:metropolis}, to implement the MCMC method.
The Markov process will reach an equilibrium, reflecting the state of a real system. The Markov process will reach an equilibrium, reflecting the state of a real system.
% Add something about burn-in time % Add something about burn-in time
@ -223,7 +238,7 @@ At each step of flipping a spin, the change in energy is evaluated as
\end{align*} \end{align*}
Since the total system energy only takes three different values, the change in Since the total system energy only takes three different values, the change in
energy can take $3^{2}$ values. However, there are only five distinct values energy can take $3^{2}$ values. However, there are only five distinct values
$\Delta E = \{-16J, -8J, 0, 8J, 16J\}$, which we find in Appendix \ref{sec:delta_energy}. $\Delta E = \{-16J, -8J, 0, 8J, 16J\}$, we derive these values in Appendix \ref{sec:delta_energy}.
\begin{figure}[H] \begin{figure}[H]
\begin{algorithm}[H] \begin{algorithm}[H]
\caption{Metropolis-Hastings Algorithm} \caption{Metropolis-Hastings Algorithm}
@ -256,19 +271,61 @@ at every spin flip, by using a look up table (LUT) with the possible values. We
the change in energy $\Delta E$ as a key for the resulting value of the exponential the change in energy $\Delta E$ as a key for the resulting value of the exponential
function in a hash map. function in a hash map.
\subsection{Implementation}\label{subsec:implementation}
\subsection{Implementation and testing}\label{subsec:implementation_test}
$\boldsymbol{Draft}$
% P3 boundary condition and if-tests % P3 boundary condition and if-tests
To avoid the overhead of if-tests, and take advantage of the parallelization, we To avoid the overhead of if-tests, and take advantage of the parallelization, we
define an index for every edge case. That is, for a spin at a given boundary index define an index for every edge case. That is, for a spin at a given boundary index
we use a pre-set index (...), to avoid if-tests and reduce overhead and runtime. we use a pre-set index (...), to avoid if-tests and reduce overhead and runtime.
% P4 testing, validation
% P7 parallelization % P7 parallelization
10 MPI processes
- 10 threads per process
= 100 threads total
First we divide the temperature range, to give each MPI process a set of temperatures
to work with. 2.1-2-4 divided into 40 steps, which gives us a step size of 0.0075.
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.
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
during the burn-in time is ... Increasing number of samples outweigh the ...
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{Tools}\label{subsec:tools} \subsection{Tools}\label{subsec:tools}
The Ising model and MCMC methods are implemented in C++, and parallelized using The Ising model and MCMC methods are implemented in C++, and parallelized using
both \verb|MPI| and \verb|OpenMP| \cite{openmp:2018}. We used the Python library both \verb|OpenMPI| \cite[text]{gabriel:2004:open_mpi} and \verb|OpenMP| \cite{openmp:2018}. We used the Python library
\verb|matplotlib| \cite{hunter:2007:matplotlib} to produce all the plots, and \verb|matplotlib| \cite{hunter:2007:matplotlib} to produce all the plots, and
\verb|seaborn| \cite{waskom:2021:seaborn} to set the theme in the figures. In \verb|seaborn| \cite{waskom:2021:seaborn} to set the theme in the figures. In
addition, while optimizing our implementation we used the profiler addition, we used \verb|Scalasca| \cite{scalasca} and \verb|Score-P| \cite{scorep}
to profile and optimize our implementation.
% Add profiler % Add profiler
\end{document} \end{document}

View File

@ -3,6 +3,7 @@
\begin{document} \begin{document}
\section{Results}\label{sec:results} \section{Results}\label{sec:results}
\subsection{Burn-in time}\label{subsec:burnin_time} \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 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. 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}$, We consider two different temperatures $T_{1} = 1.0 J/k_{B}$ and $T_{2} = 2.4 J/k_{B}$,
@ -53,7 +54,14 @@ pdf using $T = 1.0$ result in
\label{fig:burn_in_energy_2_4} \label{fig:burn_in_energy_2_4}
\end{figure} \end{figure}
\subsection{Probability distribution}\label{subsec:probability_distribution}
$\boldsymbol{Draft}$
% Histogram figures % 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.
\begin{figure}[H] \begin{figure}[H]
\centering \centering
\includegraphics[width=\linewidth]{../images/pd_estimate_1_0.pdf} \includegraphics[width=\linewidth]{../images/pd_estimate_1_0.pdf}
@ -67,6 +75,9 @@ pdf using $T = 1.0$ result in
\label{fig:histogram_2_4} \label{fig:histogram_2_4}
\end{figure} \end{figure}
\subsection{Phase transition}\label{subsec:phase_transition}
$\boldsymbol{Draft}$
% Phase transition figures % Phase transition figures
\begin{figure} \begin{figure}
\centering \centering
@ -95,6 +106,26 @@ pdf using $T = 1.0$ result in
\caption{$\chi$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.} \caption{$\chi$ for $T \in [2.1, 2.4]$, 1000000 MC cycles.}
\label{fig:phase_susceptibility} \label{fig:phase_susceptibility}
\end{figure} \end{figure}
We include results for 10 million MC cycles in Appendix \ref{sec:extra_results}
\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 % Critical temp regression figure
\begin{figure}[H] \begin{figure}[H]