Monday, 12 March 2018

Magnetization vs Time (FIG 8.7)

The exact value of the magnetization of a material at a given point of time is uncertain due to the random nature of the spins. This can be demonstrated by plotting the Magnetization as a function of time for a varying range of temperatures. In this Ising Model simulation a 10 x 10 lattice configuration is used with 1000 Monte Carlo sweeps for each temperature point. The time is not real time but solely a product of the Monte Carlo method, this means that one unit of time is one sweep through the entire lattice or one Monte Carlo sweep. This gives each spin the opportunity to flip during each time step. [1]

The beginning temperature is set to 1.5 and the result of which can be seen in Figure 1. The magnetization of the lattice is in the ferromagnetic state which is to be expected at this low temperature. There are a couple of instances in time where the magnetization drops  but these are fairly rare occurrences and just a small fluctuation due to the random nature in the Monte Carlo calculation. For the most part however all the spins are aligned and the lattice is in a ferromagnetic state.
Figure 1. Magnetization vs Time for T = 1.5
When the temperature is slightly increased to 2 as can be seen in figure 2. The fluctuations have increased significantly but the material is still in a ferromagnetic state. The average value of the magnetism has dropped to around to a magnetization value of roughly 0.9. The importance of the increase in fluctuations as they signal that the model is approaching a second order phase transition known as the critical point [1]. This point is sensitive to minor changes in the magnetic field or temperature. This will be shown even clearer when the temperature is raised closer to the Curie temperature.
Figure 2. Magnetization vs Time for T = 2
When this temperature is raised further to 2.25 the fluctuations are much larger and the system fluctuates around ± 0.8. The Curie temperature is 2.27 so the value the simulation is at is very close to that resulting in changes in phase from ferromagnetic to paramagnetic at certain instances of time. This is shown below in figure 3.
Figure 3. Magnetization vs Time for T = 2.25
In figure 4 the temperature is raised to 4 and the fluctuations have decreased and are situated approximately at M = ±0.2. The temperature is now above 2.27 and the system is now in the paragmagnetic state.
Figure 4. Magnetization vs Time for T = 4

The results achieved validated up by the the results found in Giordanos book In figure 5 & 6. The fluctuations due to the random nature of the Ising Model show it is difficult to predict the exact magnetization at a given temperature. However it is possible to get a good idea of what level of magnetization at a given temperature.
Figure 5. Magnetization vs Time from Computational physics by Giordano for T = 1.5 & T = 2

Figure 6. Magnetization vs Time from Computational physics by Giordano for T = 2.25 & T = 4


Sunday, 4 March 2018

Beowulf Cluster - The beginning of something big


Beowulf Cluster - The beginning of something big 

A Beowulf cluster is essentially a system consisting of at least 2 PCs working together to perform a given task. Each PC is known as a node with one PC set up to be the server node and the rest as client nodes. The server node controls the whole cluster and serves files to the client nodes. The client nodes are effectively “dumb nodes” and are given a IP address from the server node and can be operated remotely via the server node. The server node is the gateway node to the outside world and is the node that the user would be interfacing with [7]. The operating system that will be used for the cluster is Ubuntu which is a Linux distribution. There are two main types of software packages used to achieve the Beowulf cluster, PVM (Parallel Virtual Machine) and MPI (Message Passing Interface) libraries. The main differences between both libraries are:
  • Process Control: PVM can start and stop tasks, to find out which tasks are running, and possibly where they are running. MPI is much more static, It contains functions to start a group of tasks and to send a kill signal to a group of tasks
  • Resource Control: PVM is dynamic and can utilize nodes when required. This allows load balancing, task migration and fault tolerance. MPI is static and each node is utilized simultaneously. All potential communication paths are known at start-up. The advantage of this is higher performance but lacks in load balancing, task migration and fault tolerance.
  • Message Passing operations: PVM provides very simple message passing capabilities. MPI has a much wider range of message passing capabilities MPI-2 has 248 functions for message-passing operations
  • Fault Tolerance: In PVM If one node fails, the entire system adapts, and the application continues without the failed node. In MPI If one node fails, the entire application fails due to MPIs static nature. [8]

For the application in this project, MPI is the better of the two options due to its higher processing power due to its superior message passing capabilities. The application will not take advantage of PVMs many benefits. Due to the repeated nature of the application there is no need for task migration. Fault tolerance would be beneficial, but this is targeted more at high end parallel processing systems with hundreds of nodes running week/month long simulations. The probability of one of the 8 nodes failing is low but in the case that it does the simulation times for the application won’t be nearly long as the high-end systems causing little disruption.

All the components are now in including the switch, 8 PCs and all the peripherals. And I  have just started wiping them and installing Ubuntu.


Figure 1. Pile of Junk

Friday, 23 February 2018

Magnetization and energy versus temperature (FIG 8.8 & 8.9)


The main ingredient of the Ising model is the energy of a pair of spins. The spin can only contain 2 possible values, up or down (+1 or -1). The Ising model tells us on each bond between spins the energy of the bonds is minimized when the 2 spins are aligned. It gives ability to display the phase transition of the material from ferromagnetic to paramagnetic. [1]
Figure 1 – Spin arrangement of ferromagnetic material (left) paramagnetic material (right)

Theory

For example, if we take Iron, at low temperatures (low depending on the characteristics of the material) the spins will be pointing in the same direction and the sample is said to be ferromagnetic. As the temperature is increased some spins begin to flip until the critical temperature is reached which is known as the curie temperature (which differs for different materials). At this point the spin orientation is random and the sample is now paramagnetic. A spin si can only be one of two values ±1. Each of these spins interacts with its nearest neighbour. A simple Ising model assumes an interaction only between nearest neighbours so that the energy of the system can be described as: [1, 4, 5]
Equation 1. energy of the system

<ij> is the sum over all pairs of nearest neighbours spins and j is known as the exchange constant and is assumed to be positive, The probability of finding the system in any particular state is:
Equation 2. he probability of finding the system in any particular state

Where  kB = Boltzmann constant, Eα is the energy of state α, and T is the temperature. The measure of Magnetization of the system is Mα which is the sum of values for sj multiplied by Pα


Equation 3. Magnetization of the system

Using these equations, it is possible to simulate a basic 2D Ising model. This model works by cycling through a number of defined temperature points within a set range. At each temperature point the Monte Carlo method is applied. This means that at every temperature point the simulation is run a set amount of times. The data from the simulation is then added together and divided by the number of simulations ran at that temperature point. This is done as the phase spins are random in nature as it is a quantum phenomenon. The simulation takes an initialised 10x10 lattice (2D Array) that is initially ferromagnetic (+1 in each cell) and cycles through each cell. At each cell Equation 1 is applied. If the value of the equation 1 is less than 0 then the spin is flipped (+1 to -1 or vice versa). If the value is greater than 0 than Equation 2 is applied. If the value of Equation 2 is greater than a randomly generated +1 or -1 then the spin is flipped. [1,4]
Equation 4. Energy per spin using Monte Carlo 

The spontaneous magnetization is calculated by applying Equation 3 for each MC sweep. And again, dividing by the number of MC sweeps × number of cells in array.


Results


Figure 2 below shows the change of spins with an increase in temperature for a 100 x 100 lattice. A snapshot is taken at a given at each temperature from 1 to 5 in steps of 0.1. The temperature at each stage is below on the x - axis individual squares represent a spin with Red = +1, Blue = -1
Figure 2. 100 x 100 lattice 
It can be seen at T = 1 all spins are +1 meaning that all spins are aligned and the material is ferromagnetic. As the temperature rises between 1-2 a small amount of random spins begin to flip around the lattice but revert back to +1. once T > 2 the amount of spins that begin to flip begin increasing until it reaches the curie temperature of roughly T = 2.3 where there is a dramatic increase. From T > 2.3 the spins are randomly flipped in groups.  The number of +1 and -1 spins throughout the material are now roughly equal and the material is now paramagnetic.

The simulations for magnetism and energy can be seen below. The simulations where run twice to show the random variations. The first simulation is shown in blue and the second simulation shown in red.

The Magnetization of the system can be seen in Figure 3. At T = 1 the magnetization is 1 and slowly drops off until it reaches the curie temperature. There is a clear drop off in magnetization at the curie temperature region which shows the phase change. After this point the magnetization hovers around zero. This can be seen in Figure 3 and is validated in Figure 4.

Figure 3. Simulated spontaneous magnetization as a function of temperature
Figure 4. Spontaneous magnetization as a function of temperature from Giordano (Fig 8.8 ) [1]
The energy of the system can be seen to rise as the phase changes, with the transition at the curie temperature. The Simulated thermal average of the energy per spin versus temperature can be seen in figure 5. and validated in figure 6.

Figure 5. Simulated thermal average of the energy per spin versus temperature
Figure 6. thermal average of the energy per spin versus temperature from Giordano (Fig 8.9) [1]